KPN IoT / senml

Fork of kpn_senml by KPN IoT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers senml_bool_actuator.h Source File

senml_bool_actuator.h

00001 /*  _  __  ____    _   _ 
00002  * | |/ / |  _ \  | \ | |
00003  * | ' /  | |_) | |  \| |
00004  * | . \  |  __/  | |\  |
00005  * |_|\_\ |_|     |_| \_|
00006  * 
00007  * (c) 2018 KPN
00008  * License: MIT License.
00009  * Author: Jan Bogaerts
00010  * 
00011  * support for bool actuator header
00012  */
00013 
00014 #ifndef SENMLBOOLACTUATOR
00015 #define SENMLBOOLACTUATOR
00016 
00017 #include <senml_bool_record.h>
00018 
00019 #define BOOL_ACTUATOR_SIGNATURE void (*callback)(bool)
00020 
00021 /**
00022  * A SenMLRecord that stores boolean data and supports actuation.
00023  */ 
00024 class SenMLBoolActuator: public SenMLBoolRecord
00025 {
00026 public:
00027     SenMLBoolActuator(const char* name, BOOL_ACTUATOR_SIGNATURE): SenMLBoolRecord(name, SENML_UNIT_NONE, false), callback(callback) {};
00028     SenMLBoolActuator(const char* name, SenMLUnit unit, BOOL_ACTUATOR_SIGNATURE): SenMLBoolRecord(name, unit, false), callback(callback) {};
00029     SenMLBoolActuator(const char* name, SenMLUnit unit, bool value, BOOL_ACTUATOR_SIGNATURE):  SenMLBoolRecord(name, unit, value), callback(callback) {};
00030     ~SenMLBoolActuator(){};
00031 
00032 protected:
00033 
00034     //called while parsing a senml message, when the parser found the value for an SenMLJsonListener
00035     virtual void actuate(const void* value, int dataLength, SenMLDataType dataType);
00036 
00037 private:
00038     BOOL_ACTUATOR_SIGNATURE;
00039 };
00040 
00041 #endif // SENMLBOOLACTUATOR
00042 
00043 
00044 
00045 
00046 
00047 
00048