File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 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
224224
225225 if (cbor_value_at_end (value_iter)) {
226226 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}]
227230 } else if (cbor_value_is_text_string (value_iter)) {
228231 char * val = 0 ;
229232 size_t val_size = 0 ;
@@ -239,6 +242,8 @@ ArduinoCloudThing::MapParserState ArduinoCloudThing::handle_MapKey(CborValue * v
239242 else next_state = MapParserState::UndefinedKey;
240243 free (val);
241244 }
245+ // If the key is a number means that the Map use the CBOR Label (protocol V2)
246+ // example [{0: "temperature", 2: 25}]
242247 } else if (cbor_value_is_integer (value_iter)) {
243248 int val = 0 ;
244249 if (cbor_value_get_int (value_iter, &val) == CborNoError) {
You can’t perform that action at this time.
0 commit comments