Modbus modification to support simulation mode.

This commit is contained in:
Milan Hanajik
2015-08-15 21:11:01 +02:00
parent ee044e3dd7
commit a6aa6739ad
@@ -52,6 +52,7 @@ namespace TBF.BenchControl.Modbus.Common
{
if (modbusCommonCfg.DebugLevel == Entities.DebugMode.Simulate)
{
log.FatalFormat("Simulated device {0}", ToString());
return;
}
@@ -76,6 +77,8 @@ namespace TBF.BenchControl.Modbus.Common
/// <param name="message">Message incl CRC, CRC bytes dont have to be set</param>
public void SendMessage(byte[] message)
{
if (modbusCommonCfg.DebugLevel == Entities.DebugMode.Simulate) return;
Telegram.UpdateTelegramCRC(message);
log.Debug(Telegram.LogTelegram("Sending message ", message));
serialPort.Write(message, 0, message.Length);