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
diff -r 000000000000 -r a9259748d982 senml_float_actuator.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/senml_float_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 float actuators headers
+ */
+
+#ifndef SENMLFLOATACTUATOR
+#define SENMLFLOATACTUATOR
+
+#include <senml_float_record.h>
+
+#define FLOAT_ACTUATOR_SIGNATURE void (*callback)(float)
+
+/**
+ * A SenMLRecord that stores float data and supports actuation.
+ */ 
+class SenMLFloatActuator: public SenMLFloatRecord
+{
+public:
+    SenMLFloatActuator(const char* name, FLOAT_ACTUATOR_SIGNATURE): SenMLFloatRecord(name, SENML_UNIT_NONE, 0.0), callback(callback) {};
+    SenMLFloatActuator(const char* name, SenMLUnit unit, FLOAT_ACTUATOR_SIGNATURE): SenMLFloatRecord(name, unit, 0.0), callback(callback) {};
+    SenMLFloatActuator(const char* name, SenMLUnit unit, float value, FLOAT_ACTUATOR_SIGNATURE):  SenMLFloatRecord(name, unit, value), callback(callback) {};
+    ~SenMLFloatActuator(){};
+
+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:
+    FLOAT_ACTUATOR_SIGNATURE;
+};
+
+#endif // SENMLFLOATACTUATOR
+
+
+
+
+
+
+