I’m sending data from the device to the agent at regular interval, unfortunately, its possible that the device dont have internet connection for some time.
Is there a way to store the json that i’m normaly sending to the agent into memory, and then when the connection get back, i’ll send all data that was not sent?
Sure, you’d just push it into an array, then empty the array when you connect.
You can see an example of this in the connectionmanager class, which allows you to log when offline. The logs are push’ed into an array along with a timestamp, and this array is then replayed at connect time (see _onConnectedFlow).
Code here: https://github.com/electricimp/ConnectionManager/blob/v1.0.2/ConnectionManager.class.nut
that is fantastic
You might also take a look at https://github.com/electricimp/ImpPager
You could also add a Flash memory if you have a ton of data.
See this:
http://www.mikroe.com/add-on-boards/storage/serialflash/
It’s SPI, 3.3V, with 8Mbit. They say “Mbit”, so I’m thinking it’s actually 1MB (byte).
Still, that’s a lot of storage for data.