Definition of Data Frame Protocol

555

# Definition of Data Frame Protocol

Communication Process
Communication Process/Valid Communication

Control PC Player
1.Send request message 1.Return status code of command sent successfully 2.Return response message

Communication Process/Invalid Communication (such as LRC error)

Control PC Player
1.Send request message 1.Return failure status code

Data Frame Protocol Format
The protocol format uses byte-oriented framing. Each data frame must be encapsulated according to the protocol definition mentioned below to be recognized by the central control. The encapsulation format is as follows:
Control PC sends: <STX><FLAG><DataInfo><ETX><LRC>
Device responds: <STX><FLAG><ACK><ETX><LRC> or <STX><FLAG><NAK><ETX><LRC>

Field Description Hex Encoding
STX Start of Text 0x02
FLAG Flag Serial: 0x10, TCP: 0x11, UDP: 0x12
DataInfo Data ---(Data used by the central control for execution)
ETX End of Text 0x03
LRC Longitudinal Redundancy Check ---
ACK Acknowledgement (Successful transmission) 0x06
NAK Negative Acknowledgement (Failed transmission) 0x15

Longitudinal Redundancy Check (LRC)
Currently, command frames sent to the player do not have any checksum verification. A fixed LRC value of 32 is used when sent from the control PC. The player responds with frames that use LRC checksum.

The calculation rule involves performing a bitwise XOR operation (^) on the bytes from the flag to the end of text.

For example, 02 10 34 39 39 30 31 30 03 16
Checksum calculation: 10^34^39^39^30^31^30^03 = 16

Below is a Java code snippet for checksum verification, where the byte array byteData represents the replied data information.
img