The query response is the most involved response packet you will get in reply. This
packet can have any data in the “value” bytes (although it will still be ASCII characters in
HEX notation). Note that commands like “Model Name” will reply with text, while
commands which are controlled by numbers will reply with numbers.
The response to a query for power state (if the unit is “on”) would be:
0x02 0x32 0x31 0x30 0x35 0x41 0x31 0x00 0x31 0x00 0x36 0x44 0x03
Working in reverse of building a packet (assuming you read the previous sections),
you should be starting to see patterns:
0x02 = STX, 0x32 = “2”, 0x31 = “1”, 0x30 = “0”, 0x35 = “5”, 0x41 = “A”, 0x31 = “1”,
0x00 = NUL, 0x31 = “1”, 0x00 = NUL, 0x36 = “6”, 0x44 = “D”, 0x03 = ETX
From this you can see:
The STX which means “Attention”.
The “2” and “1” which identifies the packet as a query response type.
A “0” and “5” which shows that the byte count is 5 bytes long.
An “A” “1” for the command ID which decodes to “Power” in Section 3
A NUL before the value of the command
A “1” showing the state to be “On” as decoded in Section 3
A NUL after the value of the command
A checksum of “6D” which if we check the math;
0x02 + 0x32 + 0x31 + 0x30 + 0x35 + 0x41 + 0x31 + 0x00 + 0x31 + 0x00 = 16D
and if we truncate the value to only two “nybbles” (or two hex characters) we get
6D which matches the checksum value – showing the checksum and packet is
good.
An ETX which means “I’m done talking”
26