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.

Fork of kpn_senml by KPN IoT

Committer:
kpniot
Date:
Sun May 27 14:31:44 2018 +0000
Revision:
2:9b44be6e79ac
Parent:
0:a9259748d982
try to fix repo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kpniot 0:a9259748d982 1 /* _ __ ____ _ _
kpniot 0:a9259748d982 2 * | |/ / | _ \ | \ | |
kpniot 0:a9259748d982 3 * | ' / | |_) | | \| |
kpniot 0:a9259748d982 4 * | . \ | __/ | |\ |
kpniot 0:a9259748d982 5 * |_|\_\ |_| |_| \_|
kpniot 0:a9259748d982 6 *
kpniot 0:a9259748d982 7 * (c) 2018 KPN
kpniot 0:a9259748d982 8 * License: MIT License.
kpniot 0:a9259748d982 9 * Author: Jan Bogaerts
kpniot 0:a9259748d982 10 *
kpniot 0:a9259748d982 11 * support for bool actuator header
kpniot 0:a9259748d982 12 */
kpniot 0:a9259748d982 13
kpniot 0:a9259748d982 14 #ifndef SENMLBOOLACTUATOR
kpniot 0:a9259748d982 15 #define SENMLBOOLACTUATOR
kpniot 0:a9259748d982 16
kpniot 0:a9259748d982 17 #include <senml_bool_record.h>
kpniot 0:a9259748d982 18
kpniot 0:a9259748d982 19 #define BOOL_ACTUATOR_SIGNATURE void (*callback)(bool)
kpniot 0:a9259748d982 20
kpniot 0:a9259748d982 21 /**
kpniot 0:a9259748d982 22 * A SenMLRecord that stores boolean data and supports actuation.
kpniot 0:a9259748d982 23 */
kpniot 0:a9259748d982 24 class SenMLBoolActuator: public SenMLBoolRecord
kpniot 0:a9259748d982 25 {
kpniot 0:a9259748d982 26 public:
kpniot 0:a9259748d982 27 SenMLBoolActuator(const char* name, BOOL_ACTUATOR_SIGNATURE): SenMLBoolRecord(name, SENML_UNIT_NONE, false), callback(callback) {};
kpniot 0:a9259748d982 28 SenMLBoolActuator(const char* name, SenMLUnit unit, BOOL_ACTUATOR_SIGNATURE): SenMLBoolRecord(name, unit, false), callback(callback) {};
kpniot 0:a9259748d982 29 SenMLBoolActuator(const char* name, SenMLUnit unit, bool value, BOOL_ACTUATOR_SIGNATURE): SenMLBoolRecord(name, unit, value), callback(callback) {};
kpniot 0:a9259748d982 30 ~SenMLBoolActuator(){};
kpniot 0:a9259748d982 31
kpniot 0:a9259748d982 32 protected:
kpniot 0:a9259748d982 33
kpniot 0:a9259748d982 34 //called while parsing a senml message, when the parser found the value for an SenMLJsonListener
kpniot 0:a9259748d982 35 virtual void actuate(const void* value, int dataLength, SenMLDataType dataType);
kpniot 0:a9259748d982 36
kpniot 0:a9259748d982 37 private:
kpniot 0:a9259748d982 38 BOOL_ACTUATOR_SIGNATURE;
kpniot 0:a9259748d982 39 };
kpniot 0:a9259748d982 40
kpniot 0:a9259748d982 41 #endif // SENMLBOOLACTUATOR
kpniot 0:a9259748d982 42
kpniot 0:a9259748d982 43
kpniot 0:a9259748d982 44
kpniot 0:a9259748d982 45
kpniot 0:a9259748d982 46
kpniot 0:a9259748d982 47
kpniot 0:a9259748d982 48