Пример #1
0
 private void SerialPort_ConnectionStatusChanged(object sender, SerialPortLib.ConnectionStatusChangedEventArgs args)
 {
     logger.Debug("Serial Port Connected = {0}", args.Connected);
     if (args.Connected)
     {
         serialPort.SendMessage(ackRequest);
     }
     else
     {
         logger.Debug("W800Rf32 is offline");
         OnConnectionStatusChanged(new ConnectionStatusChangedEventArgs(false));
     }
 }
Пример #2
0
 /// <summary>
 /// Raises the connected state changed event.
 /// </summary>
 /// <param name="args">Arguments.</param>
 protected virtual void OnConnectionStatusChanged(ConnectionStatusChangedEventArgs args)
 {
     logger.Debug(args.Connected);
     if (ConnectionStatusChanged != null)
         ConnectionStatusChanged(this, args);
 }
Пример #3
0
 private void SerialPort_ConnectionStatusChanged(object sender, ConnectionStatusChangedEventArgs args)
 {
     var status = args.Connected ? ControllerStatus.Connected : ControllerStatus.Disconnected;
     Thread.Sleep(1000);
     OnControllerStatusChanged(new ControllerStatusEventArgs(status));
 }
Пример #4
0
 private void SerialPort_ConnectionStatusChanged(object sender, ConnectionStatusChangedEventArgs args)
 {
     // send last received text buffer before disconnecting
     if (!args.Connected && !String.IsNullOrEmpty(textBuffer))
     {
         try { stringReceived(textBuffer); } catch { }
     }
     // reset text receive buffer
     textBuffer = "";
     if (statusChanged != null)
     {
         statusChanged(args.Connected);
     }
 }
 /// <summary>
 /// Raises the connected state changed event.
 /// </summary>
 /// <param name="args">Arguments.</param>
 protected virtual void OnConnectionStatusChanged(ConnectionStatusChangedEventArgs args)
 {
     if (ConnectionStatusChanged != null)
         ConnectionStatusChanged(this, args);
 }
Пример #6
0
 static void SerialPort_ConnectionStatusChanged(object sender, ConnectionStatusChangedEventArgs args)
 {
     Console.WriteLine("Serial port connection status = {0}", args.Connected);
 }
Пример #7
0
 private void SerialPort_ConnectionStatusChanged(object sender, ConnectionStatusChangedEventArgs args)
 {
     if (args.Connected && !isInitialized)
     {
         discoveryTimer.Change(5000, Timeout.Infinite);
     }
     else
     {
         isInitialized = false;
     }
 }