Waveform Measurements

Waveform attributes allow the device to send several measurement values in a single message.
This is useful when the device measurement frequency is high or when the amount of data sent in a single measurement is big and might be costly.

Waveform can be sent via MQTT or HTTP API.

A good example for waveform usage might be a device that sends ECG data every 40ms.
In this case, the device needs to send a single decimal biomarker 25 times a second.

The attribute is a JSON object and includes:

  • Total number of measurements.
  • Frequency of measurements in a single second.
  • Array of numbers (measurements as integers or decimals).

The following example shows how to send an ECG waveform attribute.
The example represents sending a single HR measurement and 100 values of ECG measurement taken in a 2-second time period

{
  "metadata": {
    "timestamp":1641985478161, // MANDATORY
     "context":"VVVJRHMgb2YgcGFpZW5kSWQgYW5kIHNlc3Npb25JZA=="
  },
  "data":{
     "hr": 5, // just an example
     "ecg": {
        "metadata": {
              "frequency": 50,
              "size": 100
        },
        "data":  <base64>
     }
  }
}

The following table only references the attributes related to the waveform

Attribute JSON NameDescriptionFormat
metadataGeneral metadata about the attribute.
timestampEvent time, in milliseconds, in UTC.
Mandatory.
Note: in relation to waveform the timestamp represents the timestamp of the last measurement in the waveform. The rest of the measurements times are calculated backwards using the frequency.
Epoch time in milliseconds.
Example: 1641985478161
dataThe waveform attribute data encoded in base64.base64 encoded value array.
data.metadata.frequencyThe number of data points per second.Integer
data.metadata.sizeThe total number of data points.Integer

To create the waveform data, convert each value in the array to 4 bytes, then convert the whole array to base64 and add it to the JSON message.
The bytes values should be concatenated without any characters or separation bytes between them.
BioT will deserialize the base64 data and then divide it in to 4 byte chunks before decoding its numerical values.

Integer Example

To send the following array of values:
10,20,30,40
You can use this calculator to convert the numbers.
The binary representation of it will be (Note that new lines are only for comfort and should not be part of the data):

00000000000000000000000000001010
00000000000000000000000000010100
00000000000000000000000000011110
00000000000000000000000000101000

You can use this Base64 tool for testing.
The Base64 representation will be:

AAAACgAAABQAAAAeAAAAKA==

Decimal Example

You can use this calculator to convert the numbers.
To send the following array of values:
1.5,6.2,7.6,10.0
The binary representation of it will be (Note that new lines are only for comfort and should not be part of the data):

00111111110000000000000000000000
01000000110001100110011001100110
01000000111100110011001100110011
01000001001000000000000000000000

You can use this Base64 tool for testing.
The Base64 representation will be:

P8AAAEDGZmZA8zMzQSAAAA==