Communication Format
Communication with PSP is in the form of Hex encoded blocks. Both Commands (Requests) and Responses will be in this format.
The 0x
prefix is used in programming and technical documentation to clearly indicate that a number is written in hexadecimal (base-16) rather than in decimal (base-10) or octal (base-8). This prefix removes ambiguity, especially for numbers that could be valid in multiple bases. For example, 0x10
is unambiguously hexadecimal (equal to 16 in decimal), while 10
by itself is usually interpreted as decimal.
Block Format
Preamble | Length | Magic | Header | Payload | Payload | Checksum |
---|---|---|---|---|---|---|
0xAA | 0x04 | 0x3C | 0x21 | 0x03 | 0x66 | 0x74 |
Extended Block Format
Preamble | Length 3 | Length 2 | Length 1 | Length 0 | Magic | Header | Payload | Payload | Checksum |
---|---|---|---|---|---|---|---|---|---|
0xAA | 0x00 | 0x00 | 0x00 | 0x04 | 0x3C | 0x21 | 0x03 | 0x66 | 0x74 |
A command consists of a preamble byte, length byte (length of the block without preamble, length and checksum), magic/routing byte, header byte, payload bytes and a checksum byte. A command is limited to a maximum of 257 bytes. If extended block format is enabled the length block is 4 bytes.
Byte Explanations
Preamble Byte
The preamble byte is used to provide a device address.
- P6X - The preamble to the terminal is
0xCC
. The terminal will put a different value in this location for messages from the host. - Apollo - The preamble to the terminal is
0xCC
. The preamble to the host is0xAA
.
Length Byte
This is the length of the block, without the Preamble, Length and Checksum i.e. the Magic Byte, Header and Payload.
Magic Byte
- P6X - The magic byte is always
0x3C
. - Apollo -The magic byte is always
0x3C
.
Header Byte
This byte defines the command or message that is being used.
Payload Bytes
Payloads have a variable length, as per each commands specification.
Checksum Byte
A checksum byte must be sent at the end of each command. The checksum byte is a checksum calculated by adding all bytes in the block together. The checksum byte is not included in the summation. The carry bit for checksum additions is ignored since the checksum byte is limited to eight bits.
Byte Order
If data bytes consists of a multi byte parameter (i.e.. 0xABCD
) the most significant byte is sent first (0xAB
0xCD
).