SBW consists of two components, a broker for routing messages and modules which send and receive messages. All connections between modules and a broker are via standard TCP/IP sockets. All messages are transmitted in a binary format for maximum performance.
If a message needs to be sent between two different computers, then messages are sent first to the broker on the remote machine, this in turn routes the message to the correct remote module. Modules may be written in a variety of languages, including, Java, C/C++, Delphi, Perl, Python and Matlab.
SBW messages come in four flavors:
Call Messages - blocking messages
Call/Send Message Format:
Reply Message Format:
Error Message Format:
Version 1.0 of SBW supports seven basic data types:
byte, boolean, integer (32-bit), double (64 bit), string, array and list
Each data type is proceeded by a type type to indicate the type of data that follows. For example the data type byte, actually comprises of two bytes, one byte to indicate that the following type is a byte and the data byte itself. Boolean types are represented in exactly the same way as a byte type, the value of the byte when set to zero represents false and a value of one true.
Integer and double data types have the following structures.
The string data type has the following structure. The string itself is made up of an unsigned 32-bit integer denoting the number of bytes in the string. The remainder of the data consists of the sequence of characters that make up the string which is also null terminated.
Arrays are multi-dimensional objects of arbitrary size containing homogeneous data. Arrays start
with a header made up of one byte indicating the data type stored in the array, and an integer indicating the number of dimensions, followed by a sequence of integers, one for each dimension, denoting the number of elements in each dimension. The header is therefore (2 + 4 + 4d) bytes long, where d equals the number of dimensions of the array. Array access can be optimized at the module if it is known that the data type has a fixed size. This is especially the case for simple types such as integers and doubles. In these
cases, the application can carry out block copies of the data in order to greatly improve performance. The array type has the following structure:
Lists are recursively defined structures for storing heterogeneous data. This means that lists can be used to store other lists which allows complex relationships to be represented. A list is a much simpler structure that an array. A list starts with a list type byte, followed by a 32-bit integer indicating the number of items in the list. Each items in the list can be any of the data types previously described, including a list. The list type has the following structure.