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_actuator.cpp
00001 /* _ __ ____ _ _ 00002 * | |/ / | _ \ | \ | | 00003 * | ' / | |_) | | \| | 00004 * | . \ | __/ | |\ | 00005 * |_|\_\ |_| |_| \_| 00006 * 00007 * (c) 2018 KPN 00008 * License: MIT License. 00009 * Author: Jan Bogaerts 00010 * 00011 * support for float actuators 00012 */ 00013 00014 #include <senml_float_actuator.h> 00015 #include <senml_logging.h> 00016 00017 void SenMLFloatActuator::actuate(const void* value, int dataLength, SenMLDataType dataType) 00018 { 00019 if(dataType == SENML_TYPE_NR || dataType == CBOR_TYPE_DOUBLE){ 00020 this->set((float)*((double*)value)); 00021 if(this->callback) 00022 this->callback((float)*((double*)value)); 00023 } 00024 else if(dataType == CBOR_TYPE_FLOAT){ 00025 this->set(*((float*)value)); 00026 if(this->callback) 00027 this->callback(*((float*)value)); 00028 } 00029 else 00030 log_debug("invalid type"); 00031 } 00032 00033 00034 00035 00036 00037 00038
Generated on Tue Jul 12 2022 23:07:21 by
1.7.2
