Loading...
Searching...
No Matches
senml.h File Reference

Basic SenML types. More...

Detailed Description

Basic SenML types.

Author
Silke Hofstra silke.nosp@m.@slx.nosp@m.h.eu

Definition in file senml.h.

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "modules.h"
+ Include dependency graph for senml.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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.