LPC1115 to send-receive JSON-formatted data through GPRS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1115 to send-receive JSON-formatted data through GPRS

745 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Sat Jan 25 04:49:33 MST 2014
Hi,

The process scenario is as follows:
1) The LPC1115 send AT commands to the GSM/GPRS modem (Huawei MG323-b) for internet connection.
2) Once connected the LPC1115 will construct a JSON formatted serial data from the following like data-->
AT^CMOND
460,01,2540,7ade,3b,722,19,23,33,460,01,2540,7a9a,03,730,18,20,30,460,01,2540,
7a09,32,118,16,19,19,000,000,0000,0000,00,0,0,-,-,000,000,0000,0000,00,0,0,-,-
,000,000,0000,0000,00,0,0,-,-,000,000,0000,0000,00,0,0,-,-


3) After the JSON data will be send to the following URL: https://www.googleapis.com/geolocation/v1/geolocate?key=API_KEY
4) Google will respond with JSON formatted data like -->
{
  "location": {
    "lat": 51.0,
    "lng": -0.1
  },
  "accuracy": 1200.4
}


5) LPC1115 will then parse the Google response and create a struct for further processing.

The question is about the JSON constructor and parser. There are a couple of such open source libraries for C listed in http://json.org like json-c or ajson or jsmn with code size about 1000 lines.
By knowing the limitation of LPC1115 (flash-ram size,redlib library etc)  do you think I can implement such a scenario?

Best regards,
Theodore

Labels (1)
0 Kudos
Reply
1 Reply

642 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by celephicus on Thu Jan 30 22:43:07 MST 2014
I am using JSON-RPC to talk to an app running on an Android. I used jsmn (Search on Google) as a starting point, and ended up a parser using about 800 bytes of Flash and 256 bytes of RAM, and a JSON data formatter using 400 bytes of Flash.

Mind you it does use a stripped down printf() and strncmp(), and the both the parser and the dumper call themselves recursively, which puts some people right off.

So you can. The JSON-RPC server is the most reliable part of the project. JSON is great as we can fake either end of the link using Python on a PC to generate/parse JSON.
0 Kudos
Reply