thingsboard / thingsboard-client-sdk

Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
MIT License
153 stars 121 forks source link

JSON_OBJECT_SIZE(Helper::getOccurences(reinterpret_cast<char *>(payload), COLON)) is inaccurate to calculate jsonBuffer size #225

Closed majidahmadov closed 3 hours ago

majidahmadov commented 3 hours ago

Problem: I was testing OTA for ESP32 device. I realized when I delete assigned firmware of my device, I am receving [TB] Unable to de-serialize received json data with error (DeserializationError::NoMemory). THINGSBOARD_ENABLE_DYNAMIC is enabled. After printing output I realized calculated Json object size is not correct. This is the payload sent when assigned firmware cleared for device. { "deleted": [ "fw_checksum_algorithm", "fw_version", "fw_ts", "fw_tag", "fw_checksum", "fw_title", "fw_state", "fw_size", "fw_url" ] }

And JSON_OBJECT_SIZE(Helper::getOccurences(reinterpret_cast<char *>(payload), COLON)) is returning 16 to deserialize this payload

MathewHDYT commented 3 hours ago

Has been mentioned in this Pull Request and fixed in this Pull Request.

majidahmadov commented 3 hours ago

Oh, thank you