KPN Things Device SDK
SenMLBoolRecord Class Reference

#include <senml_bool_record.h>

Inheritance diagram for SenMLBoolRecord:
SenMLRecord SenMLBase SenMLBoolActuator

Public Member Functions

 SenMLBoolRecord (const char *name)
 
 SenMLBoolRecord (const char *name, SenMLUnit unit)
 
 SenMLBoolRecord (const char *name, SenMLUnit unit, bool value)
 
 SenMLBoolRecord (ThingsMLMeasurementIndex index)
 
 SenMLBoolRecord (ThingsMLMeasurementIndex index, bool value)
 
 ~SenMLBoolRecord ()
 
virtual int fieldsToJson ()
 
virtual int fieldsToCbor ()
 
bool get ()
 
bool set (bool value, double time=(double) NAN)
 
- 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 ()
 
SenMLBasegetNext ()
 
SenMLBasegetRoot ()
 
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)
 
SenMLBasegetPrev ()
 
virtual bool isPack ()
 
virtual int contentToCbor ()=0
 
virtual int getArrayLength ()
 
virtual int getFieldLength ()=0
 

Detailed Description

A SenMLRecord that stores boolean data. This type of object can only be used for sensor data. If actuation is needed, use SenMLBoolActuator instead.

Constructor & Destructor Documentation

◆ SenMLBoolRecord() [1/5]

SenMLBoolRecord::SenMLBoolRecord ( const char *  name)
inline

◆ SenMLBoolRecord() [2/5]

SenMLBoolRecord::SenMLBoolRecord ( const char *  name,
SenMLUnit  unit 
)
inline

◆ SenMLBoolRecord() [3/5]

SenMLBoolRecord::SenMLBoolRecord ( const char *  name,
SenMLUnit  unit,
bool  value 
)
inline

◆ SenMLBoolRecord() [4/5]

SenMLBoolRecord::SenMLBoolRecord ( ThingsMLMeasurementIndex  index)
inline

◆ SenMLBoolRecord() [5/5]

SenMLBoolRecord::SenMLBoolRecord ( ThingsMLMeasurementIndex  index,
bool  value 
)
inline

◆ ~SenMLBoolRecord()

SenMLBoolRecord::~SenMLBoolRecord ( )
inline

Member Function Documentation

◆ fieldsToCbor()

int SenMLBoolRecord::fieldsToCbor ( )
virtual

renders all the fields to cbor format. renders all the fields of the object without the length info at the beginning note: this is public so that custom implementations for the record object can use other objects internally and render to json using this function (ex: coordinatesRecord using 3 floatRecrods for lat, lon & alt.

Returns
: The number of bytes that were written.

Reimplemented from SenMLRecord.

◆ fieldsToJson()

int SenMLBoolRecord::fieldsToJson ( )
virtual

renders all the fields to json, without the starting and ending brackets. Inheriters can extend this function if they want to add extra fields to the json output note: this is public so that custom implementations for the record object can use other objects internally and render to json using this function (ex: coordinatesRecord using 3 floatRecrods for lat, lon & alt.

Returns
: The number of bytes that were written.

Reimplemented from SenMLRecord.

◆ get()

bool SenMLBoolRecord::get ( )
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.

Returns
: the value (including the base-value when applicable).

◆ set()

bool SenMLBoolRecord::set ( bool  value,
double  time = (double)NAN 
)
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.

Parameters
valuethe value to store in the record
timeoptional (default = NAN, meaning no 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.
Returns
: true if the operation was succesful. See setTime() for more info when the operation can fail.

The documentation for this class was generated from the following files: