private static byte WriteCommandWithResult(IDevice device, byte command) { byte resp = device.WriteCommand(command); if ((command & 0x0f) != (resp >> 4)) throw new Exception("Communication Error"); return (byte)(resp & 0x0f); }
private static void WriteCommandWithEchoCheck(IDevice device, byte command) { byte resp = device.WriteCommand(command); if (command != resp) throw new Exception("Communication Error"); }