KPN Things Device SDK
senml_int_pack.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 * pack (document) with int base values header
12 */
13
14#ifndef THINGSML_SENML_INT_PACK
15#define THINGSML_SENML_INT_PACK
16
17#include "senml_pack_t.h"
18
22class SenMLIntPack : public SenMLPackTemplate<int> {
23 public:
24 SenMLIntPack(const char *baseName) : SenMLPackTemplate(baseName, SENML_UNIT_NONE, NAN){};
25 SenMLIntPack(const char *baseName, SenMLUnit baseUnit) : SenMLPackTemplate(baseName, baseUnit, NAN){};
26 SenMLIntPack(const char *baseName, SenMLUnit baseUnit, double baseTime)
27 : SenMLPackTemplate(baseName, baseUnit, baseTime){};
28
29 SenMLIntPack(PACK_ACTUATOR_SIGNATURE) : SenMLPackTemplate(NULL, SENML_UNIT_NONE, NAN, callback){};
30 SenMLIntPack(const char *baseName, PACK_ACTUATOR_SIGNATURE)
31 : SenMLPackTemplate(baseName, SENML_UNIT_NONE, NAN, callback){};
32 SenMLIntPack(const char *baseName, SenMLUnit baseUnit, PACK_ACTUATOR_SIGNATURE)
33 : SenMLPackTemplate(baseName, baseUnit, NAN, callback){};
34 SenMLIntPack(const char *baseName, SenMLUnit baseUnit, double baseTime, PACK_ACTUATOR_SIGNATURE)
35 : SenMLPackTemplate(baseName, baseUnit, baseTime, callback){};
36
38
46 virtual int fieldsToJson();
47
56 virtual int fieldsToCbor();
57
58 protected:
59 virtual void setupStreamCtx(Stream *dest, SenMLStreamMethod format);
60 virtual void setupStreamCtx(char *dest, int length, SenMLStreamMethod format);
61
62 private:
63 int getAdjustedValue();
64};
65
66#endif // THINGSML_SENML_INT_PACK
Definition: senml_int_pack.h:22
SenMLIntPack(const char *baseName, SenMLUnit baseUnit, double baseTime, PACK_ACTUATOR_SIGNATURE)
Definition: senml_int_pack.h:34
SenMLIntPack(const char *baseName, SenMLUnit baseUnit, PACK_ACTUATOR_SIGNATURE)
Definition: senml_int_pack.h:32
~SenMLIntPack()
Definition: senml_int_pack.h:37
virtual int fieldsToJson()
Definition: senml_int_pack.cpp:32
SenMLIntPack(const char *baseName, SenMLUnit baseUnit)
Definition: senml_int_pack.h:25
SenMLIntPack(const char *baseName)
Definition: senml_int_pack.h:24
SenMLIntPack(PACK_ACTUATOR_SIGNATURE)
Definition: senml_int_pack.h:29
SenMLIntPack(const char *baseName, PACK_ACTUATOR_SIGNATURE)
Definition: senml_int_pack.h:30
SenMLIntPack(const char *baseName, SenMLUnit baseUnit, double baseTime)
Definition: senml_int_pack.h:26
virtual void setupStreamCtx(Stream *dest, SenMLStreamMethod format)
Definition: senml_int_pack.cpp:18
virtual int fieldsToCbor()
Definition: senml_int_pack.cpp:52
Definition: senml_pack_t.h:27
Definition: defaults.h:50
SenMLUnit
Definition: senml_enums.h:97
@ SENML_UNIT_NONE
Definition: senml_enums.h:98
SenMLStreamMethod
Definition: senml_enums.h:49