public override void sendMsg(IMessage message) { if (port == null || !port.IsOpen) { throw new DeviceNotConnectedException("tried to send data while the device is not connected!"); } BinaryMessage m = message as BinaryMessage; log.Info("sending " + m.opcode.ToString()); port.Write(m.asByteArray(), 0, m.asByteArray().Length); }
public override void sendMsg(IMessage message) { if (socket == null || !socket.Connected) { throw new DeviceNotConnectedException("tried to send data while the device is not connected!"); } BinaryMessage m = message as BinaryMessage; log.Info("sending " + m.opcode.ToString()); socket.Send(m.asByteArray()); }
public override void sendMsg(IMessage message) { if (device.socket == null || !device.socket.Connected) { throw new DeviceNotConnectedException("tried to send data while the device is not connected!"); } BinaryMessage m = message as BinaryMessage; log.Info("sending " + m.opcode.ToString()); byte [] src = m.asByteArray(); byte [] dest = prepare_data_to_send(src); // log.Info("array is: " + BitConverter.ToString(dest).Replace("-", " ")); /* flush input data */ device.socket.Send(dest); }
public override void sendMsg(IMessage message) { if (port == null || !port.IsOpen) { throw new DeviceNotConnectedException("tried to send data while the device is not connected!"); } BinaryMessage m = message as BinaryMessage; log.Info("sending " + m.opcode.ToString()); byte [] src = m.asByteArray(); byte [] dest = prepare_data_to_send(src); log.Info("array is: " + BitConverter.ToString(dest).Replace("-", " ")); /* flush input data */ port.ReadExisting(); port.Write(dest, 0, dest.Length); }