This repository was archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathArduinoCloudPropertyContainer.cpp
35 lines (28 loc) · 1.79 KB
/
ArduinoCloudPropertyContainer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/******************************************************************************
* INCLUDE
******************************************************************************/
#include "ArduinoCloudPropertyContainer.hpp"
/******************************************************************************
* PUBLIC MEMBER FUNCTIONS
******************************************************************************/
bool ArduinoCloudPropertyContainer::isPropertyInContainer(Type const type, String const & name) {
if (type == Type::Bool ) return isPropertyInList(_bool_property_list, name);
else if (type == Type::Int ) return isPropertyInList(_int_property_list, name);
else if (type == Type::Float ) return isPropertyInList(_float_property_list, name);
else if (type == Type::String) return isPropertyInList(_string_property_list, name);
else return false;
}
int ArduinoCloudPropertyContainer::getNumOfChangedProperties() {
int num_changes_properties = 0;
num_changes_properties += getNumOfChangedProperties(_bool_property_list );
num_changes_properties += getNumOfChangedProperties(_int_property_list );
num_changes_properties += getNumOfChangedProperties(_float_property_list );
num_changes_properties += getNumOfChangedProperties(_string_property_list);
return num_changes_properties;
}
void ArduinoCloudPropertyContainer::appendChangedProperties(CborEncoder * arrayEncoder, CloudProtocol const cloud_protocol) {
appendChangedProperties<bool> (_bool_property_list, arrayEncoder, cloud_protocol);
appendChangedProperties<int> (_int_property_list, arrayEncoder, cloud_protocol);
appendChangedProperties<float> (_float_property_list, arrayEncoder, cloud_protocol);
appendChangedProperties<String>(_string_property_list, arrayEncoder, cloud_protocol);
}