This class adds HTTP, FTP and CellLocate client support for u-blox modules for the C027 and C030 boards (excepting the C030 N2xx flavour) from mbed 5.5 onwards. The HTTP, FTP and CellLocate operations are all hosted on the module, minimizing RAM consumption in the mbed MCU. It also sub-classes ublox-cellular-driver-gen to bring in SMS, USSD and modem file system support if you need to use these functions at the same time as the cellular interface.
Dependencies: ublox-at-cellular-interface
Dependents: example-ublox-at-cellular-interface-ext HelloMQTT ublox_new_driver_test example-ublox-at-cellular-interface-ext ... more
Revision 1:26a67ab07275, committed 2017-06-07
- Comitter:
- rob.meades@u-blox.com
- Date:
- Wed Jun 07 23:52:33 2017 +0100
- Parent:
- 0:0b75e22c9231
- Child:
- 2:3c825852fdbe
- Commit message:
- Add UbloxCellularDriverGen library, since it is being subclassed.
Improved printing of Cell Locate data.
Fixed bug with printing Cell Locate year.
Added parsing for an additional +UULOC form.
Changed in this revision
--- a/TESTS/unit_tests/cell-locate/main.cpp Mon Jun 05 12:58:04 2017 +0000 +++ b/TESTS/unit_tests/cell-locate/main.cpp Wed Jun 07 23:52:33 2017 +0100 @@ -84,6 +84,13 @@ // Lock for debug prints static Mutex mtx; +// Power up GNSS +#ifdef TARGET_UBLOX_C030 +static DigitalInOut gnssEnable(GNSSEN, PIN_OUTPUT, PushPullNoPull, 1); +#elif TARGET_UBLOX_C027 +static DigitalOut gnssEnable(GNSSEN, 1); +#endif + // An instance of the cellular interface static UbloxATCellularInterfaceExt *pDriver = new UbloxATCellularInterfaceExt(MDMTXD, MDMRXD, @@ -110,15 +117,12 @@ char timeString[25]; tr_debug("Cell Locate data:"); - if (strftime(timeString, sizeof(timeString), "%a %b %d %H:%M:%S %Y", (const tm *) &(pData->time)) > 0) { + if (strftime(timeString, sizeof(timeString), "%F %T", (const tm *) &(pData->time)) > 0) { tr_debug(" time: %s", timeString); } tr_debug(" longitude: %.6f", pData->longitude); tr_debug(" latitude: %.6f", pData->latitude); - tr_debug(" altitude: %d metres", pData->altitude); - tr_debug(" uncertainty: %d metres", pData->uncertainty); - tr_debug(" speed: %d metres/second", pData->speed); - tr_debug(" vertical accuracy: %d metres/second", pData->speed); + tr_debug(" altitude: %d metre(s)", pData->altitude); switch (pData->sensor) { case UbloxATCellularInterfaceExt::CELL_LAST: tr_debug(" sensor type: last"); @@ -136,7 +140,13 @@ tr_debug(" sensor type: unknown"); break; } - tr_debug(" satellites used: %d", pData->svUsed); + tr_debug(" uncertainty: %d metre(s)", pData->uncertainty); + tr_debug(" speed: %d metre(s)/second", pData->speed); + tr_debug(" direction: %d degree(s)", pData->direction); + tr_debug(" vertical accuracy: %d metre(s)/second", pData->speed); + tr_debug(" satellite(s) used: %d", pData->svUsed); + tr_debug("I am here: " + "https://maps.google.com/?q=%.5f,%.5f", pData->latitude, pData->longitude); } // ----------------------------------------------------------------
--- a/UbloxATCellularInterfaceExt.cpp Mon Jun 05 12:58:04 2017 +0000 +++ b/UbloxATCellularInterfaceExt.cpp Wed Jun 07 23:52:33 2017 +0100 @@ -280,6 +280,7 @@ // +UHTTPCR: <profile_id>,<op_code>,<param_val> if (read_at_to_char(urcBuf, sizeof (urcBuf), '\n') > 0) { + // Response type 1 // +UULOC: <date>,<time>,<lat>,<long>,<alt>,<uncertainty>,<speed>, <direction>,<vertical_acc>,<sensor_used>,<SV_used>,<antenna_status>, <jamming_status> if (sscanf(urcBuf, ": %d/%d/%d,%d:%d:%d.%*d,%f,%f,%d,%d,%d,%d,%d,%d,%d,%*d,%*d", &_loc[0].time.tm_mday, &_loc[0].time.tm_mon, @@ -292,12 +293,14 @@ debug_if(_debug_trace_on, "Position found at index 0\n"); _loc[0].sensor = (b == 0) ? CELL_LAST : (b == 1) ? CELL_GNSS : (b == 2) ? CELL_LOCATE : (b == 3) ? CELL_HYBRID : CELL_LAST; + _loc[0].time.tm_year -= 1900; _loc[0].time.tm_mon -= 1; _loc[0].time.tm_wday = 0; _loc[0].time.tm_yday = 0; _loc[0].validData = true; _locExpPos=1; _locRcvPos++; + // Response type 2, sensor used 1 // +UULOC: <sol>,<num>,<sensor_used>,<date>,<time>,<lat>,<long>,<alt>,<uncertainty>,<speed>, <direction>,<vertical_acc>,,<SV_used>,<antenna_status>, <jamming_status> } else if (sscanf(urcBuf, ": %d,%d,%d,%d/%d/%d,%d:%d:%d.%*d,%f,%f,%d,%d,%d,%d,%d,%d,%*d,%*d", &a, &_locExpPos, &b, @@ -322,12 +325,14 @@ _loc[a].sensor = (b == 0) ? CELL_LAST : (b == 1) ? CELL_GNSS : (b == 2) ? CELL_LOCATE : (b == 3) ? CELL_HYBRID : CELL_LAST; + _loc[a].time.tm_year -= 1900; _loc[a].time.tm_mon -= 1; _loc[a].time.tm_wday = 0; _loc[a].time.tm_yday = 0; _loc[a].validData = true; _locRcvPos++; } + // Response type 2, sensor used 2 //+UULOC: <sol>,<num>,<sensor_used>,<date>,<time>,<lat>,<long>,<alt>,<lat50>,<long50>,<major50>,<minor50>,<orientation50>,<confidence50>[,<lat95>,<long95>,<major95>,<minor95>,<orientation95>,<confidence95>] } else if (sscanf(urcBuf, ": %d,%d,%d,%d/%d/%d,%d:%d:%d.%*d,%f,%f,%d,%*f,%*f,%d,%*d,%*d,%*d", &a, &_locExpPos, &b, @@ -349,9 +354,47 @@ _loc[a].sensor = (b == 0) ? CELL_LAST : (b == 1) ? CELL_GNSS : (b == 2) ? CELL_LOCATE : (b == 3) ? CELL_HYBRID : CELL_LAST; + _loc[a].time.tm_year -= 1900; _loc[a].time.tm_mon -= 1; _loc[a].time.tm_wday = 0; _loc[a].time.tm_yday = 0; + _loc[a].speed = 0; + _loc[a].direction = 0; + _loc[a].verticalAcc = 0; + _loc[a].svUsed = 0; + _loc[a].validData = true; + _locRcvPos++; + } + // Response type 2, sensor used 0 + //+UULOC: <sol>,<num>,<sensor_used>,<date>,<time>,<lat>,<long>,<alt>,<uncertainty> + } else if (sscanf(urcBuf, ": %d,%d,%d,%d/%d/%d,%d:%d:%d.%*d,%f,%f,%d,%d", + &a, &_locExpPos, &b, + &_loc[CELL_MAX_HYP - 1].time.tm_mday, + &_loc[CELL_MAX_HYP - 1].time.tm_mon, + &_loc[CELL_MAX_HYP - 1].time.tm_year, + &_loc[CELL_MAX_HYP - 1].time.tm_hour, + &_loc[CELL_MAX_HYP - 1].time.tm_min, + &_loc[CELL_MAX_HYP - 1].time.tm_sec, + &_loc[CELL_MAX_HYP - 1].latitude, + &_loc[CELL_MAX_HYP - 1].longitude, + &_loc[CELL_MAX_HYP - 1].altitude, + &_loc[CELL_MAX_HYP - 1].uncertainty) == 13) { + if (--a >= 0) { + + debug_if(_debug_trace_on, "Position found at index %d\n", a); + + memcpy(&_loc[a], &_loc[CELL_MAX_HYP - 1], sizeof(*_loc)); + + _loc[a].sensor = (b == 0) ? CELL_LAST : (b == 1) ? CELL_GNSS : + (b == 2) ? CELL_LOCATE : (b == 3) ? CELL_HYBRID : CELL_LAST; + _loc[a].time.tm_year -= 1900; + _loc[a].time.tm_mon -= 1; + _loc[a].time.tm_wday = 0; + _loc[a].time.tm_yday = 0; + _loc[a].speed = 0; + _loc[a].direction = 0; + _loc[a].verticalAcc = 0; + _loc[a].svUsed = 0; _loc[a].validData = true; _locRcvPos++; }
--- a/UbloxATCellularInterfaceExt.h Mon Jun 05 12:58:04 2017 +0000 +++ b/UbloxATCellularInterfaceExt.h Wed Jun 07 23:52:33 2017 +0100 @@ -423,6 +423,10 @@ * * This function is non-blocking, the result is retrieved using cellLocGetxxx. * + * Note: none of the CellLocate methods switch on the GNSS receiver chip. + * That should be done by instantiating the GnssSerial or GnssI2C classes and + * calling the init() method. + * * Note: during the location process, unsolicited result codes will be returned * by the modem indicating progress and potentially flagging interesting errors. * In order to see these errors, instantiate this class with debugOn set to true.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ublox-cellular-driver-gen.lib Wed Jun 07 23:52:33 2017 +0100 @@ -0,0 +1,1 @@ +https://mbed.org/teams/ublox/code/ublox-cellular-driver-gen/#458e1b3d460c \ No newline at end of file