next up previous contents
Next: 6. Device Interfaces Up: 5. Client/Server Protocol Previous: 5.3 Connecting to the   Contents

Subsections


5.4 Message Formats

Player clients and servers communicate with a simple symmetric message protocol. Each message is composed of two parts: a header and a payload. We now describe the format of the header and of the payloads of the 4 different message types.

5.4.1 Header

Every Player message has a 32-byte header that contains information about how to interpret the payload of the message. The header format is shown in Table 5.2.


Table 5.2: Message header fields and types
Byte 0 Byte 31
STX type device index t_sec t_usec ts_sec ts_usec reserved size
short short short short int int int int int int


The fields in the header have the following meanings:


5.4.2 Data Messages

When read access has been granted for a device, sensor data from that device it is sent to the client in a data message (type 0x0001). By default, the server continuously sends sensor data at 10Hz. The device and index fields designate the device from which the data comes and the ts_sec and ts_usec fields give the time at which the device generated the data. The t_sec and t_usec fields give the server's current time the payload contains the sensor data, the format of which is device-specific. Data formats are given in Chapter 6.


5.4.3 Command Messages

When write permission has been granted for a device, the client can command the device by sending a command message (type 0x0002) to the server. The device and index fields designate the device for which the command is intended. The t_sec, t_usec, ts_sec, and ts_usec fields are unused. The payload contains the actuator command, the format of which is device-specific. In the interest of simplifying the protocol, the server does NOT respond to command messages. Badly formatted commands and commands to devices for which write permission was never established will only cause errors to be printed on the console from which Player was launched. Command formats are given in Chapter 6.


5.4.4 Request Messages

Request messages (type 0x0003) are sent by the client to the server to make configuration changes to devices. Although stricly speaking the device need not be open in order for the client to configure it, the client should always open it first to ensure that the configuration change is actually made (the player device is always ``open''). The device and index fields designate the device for which the configuration is intended. The t_sec, t_usec, ts_sec, and ts_usec fields are unused. The payload contains the configuration request, the format of which is device-specific. The server will respond to each request message with an appropriate response message (type 0x0004, 0x0006, or 0x0007).


5.4.5 Acknowledgement Response Messages

Acknowledgement response messages (type 0x0004) are generated as a result of request messages (type 0x0003) that were successfully received, interpreted, and executed by a device. Acknowledgement response messages are only sent by the server to the client. The device and index fields designate the device for which the configuration is intended. The t_sec and t_usec fields give the server's current time; the ts_sec and ts_usec fields are time at which the device generated the reply. The payload contains the response, the format of which is device-specific.


5.4.6 Synchronization Messages

After each round of data, the server sends a single synchronization message (type 0x0005), with a zero-length body. This message lets the client know that all data for this cycle has been sent. The synchronization message is sent even when no data was sent, as can occur if the client is using one of the data delivery modes that only send new data.


5.4.7 Negative Acknowledgement Response Messages

Negative acknowledgement response messages (type 0x0006) are generated as a result of request messages (type 0x0003) that were successfully received by a device, but which could not be properly interpreted or executed. Negative acknowledgement response messages are only sent by the server to the client. The device and index fields designate the device for which the configuration is intended. The t_sec and t_usec fields give the server's current time; the ts_sec and ts_usec fields are time at which the device generated the reply. The payload contains the response, the format of which is device-specific.


5.4.8 Error Acknowledgement Response Messages

Error acknowledgement response messages (type 0x0007) are generated as a result of request messages (type 0x0003) that could not be handed off to the target device, usually because the device's incoming configuration queue is full. Error acknowledgement response messages are only sent by the server to the client. The device and index fields designate the device for which the configuration is intended. The t_sec and t_usec fields give the server's current time; the ts_sec and ts_usec fields are unused. The payload will be empty.
next up previous contents
Next: 6. Device Interfaces Up: 5. Client/Server Protocol Previous: 5.3 Connecting to the   Contents
2004-06-02