Transport layer

Communication is done through messages, which may be split into several fragments, which are then sent as individual packets. Packets are framed as described earlier in this file.

Packet level

Each packet consists of the following two-byte header:

<sequence> <ptype>

There are two sequence numbers: the message sequence number <mseq> and the fragment sequence number <fseq>. They are counted independently and start at zero. <mseq> is reset at the beginning of a session, while <fseq> is reset at the beginning of each message.

The following packet types are known:

00 Message fragment

03 Speed message from computer

04 EOT

05 ACK

06 Compatibility?

A packet with type 03 is sent once, early in the initialization for the computer to ask the camera to switch to a higher speed.

Each message ends with an EOT packet, which is then confirmed by an ACK packet.

EOT has the following format:

xx 04 xx 00 00 00
|     |
|     indication of the message length. Known values:
<mseq>          00      empty message (no fragments)
                01      short message (one fragment)
                03      used when uploading
                ff      maximum length data packet, more to follow
                else    data packet, at end (observed values: 0f, 7f)

ACK has the following format:

xx 05 xx 00 00 00
|     |
|     error code
<mseq> 00 No error, acknowledged
       01 Not acknowledged
       FF retransmit last sequence
       else other values not known

A packet with type 06 is sent once, as the first packet coming from the camera. It contains a length, just like a normal message fragment, but the message structure is different.

An empty message can be used to test if the camera is still responding. If yes, it will respond with an ACK. Example:

PCCAM xx 04 00 00 00 00

CAMPC xx 05 00 00 00 00

Message fragment level

Message fragments have the following structure:

xx 00 xx xx ...
|     |  |  |
|     |  |  fragment data
|     |  data length, MSB
|     data length, LSB

The data length is the length (in bytes) of the fragment data that follows the length. Fragment data is simply concatenated to form the complete message.