Esempio n. 1
0
        public AnvizDevice(TcpClient socket)
        {
            DeviceStream = new AnvizStream(socket);
            DeviceStream.ReceivedPacket += (s, e) =>
            {
                switch (e.ResponseCode)
                {
                case 0x7F:
                    DevicePing?.Invoke(this, null);
                    break;

                case 0xDF:
                    ReceivedRecord?.Invoke(this, new Record(e.DATA, 0));
                    break;

                default:
                    ReceivedPacket?.Invoke(this, e);
                    break;
                }
            };
            DeviceStream.DeviceError += (s, e) =>
            {
                DeviceError?.Invoke(this, e);
            };
        }
Esempio n. 2
0
 public AnvizDevice(TcpClient socket)
 {
     DeviceStream = new AnvizStream(socket);
     DeviceStream.ReceivedPacket += (s, e) =>
     {
         if (e.ResponseCode == 0x7F)
         {
             DevicePing?.Invoke(this, null);
         }
         else
         {
             ReceivedPacket?.Invoke(this, e);
         }
     };
 }
Esempio n. 3
0
 public void DevicePing(DevicePing devicePing)
 {
     UserDeviceService.UpdateDeviceLastPing(devicePing.SecretKey, DateTime.Now);
 }
Esempio n. 4
0
 public PingReceivedEventArgs(SerialPort serialPort, DevicePing devicePing)
 {
     this.SerialPort = serialPort;
     this.DevicePing = devicePing;
 }