I am looking to set up a central node in a network of sensors. The sensors report by radio, some are mobile and move around, some are stationary. Most are already working.
I would like the central node to listen and store the last value it received from all the other sensors. Then when I get close enough to it with my mobile unit I call the central node and it will tell me what I want to know about a given sensor.
I am working with the radiohead library and this is what I have to work with for each message.
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
uint8_t from;
uint8_t to;
uint8_t id;
uint8_t flags;
if (manager.recvfromAck(buf, &len, &from, &to, &id, &flags))
I would like to store:
the first two bytes of the message(though most are a single byte)
The from byte,
and the flags byte
That is 4 bytes. What is the best way to go about this?
In memory is likely easiest, just stumped how to set it up. Guessing some kind of an array, but having a hard time visualizing how that would work.
An array to store the last 10 messages from any station I can see, but in my case not all stations report at the same frequency and the one I may be interested in could be message 50. which would not work with limited memory.
epromm is likely better, again not seeing how to do the actual store and retrieval of the 4 different bytes, sorted by a particular one.
While I mention epromm I would also be happy going an sd card route and logging everything.(I have done that and sort of know my way around it), but again how to go about retrieving the data for a give node.
Total number of nodes is around 12, but subject to change. Ideally I would like to make it flexible about new nodes being added or removed, vs hard coded for each node.
To sum up any thoughts on how to go about storing and retrieving the last data point for a given node?
Thanks,
Brandan