6.2 Transport layer
Figure 6.6 A packet consists of a header and data and is surrounded by a packet frame.
Figure 6.7 The packet header structure consists of the four fields shown.
a different purpose. Firstly, the framing information allows the beginning and end of a packet to be located within a stream of data. This allows a packet decoder to synchronise with the data stream if it begins decoding midway through a packet. This framing infor- mation is unique in that it can occur only at the beginning and end of a packet and is not valid data within a packet.
The second part of a packet is the packet header. This contains metadata associated with the packet. For this implementation it is a packet time stamp, the identification of the intended recipient, the identification of the sender, and the packet ID (Figure 6.7). There is latency in the communications system and a packet is not available at the receiver at the same instant that it has been sent. The time stamp ensures that important data such as centroid coordinates can be correctly linked to the time that the centroid was calculated.
Each device using the bus has an ID. This is an integer that is unique to the device. The Soft Hub has the ID ‘1’ and camera modules have IDs greater than one. The ‘0’ ID is used as a broadcast ID and all devices receive packets sent using this ID. The broadcast ID is intended to be used by the Soft Hub only. Finally, the packet ID identifies the type of packet that is being sent. packet decoder uses this field to determine the packet data. Packets contain different types of data and the length of a given packet is not known until
the Packet ID has been determined.
To reduce the computation required by the Black Spot packet decoder, the destination ID is the first field in the packet header. Therefore, the packet decoder need only decode this first field to determine whether it should continue decoding the rest of the packet or ignore it. The packet data varies between packet types but is most often the centroid co-ordinates