Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of kpn_senml by
senml_float_record.h
00001 /* _ __ ____ _ _ 00002 * | |/ / | _ \ | \ | | 00003 * | ' / | |_) | | \| | 00004 * | . \ | __/ | |\ | 00005 * |_|\_\ |_| |_| \_| 00006 * 00007 * (c) 2018 KPN 00008 * License: MIT License. 00009 * Author: Jan Bogaerts 00010 * 00011 * support for float sensors header 00012 */ 00013 00014 #ifndef SENMLFLOATRECORD 00015 #define SENMLFLOATRECORD 00016 00017 #include <senml_record_t.h> 00018 00019 /** 00020 * A SenMLRecord that stores float data. 00021 * This type of object can only be used for sensor data. If actuation is needed, use SenMLFloatActuator 00022 * instead. 00023 */ 00024 class SenMLFloatRecord: public SenMLRecordTemplate<float> 00025 { 00026 public: 00027 SenMLFloatRecord(const char* name); 00028 SenMLFloatRecord(const char* name, SenMLUnit unit); 00029 SenMLFloatRecord(const char* name, SenMLUnit unit, float value): SenMLRecordTemplate(name, unit, value){}; 00030 ~SenMLFloatRecord(){}; 00031 00032 /** 00033 * renders all the fields to json, without the starting and ending brackets. 00034 * Inheriters can extend this function if they want to add extra fields to the json output 00035 * note: this is public so that custom implementations for the record object can use other objects 00036 * internally and render to json using this function (ex: coordinatesRecord using 3 floatRecrods for lat, lon & alt. 00037 * @returns: None 00038 */ 00039 virtual void fieldsToJson(); 00040 00041 /** 00042 * renders all the fields to cbor format. renders all the fields of the object without the length info 00043 * at the beginning 00044 * note: this is public so that custom implementations for the record object can use other objects 00045 * internally and render to json using this function (ex: coordinatesRecord using 3 floatRecrods for 00046 * lat, lon & alt. 00047 * @returns: The number of bytes that were written. 00048 */ 00049 virtual int fieldsToCbor(); 00050 protected: 00051 00052 00053 private: 00054 float getAdjustedValue(); 00055 }; 00056 00057 #endif // SENMLFLOATRECORD 00058 00059 00060 00061 00062 00063 00064
Generated on Tue Jul 12 2022 23:07:21 by
