Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of kpn_senml by
SenMLIntActuator Class Reference
A SenMLRecord that stores integer data and supports actuation. More...
#include <senml_int_actuator.h>
Inherits SenMLIntRecord.
Public Member Functions | |
virtual void | fieldsToJson () |
renders all the fields to json, without the starting and ending brackets. | |
virtual int | fieldsToCbor () |
renders all the fields to cbor format. | |
bool | asSum () |
Get if the value should be interpreted as a sum or regular value. | |
int | get () |
Get the value assigned to this SenMLRecord. | |
bool | set (intvalue) |
Assign a value to the SenMLRecord. | |
bool | set (intvalue, double time) |
Assign a value to the SenMLRecord. | |
bool | set (intvalue, double time, bool asSum) bool set(intvalue |
Assign a value to the SenMLRecord. | |
double | getTime () |
returns the time assigned to this record. | |
bool | setTime (double value, bool absolute=true) |
set the time, expressed as a unix epoch time, absolute or relative to the base time of the parent SenMLPack object. | |
const char * | getName () |
Get the name of the record. | |
void | setName (const char *name) |
Assign an identifier to the record. | |
int | getUpdateTime () |
Get the expected timestamp at which this record will be updated again. | |
bool | setUpdateTime (double value, bool absolute=true) |
Assign a timestamp to the record at which it is expected to update the value. | |
SenMLUnit | getUnit () |
Get the enum that identifies the unit name assigned to the record. | |
void | setUnit (SenMLUnit value) |
Assigns a unit value to the record. | |
SenMLBase * | getNext () |
get the next item in the list. | |
SenMLBase * | getRoot () |
Get the root object of this list. | |
Protected Member Functions | |
virtual void | actuate (const void *value, int dataLength, SenMLDataType dataType) |
called while parsing a senml message, when the parser found the value for an SenMLJsonListener |
Detailed Description
A SenMLRecord that stores integer data and supports actuation.
Definition at line 24 of file senml_int_actuator.h.
Member Function Documentation
void actuate | ( | const void * | value, |
int | dataLength, | ||
SenMLDataType | dataType | ||
) | [protected, virtual] |
called while parsing a senml message, when the parser found the value for an SenMLJsonListener
Reimplemented from SenMLRecord.
Definition at line 17 of file senml_int_actuator.cpp.
bool asSum | ( | ) | [inherited] |
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().
- Returns:
- : True when the value is interpreted as a sum, otherwise false.
Definition at line 49 of file senml_record_t.h.
int fieldsToCbor | ( | ) | [virtual, inherited] |
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.
Definition at line 77 of file senml_int_record.cpp.
void fieldsToJson | ( | ) | [virtual, inherited] |
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:
- : None
Reimplemented from SenMLRecord.
Definition at line 52 of file senml_int_record.cpp.
int get | ( | ) | [inherited] |
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).
Definition at line 41 of file senml_record_t.h.
const char* getName | ( | ) | [inherited] |
Get the name of the record.
- Returns:
- the name of the record as an immutable string. Don't delete this pointer, it refers to the internal buffer of the object and is managed by the record.
Definition at line 98 of file senml_record.h.
SenMLBase* getNext | ( | ) | [inherited] |
get the next item in the list.
- Returns:
- : a pointer to the next SenMLBase object in the list or NULL when at the end of the list.
Definition at line 42 of file senml_base.h.
SenMLBase * getRoot | ( | ) | [inherited] |
Get the root object of this list.
Usually, this is a SenMLPack object. The root object is defined as the first item in the list.
- Returns:
- : a pointer to the first SenMLBase object in the list or NULL when there is none.
Definition at line 53 of file senml_base.cpp.
double getTime | ( | ) | [inherited] |
returns the time assigned to this record.
NaN represents 'no time assigned'. See [base fields](https://tools.ietf.org/html/draft-ietf-core-senml-13#section-4.1) for more info on the time value.
- Returns:
- the timestamp assigned to the record, expressed in unix epoch, relative to the parent SenMLPack object's base time (if any).
Definition at line 73 of file senml_record.h.
SenMLUnit getUnit | ( | ) | [inherited] |
Get the enum that identifies the unit name assigned to the record.
The value SENML_UNIT_NONE means that no unit will be generated in the output. Senml defines a fixed set of supported [unit names](https://tools.ietf.org/html/draft-ietf-core-senml-13#section-12.1).
- Returns:
- a SenMLUnit enum value representing the unit name.
Definition at line 139 of file senml_record.h.
int getUpdateTime | ( | ) | [inherited] |
Get the expected timestamp at which this record will be updated again.
NaN represents 'no time assigned'.
- Returns:
- a unix epoch time, relative to the parent SenMLPack object's base time (if any).
Definition at line 114 of file senml_record.h.
bool set | ( | int | value, |
double | time, | ||
bool | asSum | ||
) | [inherited] |
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:
-
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.
- Returns:
- : true if the operation was succesful. See setTime() for more info when the operation can fail. 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:
-
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.
- Returns:
- : true if the operation was succesful. See setTime() for more info when the operation can fail.
bool set | ( | int | value ) | [inherited] |
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. No timestamp is added and the value is interpreted as a regular value, not as a sum
- Parameters:
-
value the value to store in the record
- Returns:
- : true if the operation was succesful. See setTime() for more info when the operation can fail.
Definition at line 60 of file senml_record_t.h.
bool set | ( | int | value, |
double | time | ||
) | [inherited] |
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. The value is interpreted as a regular value, not as a sum
- Parameters:
-
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.
- Returns:
- : true if the operation was succesful. See setTime() for more info when the operation can fail.
Definition at line 76 of file senml_record_t.h.
void setName | ( | const char * | name ) | [inherited] |
Assign an identifier to the record.
This is a free-form string, but a set of predefined names, supported by the KPN network can be found in senml_enums.h
- Parameters:
-
name a string that represents the identifier for the record. A copy of the value is made.
- Returns:
- none
Definition at line 107 of file senml_record.h.
bool setTime | ( | double | value, |
bool | absolute = true |
||
) | [inherited] |
set the time, expressed as a unix epoch time, absolute or relative to the base time of the parent SenMLPack object.
when absolute is true (default behaviour), the time value will be made relative to the base time of the pack object, if it has a base time. See [base fields](https://tools.ietf.org/html/draft-ietf-core-senml-13#section-4.1) for more info on the time value. Possible reasons for failure:
- if there is a root object, but it is not a SenMLPack
- if absolute is false, but there is no parent SenMLPack object.
- Parameters:
-
value the unix epoch time value to assign to the record absolute When true (default), the value will be interpreted as an absolute time stamp. If there is a parent SenMLPack, the value will be made relative to the pack's base time, if there is any. When false, no conversion is done, but a parent SenMLPack has to be present.
- Returns:
- true upon success, otherwise false.
Definition at line 28 of file senml_record.cpp.
void setUnit | ( | SenMLUnit | value ) | [inherited] |
Assigns a unit value to the record.
The value SENML_UNIT_NONE means that no unit will be generated in the output. Senml defines a fixed set of supported [unit names](https://tools.ietf.org/html/draft-ietf-core-senml-13#section-12.1).
- Parameters:
-
value a SenMLUnit enum value representing the unit name.
- Returns:
- none
Definition at line 148 of file senml_record.h.
bool setUpdateTime | ( | double | value, |
bool | absolute = true |
||
) | [inherited] |
Assign a timestamp to the record at which it is expected to update the value.
when absolute is true (default behaviour), the time value will be made relative to the base time of the pack object, if it has a base time. See [base fields](https://tools.ietf.org/html/draft-ietf-core-senml-13#section-4.1) for more info on the time value. Possible reasons for failure:
- if there is a root object, but it is not a SenMLPack
- if absolute is false, but there is no parent SenMLPack object.
- Parameters:
-
value the unix epoch update time value to assign to the record absolute When true (default), the value will be interpreted as an absolute time stamp. If there is a parent SenMLPack, the value will be made relative to the pack's base time, if there is any. When false, no conversion is done, but a parent SenMLPack has to be present.
- Returns:
- true upon success, otherwise false.
Definition at line 50 of file senml_record.cpp.
Generated on Tue Jul 12 2022 23:07:22 by
