The KPN SenML library helps you create and parse senml documents in both json and cbor format. The library can be used for sending sensor data and receiving actuator commands.

Revision:
0:a9259748d982
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/senml_bool_actuator.h	Sat May 19 17:35:20 2018 +0000
@@ -0,0 +1,48 @@
+/*  _  __  ____    _   _ 
+ * | |/ / |  _ \  | \ | |
+ * | ' /  | |_) | |  \| |
+ * | . \  |  __/  | |\  |
+ * |_|\_\ |_|     |_| \_|
+ * 
+ * (c) 2018 KPN
+ * License: MIT License.
+ * Author: Jan Bogaerts
+ * 
+ * support for bool actuator header
+ */
+
+#ifndef SENMLBOOLACTUATOR
+#define SENMLBOOLACTUATOR
+
+#include <senml_bool_record.h>
+
+#define BOOL_ACTUATOR_SIGNATURE void (*callback)(bool)
+
+/**
+ * A SenMLRecord that stores boolean data and supports actuation.
+ */ 
+class SenMLBoolActuator: public SenMLBoolRecord
+{
+public:
+    SenMLBoolActuator(const char* name, BOOL_ACTUATOR_SIGNATURE): SenMLBoolRecord(name, SENML_UNIT_NONE, false), callback(callback) {};
+    SenMLBoolActuator(const char* name, SenMLUnit unit, BOOL_ACTUATOR_SIGNATURE): SenMLBoolRecord(name, unit, false), callback(callback) {};
+    SenMLBoolActuator(const char* name, SenMLUnit unit, bool value, BOOL_ACTUATOR_SIGNATURE):  SenMLBoolRecord(name, unit, value), callback(callback) {};
+    ~SenMLBoolActuator(){};
+
+protected:
+
+    //called while parsing a senml message, when the parser found the value for an SenMLJsonListener
+    virtual void actuate(const void* value, int dataLength, SenMLDataType dataType);
+
+private:
+    BOOL_ACTUATOR_SIGNATURE;
+};
+
+#endif // SENMLBOOLACTUATOR
+
+
+
+
+
+
+