-
Notifications
You must be signed in to change notification settings - Fork 0
protocol definition
RRDTP version 1 is a data streaming protocol. One host acts as the server, and is the authoritative source for all data values. Multiple clients can connect to the server to send and receive updates to data values. Values can be stored hierarchically in categories. The design of RRDTP draws inspiration from WPI Network Tables, but is designed to be simpler and more easily portable to resource-limited platforms.
Each packet will contain an event type. The currently defined event types are listed below.
-
Set value: sent to change a value. Either a client, or the server can send this type of packet.
-
Delete value: sent to indicate that a value should be deleted. Either a client, or the server can send this type of packet.
Data can be one of 7 types.
| Type | Size | Format |
|---|---|---|
| int | 4 bytes | 2's complement |
| long | 8 bytes | 2's complement |
| float | 4 bytes | IEEE 754 binary32 |
| double | 8 bytes | IEEE 754 binary64 |
| boolean | 1 byte | raw binary |
| string | n>2 bytes | 2 byte unsigned integer size + n bytes ASCII/UTF8 text |
| unformatted | n bytes | 2 byte unsigned integer size + n bytes raw data |
Values are identified by an identifier string with a hierarchical format. An identifier begins with zero or more categories separated by periods '.' and ending with the name of the value. Identifiers are case sensitive ("Value1" != "VALUE1") and have a maximum length of 255 characters and can contain only upper and lowercase letters, numbers, dashes '-' and underscores '_'.
Some examples of valid identifiers:
sensor1
sensors.sensor_1
Arm.Motors.motor_1-power
RRDTP is based on TCP sockets. The server is responsible for accepting or denying TCP connections on the port being used by RRDTP (default 4309). When a new client connects, a "set value" packet must be sent to it by the server for all entries in order to synchronize the client with the latest values.
All RRDTP packets begin with a header containing the protocol version and the event type. After the header, the packet format will be different depending on the event type.
| Field Name | Type | Size |
|---|---|---|
| Protocol Version | int | 1 byte |
| Event Type | int | 1 byte |
Sent to create or update a value entry. The system that creates the value (sends the set packet first) is considered to own the value, and is (by default) the only system allowed to update that value later. The data is encoded according to the format specified above in the data types section.
| Field Name | Type | Size |
|---|---|---|
| Identifier Length | int | 1 byte |
| Identifier String | string | n<256 bytes |
| Data Type | int | 1 byte |
| Data | variable | n bytes |
Sent to indicate that a value entry can be deleted. A value deletion packet can only be sent by the owner of the value entry. If a host besides the owner sends a deletion packet, then it will be ignored.
| Field Name | Type | Size |
|---|---|---|
| Identifier Length | int | 1 byte |
| Identifier String | string | n<256 bytes |