Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 6
0
 static void SerialPort_ConnectionStatusChanged(object sender, ConnectionStatusChangedEventArgs args)
 {
     Console.WriteLine("Serial port connection status = {0}", args.Connected);
 }
Ejemplo n.º 7
0
 private void SerialPort_ConnectionStatusChanged(object sender, ConnectionStatusChangedEventArgs args)
 {
     if (args.Connected && !isInitialized)
     {
         discoveryTimer.Change(5000, Timeout.Infinite);
     }
     else
     {
         isInitialized = false;
     }
 }