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

Interface class #11

Merged
merged 25 commits into from
Oct 13, 2024
Merged

Interface class #11

merged 25 commits into from
Oct 13, 2024

Conversation

vortigont
Copy link
Owner

No description provided.

добавлен метод позволяющий проводить слияение объектов ранее загруженных из джейсона
с другими загружаемымы объектами.
На основе этой фунции можно реализовать простенькую схему многоязычности.
Языковые данные подгружаются из отдельного ресурс-файла после загрузки основных UI данных и перекрывают метки/надписи в UI блоках.
from now on, resources/data.zip is obsolete,
all resource files in /data/ dir should be uploaded to contraller's FS
Method JsonArray Interface::get_block() allows to get last section's block array

plus small code refactoring
send accumulated data and clears memory while preserving sections stack
this call does NOT closes the frame and implies that a continuation data will follow
should be used when sending really large sections by periodicaly dumping the
data to network stack and reusing memory
It creates a new JsonObject at the end of current block and returns a referencing object.
Since ArduinoJson 7 it is not required to fit into a limit of fixed size JsonDocument,
so creating an elements in-place appending to Interface's document could help to avoid useless data copy.

Another benefit - it's more simple to create any arbitrary objects without modifying lib's code and
adding specific methods to Interface class.
Most of the Interface methods related to UI objects creation now returns
JsonObject that points to a newly created UI object.
This will allow to further add/change it's properties before submiting frame.

new method Interface::make_new_object() allows to create an empty object to
add any user-defined properties and structure to it.
do not use UIelement for button methods,
Interface::button* methods now returns JsonObject referencing button object
added
Interface::json_block_get() to access block array
Interface::json_object_get() to access last added object

Interface::json_object_create() replaces Interface::make_new_object()
Interface::json_frame_add replaced with Interface::json_object_add

Interface::json_frame_* methods new return reference to JsonObjectwith a frame (in fact private json member)
remove backup file save/load, use bare minimum

This config functionality need full refactoring
…onst value

it does not makes much sense to pass object by pointer 'cause JsonObject is itself a pointer,
passing by value simplifies syntax and checks
those wrappers over JsonDocument cfg were quite ugly and would be better
to either reimplement it or remove conmletely and work directly on cfg object.
not supported for a long time already
@vortigont vortigont merged commit 3ae9c73 into main Oct 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant