No
. 96-1886-01E
Rev
.
1.1
GTECH Aircon Radio (Model GWT154)
PAGE
36
OF
72
Figure 17 - GTECH Data Packet Structure
7.1.5
Data
Exception
Handling
Special handling is required for binary data with values between 0x04 to 0x06 and 0x0F to 0x1B
because these ranges are reserved for GTECH485 protocol control characters. The control character
ESC (0x1B) is used as an escape prefix to signal that the following byte was in the range of the control
characters and has been modified (1’s complemented) to place it outside the reserved range. All
characters following the ESC are expected be in the range of 0x21 to 0xFF. In the event an ESC is
followed by a reserved protocol character, special exception handling is required.
The following example illustrates ESC insertion on a data packet with the string “Hello” as its payload.
Process-ID, Carriage-Return, Line-Feed and Checksum characters all fall in the reserved range; they
are 1’s complemented and prefixed with ESC before being transmitted. Other than being
complemented as necessary, the Checksum is unchanged from the value calculated on the raw data.
Figure 18 - Escape Character Insertion
Referring to
Error! Reference source not found.
, the UART receive process is reset to the idle state.
The protocol characters ACK, NAK, CAN and SI are encapsulated and unicast to the currently
connected radio. The protocol character SYN must be intercepted by the Coordinator radio to initiate a
new peripheral address selection sequence. The Coordinator radio will clear any current connection’s
address and broadcast the SYN address packet to all radios.
Anytime the ESC protocol character is received on the 485 bus, the exception state is entered.
Generally, the byte following ESC only needs to be inverted to restore it to its original value. It is
documented in
[2]
, the GTECH485 Bus Packet Protocol Specification, how a peripheral receiver is to
respond in the event a protocol character does follow the ESC. ACK, NAC, CAN and SI are to be
processes as if the ESC had not occurred, though the byte immediately following is to be inverted. A
SYN address change will be processed normally, but any data received and buffered prior to that is
discarded. Start of a new data packet ENQ discards any previously buffered data and starts over. The
end of data packet EOT forwards the data packet to the connected radio, or processes locally if this
radio is the selected peripheral.