OpenCurves
0.9
|
The XML format for connecting Open Curves to a real-time data source is described below. The root element is "connection" and contains either a "serial" or "network" child element.
serial, network
The root document element.
connection
buffer, time, comms
The serial
element specifies the use of a serial data connection. It is mutually exclusive of the network
element.
Attribute | Description |
---|---|
port | Identifies the serial comm port to connect on ("COM3", "/dev/ttyUSB0"). |
baud | Specifies the serial baud rate. |
connection
buffer, time, comms
The network
element specifies the use of a TCP or UDP connection. It is mutually exclusive of the serial
element.
Attribute | Description |
---|---|
address | The connection address. |
port | The target connection port. |
protocol | Either "tcp" or "udp". |
Optional: Determines the size of the ring buffer Open Curves uses to store data samples.
Attribute | Description |
---|---|
size | The number of data elements to store in the ring buffer. This number of elements is stored for each "column". Zero size results in the default size being used. |
Optional: The time
element can be used to identify the index of the timestamp column in the incoming data, and/or to adjust the timescale. The timestamp column is used to timestamp each incoming data value. The index is specified by the column
attribute. The scale
attribute is used to scale the read time stamps into seconds. The default is 1.
Attribute | Description |
---|---|
column | Optional, one based index identifying the timestamp column index (default zero, for no column). |
scale | Optional time scale multiplier used to convert the time column into seconds. The default is 1. |
serial
or network
onconnect, headings, receive, ondisconnect
Identifies how to communicate over the selected protocol. Communication may be binary or text-based as indicated by the binary
attribute. The binary selection affects how descendants of this element are formatted.
Attribute | Description |
---|---|
binary | Optional, "true" to use binary communications, "false" for text based communication. The default is "false". |
comms
The onconnect
element the message to send when a connection is established, while ondisconnect
specifies the message to send just prior to disconnecting. These are intended to be used as handshaking messages, to request the start and end of data transmission. The content of these elements depends on the binary
attribute of its parent. In binary mode, elements require a struct
child element. In text mode, the element text is used for the message (the text between the start and end tag).In either communication mode both onconenct
and ondisconnect
elements are optional and may be omitted.
comms
Children
- heading
for headings
, or struct
for receive
Optional: The headings
and receive
elements specify details about the incoming data, but are mutually exclusive. Use headings
when the comms
mode is text based and receive
in binary mode.The headings
element specifies a list of headings to attribute to incoming data as well as identifying the expected number of incoming data items per message. Incoming messages are parsed in the same was as each line in a text input file. The headings
element has a number of heading
child elements, one per "column" as defined in the supported formats. Each heading
element has a single name
attribute which is used as the name for that column.
When omitted, the number of text based samples per line is inferred from the first line, and headings are labelled "Column 1", "Column 2", ...
The receive
element defines a binary structure to read and has exactly one struct
child.
onconnect, receive, ondisconnect
struct
element identifies the binary structure of a message. It is used to define both incoming and outgoing messages, though some attributes of field
elements change for each use case.A struct
has any number of field
elements, each of which identify a data member of the structure, including type, name and value for outgoing messages. The order of the fields controls the order of serialisation.
The struct
has the following attributes:
Attribute | Description |
---|---|
endian | "network", "little" or "big". Network Endian is an alias for "big" as this is commonly used for network transmission. The default is "network". |
A field
element has the following attributes.
Attribute | Description |
---|---|
type | The attribute data type. Also used for structure alignment and padding. See below. |
name | The display name for the field. |
heading | Optional, used with receive only. Only fields with heading set to "true" are plotted. All other fields are ignored. The default is "false". |
A field
may also have a text value (between the start and end tags), which sets the value for that field. The text must be a valid string for the selected type
. Fields with values are only used for onconnect
and ondisconnect
structures or receive
structure fields with a padding type (see below).
The following field types are supported:
Type | Description |
---|---|
int8 | 8-bit, signed integer |
int16 | 16-bit, signed integer |
int32 | 32-bit, signed integer |
int64 | 64-bit, signed integer |
uint8 | 8-bit, unsigned integer |
uint16 | 16-bit, unsigned integer |
uint32 | 32-bit, unsigned integer |
uint64 | 64-bit, unsigned integer |
float | Single precision, 32-bit floating point number. |
double | Double precision, 64-bit floating point number. |
Additionally, the type may be set to one of the following padding types. A padding type must have a value specified in the element text, which controls how much padding to apply (always in bytes).
Padding Type | Description |
---|---|
pad | Pads the structure by skipping the specified number of bytes (relative padding). |
padto | Pads the structure out to the given byte value (absolute padding). No effect if already beyond this byte. |
padbyfield | Like pad , but but the number of padding bytes is read from a preceding field. The element text matches the name of the field, which must appear before this field. |
padtofield | Like padto , but but the padding byte is read from a preceding field. The element text matches the name of the field, which must appear before this field. |
The padtofield
may be used as a skip value for variable sized messages; e.g., skip to the end of the message by using a "messagesize" member field for the padding byte position.