The 'Payload' field of a telegram starts from the octet following the octet containing the 'Length' field.
D7 defines the purpose of the telegram.
D6 defines whether the telegram contains a sequence number.
The combination of D7 & D6 is called the TPCI, which is the abbreviation for Transport Layer Protocol Control Information.
D7 = 0: purpose of the telegram is to transfer data and is therefore called a 'data packet' telegram
D7 = 1: purpose of the telegram is to control a communication session and is therefore called a 'control data' telegram
D6 = 0: D5+D4+D3+D2 = there is no sequence number in the telegram ('do not care')
D6 = 1: D5+D4+D3+D2 = represents the sequence number of the telegram
The sequence number is a kind of telegram tracking number, in order to make sure that no telegrams will be lost during a communication session. A sequence number can also be important to guarantee a specific order in which the telegrams shall be sent and especially received.
The 'Length' field of such telegram is always set to 0, which means that there are no extra octets in the payload field. Based on D1 and D0, 4 types of data packets are defined:
- D1+D0 = 00 = TL_connect
- D1+D0 = 01 = TL_disconnect
- D1+D0 = 10 = TL_ACK
- D1+D0 = 11 = TL_NAK
The meaning behind these telegrams is:
- TL_connect: 'Hello, I want to talk to you'
- TL_disconnect: 'For me this conversation is over, goodbye'
- TL_ACK: 'OK, roger that, please continue with the next message'
- TL_NAK: 'Sorry, I did not get that, please repeat that latest message'
For such telegram the 'Length' field > 0, which means that there is at least one extra byte in the Payload field. The purpose of the telegram is to send a 'command' like: close/open this relay, write this to that memory location, give me the status of this valve, ...
The Payload field contains a service identifier + the DATA to be used by that service, the service identifier is called APCI, which is the abbreviation for Application Layer Protocol Control Information.
The APCI is either represented by 4 bits or by 10 bits.
- APCI = D1 and D0 of the first Payload octet + D7 and D6 of the second Payload octet
- if the DATA length = max 6 bits: DATA is put in the remaining 6 bits of the second Payload octet
- if the DATA length > 6 bits: DATA is put from the third Payload octet onwards
- APCI = D1 and D0 of the first Payload octet + the entire second Payload octet
- DATA is put from the third Payload octet onwards