I have a Beaglebone Black which gathers various bits of data on our
boat in France. At present these comprise some temperatures and
battery voltages and currents but there might be other things added.
I want to store these in a sqlite database on my desktop machine here
at home. The mechanics of doing this are easy enough, I store the
data in a file named for the date and time on the Beaglebone Black and
at intervals my desktop machine mounts the directory where these files
are saved (using sshfs), reads the data, inserts it into the database
and then deletes the file. This means that if the connection fails
for a while then nothing is lost, it's probably not by any means
perfect but it's good enough, my life doesn't depend on the data! :-)
At the moment the receiving end just assumes there are ten values
sent and that they are in a specific order. E.g. there's a file
there at the moment whose name is "2014-09-29_15:05.od" and whose
contents are:-
'2014-09-29 15:05', 22.125, 22.75, 13.6285714286, 13.8876923077, 34.36875, 0.253125, 14.85, 8.803125, 8
I'm not really happy with this because it means that any changes I do
have to be 'synchronised' at the two ends to keep their knowledge of
which value is which in step.
Is there a standard way of labelling values in this sort of situation?
Should I send a file something like:-
DateTime, '2014-09-29 15:05'
InsideTemperature, 22.125
OutsideTemperature, 22.75
LeisureVolts, 13.6285714286
StarterVolts, 13.8876923077
LeisureAmps1, 34.36875
etc.
Then the first column of this data is the database field name and the
second column is the data. If a field name doesn't exist then the
receiving program/script will create a new column. This rather
depends on there always being a DateTime field so maybe the receiving
script could reject files with no DateTime value.
Does this seem a reasonable way to do it or are there better ways, or
should I just stay with the existing set-up where the order is
significant?
--
Chris Green