KPN Things Device SDK
senml_bool_actuator.h
Go to the documentation of this file.
1/* _ __ ____ _ _
2 * | |/ / | _ \ | \ | |
3 * | ' / | |_) | | \| |
4 * | . \ | __/ | |\ |
5 * |_|\_\ |_| |_| \_|
6 *
7 * (c) 2020 KPN
8 * License: MIT License.
9 * Author: Joseph Verburg, Jan Bogaerts
10 *
11 * support for bool actuator header
12 */
13
14#ifndef SENMLBOOLACTUATOR
15#define SENMLBOOLACTUATOR
16
17#include "../record/senml_bool_record.h"
18
19#define BOOL_ACTUATOR_SIGNATURE void (*callback)(bool)
20
25 public:
26 SenMLBoolActuator(const char *name, BOOL_ACTUATOR_SIGNATURE)
27 : SenMLBoolRecord(name, SENML_UNIT_NONE, false), callback(callback){};
28 SenMLBoolActuator(const char *name, SenMLUnit unit, BOOL_ACTUATOR_SIGNATURE)
29 : SenMLBoolRecord(name, unit, false), callback(callback){};
30 SenMLBoolActuator(const char *name, SenMLUnit unit, bool value, BOOL_ACTUATOR_SIGNATURE)
31 : SenMLBoolRecord(name, unit, value), callback(callback){};
32 SenMLBoolActuator(ThingsMLMeasurementIndex index, BOOL_ACTUATOR_SIGNATURE)
33 : SenMLBoolRecord(index), callback(callback){};
34 SenMLBoolActuator(ThingsMLMeasurementIndex index, bool value, BOOL_ACTUATOR_SIGNATURE)
35 : SenMLBoolRecord(index, value), callback(callback){};
36
37 SenMLBoolActuator(const char *name) : SenMLBoolRecord(name){};
38 SenMLBoolActuator(const char *name, SenMLUnit unit) : SenMLBoolRecord(name, unit){};
39 SenMLBoolActuator(const char *name, SenMLUnit unit, bool value) : SenMLBoolRecord(name, unit, value){};
41 SenMLBoolActuator(ThingsMLMeasurementIndex index, bool value) : SenMLBoolRecord(index, value){};
43
44 protected:
45 // called while parsing a senml message, when the parser found the value for an SenMLJsonListener
46 virtual void actuate(const void *value, int dataLength, SenMLDataType dataType);
47
48 private:
49 BOOL_ACTUATOR_SIGNATURE = NULL;
50};
51
52#endif // SENMLBOOLACTUATOR
Definition: senml_bool_actuator.h:24
SenMLBoolActuator(ThingsMLMeasurementIndex index, bool value, BOOL_ACTUATOR_SIGNATURE)
Definition: senml_bool_actuator.h:34
SenMLBoolActuator(const char *name, SenMLUnit unit, bool value)
Definition: senml_bool_actuator.h:39
~SenMLBoolActuator()
Definition: senml_bool_actuator.h:42
SenMLBoolActuator(ThingsMLMeasurementIndex index, BOOL_ACTUATOR_SIGNATURE)
Definition: senml_bool_actuator.h:32
SenMLBoolActuator(const char *name, SenMLUnit unit, bool value, BOOL_ACTUATOR_SIGNATURE)
Definition: senml_bool_actuator.h:30
virtual void actuate(const void *value, int dataLength, SenMLDataType dataType)
Definition: senml_bool_actuator.cpp:18
SenMLBoolActuator(ThingsMLMeasurementIndex index)
Definition: senml_bool_actuator.h:40
SenMLBoolActuator(ThingsMLMeasurementIndex index, bool value)
Definition: senml_bool_actuator.h:41
SenMLBoolActuator(const char *name)
Definition: senml_bool_actuator.h:37
SenMLBoolActuator(const char *name, SenMLUnit unit)
Definition: senml_bool_actuator.h:38
SenMLBoolActuator(const char *name, SenMLUnit unit, BOOL_ACTUATOR_SIGNATURE)
Definition: senml_bool_actuator.h:28
SenMLBoolActuator(const char *name, BOOL_ACTUATOR_SIGNATURE)
Definition: senml_bool_actuator.h:26
Definition: senml_bool_record.h:24
SenMLUnit
Definition: senml_enums.h:97
@ SENML_UNIT_NONE
Definition: senml_enums.h:98
ThingsMLMeasurementIndex
Definition: senml_enums.h:51
SenMLDataType
Definition: senml_enums.h:25