diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index e9c408903..6f0f8c21f 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -157,6 +157,6 @@ #define AIOT_CONFIG_RP2040_OTA_HTTP_HEADER_RECEIVE_TIMEOUT_ms (10*1000UL) #define AIOT_CONFIG_RP2040_OTA_HTTP_DATA_RECEIVE_TIMEOUT_ms (4*60*1000UL) -#define AIOT_CONFIG_LIB_VERSION "1.15.1" +#define AIOT_CONFIG_LIB_VERSION "2.0.0" #endif /* ARDUINO_AIOTC_CONFIG_H_ */ diff --git a/src/ArduinoIoTCloudTCP.cpp b/src/ArduinoIoTCloudTCP.cpp index 1ffb5b0e7..439cbd80f 100644 --- a/src/ArduinoIoTCloudTCP.cpp +++ b/src/ArduinoIoTCloudTCP.cpp @@ -421,6 +421,13 @@ void ArduinoIoTCloudTCP::handleMessage(int length) } break; + case CommandId::TimezoneCommandDownId: + { + DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] timezone update received", __FUNCTION__, millis()); + _thing.handleMessage((Message*)&command); + } + break; + case CommandId::LastValuesUpdateCmdId: { DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] last values received", __FUNCTION__, millis()); diff --git a/src/ArduinoIoTCloudThing.cpp b/src/ArduinoIoTCloudThing.cpp index 6ea6dd904..3c5602f48 100644 --- a/src/ArduinoIoTCloudThing.cpp +++ b/src/ArduinoIoTCloudThing.cpp @@ -76,6 +76,14 @@ void ArduinoCloudThing::update() { nextState = State::Connected; } break; + + /* We have received a timezone update */ + case TimezoneCommandDownId: + { + TimezoneCommandDown * cmd = (TimezoneCommandDown *)_command; + TimeService.setTimeZoneData(cmd->params.offset, cmd->params.until); + } + break; /* We have received a reset command */ case ResetCmdId: diff --git a/src/cbor/MessageDecoder.cpp b/src/cbor/MessageDecoder.cpp index 7c3e9a215..299bf7940 100644 --- a/src/cbor/MessageDecoder.cpp +++ b/src/cbor/MessageDecoder.cpp @@ -127,6 +127,13 @@ CBORMessageDecoder::ArrayParserState CBORMessageDecoder::decodeThingUpdateCmd(Cb return ArrayParserState::Error; } + size_t thingIdLen = strlen(thingCommand->params.thing_id); + + // thing_id length normally is 36, or 0 in case of device not attached to any thing + if (!((thingIdLen == sizeof(thingCommand->params.thing_id) -1) || (thingIdLen == 0))) { + return ArrayParserState::Error; + } + return ArrayParserState::LeaveArray; }