OPEnSLab-OSU / Loom-V4

Open Source Internet Of Things Rapid Prototyping Framework For Environmental Sensing Applications
5 stars 1 forks source link

Port manager JSON to proper ArduinoJson usage. Using strings to store arduino #122

Open WL-Richards opened 5 months ago

WL-Richards commented 5 months ago

We currently use a global instance of a DynamicJsonDocument in the Manager to hold our JSON data, which works fine. However, according to the ArduinoJson spec. This is not how we are supposed to do this. We should be storing JSON documents as c-strings and then when we wish to change some value of the document we create a temp. document to read the string in make the change and then write the data back to a "global" string held by the manager.

ZakaryW commented 4 months ago

So I updated how JSON data is being handled. Now whenever the JSON document is need, deserializeJson is called with the doc and jsonStr variable. Likewise, whenever changes have been made to the doc obj, serializeJson is called with the doc and jsonStr variable. So jsonStr is the json data stored as a cstring and is used for mediating changes to the document. Changes are on this branch --> https://github.com/OPEnSLab-OSU/Loom-V4/tree/json-overhaul