-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul Library API Design #220
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, when using dynamic mode and deserializing an incoming JSON message from MQTT, the library would allocate space based on the number of colons - i.e. the number of object key-value pairs. However, if there are arrays in the JSON message (such as when a shared attribute gets deleted), that wouldn't allocate enough space.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overhauled the library API usage, to decrease the code size of the
ThingsBoard.h
file from 1900 to 700 lines of code.Achieved by seperating the individual ThingsBoard APIs (Shared Attribute Update, Attribute Request, ...) into seperate classes that can be subscribed to the main
ThingsBoard.h
file. Allows to seperate connection to MQTT Broker (Thingsboard.h
) from specific API handling (IAPI_Implementation.h
). Furthermore this now also allows to define and subscribe custom APIs, making the library even more flexible. Closes #211, closes #187, closes #219, closes #221.Additionally the internal usages of timers have been reworked for non
ESP32
devices to now work correctly. Closes #182 and closes #206.Ajudsted examples to changes, closes #210.
Adjusting
Configuration.h
so it enablesESP
components for the exact version the required methods were implemented at. Closes #215.Fixing problems with
THINGSBOARD_ENABLE_DYNAMIC
, where not enough space was allocated, closes #216. Additionally added optional argument to hardcap the allocation done by this automatic calculation to prevent huge memory allocations from malicious payloads.Fixed OTA API so it actually utilizes the request id parameter required by the API. Added additional callback method to the OTA update process so we can stop all other processes and unsubscribe from everything before subscribing to chunk requests or receiving the first chunk.
Fix problems were default initalization left variables unitialized, ensure direct initalization occurs with
= {};
. Additionaly adjusted OTA failure messages to reset fw error text on success and send correct states. Closes #221.Adjusted response handling to fiX transformation of JsonDocument as JsonObject. Closes #222
Furthermore this pull request includes the relevant changes from other Pull requests. Closes #217 and closes #209.
@imbeacon Would be nice if this could be merged and released as
v0.14.0
on ArduinoIDE, PlattformIO and EspressifIDF Registry.