- The device uses the HID Protocol Class with 64-byte blocks (Reports in HID terminology).
- The first byte of every 64-byte block is a length byte, indicating how many of the following 63 bytes are actually used.
- If the length byte is less than 63, the remaining bytes should be discarded.
- If it is 63 or more, all following 63 bytes are used.
Datalink Protocol
Command Sequence Example (GetKioskId)
The following exchange shows the full ACK/NAK flow for aGetKioskID command:
Data Frame
Example:<A[Frame-ID]|[Length][Data][LRC]>
| Field | Description |
|---|---|
< | Start of frame |
> | End of frame |
A | Protocol version A; fixed value |
[Frame-ID] | ID of the frame: 0 or 1, toggled by the sender on every new frame. On retry (after NAK or timeout), Frame-ID stays the same. ACK/NAK use the same Frame-ID. |
[Length] | 4 decimal digits: length of the [Data] field in bytes |
[Data] | Higher-level data being transported, typically a JSON-RPC message |
[LRC] | 2-character hex LRC (XOR of all bytes from < through the last byte of [Data]) |
LRC and Length Calculation Example
ACK Frame
Sent to acknowledge a successfully received and validated Data Frame. Examples:<+0>, <+1>
Structure: <+[Frame-ID]>
The [Frame-ID] matches the Data Frame being acknowledged.
NAK Frame
Sent when the receiving side fails to parse a Data Frame. Examples:<-0|1>, <-1|7>
Structure: <-[Frame-ID]|[Err]>
| Error Code | Meaning |
|---|---|
0 | Unspecified |
1 | Unsupported protocol (first byte after < is not A) |
2 | Length field invalid (contains non-digits) |
3 | Length field too large |
4 | Data field invalid (not JSON-RPC) |
5 | LRC field invalid (characters not hex A-F, 0-9) |
6 | LRC wrong |
7 | ETX invalid |
8 | Timeout: frame not fully received after timeout expired |
Protocol Rules
The datalink layer follows these timing and sequencing rules:- ACK/NAK are expected within 30 milliseconds.
- If ACK is not received, or if a NAK is received, the sending party may resend the frame with the same Frame-ID.
- While waiting for ACK/NAK, the sending party must not send another frame.
- When receiving a frame: if the first bytes are not
<A0or<A1, do not send a NAK. Instead, keep reading until receiving a valid start of frame.