public Message(byte deviceID, CommandIDPair command, byte?[] bytes) { this.bytes[0] = Message.CreateHeader(deviceID, command); for (int i = 1; i < 4; i++) { this.bytes[i] = bytes?[i - 1] ?? 0; } }
public static byte CreateHeader(byte deviceID, CommandIDPair command) { var commandID = (int)command; var header = deviceID << 3; header = header | commandID; return((byte)header); }