File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,9 @@ ArduinoCloudThing::MapParserState ArduinoCloudThing::handle_MapKey(CborValue * v
224
224
225
225
if (cbor_value_at_end (value_iter)) {
226
226
next_state = MapParserState::LeaveMap;
227
+ // If the key is a string means that the Map use the string keys (protocol V1)
228
+ // https://tools.ietf.org/html/rfc8428#section-4.3
229
+ // example [{"n": "temperature", "v": 25}]
227
230
} else if (cbor_value_is_text_string (value_iter)) {
228
231
char * val = 0 ;
229
232
size_t val_size = 0 ;
@@ -239,6 +242,8 @@ ArduinoCloudThing::MapParserState ArduinoCloudThing::handle_MapKey(CborValue * v
239
242
else next_state = MapParserState::UndefinedKey;
240
243
free (val);
241
244
}
245
+ // If the key is a number means that the Map use the CBOR Label (protocol V2)
246
+ // example [{0: "temperature", 2: 25}]
242
247
} else if (cbor_value_is_integer (value_iter)) {
243
248
int val = 0 ;
244
249
if (cbor_value_get_int (value_iter, &val) == CborNoError) {
You can’t perform that action at this time.
0 commit comments