Looking to see if I'm recreating the wheel on this one or not...
I'm attempting to use my new EthernetShield as a webserver that is capable of reading and writing to JSON files that are accessed through the HTML pages served up using jQuery's $.get to retrieve the data and display it on the web page.
The first hurdle is to read in JSON data that is at first static on the SD card of the Ethernet shield so the Uno can know variables such as a MAX or MIN temperature to send out email alerts. It sends these email alerts by briefly opening a connection to an external website page that takes POST data to send out the email alerts.
For parsing the JSON data I'm looking to use the aJSON library provided at https://github.com/interactive-matter/aJson
. This library is expecting a char* or string value to parse the JSON data. I'm using the demo at http://arduino.cc/en/Tutorial/ReadWrite
to load or read the data from the SD card.
However, the myFile.read() is only returning one byte of data at a time from the file and not the whole file or chunks. So I need to be able to store this information in a char* to pass to aJSON for parsing. I haven't figured this out how to do this yet and that is my base question. I've tried numerous methods in which to buffer this data but it only seems to freak out the card or else the chars captured are strange ASCII codes that cause the output of the Serial to freak out as I echo it back via Serial.println(data);.
If I'm on the wrong track please let me know. I don't wish to take someone else's code for free and claim it as my own or anything, just looking to better understand the method or thought process I should be taking in getting over this hurdle. My best guess at this point is to refit the streamhelper.c located at https://github.com/interactive-matter/aJson/blob/master/utility/streamhelper.c
to work with the data from the SD card if such a thing can be done.
Thanks in advance if you have any feedback to this wild rambling of confusion.