Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ublox-at-cellular-interface
Diff: UbloxATCellularInterfaceExt.cpp
- Revision:
- 1:26a67ab07275
- Parent:
- 0:0b75e22c9231
- Child:
- 4:39acbc0111eb
diff -r 0b75e22c9231 -r 26a67ab07275 UbloxATCellularInterfaceExt.cpp
--- 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++;
}