Skip to content
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 #223

Merged
merged 34 commits into from
Oct 15, 2024
Merged

Overhaul Library API Design #223

merged 34 commits into from
Oct 15, 2024

Conversation

MathewHDYT
Copy link
Contributor

@MathewHDYT MathewHDYT commented Sep 18, 2024

Overhauled the library API usage, to decrease the code size of the ThingsBoard.h file from 1900 to 800 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.

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, closes #228, closes #207

Adjusting Configuration.h so it enables ESP 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 and closes #225. 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.

Add additional checks to login to make sure that existing but empty strings do not cause the underlying clients to assume that MQTT Basic Credentials authentication method is choosen. Closes #224

Adjust OTA hash check to actually check the string representation of the hash instead of comparing byte and string version. Closes #219


@imbeacon Would be nice if this could be merged and released as v0.14.0 on ArduinoIDE, PlattformIO and EspressifIDF Registry.

@MathewHDYT
Copy link
Contributor Author

MathewHDYT commented Oct 14, 2024

@imbeacon Would be nice if this could be merged as it would resolve all currently open issues of the library. As well as some not yet reported bugs in the implementation that have been fixed as well (Especially with Thingsboard dynamic mode).

@imbeacon imbeacon merged commit 1f327a4 into thingsboard:master Oct 15, 2024
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment