|
KPN Things Device SDK
|
#include <senml_record_t.h>
Public Member Functions | |
| SenMLRecordTemplate (const char *name) | |
| SenMLRecordTemplate (const char *name, SenMLUnit unit) | |
| SenMLRecordTemplate (const char *name, SenMLUnit unit, T value) | |
| SenMLRecordTemplate (ThingsMLMeasurementIndex index) | |
| SenMLRecordTemplate (ThingsMLMeasurementIndex index, T value) | |
| T | get () |
| bool | asSum () |
| bool | set (T value, double time=(double) NAN, bool asSum=false) |
Public Member Functions inherited from SenMLRecord | |
| SenMLRecord () | |
| SenMLRecord (const char *name) | |
| SenMLRecord (ThingsMLMeasurementIndex index) | |
| SenMLRecord (const char *name, SenMLUnit unit) | |
| double | getTime () |
| bool | setTime (double value, bool absolute=true) |
| void | setTimeDirect (double value) |
| const char * | getName () |
| ThingsMLMeasurementIndex | getIndex () |
| void | setName (const char *name) |
| double | getUpdateTime () |
| bool | setUpdateTime (double value, bool absolute=true) |
| SenMLUnit | getUnit () |
| void | setUnit (SenMLUnit value) |
| virtual int | fieldsToJson () |
| virtual int | fieldsToCbor () |
Public Member Functions inherited from SenMLBase | |
| SenMLBase () | |
| ~SenMLBase () | |
| SenMLBase * | getNext () |
| SenMLBase * | getRoot () |
| virtual void | adjustToBaseTime (double prev, double time) |
| virtual int | fieldsToJson ()=0 |
| virtual int | fieldsToCbor ()=0 |
Additional Inherited Members | |
Protected Member Functions inherited from SenMLRecord | |
| virtual int | contentToJson () |
| virtual int | contentToCbor () |
| virtual void | adjustToBaseTime (double prev, double time) |
| virtual void | actuate (const void *value, int dataLength, SenMLDataType dataType) |
| int | getFieldLength () |
Protected Member Functions inherited from SenMLBase | |
| virtual int | contentToJson ()=0 |
| void | setNext (SenMLBase *value) |
| void | setPrev (SenMLBase *value) |
| SenMLBase * | getPrev () |
| virtual bool | isPack () |
| virtual int | contentToCbor ()=0 |
| virtual int | getArrayLength () |
| virtual int | getFieldLength ()=0 |
A template class that can be used to create new SenMLRecord types that store a value with a basic data type (no structs or classes). When you create a new class, you should always implement the following functions in order for the new class to operate correctly: fieldsToJson() and fieldsToCbor()
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get if the value should be interpreted as a sum or regular value. These are exclusive: a SenMLRecord either has a sum or a value, but never both. Sum and value are always assigned with the function set().
|
inline |
Get the value assigned to this SenMLRecord. This function always returns the absolute value, also when the record is part of a pack that has a base value assigned.
|
inline |
Assign a value to the SenMLRecord. You can optionally assign the time at which the measurement was taken and if it should be interpreted as a sum or regular value.
| value | the value to store in the record |
| time | optional (default = NAN, meaning not time info). The time at which the measurement was taken. This should always be the absolute time value which will be converted relative to the base time when applicable (if the root is a SenMLPack with baseTime) . If you want to set the time manually relative to the basetime of the root-pack, then use setTime() instead. |
| asSum | when true, the value will be interpreted as a sum, otherwise as a regular value. |