Skip to content

Commit 9d7cd84

Browse files
committed
Restore "v" as key for value
1 parent d94fb00 commit 9d7cd84

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ArduinoCloudThing.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ void ArduinoCloudThing::decode(uint8_t * payload, size_t length) {
222222
ArduinoCloudPropertyGeneric* property = list.get(propId);
223223
// Check for the property type, write method internally check for the permission
224224

225+
cbor_value_map_find_value(&recursedMap, "v", &propValue);
226+
225227
if (propValue.type == CborDoubleType) {
226228
double val;
227229
// get the value of the property as a double

ArduinoCloudThing.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,31 +197,37 @@ inline bool ArduinoCloudProperty<float>::newData() {
197197

198198
template <>
199199
inline void ArduinoCloudProperty<int>::appendValue(CborEncoder* mapEncoder) {
200+
cbor_encode_text_stringz(mapEncoder, "v");
200201
cbor_encode_int(mapEncoder, property);
201202
};
202203

203204
template <>
204205
inline void ArduinoCloudProperty<bool>::appendValue(CborEncoder* mapEncoder) {
206+
cbor_encode_text_stringz(mapEncoder, "v");
205207
cbor_encode_boolean(mapEncoder, property);
206208
};
207209

208210
template <>
209211
inline void ArduinoCloudProperty<float>::appendValue(CborEncoder* mapEncoder) {
212+
cbor_encode_text_stringz(mapEncoder, "v");
210213
cbor_encode_float(mapEncoder, property);
211214
};
212215

213216
template <>
214217
inline void ArduinoCloudProperty<String>::appendValue(CborEncoder* mapEncoder) {
218+
cbor_encode_text_stringz(mapEncoder, "v");
215219
cbor_encode_text_stringz(mapEncoder, property.c_str());
216220
};
217221

218222
template <>
219223
inline void ArduinoCloudProperty<String*>::appendValue(CborEncoder* mapEncoder) {
224+
cbor_encode_text_stringz(mapEncoder, "v");
220225
cbor_encode_text_stringz(mapEncoder, property->c_str());
221226
};
222227

223228
template <>
224229
inline void ArduinoCloudProperty<char*>::appendValue(CborEncoder* mapEncoder) {
230+
cbor_encode_text_stringz(mapEncoder, "v");
225231
cbor_encode_text_stringz(mapEncoder, property);
226232
};
227233

0 commit comments

Comments
 (0)