Loading...
Searching...
No Matches
SenML

Basic SenML types. More...

Detailed Description

Basic SenML types.

The senml module contains the building blocks for using SenML. This module provides the basic types that can be used with (for example) SenML CBOR for encoding measurement data.

Some attributes defined in SenML need to be enabled explicitly, see senml_attr_t for details. To enable all attributes, set:

CFLAGS += -DCONFIG_SENML_ATTR_SUM=1
CFLAGS += -DCONFIG_SENML_ATTR_VERSION=1
CFLAGS += -DCONFIG_SENML_ATTR_UPDATE_TIME=1

Modules

 SenML CBOR
 Functionality for encoding SenML values as CBOR.
 
 SenML Phydat
 Functionality for converting from Phydat to SenML.
 
 SenML SAUL
 Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML.
 

Files

file  senml.h
 Basic SenML types.
 

Data Structures

struct  senml_decfrac_t
 Decimal fraction containing a value in the form of m * 10^e. More...
 
struct  senml_numeric_t
 SenML numeric value. More...
 
struct  senml_attr_t
 SenML common record attributes. More...
 
struct  senml_value_t
 SenML string value. More...
 
struct  senml_string_value_t
 SenML string value. More...
 
struct  senml_bool_value_t
 SenML boolean value. More...
 
struct  senml_data_value_t
 SenML data value. More...
 

Macros

#define CONFIG_SENML_ATTR_SUM   0
 Enable the SenML 'sum' and 'base sum' attributes.
 
#define CONFIG_SENML_ATTR_VERSION   0
 Enable the SenML 'version' and 'base version' attributes.
 
#define CONFIG_SENML_ATTR_UPDATE_TIME   0
 Enable the SenML 'update time' attribute.
 

Enumerations

enum  senml_unit_t {
  SENML_UNIT_NONE , SENML_UNIT_METER , SENML_UNIT_KILOGRAM , SENML_UNIT_GRAM ,
  SENML_UNIT_SECOND , SENML_UNIT_AMPERE , SENML_UNIT_KELVIN , SENML_UNIT_CANDELA ,
  SENML_UNIT_MOLE , SENML_UNIT_HERTZ , SENML_UNIT_RADIAN , SENML_UNIT_STERADIAN ,
  SENML_UNIT_NEWTON , SENML_UNIT_PASCAL , SENML_UNIT_JOULE , SENML_UNIT_WATT ,
  SENML_UNIT_COULOMB , SENML_UNIT_VOLT , SENML_UNIT_FARAD , SENML_UNIT_OHM ,
  SENML_UNIT_SIEMENS , SENML_UNIT_WEBER , SENML_UNIT_TESLA , SENML_UNIT_HENRY ,
  SENML_UNIT_CELSIUS , SENML_UNIT_LUMEN , SENML_UNIT_LUX , SENML_UNIT_BECQUEREL ,
  SENML_UNIT_GRAY , SENML_UNIT_SIEVERT , SENML_UNIT_KATAL , SENML_UNIT_SQUARE_METER ,
  SENML_UNIT_CUBIC_METER , SENML_UNIT_LITER , SENML_UNIT_METER_PER_SECOND , SENML_UNIT_METER_PER_SQUARE_SECOND ,
  SENML_UNIT_CUBIC_METER_PER_SECOND , SENML_UNIT_LITER_PER_SECOND , SENML_UNIT_WATT_PER_SQUARE_METER , SENML_UNIT_CANDELA_PER_SQUARE_METER ,
  SENML_UNIT_BIT , SENML_UNIT_BIT_PER_SECOND , SENML_UNIT_LATITUDE , SENML_UNIT_LONGITUDE ,
  SENML_UNIT_PH , SENML_UNIT_DECIBEL , SENML_UNIT_DBW , SENML_UNIT_BEL ,
  SENML_UNIT_COUNT , SENML_UNIT_RATIO , SENML_UNIT_RATIO_2 , SENML_UNIT_RELATIVE_HUMIDITY_PERCENT ,
  SENML_UNIT_REMAINING_BATTERY_PERCENT , SENML_UNIT_REMAINING_BATTERY_SECONDS , SENML_UNIT_RATE , SENML_UNIT_RPM ,
  SENML_UNIT_BEAT_PER_MINUTE , SENML_UNIT_BEATS , SENML_UNIT_SIEMENS_PER_METER , SENML_UNIT_BYTE ,
  SENML_UNIT_VOLT_AMPERE , SENML_UNIT_VOLT_AMPERE_SECOND , SENML_UNIT_VOLT_AMPERE_REACTIVE , SENML_UNIT_VOLT_AMPERE_REACTIVE_SECOND ,
  SENML_UNIT_JOULE_PER_METER , SENML_UNIT_KILOGRAM_PER_CUBIC_METER , SENML_UNIT_DEGREE , SENML_UNIT_NEPHELOMETRIC_TURBIDITY_UNIT ,
  SENML_UNIT_MILLISECOND , SENML_UNIT_MINUTE , SENML_UNIT_HOUR , SENML_UNIT_MEGAHERTZ ,
  SENML_UNIT_KILOWATT , SENML_UNIT_KILOVOLT_AMPERE , SENML_UNIT_KILOVAR , SENML_UNIT_AMPERE_HOUR ,
  SENML_UNIT_WATT_HOUR , SENML_UNIT_KILOWATT_HOUR , SENML_UNIT_VAR_HOUR , SENML_UNIT_KILOVAR_HOUR ,
  SENML_UNIT_KILOVOLT_AMPERE_HOUR , SENML_UNIT_WATT_HOUR_PER_KILOMETER , SENML_UNIT_KIBIBYTE , SENML_UNIT_GIGABYTE ,
  SENML_UNIT_MEGABIT_PER_SECOND , SENML_UNIT_BYTE_PER_SECOND , SENML_UNIT_MEGABYTE_PER_SECOND , SENML_UNIT_MILLIVOLT ,
  SENML_UNIT_MILLIAMPERE , SENML_UNIT_DECIBEL_MILLIWATT , SENML_UNIT_MICROGRAM_PER_CUBIC_METER , SENML_UNIT_MILLIMETER_PER_HOUR ,
  SENML_UNIT_METER_PER_HOUR , SENML_UNIT_PARTS_PER_MILLION , SENML_UNIT_PERCENT , SENML_UNIT_PERMILLE ,
  SENML_UNIT_HECTOPASCAL , SENML_UNIT_MILLIMETER , SENML_UNIT_CENTIMETER , SENML_UNIT_KILOMETER ,
  SENML_UNIT_KILOMETER_PER_HOUR , SENML_UNIT_PARTS_PER_BILLION , SENML_UNIT_PARTS_PER_TRILLION , SENML_UNIT_VOLT_AMPERE_HOUR ,
  SENML_UNIT_MILLIGRAM_PER_LITER , SENML_UNIT_MICROGRAM_PER_LITER , SENML_UNIT_GRAM_PER_LITER
}
 SenML units and secondary units. More...
 
enum  senml_value_type_t {
  SENML_TYPE_NUMERIC_UINT , SENML_TYPE_NUMERIC_INT , SENML_TYPE_NUMERIC_FLOAT , SENML_TYPE_NUMERIC_DOUBLE ,
  SENML_TYPE_NUMERIC_DECFRAC
}
 SenML numeric value types. More...
 

Functions

static senml_numeric_t senml_float (float v)
 Create a floating point numeric value.
 
static void senml_set_float (senml_numeric_t *n, float v)
 Set a floating point numeric value.
 
static senml_numeric_t senml_double (double v)
 Create a double precision floating point numeric value.
 
static void senml_set_double (senml_numeric_t *n, double v)
 Set a double precision floating point numeric value.
 
static senml_numeric_t senml_int (int64_t v)
 Create an integer numeric value.
 
static void senml_set_int (senml_numeric_t *n, int64_t v)
 Set an integer numeric value.
 
static senml_numeric_t senml_uint (uint64_t v)
 Create an unsigned integer numeric value.
 
static void set_senml_uint (senml_numeric_t *n, uint64_t v)
 Set an unsigned integer numeric value.
 
static senml_numeric_t senml_decfrac (int32_t m, int32_t e)
 Create a decimal fraction numeric value in the form m*10^e.
 
static void senml_set_decfrac (senml_numeric_t *n, int32_t m, int32_t e)
 Set a decimal fraction numeric value in the form m*10^e.
 
static senml_numeric_t senml_duration_s (int64_t s)
 Get an integer representation of a duration in seconds.
 
static void senml_set_duration_s (senml_numeric_t *n, int64_t s)
 Set an integer representation of a duration in seconds.
 
static senml_numeric_t senml_duration_ms (int32_t ms)
 Get a senml_decfrac_t representation of a duration in milliseconds.
 
static void senml_set_duration_ms (senml_numeric_t *n, int32_t ms)
 Set a senml_decfrac_t representation of a duration in milliseconds.
 
static senml_numeric_t senml_duration_us (int32_t us)
 Get a senml_decfrac_t representation of a duration in microseconds.
 
static void senml_set_duration_us (senml_numeric_t *n, int32_t us)
 Get a senml_decfrac_t representation of a duration in microseconds.
 
static senml_numeric_t senml_duration_ns (int32_t ns)
 Get a senml_decfrac_t representation of a duration in nanoseconds.
 
static void senml_set_duration_ns (senml_numeric_t *n, int32_t ns)
 Set a senml_decfrac_t representation of a duration in nanoseconds.
 
const char * senml_unit_to_str (senml_unit_t unit)
 Convert a SenML unit to a string.
 

Macro Definition Documentation

◆ CONFIG_SENML_ATTR_SUM

#define CONFIG_SENML_ATTR_SUM   0

Enable the SenML 'sum' and 'base sum' attributes.

Definition at line 53 of file senml.h.

◆ CONFIG_SENML_ATTR_UPDATE_TIME

#define CONFIG_SENML_ATTR_UPDATE_TIME   0

Enable the SenML 'update time' attribute.

Definition at line 67 of file senml.h.

◆ CONFIG_SENML_ATTR_VERSION

#define CONFIG_SENML_ATTR_VERSION   0

Enable the SenML 'version' and 'base version' attributes.

Definition at line 60 of file senml.h.

Enumeration Type Documentation

◆ senml_unit_t

SenML units and secondary units.

This list contains the SenML units and secondary units as assigned by IANA. Units in italic are not recommended to be produced by new implementations. Secondary units include the equivalent primary unit.

Enumerator
SENML_UNIT_NONE 

No unit specified.

SENML_UNIT_METER 

meter (m)

SENML_UNIT_KILOGRAM 

kilogram (kg)

SENML_UNIT_GRAM 

gram (g)

SENML_UNIT_SECOND 

second (s)

SENML_UNIT_AMPERE 

ampere (A)

SENML_UNIT_KELVIN 

kelvin (K)

SENML_UNIT_CANDELA 

candela (cd)

SENML_UNIT_MOLE 

mole (mol)

SENML_UNIT_HERTZ 

hertz (Hz)

SENML_UNIT_RADIAN 

radian (rad)

SENML_UNIT_STERADIAN 

steradian (sr)

SENML_UNIT_NEWTON 

newton (N)

SENML_UNIT_PASCAL 

pascal (Pa)

SENML_UNIT_JOULE 

joule (J)

SENML_UNIT_WATT 

watt (W)

SENML_UNIT_COULOMB 

coulomb (C)

SENML_UNIT_VOLT 

volt (V)

SENML_UNIT_FARAD 

farad (F)

SENML_UNIT_OHM 

ohm (Ohm)

SENML_UNIT_SIEMENS 

siemens (S)

SENML_UNIT_WEBER 

weber (Wb)

SENML_UNIT_TESLA 

tesla (T)

SENML_UNIT_HENRY 

henry (H)

SENML_UNIT_CELSIUS 

degrees Celsius (Cel)

SENML_UNIT_LUMEN 

lumen (lm)

SENML_UNIT_LUX 

lux (lx)

SENML_UNIT_BECQUEREL 

becquerel (Bq)

SENML_UNIT_GRAY 

gray (Gy)

SENML_UNIT_SIEVERT 

sievert (Sv)

SENML_UNIT_KATAL 

katal (kat)

SENML_UNIT_SQUARE_METER 

square meter (area) (m2)

SENML_UNIT_CUBIC_METER 

cubic meter (volume) (m3)

SENML_UNIT_LITER 

liter (volume) (l)

SENML_UNIT_METER_PER_SECOND 

meter per second (velocity) (m/s)

SENML_UNIT_METER_PER_SQUARE_SECOND 

meter per square second (acceleration) (m/s2)

SENML_UNIT_CUBIC_METER_PER_SECOND 

cubic meter per second (flow rate) (m3/s)

SENML_UNIT_LITER_PER_SECOND 

liter per second (flow rate) (l/s)

SENML_UNIT_WATT_PER_SQUARE_METER 

watt per square meter (irradiance) (W/m2)

SENML_UNIT_CANDELA_PER_SQUARE_METER 

candela per square meter (luminance) (cd/m2)

SENML_UNIT_BIT 

bit (information content) (bit)

SENML_UNIT_BIT_PER_SECOND 

bit per second (data rate) (bit/s)

SENML_UNIT_LATITUDE 

degrees latitude (lat)

SENML_UNIT_LONGITUDE 

degrees longitude (lon)

SENML_UNIT_PH 

pH value (acidity; logarithmic quantity) (pH)

SENML_UNIT_DECIBEL 

decibel (logarithmic quantity) (dB)

SENML_UNIT_DBW 

decibel relative to 1 W (power level) (dBW)

SENML_UNIT_BEL 

bel (sound pressure level; logarithmic quantity) (Bspl)

SENML_UNIT_COUNT 

1 (counter value) (count)

SENML_UNIT_RATIO 

1 (ratio e.g., value of a switch) (/)

SENML_UNIT_RATIO_2 

1 (ratio e.g., value of a switch) (%)

SENML_UNIT_RELATIVE_HUMIDITY_PERCENT 

Percentage (Relative Humidity) (RH)

SENML_UNIT_REMAINING_BATTERY_PERCENT 

Percentage (remaining battery energy level) (EL)

SENML_UNIT_REMAINING_BATTERY_SECONDS 

seconds (remaining battery energy level) (EL)

SENML_UNIT_RATE 

1 per second (event rate) (1/s)

SENML_UNIT_RPM 

1 per minute (event rate, "rpm") (1/min)

SENML_UNIT_BEAT_PER_MINUTE 

1 per minute (heart rate in beats per minute) (beat/min))

SENML_UNIT_BEATS 

1 (Cumulative number of heart beats) (beats)

SENML_UNIT_SIEMENS_PER_METER 

Siemens per meter (conductivity) (S/m)

SENML_UNIT_BYTE 

Byte (information content) (B)

SENML_UNIT_VOLT_AMPERE 

volt-ampere (Apparent Power) (VA)

SENML_UNIT_VOLT_AMPERE_SECOND 

volt-ampere second (Apparent Energy) (VAs)

SENML_UNIT_VOLT_AMPERE_REACTIVE 

volt-ampere reactive (Reactive Power) (var)

SENML_UNIT_VOLT_AMPERE_REACTIVE_SECOND 

volt-ampere-reactive second (Reactive Energy) (vars)

SENML_UNIT_JOULE_PER_METER 

joule per meter (Energy per distance) (J/m)

SENML_UNIT_KILOGRAM_PER_CUBIC_METER 

kilogram per cubic meter (mass density, mass concentration) (kg/m3)

SENML_UNIT_DEGREE 

degree (angle) (deg)

SENML_UNIT_NEPHELOMETRIC_TURBIDITY_UNIT 

Nephelometric Turbidity Unit (NTU)

SENML_UNIT_MILLISECOND 

millisecond (ms, equivalent to 1/1000 s)

SENML_UNIT_MINUTE 

minute (min, equivalent to 60 s)

SENML_UNIT_HOUR 

hour (h, equivalent to 3600 s)

SENML_UNIT_MEGAHERTZ 

megahertz (MHz, equivalent to 1000000 Hz)

SENML_UNIT_KILOWATT 

kilowatt (kW, equivalent to 1000 W)

SENML_UNIT_KILOVOLT_AMPERE 

kilovolt-ampere (kVA, equivalent to 1000 VA)

SENML_UNIT_KILOVAR 

kilovar (kvar, equivalent to 1000 var)

SENML_UNIT_AMPERE_HOUR 

ampere-hour (Ah, equivalent to 3600 C)

SENML_UNIT_WATT_HOUR 

watt-hour (Wh, equivalent to 3600 J)

SENML_UNIT_KILOWATT_HOUR 

kilowatt-hour (kWh, equivalent to 3600000 J)

SENML_UNIT_VAR_HOUR 

var-hour (varh, equivalent to 3600 vars)

SENML_UNIT_KILOVAR_HOUR 

kilovar-hour (kvarh, equivalent to 3600000 vars)

SENML_UNIT_KILOVOLT_AMPERE_HOUR 

kilovolt-ampere-hour (kVAh, equivalent to 3600000 VAs)

SENML_UNIT_WATT_HOUR_PER_KILOMETER 

watt-hour per kilometer (Wh/km, equivalent to 3.6 J/m)

SENML_UNIT_KIBIBYTE 

kibibyte (KiB, equivalent to 1024 B)

SENML_UNIT_GIGABYTE 

gigabyte (GB, equivalent to 1e9 B)

SENML_UNIT_MEGABIT_PER_SECOND 

megabit per second (Mbit/s, equivalent to 1000000 bit/s)

SENML_UNIT_BYTE_PER_SECOND 

byte per second (B/s, equivalent to 8 bit/s)

SENML_UNIT_MEGABYTE_PER_SECOND 

megabyte per second (MB/s, equivalent to 8000000 bit/s)

SENML_UNIT_MILLIVOLT 

millivolt (mV, equivalent to 1/1000 V)

SENML_UNIT_MILLIAMPERE 

milliampere (mA, equivalent to 1/1000 A)

SENML_UNIT_DECIBEL_MILLIWATT 

decibel (milliwatt) (dBm, equivalent to -29 dBW)

SENML_UNIT_MICROGRAM_PER_CUBIC_METER 

microgram per cubic meter (ug/m3, equivalent to 1e-9 kg/m3)

SENML_UNIT_MILLIMETER_PER_HOUR 

millimeter per hour (mm/h, equivalent to 1/3600000 m/s)

SENML_UNIT_METER_PER_HOUR 

meter per hour (m/h, equivalent to 1/3600 m/s)

SENML_UNIT_PARTS_PER_MILLION 

parts per million (ppm, equivalent to 1e-6 '/')

SENML_UNIT_PERCENT 

percent (/100, equivalent to 1/100 '/')

SENML_UNIT_PERMILLE 

permille (/1000, equivalent to 1/1000 '/')

SENML_UNIT_HECTOPASCAL 

hectopascal (hPa, equivalent to 100 Pa)

SENML_UNIT_MILLIMETER 

millimeter (mm, equivalent to 1/1000 m)

SENML_UNIT_CENTIMETER 

centimeter (cm, equivalent to 1/100 m)

SENML_UNIT_KILOMETER 

kilometer (km, equivalent to 1000 m)

SENML_UNIT_KILOMETER_PER_HOUR 

kilometer per hour (km/h, equivalent to 1/3.6 m/s)

SENML_UNIT_PARTS_PER_BILLION 

parts per billion (ppb, equivalent to 1e-9 '/')

SENML_UNIT_PARTS_PER_TRILLION 

parts per trillion (ppt, equivalent to 1e-12 '/')

SENML_UNIT_VOLT_AMPERE_HOUR 

volt-ampere-hour (VAh, equivalent to 3600 VAs)

SENML_UNIT_MILLIGRAM_PER_LITER 

milligram per liter (mg/l, equivalent to 1/1000 kg/m3)

SENML_UNIT_MICROGRAM_PER_LITER 

microgram per liter (ug/l, equivalent to 1e-6 kg/m3)

SENML_UNIT_GRAM_PER_LITER 

gram per liter (g/l, equivalent to 1 kg/m3)

Definition at line 78 of file senml.h.

◆ senml_value_type_t

SenML numeric value types.

Enumerator
SENML_TYPE_NUMERIC_UINT 

Unsigned integer.

SENML_TYPE_NUMERIC_INT 

Integer.

SENML_TYPE_NUMERIC_FLOAT 

Floating point number.

SENML_TYPE_NUMERIC_DOUBLE 

Double-precision floating point number.

SENML_TYPE_NUMERIC_DECFRAC 

Decimal fraction.

Definition at line 201 of file senml.h.

Function Documentation

◆ senml_decfrac()

static senml_numeric_t senml_decfrac ( int32_t  m,
int32_t  e 
)
inlinestatic

Create a decimal fraction numeric value in the form m*10^e.

Parameters
mMantissa (value) to encode.
eExponent (scale) to encode.
Returns
Numeric value containing the given value.

Definition at line 398 of file senml.h.

◆ senml_double()

static senml_numeric_t senml_double ( double  v)
inlinestatic

Create a double precision floating point numeric value.

Parameters
vValue to encode.
Returns
Numeric value containing the given value.

Definition at line 325 of file senml.h.

◆ senml_duration_ms()

static senml_numeric_t senml_duration_ms ( int32_t  ms)
inlinestatic

Get a senml_decfrac_t representation of a duration in milliseconds.

Parameters
msDuration in milliseconds.
Returns
Numeric representation of the duration.

Definition at line 446 of file senml.h.

◆ senml_duration_ns()

static senml_numeric_t senml_duration_ns ( int32_t  ns)
inlinestatic

Get a senml_decfrac_t representation of a duration in nanoseconds.

Parameters
nsDuration in nanoseconds.
Returns
Numeric representation of the duration.

Definition at line 492 of file senml.h.

◆ senml_duration_s()

static senml_numeric_t senml_duration_s ( int64_t  s)
inlinestatic

Get an integer representation of a duration in seconds.

Parameters
sDuration in seconds.
Returns
Numeric representation of the duration in seconds.

Definition at line 424 of file senml.h.

◆ senml_duration_us()

static senml_numeric_t senml_duration_us ( int32_t  us)
inlinestatic

Get a senml_decfrac_t representation of a duration in microseconds.

Parameters
usDuration in microseconds.
Returns
Numeric representation of the duration.

Definition at line 469 of file senml.h.

◆ senml_float()

static senml_numeric_t senml_float ( float  v)
inlinestatic

Create a floating point numeric value.

Parameters
vValue to encode.
Returns
Numeric value containing the given value.

Definition at line 301 of file senml.h.

◆ senml_int()

static senml_numeric_t senml_int ( int64_t  v)
inlinestatic

Create an integer numeric value.

Parameters
vValue to encode.
Returns
Numeric value containing the given value.

Definition at line 349 of file senml.h.

◆ senml_set_decfrac()

static void senml_set_decfrac ( senml_numeric_t n,
int32_t  m,
int32_t  e 
)
inlinestatic

Set a decimal fraction numeric value in the form m*10^e.

Parameters
nNumeric value to set.
mMantissa (value) to encode.
eExponent (scale) to encode.

Definition at line 411 of file senml.h.

◆ senml_set_double()

static void senml_set_double ( senml_numeric_t n,
double  v 
)
inlinestatic

Set a double precision floating point numeric value.

Parameters
nNumeric value to set.
vValue to encode.

Definition at line 337 of file senml.h.

◆ senml_set_duration_ms()

static void senml_set_duration_ms ( senml_numeric_t n,
int32_t  ms 
)
inlinestatic

Set a senml_decfrac_t representation of a duration in milliseconds.

Parameters
nNumeric value to set.
msDuration in milliseconds.
Returns
Numeric representation of the duration.

Definition at line 458 of file senml.h.

◆ senml_set_duration_ns()

static void senml_set_duration_ns ( senml_numeric_t n,
int32_t  ns 
)
inlinestatic

Set a senml_decfrac_t representation of a duration in nanoseconds.

Parameters
nNumeric value to set.
nsDuration in nanoseconds.

Definition at line 503 of file senml.h.

◆ senml_set_duration_s()

static void senml_set_duration_s ( senml_numeric_t n,
int64_t  s 
)
inlinestatic

Set an integer representation of a duration in seconds.

Parameters
nNumeric value to set.
sDuration in seconds.

Definition at line 435 of file senml.h.

◆ senml_set_duration_us()

static void senml_set_duration_us ( senml_numeric_t n,
int32_t  us 
)
inlinestatic

Get a senml_decfrac_t representation of a duration in microseconds.

Parameters
nNumeric value to set.
usDuration in microseconds.
Returns
Numeric representation of the duration.

Definition at line 481 of file senml.h.

◆ senml_set_float()

static void senml_set_float ( senml_numeric_t n,
float  v 
)
inlinestatic

Set a floating point numeric value.

Parameters
nNumeric value to set.
vValue to encode.

Definition at line 313 of file senml.h.

◆ senml_set_int()

static void senml_set_int ( senml_numeric_t n,
int64_t  v 
)
inlinestatic

Set an integer numeric value.

Parameters
nNumeric value to set.
vValue to encode.

Definition at line 361 of file senml.h.

◆ senml_uint()

static senml_numeric_t senml_uint ( uint64_t  v)
inlinestatic

Create an unsigned integer numeric value.

Parameters
vValue to encode.
Returns
Numeric value containing the given value.

Definition at line 373 of file senml.h.

◆ senml_unit_to_str()

const char * senml_unit_to_str ( senml_unit_t  unit)

Convert a SenML unit to a string.

See the SenML units and Secondary units from IANA. Values not defined in senml_unit_t will result in an empty string.

Parameters
unitUnit to convert to string.
Returns
String representation of the unit.

◆ set_senml_uint()

static void set_senml_uint ( senml_numeric_t n,
uint64_t  v 
)
inlinestatic

Set an unsigned integer numeric value.

Parameters
nNumeric value to set.
vValue to encode.

Definition at line 385 of file senml.h.