Esempio n. 1
0
        private void Disconnect(ModbusPkt pkt)
        {
            MB.Disconnect();
            AsyncComplete ac = new AsyncComplete(MB, pkt)
            {
                Success = true
            };

            parent.Invoke(new EventHandler(delegate { Complete(this, ac); }));
        }
Esempio n. 2
0
 private void Reconnect()
 {
     try
     {
         m_Modbus.Disconnect();
         Thread.Sleep(200);
         m_Modbus.Connect();
     }
     catch (Exception ex)
     {
         log.AddERRORLOG(string.Format("重连异常:{0}\r\n{1}", ex.Message, ex.StackTrace));
     }
 }
Esempio n. 3
0
 public override bool Disconnect()
 {
     try
     {
         Modbus?.Disconnect();
         Status = Stav.Offline;
         return(true);
     }
     catch (Exception exception)
     {
         var zarizeniArgs = new ZarizeniArgs(Status, Ping, $"!CHYBA!", exception);
         OnStatusChanged(zarizeniArgs);
         return(false);
     }
 }
Esempio n. 4
0
 private Task Disconnect()
 {
     _client = Modbus.Disconnect(_client);
     return(Task.CompletedTask);
 }