A basic library for the Adafruit Ultimate GPS module. (MTK3339) http://www.adafruit.com/products/746
Fork of GPS by
Diff: GPS.cpp
- Revision:
- 6:bcbfe060c93e
- Parent:
- 5:96d5736d9613
--- a/GPS.cpp Sun Jan 19 08:47:38 2014 +0000 +++ b/GPS.cpp Tue Mar 15 16:58:07 2016 +0000 @@ -86,6 +86,25 @@ } } +int GPS::structJSON(char * content) { + + + char contentTemplate[] = "{ \ + \"datetime\": \"%04d-%02d-%02dT%02d:%02d:%02.3fZ\",\ + \"coordinates\": {\ + \"lat\": %f,\ + \"lng\": %f},\ + \"utc_time\": \"%04d-%02d-%02dT%02d:%02d:%02.3fZ\",\ + \"satellites_used\": %d,\ + \"gps_quality_indicator\": %d,\ + \"altitude\": %d}\0"; + + if (0 == parseData()) { + return 0; + } + sprintf(content, contentTemplate, year, month, day, hours, minutes, seconds, latitude, longitude, year, month, day, hours, minutes, seconds, satellites, fixtype, (int)altitude); + return 1; +} float GPS::trunc(float v) {