Fix for HTTP return status code 1.0 in http_tls
Dependencies: ublox-at-cellular-interface
Revision 4:39acbc0111eb, committed 2017-06-09
- Comitter:
- RobMeades
- Date:
- Fri Jun 09 22:23:28 2017 +0000
- Parent:
- 3:e51d808980d8
- Child:
- 5:9fd89567f769
- Commit message:
- Handle case where uncertainty is "-1". Differentiate between +UULOC and +UULOCIND URCs.
Changed in this revision
| UbloxATCellularInterfaceExt.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/UbloxATCellularInterfaceExt.cpp Wed Jun 07 23:05:43 2017 +0000
+++ b/UbloxATCellularInterfaceExt.cpp Fri Jun 09 22:23:28 2017 +0000
@@ -282,7 +282,7 @@
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",
+ 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,
&_loc[0].time.tm_year, &_loc[0].time.tm_hour,
&_loc[0].time.tm_min, &_loc[0].time.tm_sec,
@@ -298,11 +298,18 @@
_loc[0].time.tm_wday = 0;
_loc[0].time.tm_yday = 0;
_loc[0].validData = true;
- _locExpPos=1;
+ // Uncertainty can appear as 4294967, which is
+ // (2^32 - 1) / 1000, or -1. Since it is confusing
+ // for the user to get a large positive number instead
+ // of 0 -1, set it to -1 in th1s case.
+ if (_loc[0].uncertainty == 4294967) {
+ _loc[0].uncertainty = -1;
+ }
+ _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",
+ } 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,
&_loc[CELL_MAX_HYP - 1].time.tm_mday,
&_loc[CELL_MAX_HYP - 1].time.tm_mon,
@@ -329,12 +336,19 @@
_loc[a].time.tm_mon -= 1;
_loc[a].time.tm_wday = 0;
_loc[a].time.tm_yday = 0;
+ // Uncertainty can appear as 4294967, which is
+ // (2^32 - 1) / 1000, or -1. Since it is confusing
+ // for the user to get a large positive number instead
+ // of 0 -1, set it to -1 in th1s case.
+ if (_loc[a].uncertainty == 4294967) {
+ _loc[a].uncertainty = -1;
+ }
_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",
+ } 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,
&_loc[CELL_MAX_HYP - 1].time.tm_mday,
&_loc[CELL_MAX_HYP - 1].time.tm_mon,
@@ -362,12 +376,19 @@
_loc[a].direction = 0;
_loc[a].verticalAcc = 0;
_loc[a].svUsed = 0;
+ // Uncertainty can appear as 4294967, which is
+ // (2^32 - 1) / 1000, or -1. Since it is confusing
+ // for the user to get a large positive number instead
+ // of 0 -1, set it to -1 in th1s case.
+ if (_loc[a].uncertainty == 4294967) {
+ _loc[a].uncertainty = -1;
+ }
_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",
+ } 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,
@@ -395,6 +416,13 @@
_loc[a].direction = 0;
_loc[a].verticalAcc = 0;
_loc[a].svUsed = 0;
+ // Uncertainty can appear as 4294967, which is
+ // (2^32 - 1) / 1000, or -1. Since it is confusing
+ // for the user to get a large positive number instead
+ // of 0 -1, set it to -1 in th1s case.
+ if (_loc[a].uncertainty == 4294967) {
+ _loc[a].uncertainty = -1;
+ }
_loc[a].validData = true;
_locRcvPos++;
}
@@ -442,8 +470,8 @@
_at->oob("+UUFTPCD", callback(this, &UbloxATCellularInterfaceExt::UUFTPCD_URC));
// URC handlers for Cell Locate
- _at->oob("+UULOCIND", callback(this, &UbloxATCellularInterfaceExt::UULOCIND_URC));
- _at->oob("+UULOC", callback(this, &UbloxATCellularInterfaceExt::UULOC_URC));
+ _at->oob("+UULOCIND:", callback(this, &UbloxATCellularInterfaceExt::UULOCIND_URC));
+ _at->oob("+UULOC:", callback(this, &UbloxATCellularInterfaceExt::UULOC_URC));
}
// Destructor.