|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Sensor Measurement Lists (SenML, RFC 8428): the Pack builders and the Record resolver. More...
#include "protocore_config.h"Go to the source code of this file.
Sensor Measurement Lists (SenML, RFC 8428): the Pack builders and the Record resolver.
RFC 8428 sec 3 names the units: a SenML Record is "one measurement or configuration instance in time presented using the SenML data model", and a SenML Pack is "one or more SenML Records in an array structure". This module builds a Pack from a caller-owned Record array and resolves a Pack in place of a consumer.
A Record carries Base Fields (RFC 8428 sec 4.1) that apply to it and the Records after it, and Regular Fields (sec 4.2) that apply to it alone. RFC 8428 sec 5.1.1:
The JSON representation (sec 5, application/senml+json) writes the labels as member names. The CBOR representation (sec 6, application/senml+cbor) writes the Table 4 integer map keys instead; that table is conclusive, so one walk feeds every binary encoding through protocore_codec and the encoding is an argument. A Number that is integral is emitted as an integer, so a Time keeps full precision; otherwise it is emitted as a floating-point value.
Both builders write into a caller buffer and report 0 bytes when it will not hold the whole Pack. The resolver (sec 4.6) folds the Base Name and Base Time into each Record, so each output Record carries a full Name and an absolute Time and stands alone.
The module exports one symbol, Senml. Everything in senml.c has internal linkage.
Definition in file senml.h.