KPN IoT / senml

Fork of kpn_senml by KPN IoT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers senml_bool_actuator.cpp Source File

senml_bool_actuator.cpp

00001 /*  _  __  ____    _   _ 
00002  * | |/ / |  _ \  | \ | |
00003  * | ' /  | |_) | |  \| |
00004  * | . \  |  __/  | |\  |
00005  * |_|\_\ |_|     |_| \_|
00006  * 
00007  * (c) 2018 KPN
00008  * License: MIT License.
00009  * Author: Jan Bogaerts
00010  * 
00011  * support for bool actuators
00012  */
00013 
00014 #include <senml_bool_actuator.h>
00015 #include <senml_logging.h>
00016 
00017 void SenMLBoolActuator::actuate(const void* value, int dataLength, SenMLDataType dataType)
00018 {
00019     if(dataType == SENML_TYPE_BOOL || dataType == CBOR_TYPE_BOOL){
00020         this->set(*((bool*)value));
00021         if(this->callback){
00022             this->callback(*((bool*)value));
00023         }
00024     }
00025     else{
00026         log_debug("invalid type");
00027     }
00028 }
00029 
00030 
00031 
00032 
00033 
00034 
00035