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); }; }
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); } }; }
public void DevicePing(DevicePing devicePing) { UserDeviceService.UpdateDeviceLastPing(devicePing.SecretKey, DateTime.Now); }
public PingReceivedEventArgs(SerialPort serialPort, DevicePing devicePing) { this.SerialPort = serialPort; this.DevicePing = devicePing; }