# Polaroid PDC320 protocol description

Commands are prefixed with 4 E6.
The commands return 1 reply code byte. All commands return an addition 2 byte checksum.

Name | Byte code | Arguments | Reply code | reply length | reply desc
Init | 0x00 | None. | 0x05 | None. | Nothing.
Id | 0x01 | None. | 0x00 | 11 bytes | Returns 11 byte. Byte 0-8 are the string "XIRLINK", these are followed by a 0x02, 0x01 and 2 unknown additional bytes.
State | 0x02 | None. | 0x02 | 21 | Returns 21 bytes. First byte is 0x3f, the following 9 byte are big endian 16bit values: 320,240,5,320,240,5,80,80,0 on the pdc320.
Num | 0x03 | None. | 0x03 | 1 Byte | Returns 1 bytes, the number of images.
Size | 0x04 | Imagenr.(starting with 1) | 0x06 | 4 Bytes | Returns 4 bytes, the big endian size of the image.
Pic | 0x05 | Imagenr.(starting with 1) | 0x04 | 4 Bytes, then data. | Returns 4 bytes, 2 byte part offset, 2 byte part offset, then data, then 2 byte checksum. Then again a reply until the end of the image.
Delete All | 0x07 | None. | 0x08 | None. | Nothing.
End Init | 0x0a | None. | 0x09 | None. | Nothing.
Get Image Params | 0x0c | Imagenr. (starting with 1) | 0x07 | 2 byte bigendian size, then data of this size | The data is expected to be 6 byte, which seems to be picture parameters. Unclear what they mean. The checksum is appended after the data.

For checksum calculation see the sourcecode (for now).

The image data return starts with:
0xff,0xc0,16 bit bigendian height, 16 bit bigendian width, raw JPEG data.