|
@@ -456,7 +456,8 @@ namespace MECF.Framework.Common.PLC
|
|
|
LOG.Write(ex, String.Format("Communication failed with PLC {0}:{1}", _ip, _port));
|
|
|
EV.PostMessage("System", EventEnum.DefaultWarning, String.Format("Communication failed with PLC {0}:{1}", _ip, _port));
|
|
|
}
|
|
|
-
|
|
|
+ _isOpened = false;
|
|
|
+ SetState(IoProviderStateEnum.Uninitialized);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -474,7 +475,6 @@ namespace MECF.Framework.Common.PLC
|
|
|
if (_isOpened)
|
|
|
{
|
|
|
_isOpened = false;
|
|
|
- SetState(IoProviderStateEnum.Uninitialized);
|
|
|
msender.Close();
|
|
|
}
|
|
|
|
|
@@ -515,6 +515,8 @@ namespace MECF.Framework.Common.PLC
|
|
|
LOG.Error($"PLC ({_ip}) Read DI exception{detail}.", ex);
|
|
|
EV.PostMessage("System", EventEnum.DefaultWarning, "PLC Read DI exception");
|
|
|
Close();
|
|
|
+ if (State != IoProviderStateEnum.Closing)
|
|
|
+ SetState(IoProviderStateEnum.Uninitialized);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -544,6 +546,8 @@ namespace MECF.Framework.Common.PLC
|
|
|
LOG.Error($"PLC ({_ip}) Read DO exception{detail}.", ex);
|
|
|
EV.PostMessage("System", EventEnum.DefaultWarning, "PLC Read DO exception");
|
|
|
Close();
|
|
|
+ if (State != IoProviderStateEnum.Closing)
|
|
|
+ SetState(IoProviderStateEnum.Uninitialized);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -574,6 +578,8 @@ namespace MECF.Framework.Common.PLC
|
|
|
LOG.Error($"PLC ({_ip}) Read AI exception{detail}.", ex);
|
|
|
EV.PostMessage("System", EventEnum.DefaultWarning, "PLC Read AI exception");
|
|
|
Close();
|
|
|
+ if (State != IoProviderStateEnum.Closing)
|
|
|
+ SetState(IoProviderStateEnum.Uninitialized);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -603,6 +609,8 @@ namespace MECF.Framework.Common.PLC
|
|
|
LOG.Error($"PLC ({_ip}) Write DO exception{detail}.", ex);
|
|
|
EV.PostMessage("System", EventEnum.DefaultWarning, "PLC Write DO exception");
|
|
|
Close();
|
|
|
+ if (State != IoProviderStateEnum.Closing)
|
|
|
+ SetState(IoProviderStateEnum.Uninitialized);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -633,6 +641,8 @@ namespace MECF.Framework.Common.PLC
|
|
|
LOG.Error($"PLC ({_ip}) Write AO exception{detail}.", ex);
|
|
|
EV.PostMessage("System", EventEnum.DefaultWarning, "PLC Write AO exception");
|
|
|
Close();
|
|
|
+ if (State != IoProviderStateEnum.Closing)
|
|
|
+ SetState(IoProviderStateEnum.Uninitialized);
|
|
|
return;
|
|
|
}
|
|
|
}
|