OSDP Packet Format
The Start of Message is a single byte with a value of 0x53. Along with message validation it identifies the start on an OSDP packet.
Message Synchronization
The process to get message alignment is to look for the SOM character and pull in 4 bytes.
Then look at the length of the packet and confirm it is within the allow range. If the
packet length is a valid value, then use it to confirm the rest of the frame. Once the entire
frame is received, then based on the CTRL value, validate the CRC or checksum.
Note that the SOM character in the middle of a frame, you would know from the context that it is
not a SOM. (Start of Message)
If the checksum/CRC is validate then the frame is valid then the PD is receiving messages (synchronized).
If the checksum is good, only the PD that matches the address field processes the message.
The ADDR field is 1 byte long with the 7 least significant bits making up the address of the perpherial device. PD. The values range from 0x00 to 0x7E.
The value 0x7F represent a broadcast address from the ACU to a single PD.
When the communication packet flows from the ACU to the PD, then value of bit 7 in the ADDR field is 0.
When there is a reply from the PD to the ACU, bit 7 set set to 1.
The LEN_LST is one byte and is the least significant byte of the length of the OSDP packet. The length of a packet is measured from the SOM all the way to the last byte of the message.
This is just used for setting up a secure session. It does not hold any payload data.
The DATA block field optional but when present it contains the data in the packet. This includes unencrypted data and when sent in a secure session, it
contains encrypted data. More specifically, to payload data is send in SEC_BLK_DATA field which is used only to set up the secure channel.
The DATA block field size, 0 bytes or greater, is determined from parsing the packet calculating using the lengh of the packet minus other
fields.