I’m currently working on a project which collects data from serial port and sends it to a server on the internet. That’s all working fine, but sometimes the internet connection is unavailable for some time (can be one minute, until several days.)
In case the connection is down, I need to store the serial data and send it as soon as the connection is restored. I take an GPS position every minute, so the amount of data collected can be quite a lot.
I tested this by using sqllite on EMX, but quickly ran into issues with the database file, mainly when the power to the module is interupted. After reboot, I often get messages like invalid file format.
I create json objects from the serial data I receive and could easliy store them in textfiles, but I can’t figure out a simple way to remove them from the file after I transfered them to the webserver.
I’m also struggeling with the diffrent tasks that my program has to perform. Right now, I have one thread collecting the data and another thread sending it to the server. I wonder what the best way is to approach all this, when implementing the third task of storing the data when connection is unavailable.
As always, thanks in advance for any suggestions.