Sending Measurements

562562

To send a measurement or the current device status, you first need to obtain the appropriate topics from the “environmentData” named shadow.

📘

Note

The clientId in the following topics is configured in the device during the activation stage. See Direct Device Connection

Register to the following topic:

$aws/things/<clientId>/shadow/name/environmentData/get/accepted

Then publish an empty JSON message to the following topic:

$aws/things/<clientId>/shadow/name/environmentData/get

You will receive the current “environmentData” shadow content, for example:

{
   "state":{
      "desired":{
         "topics":{
            "MEASUREMENT":{
               "publish":"<clientId>/from-device/measurement"
            },
            "STATUS":{
               "subscribe":"<clientId>/to-device/status",
               "publish":"<clientId>/from-device/status"
            }
         }
      },
      "delta":{
         "topics":{
            "MEASUREMENT":{
               "publish":"<clientId>/from-device/measurement"
            },
            "STATUS":{
               "subscribe":"<clientId>/to-device/status",
               "publish":"<clientId>/from-device/status"
            }
         }
      }
   }
}
  • Read the “MEASUREMENT.publish” value from the received JSON and use it as the topic to publish the measurement to.
  • Read the “STATUS.publish” value from the received JSON and use it as the topic to publish the statuses to.
  • Read the “STATUS.subscribe” value from the received JSON and subscribe to it to get status update requests from BioT.

Sending measurements

Use the following JSON format to send a measurement:

{
   "metadata":{
      "timestamp":1641985478161,
      "context":"VVVJRHMgb2YgcGFpZW5kSWQgYW5kIHNlc3Npb25JZA=="
   },
   "data":{
      "hr":"97",
      "spo2":"92"
   }
}

Parameter

Description

Format

timestamp

Event time, in milliseconds, in UTC.
Mandatory.

Epochtime in milliseconds
Example: 1641985478161

context

A unique string representing the session. This context needs to be passed back to BioT with every measurement message.

String

data

Biomarkers with values (key-value JSON).
The JSON keys names should match the JSON names that appear in the Measurement Fields tab of the Patient template configured in the BioT Console.


Did this page help you?