beautypg.com

Magic number, Packet type – BenQ PB6200 User Manual

Page 64

background image

64

The Packet Header size is fixed at seven bytes (Intel byte ordering is used). The following code fragments are taken

from these source files

The Packet Header definition is shown below:

typedef struct

{

BYTE ePacketType; // type of the payload

WORD nPacketSize; // size of the payload

WORD nCRCPacket; // CRC for the entire packet

} PACKET_HEADER;

Magic Number

The Magic Number is a fixed value that is used to insure packet alignment if there are partial packets received or

bytes lost. The Magic Number is a WORD in length (2 bytes). The Magic Number value is 0xEFBE. Because Intel

byte ordering is used, the ls-byte of the word is sent first (byte0 = 0xBE), then the ms-byte (byte1 = 0xEF).

Packet Type

The Packet Type (ePacketType) is a BYTE in length number that defines the type of data in the packet. The following

entries are valid packet typess:

Table 4

Packet

Types

Packet Payload Size

The Packet Payload Size (nPacketSize) is a BYTE that defines the size of the Payload portion of the packet. If the

packet contains only header information, this is zero. Therefore, the total byte count of any packet = nPacketSize plus

7 (since the Packet Header is seven bytes long).

Packet Checksum (CRC)

Each packet is CRC’ed using the tables later in this document. This number is the CRC value for the complete packet

including the Packet Header and Packet Payload. The CRC is calculated with the nCRCPacket value initialized to

zero.

Packet Type Name

Packet Type

Number

Description

pt_INVALID

0

Invalid Packet Type

RESERVED

1

RESERVED

pt_EVENT

2

Host can send any event defined in BenQ PB6XXX

software.

pt_OPERATION

3

Host can send any operation defined in BenQ PB6XXX

software.

This manual is related to the following products: