![]() |
NHS31xx SW API
|
This file describes the application specific commands and responses used in the Temperature Logger demo application.
Data Structures | |
struct | APP_MSG_CMD_GETMEASUREMENTS_T |
struct | APP_MSG_CMD_SETCONFIG_T |
struct | APP_MSG_CMD_MEASURETEMPERATURE_T |
struct | APP_MSG_CMD_GETEVENTS_T |
struct | APP_MSG_CMD_GETPERIODICDATA_T |
struct | APP_MSG_RESPONSE_GETMEASUREMENTS_T |
struct | APP_MSG_RESPONSE_GETCONFIG_T |
struct | APP_MSG_RESPONSE_MEASURETEMPERATURE_T |
struct | APP_MSG_RESPONSE_GETEVENTS_T |
struct | APP_MSG_RESPONSE_GETPERIODICDATA_T |
Macros | |
#define | APP_MSG_ERR_TSEN 0x1000E |
#define | APP_MSG_MIN_TEMPERATURE -400 |
#define | APP_MSG_MAX_TEMPERATURE 850 |
#define | APP_MSG_TEMPERATURE_PLACEHOLDER_VALUE (APP_MSG_MAX_TEMPERATURE + 1) |
#define | APP_MSG_DELAY_START_INDEFINITELY 0xFFFFFFFF |
#define | APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE 232 |
#define | APP_MSG_SIZEOFEVENT_IN_RESPONSE(info, data) |
#define | APP_MSG_MAX_EVENTS_IN_RESPONSE(size) (505 / (size)) |
struct APP_MSG_CMD_GETMEASUREMENTS_T |
struct APP_MSG_CMD_SETCONFIG_T |
Data Fields | ||
---|---|---|
uint32_t | currentTime |
The absolute current time in epoch seconds. |
uint16_t | interval |
The time between two measurements, set in seconds.
|
uint32_t | startDelay |
Only looked at when
Regardless of when the first measurement is taken, subsequent measurements will be spaced |
uint32_t | runningTime |
Only looked at when
For example, with |
int16_t | validMinimum |
A validity constraint. The minimum value in deci-Celsius degrees for each measured temperature value.
|
int16_t | validMaximum |
A validity constraint. The minimum value in deci-Celsius degrees for each measured temperature value.
|
uint8_t | len |
|
uint8_t | url[163] |
|
int8_t | offset |
|
uint8_t | resolution | |
uint8_t | unit |
|
uint32_t | key[4] |
|
uint8_t | lock |
|
struct APP_MSG_CMD_MEASURETEMPERATURE_T |
Data Fields | ||
---|---|---|
uint8_t | resolution |
struct APP_MSG_CMD_GETEVENTS_T |
Data Fields | ||
---|---|---|
uint16_t | index |
Unit: number of events.
|
uint32_t | eventMask |
A bitmask of OR'd events of type APP_MSG_EVENT_T.
|
uint8_t | info |
A bitmask of OR'd event information types of type EVENT_INFO_T.
|
struct APP_MSG_CMD_GETPERIODICDATA_T |
Data Fields | ||
---|---|---|
uint8_t | which |
A bitmask of OR'd values of type APP_MSG_PERIODICDATA_TYPE_T.
|
uint8_t | format |
The enumeration value of type APP_MSG_PERIODICDATA_FORMAT_T, indicating the format of the retrieved data. When this format is not compatible with the value |
uint16_t | offset |
|
struct APP_MSG_RESPONSE_GETMEASUREMENTS_T |
Data Fields | ||
---|---|---|
uint32_t | result |
The command result. Only when |
uint16_t | offset |
Unit: number of samples. Defines the sequence number of the first data value that follows.
|
uint8_t | count |
The number of values that follow after the padding bytes. This number can be
|
uint8_t | zero[3] |
Padding bytes. Must be
|
struct APP_MSG_RESPONSE_GETCONFIG_T |
Data Fields | ||
---|---|---|
uint32_t | result |
The command result. Only when |
uint32_t | configTime |
The value as given by APP_MSG_CMD_SETCONFIG_T.currentTime, with |
uint16_t | interval |
The value as given by APP_MSG_CMD_SETCONFIG_T.interval, with |
uint32_t | startDelay |
The value as given by APP_MSG_CMD_SETCONFIG_T.startDelay, with |
uint32_t | runningTime |
The value as given by APP_MSG_CMD_SETCONFIG_T.runningTime, with |
int16_t | validMinimum |
The value as given by APP_MSG_CMD_SETCONFIG_T.validMinimum, with |
int16_t | validMaximum |
The value as given by APP_MSG_CMD_SETCONFIG_T.validMaximum, with |
int16_t | attainedMinimum |
The absolute minimum value of all temperature measurements. |
int16_t | attainedMaximum |
The absolute maximum value of all temperature measurements. |
uint16_t | count |
The number of measurements available. A sequence number. Indicates the number of times a URL was read out in different NFC sessions.
|
uint32_t | status |
A bitmask of OR'd events of type APP_MSG_EVENT_T.
|
uint32_t | startTime |
The time in epoch seconds when the first measurement was taken. |
uint32_t | currentTime |
The current time as known by the IC. This may or may not reflect the current absolute time in epoch seconds: The IC may have stopped keeping track of time:
In these cases,
|
uint8_t | len |
|
uint8_t | url[163] |
|
int8_t | offset |
|
uint8_t | resolution | |
uint8_t | unit |
|
uint8_t | locked |
|
uint8_t | id[8] |
An identifier guaranteed unique for each IC.
|
uint16_t | temperature |
The last measured temperature. The
|
struct APP_MSG_RESPONSE_MEASURETEMPERATURE_T |
Data Fields | ||
---|---|---|
uint32_t | result |
The command result. Only when |
int16_t | temperature |
The measured temperature in deci-Celsius degrees. |
struct APP_MSG_RESPONSE_GETEVENTS_T |
Depending on the value given in APP_MSG_CMD_GETEVENTS_T.info, the response will have a different stream of bytes 'data' added right after the last field of this structure. The diagrams below give some examples what to expect:
Data Fields | ||
---|---|---|
uint16_t | index |
Unit: number of events. The value as given by APP_MSG_CMD_GETEVENTS_T.index. |
uint32_t | eventMask |
A bitmask of OR'd events of type APP_MSG_EVENT_T. The value as given by APP_MSG_CMD_GETEVENTS_T.eventMask, with (1 << APP_MSG_EVENT_COUNT) - 1 . |
uint8_t | info |
A bitmask of OR'd event information types of type EVENT_INFO_T. The value as given by APP_MSG_CMD_GETEVENTS_T.info, possibly extended by setting EVENT_INFO_MORE.
|
uint16_t | count |
The number of events that match
Immediately following this structure is an array of bytes, with extra information per event, as indicated by
The total size of the response is thus variable and must be deduced from this value |
struct APP_MSG_RESPONSE_GETPERIODICDATA_T |
Data Fields | ||
---|---|---|
uint32_t | result |
The command result. Only when |
uint8_t | which |
A bitmask of OR'd values of type APP_MSG_PERIODICDATA_TYPE_T The value as given by APP_MSG_CMD_GETPERIODICDATA_T.which, possibly reduced to only list the available types. |
uint8_t | format |
The value as given by APP_MSG_CMD_GETPERIODICDATA_T.format |
uint16_t | offset |
A value smaller than or equal to APP_MSG_CMD_GETPERIODICDATA_T.offset, with the unit defined by
|
#define APP_MSG_ERR_TSEN 0x1000E |
The temperature sensor was already in use. Wait, then try again. The time to wait is dependent on the resolution of the temperature conversion currently in progress - see APP_MSG_TSEN_RESOLUTION_T - and is at most 100 ms.
#define APP_MSG_MIN_TEMPERATURE -400 |
The maximum temperature the application can handle. This is a result of the limitations of the IC (-40:+85C), the limitations of the battery (say, -30:+50C), and the requirements of the use case. Since this is a demo, the maximum temperature the IC validated for is chosen.
#define APP_MSG_MAX_TEMPERATURE 850 |
The maximum temperature the application can handle. This is a result of the limitations of the IC (-40:+85C), the limitations of the battery (say, -30:+50C), and the requirements of the use case. Since this is a demo, the maximum temperature the IC validated for is chosen.
#define APP_MSG_TEMPERATURE_PLACEHOLDER_VALUE (APP_MSG_MAX_TEMPERATURE + 1) |
A value used to indicate either
#define APP_MSG_DELAY_START_INDEFINITELY 0xFFFFFFFF |
The value used to indicate the first measurement is to be delayed until an explicit command with message id APP_MSG_ID_START is given. See APP_MSG_CMD_SETCONFIG_T.startDelay.
#define APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE 232 |
The maximum number of temperature measurement values that can be retrieved in one response.
#define APP_MSG_SIZEOFEVENT_IN_RESPONSE | ( | info, | |
data | |||
) |
Helper macro to calculate the size of a single event, appended after a APP_MSG_CMD_GETEVENTS_T response.
info | : A bitmask of OR'd event information types of type EVENT_INFO_T. |
data | : The number of bytes of the extra data stored with the event. Ignored if EVENT_INFO_DATA is not set in info . |
#define APP_MSG_MAX_EVENTS_IN_RESPONSE | ( | size | ) | (505 / (size)) |
The maximum number of events that can be retrieved in a one response.
size | : the size of one event, appended after a APP_MSG_CMD_GETEVENTS_T response. All events are assumed to be of equal size (i.e. ignoring potential differences when EVENT_INFO_DATA is set). |
enum APP_MSG_ID_T |
Supported messages
Enumerator | |||||
---|---|---|---|---|---|
APP_MSG_ID_GETMEASUREMENTS |
| ||||
APP_MSG_ID_GETCONFIG |
| ||||
APP_MSG_ID_SETCONFIG |
| ||||
APP_MSG_ID_MEASURETEMPERATURE |
| ||||
APP_MSG_ID_START |
| ||||
APP_MSG_ID_GETEVENTS |
| ||||
APP_MSG_ID_GETPERIODICDATA |
| ||||
APP_MSG_ID_COUNT | Number of application specific message IDs. Not to be used as a possible ID. Use this in for loops or to define array sizes. | ||||
APP_MSG_ID_GETMEASUREMENTS |
| ||||
APP_MSG_ID_GETCONFIG |
| ||||
APP_MSG_ID_SETCONFIG |
| ||||
APP_MSG_ID_MEASURETEMPERATURE |
| ||||
APP_MSG_ID_START |
| ||||
APP_MSG_ID_GETEVENTS |
| ||||
APP_MSG_ID_GETACCELCONFIG |
| ||||
APP_MSG_ID_SETACCELCONFIG |
| ||||
APP_MSG_ID_GETPERIODICDATA |
| ||||
APP_MSG_ID_COUNT | Number of application specific message IDs. Not to be used as a possible ID. Use this in for loops or to define array sizes. | ||||
APP_MSG_ID_GETMEASUREMENTS |
| ||||
APP_MSG_ID_GETCONFIG |
| ||||
APP_MSG_ID_SETCONFIG |
| ||||
APP_MSG_ID_MEASURETEMPERATURE |
| ||||
APP_MSG_ID_START |
| ||||
APP_MSG_ID_GETEVENTS |
| ||||
APP_MSG_ID_GETACCELCONFIG |
| ||||
APP_MSG_ID_SETACCELCONFIG |
| ||||
APP_MSG_ID_GETPERIODICDATA |
| ||||
APP_MSG_ID_GETHUMIDITYCONFIG |
| ||||
APP_MSG_ID_SETHUMIDITYCONFIG |
| ||||
APP_MSG_ID_COUNT | Number of application specific message IDs. Not to be used as a possible ID. Use this in for loops or to define array sizes. | ||||
APP_MSG_ID_SETURL |
| ||||
APP_MSG_ID_SETOFFSET |
| ||||
APP_MSG_ID_SETRESOLUTION |
| ||||
APP_MSG_ID_SETUNIT |
| ||||
APP_MSG_ID_SETKEY |
| ||||
APP_MSG_ID_LOCK |
| ||||
APP_MSG_ID_SETCONFIG |
| ||||
APP_MSG_ID_GETCONFIG |
|
enum APP_MSG_EVENT_T |
The different events that can occur and are tracked - used in APP_MSG_RESPONSE_GETCONFIG_T.status.
APP_MSG_EVENT_CONFIGURED
.Enumerator | |
---|---|
APP_MSG_EVENT_PRISTINE |
|
APP_MSG_EVENT_CONFIGURED |
|
APP_MSG_EVENT_STARTING |
|
APP_MSG_EVENT_LOGGING |
|
APP_MSG_EVENT_STOPPED |
|
APP_MSG_EVENT_TEMPERATURE_TOO_HIGH |
|
APP_MSG_EVENT_TEMPERATURE_TOO_LOW |
|
APP_MSG_EVENT_BOD |
|
APP_MSG_EVENT_FULL |
|
APP_MSG_EVENT_EXPIRED |
|
APP_MSG_EVENT_I2C_ERROR |
Depending on environmental conditions this problem is likely to be temporary. When I2C communication is successful next time, this bit is cleared again. |
APP_MSG_EVENT_SPI_ERROR |
Depending on environmental conditions this problem is likely to be temporary. When SPI communication is successful next time, this bit is cleared again. |
APP_MSG_EVENT_SHOCK |
|
APP_MSG_EVENT_SHAKE |
|
APP_MSG_EVENT_VIBRATION |
|
APP_MSG_EVENT_TILT |
|
APP_MSG_EVENT_SHOCK_CONFIGURED |
|
APP_MSG_EVENT_SHAKE_CONFIGURED |
|
APP_MSG_EVENT_VIBRATION_CONFIGURED |
|
APP_MSG_EVENT_TILT_CONFIGURED |
|
APP_MSG_EVENT_HUMIDITY_CONFIGURED |
|
APP_MSG_EVENT_HUMIDITY_TOO_HIGH |
|
APP_MSG_EVENT_HUMIDITY_TOO_LOW |
|
APP_MSG_EVENT_COUNT |
|
APP_MSG_EVENT_ALL | Convenience value. Not to be used as a possible event. Use this in bitmasks to capture all events. |
APP_MSG_EVENT_PRISTINE |
|
APP_MSG_EVENT_CONFIGURED |
|
APP_MSG_EVENT_STARTING |
|
APP_MSG_EVENT_LOGGING |
|
APP_MSG_EVENT_STOPPED |
|
APP_MSG_EVENT_TEMPERATURE_TOO_HIGH |
|
APP_MSG_EVENT_TEMPERATURE_TOO_LOW |
|
APP_MSG_EVENT_BOD |
|
APP_MSG_EVENT_FULL |
|
APP_MSG_EVENT_EXPIRED |
|
APP_MSG_EVENT_I2C_ERROR |
Depending on environmental conditions this problem is likely to be temporary. When I2C communication is successful next time, this bit is cleared again. |
APP_MSG_EVENT_SPI_ERROR |
Depending on environmental conditions this problem is likely to be temporary. When SPI communication is successful next time, this bit is cleared again. |
APP_MSG_EVENT_SHOCK |
|
APP_MSG_EVENT_SHAKE |
|
APP_MSG_EVENT_VIBRATION |
|
APP_MSG_EVENT_TILT |
|
APP_MSG_EVENT_SHOCK_CONFIGURED |
|
APP_MSG_EVENT_SHAKE_CONFIGURED |
|
APP_MSG_EVENT_VIBRATION_CONFIGURED |
|
APP_MSG_EVENT_TILT_CONFIGURED |
|
APP_MSG_EVENT_HUMIDITY_CONFIGURED |
|
APP_MSG_EVENT_HUMIDITY_TOO_HIGH |
|
APP_MSG_EVENT_HUMIDITY_TOO_LOW |
|
APP_MSG_EVENT_COUNT |
|
APP_MSG_EVENT_ALL | Convenience value. Not to be used as a possible event. Use this in bitmasks to capture all events. |
APP_MSG_EVENT_PRISTINE |
|
APP_MSG_EVENT_CONFIGURED |
|
APP_MSG_EVENT_STARTING |
|
APP_MSG_EVENT_LOGGING |
|
APP_MSG_EVENT_STOPPED |
|
APP_MSG_EVENT_TEMPERATURE_TOO_HIGH |
|
APP_MSG_EVENT_TEMPERATURE_TOO_LOW |
|
APP_MSG_EVENT_BOD |
|
APP_MSG_EVENT_FULL |
|
APP_MSG_EVENT_EXPIRED |
|
APP_MSG_EVENT_I2C_ERROR |
Depending on environmental conditions this problem is likely to be temporary. When I2C communication is successful next time, this bit is cleared again. |
APP_MSG_EVENT_SPI_ERROR |
Depending on environmental conditions this problem is likely to be temporary. When SPI communication is successful next time, this bit is cleared again. |
APP_MSG_EVENT_SHOCK |
|
APP_MSG_EVENT_SHAKE |
|
APP_MSG_EVENT_VIBRATION |
|
APP_MSG_EVENT_TILT |
|
APP_MSG_EVENT_SHOCK_CONFIGURED |
|
APP_MSG_EVENT_SHAKE_CONFIGURED |
|
APP_MSG_EVENT_VIBRATION_CONFIGURED |
|
APP_MSG_EVENT_TILT_CONFIGURED |
|
APP_MSG_EVENT_HUMIDITY_CONFIGURED |
|
APP_MSG_EVENT_HUMIDITY_TOO_HIGH |
|
APP_MSG_EVENT_HUMIDITY_TOO_LOW |
|
APP_MSG_EVENT_COUNT |
|
APP_MSG_EVENT_ALL | Convenience value. Not to be used as a possible event. Use this in bitmasks to capture all events. |
enum EVENT_INFO_T |
Lists the different types of information that can be returned in a response with message id APP_MSG_ID_GETEVENTS
Enumerator | |
---|---|
EVENT_INFO_INDEX |
|
EVENT_INFO_TIMESTAMP |
|
EVENT_INFO_ENUM |
|
EVENT_INFO_DATA |
|
EVENT_INFO_COUNT |
|
EVENT_INFO_NONE |
|
EVENT_INFO_ALL |
|
EVENT_INFO_MORE |
When set, indicates more events matching APP_MSG_RESPONSE_GETEVENTS_T.eventMask are available, that did not fit in the response. |
EVENT_INFO_INDEX |
|
EVENT_INFO_TIMESTAMP |
|
EVENT_INFO_ENUM |
|
EVENT_INFO_DATA |
|
EVENT_INFO_COUNT |
|
EVENT_INFO_NONE |
|
EVENT_INFO_ALL |
|
EVENT_INFO_MORE |
When set, indicates more events matching APP_MSG_RESPONSE_GETEVENTS_T.eventMask are available, that did not fit in the response. |
EVENT_INFO_INDEX |
|
EVENT_INFO_TIMESTAMP |
|
EVENT_INFO_ENUM |
|
EVENT_INFO_DATA |
|
EVENT_INFO_COUNT |
|
EVENT_INFO_NONE |
|
EVENT_INFO_ALL |
|
EVENT_INFO_MORE |
When set, indicates more events matching APP_MSG_RESPONSE_GETEVENTS_T.eventMask are available, that did not fit in the response. |
The different types of data that is sampled periodically.
The different formats periodic data is represented in.
Enumerator | |
---|---|
APP_MSG_PERIODICDATA_FORMAT_FULL | Each data sample takes up 1 or more full bytes:
|
APP_MSG_PERIODICDATA_FORMAT_RAW | The data is returned as it is stored in memory: an exact copy of the raw bytes from the non-volatile memories EEPROM and FLASH used for data storage are returned. The data may be converted, mapped, lossless or lossy compressed. It is up to the tag reader to know and understand the storage format and to be able to convert it back to the sampled data.
|
APP_MSG_PERIODICDATA_FORMAT_FULL | Each data sample takes up 1 or more full bytes:
|
APP_MSG_PERIODICDATA_FORMAT_RAW | The data is returned as it is stored in memory: an exact copy of the raw bytes from the non-volatile memories EEPROM and FLASH used for data storage are returned. The data may be converted, mapped, lossless or lossy compressed. It is up to the tag reader to know and understand the storage format and to be able to convert it back to the sampled data.
|
APP_MSG_PERIODICDATA_FORMAT_FULL | Each data sample takes up 1 or more full bytes:
|
APP_MSG_PERIODICDATA_FORMAT_RAW | The data is returned as it is stored in memory: an exact copy of the raw bytes from the non-volatile memories EEPROM and FLASH used for data storage are returned. The data may be converted, mapped, lossless or lossy compressed. It is up to the tag reader to know and understand the storage format and to be able to convert it back to the sampled data.
|
Possible resolutions for the Temperature Sensor, used in APP_MSG_CMD_MEASURETEMPERATURE_T.resolution