KPN Things Device SDK
senml_simplepack.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 * Simple pack without any base fields, use this when you do not need base fields and want a more efficient memory footprint (saves ~50 bytes).
12 *
13 */
14#ifndef THINGSML_SENML_SIMPLE_PACK
15#define THINGSML_SENML_SIMPLE_PACK
16
17#include "senml_basepack.h"
18
20
21 public:
24
26 return 0;
27 };
29 return 0;
30 };
31
33 SenMLBase *first = this->getFirst();
34 // we can only inline the first record. If the first item is a Pack (child device), then don't inline it.
35 if (first && first->isPack() == false) {
36 return first->getFieldLength();
37 }
38 return 0;
39 }
40};
41
42#endif // !THINGSML_SENML_SIMPLE_PACK
Definition: senml_base.h:24
virtual bool isPack()
Definition: senml_base.h:95
virtual int getFieldLength()=0
Definition: senml_basepack.h:24
SenMLBase * getFirst()
Definition: senml_basepack.h:149
Definition: senml_simplepack.h:19
int fieldsToJson()
Definition: senml_simplepack.h:25
SenMLSimplePack()
Definition: senml_simplepack.h:22
int getFieldLength()
Definition: senml_simplepack.h:32
~SenMLSimplePack()
Definition: senml_simplepack.h:23
int fieldsToCbor()
Definition: senml_simplepack.h:28