This is a message protocol to communicate with a fictional measurement device.
Structural Overview
Structures
ClientConnect
Message the client must send to the device to establish a connection.
Offset |
Size |
Name |
Type |
0 Byte |
1 Byte |
version |
uint8
|
ClientConnect.version
Client version
ClientDisconnect
Message the client must send to the device to disconnect.
ClientStart
Starts the measurement process.
Offset |
Size |
Name |
Type |
0 Byte |
4 × 1 Byte |
channel |
bool[]
|
4 Bytes |
1 Byte |
mode |
Mode
|
ClientStart.channel
Control array to activate measurement channels
ClientStart.mode
Measurement mode
ClientAbort
Each measurement process must be aborted by the client.
Offset |
Size |
Name |
Type |
0 Byte |
1 Byte |
reason |
int8
|
ClientAbort.reason
The reason why the measurement was cancled
DeviceData
Message which contains acquired measurement data.
Offset |
Size |
Name |
Type |
0 Byte |
1 Byte |
channel |
uint8
|
1 Byte |
8 Bytes |
timestamp |
uint64
|
9 Bytes |
1 Byte |
Bitfield0 |
|
⬑ 0 Byte |
|
1 Bit
|
overheating
|
bool
|
⬑ 0 Byte |
|
3 Bits
|
batterie
|
int8
|
⬑ 0 Byte |
|
4 Bits
|
pendingFrames
|
int8
|
10 Bytes |
4 Bytes |
sampleCount |
int32
|
14 Bytes |
sampleCount × 4 Bytes |
samples |
float[]
|
DeviceData.channel
Channel the data belongs to (0..3)
DeviceData.timestamp
Timestamp of data acquisition
Size: |
8 Bytes
|
Byteorder: |
BigEndian |
DeviceData.Bitfield0
DeviceData.overheating
Flag which indicates if device is overheating
DeviceData.batterie
Value which indicates battery charge condition
DeviceData.pendingFrames
Value which indicates how many frames are pending
DeviceData.sampleCount
Measurement sample count
Size: |
4 Bytes
|
Byteorder: |
BigEndian |
DeviceData.samples
Array of measurement sample points
Size: |
sampleCount × 4 Bytes
|
Byteorder: |
BigEndian |
MessageFrame
Frame structure which acts as container for messages. The containing message will be specified by a message id.
MessageFrame.msgId
Id of the protocol message
MessageFrame.msg
Dynamic protocol message