Still need to read out values, even if not keeping

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2020-02-13 13:50:08 -05:00
parent 46d606260f
commit 71f26658d4
10 changed files with 191 additions and 117 deletions

View File

@@ -451,25 +451,44 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
// *secondWithSS = atof(dtSBuff);
streamSkipUntil(','); // Throw away the final comma
*lat = streamGetFloat(','); // Latitude
*lon = streamGetFloat(','); // Longitude
if (alt != NULL) *alt = streamGetFloat(','); // MSL Altitude
if (speed != NULL) *speed = streamGetFloat(','); // Speed Over Ground
streamSkipUntil(','); // Course Over Ground
streamSkipUntil(','); // Fix Mode
streamSkipUntil(','); // Reserved1
streamSkipUntil(','); // Horizontal Dilution Of Precision
if (accuracy != NULL)
*accuracy = streamGetFloat(','); // Position Dilution Of Precision
streamSkipUntil(','); // Vertical Dilution Of Precision
streamSkipUntil(','); // Reserved2
if (vsat != NULL) *vsat = streamGetInt(','); // GNSS Satellites in View
if (usat != NULL) *usat = streamGetInt(','); // GNSS Satellites Used
streamSkipUntil(','); // GLONASS Satellites Used
streamSkipUntil(','); // Reserved3
streamSkipUntil(','); // C/N0 max
streamSkipUntil(','); // HPA
streamSkipUntil('\n'); // VPA
*lat = streamGetFloat(','); // Latitude
*lon = streamGetFloat(','); // Longitude
if (alt != NULL) { // MSL Altitude. Unit is meters
*alt = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
if (speed != NULL) { // Speed Over Ground. Unit is knots.
*speed = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Course Over Ground. Degrees.
streamSkipUntil(','); // Fix Mode
streamSkipUntil(','); // Reserved1
streamSkipUntil(','); // Horizontal Dilution Of Precision
if (accuracy != NULL) { // Position Dilution Of Precision
*accuracy = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Vertical Dilution Of Precision
streamSkipUntil(','); // Reserved2
if (vsat != NULL) { // GNSS Satellites in View
*vsat = streamGetInt(',');
} else {
streamSkipUntil(',');
}
if (usat != NULL) { // GNSS Satellites Used
*usat = streamGetInt(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // GLONASS Satellites Used
streamSkipUntil(','); // Reserved3
streamSkipUntil(','); // C/N0 max
streamSkipUntil(','); // HPA
streamSkipUntil('\n'); // VPA
waitResponse();

View File

@@ -433,8 +433,6 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
int* vsat = 0, int* usat = 0, float* accuracy = 0,
int* year = 0, int* month = 0, int* day = 0, int* hour = 0,
int* minute = 0, int* second = 0) {
// String buffer = "";
sendAT(GF("+CGNSSINFO"));
if (waitResponse(GF(GSM_NL "+CGNSSINFO:")) != 1) { return false; }
@@ -479,16 +477,25 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
// *secondWithSS = atof(dtSBuff);
streamSkipUntil(','); // Throw away the final comma
if (alt != NULL)
*alt = streamGetFloat(','); // MSL Altitude. Unit is meters
if (speed != NULL)
*speed = streamGetFloat(','); // Speed Over Ground. Unit is knots.
streamSkipUntil(','); // Course. Degrees.
streamSkipUntil(','); // After set, will report GPS every x seconds
if (accuracy != NULL)
*accuracy = streamGetFloat(','); // Position Dilution Of Precision
streamSkipUntil(','); // Horizontal Dilution Of Precision
streamSkipUntil(','); // Vertical Dilution Of Precision
if (alt != NULL) { // MSL Altitude. Unit is meters
*alt = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
if (speed != NULL) { // Speed Over Ground. Unit is knots.
*speed = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Course Over Ground. Degrees.
streamSkipUntil(','); // After set, will report GPS every x seconds
if (accuracy != NULL) { // Position Dilution Of Precision
*accuracy = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Horizontal Dilution Of Precision
streamSkipUntil(','); // Vertical Dilution Of Precision
streamSkipUntil('\n'); // TODO(?) is one more field reported??
waitResponse();

View File

@@ -26,20 +26,14 @@ class TinyGsmSim808 : public TinyGsmSim800, public TinyGsmGPS<TinyGsmSim808> {
protected:
// enable GPS
bool enableGPSImpl() {
// uint16_t state;
sendAT(GF("+CGNSPWR=1"));
if (waitResponse() != 1) { return false; }
return true;
}
bool disableGPSImpl() {
// uint16_t state;
sendAT(GF("+CGNSPWR=0"));
if (waitResponse() != 1) { return false; }
return true;
}
@@ -96,25 +90,44 @@ class TinyGsmSim808 : public TinyGsmSim800, public TinyGsmGPS<TinyGsmSim808> {
// *secondWithSS = atof(dtSBuff);
streamSkipUntil(','); // Throw away the final comma
*lat = streamGetFloat(','); // Latitude
*lon = streamGetFloat(','); // Longitude
if (alt != NULL) *alt = streamGetFloat(','); // MSL Altitude
if (speed != NULL) *speed = streamGetFloat(','); // Speed Over Ground
streamSkipUntil(','); // Course Over Ground
streamSkipUntil(','); // Fix Mode
streamSkipUntil(','); // Reserved1
streamSkipUntil(','); // Horizontal Dilution Of Precision
if (accuracy != NULL)
*accuracy = streamGetFloat(','); // Position Dilution Of Precision
*lat = streamGetFloat(','); // Latitude
*lon = streamGetFloat(','); // Longitude
if (alt != NULL) { // MSL Altitude. Unit is meters
*alt = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
if (speed != NULL) { // Speed Over Ground. Unit is knots.
*speed = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Course Over Ground. Degrees.
streamSkipUntil(','); // Fix Mode
streamSkipUntil(','); // Reserved1
streamSkipUntil(','); // Horizontal Dilution Of Precision
if (accuracy != NULL) { // Position Dilution Of Precision
*accuracy = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Vertical Dilution Of Precision
streamSkipUntil(','); // Reserved2
if (vsat != NULL) *vsat = streamGetInt(','); // GNSS Satellites in View
if (usat != NULL) *usat = streamGetInt(','); // GNSS Satellites Used
streamSkipUntil(','); // GLONASS Satellites Used
streamSkipUntil(','); // Reserved3
streamSkipUntil(','); // C/N0 max
streamSkipUntil(','); // HPA
streamSkipUntil('\n'); // VPA
if (vsat != NULL) { // GNSS Satellites in View
*vsat = streamGetInt(',');
} else {
streamSkipUntil(',');
}
if (usat != NULL) { // GNSS Satellites Used
*usat = streamGetInt(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // GLONASS Satellites Used
streamSkipUntil(','); // Reserved3
streamSkipUntil(','); // C/N0 max
streamSkipUntil(','); // HPA
streamSkipUntil('\n'); // VPA
waitResponse();

View File

@@ -538,21 +538,33 @@ class TinyGsmSaraR4
*lat = streamGetFloat(','); // Estimated latitude, in degrees
*lon = streamGetFloat(','); // Estimated longitude, in degrees
if (alt != NULL)
*alt = streamGetFloat(','); // Estimated altitude, in meters - only for
// GNSS positioning, 0 in case of CellLocate
if (accuracy != NULL) {
if (alt != NULL) { // Estimated altitude, in meters - only for GNSS
// positioning, 0 in case of CellLocate
*alt = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
if (accuracy != NULL) { // Maximum possible error, in meters (0 - 20000000)
*accuracy = streamGetFloat(',');
} // Maximum possible error, in meters (0 - 20000000)
if (speed != NULL) *speed = streamGetFloat(','); // Speed over ground m/s3
} else {
streamSkipUntil(',');
}
if (speed != NULL) { // Speed over ground m/s3
*speed = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Course over ground in degree (0 deg - 360 deg)
streamSkipUntil(','); // Vertical accuracy, in meters
streamSkipUntil(','); // Sensor used for the position calculation
streamSkipUntil(','); // Number of satellite used to calculate the position
if (usat != NULL)
*usat = streamGetInt(
','); // Number of satellite used to calculate the position
streamSkipUntil(','); // Antenna status
if (vsat != NULL) vsat = 0; // Number of satellites viewed not reported
if (usat != NULL) { // Number of satellite used to calculate the position
*usat = streamGetInt(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Antenna status
streamSkipUntil('\n'); // Jamming status
// final ok

View File

@@ -505,21 +505,33 @@ class TinyGsmUBLOX
*lat = streamGetFloat(','); // Estimated latitude, in degrees
*lon = streamGetFloat(','); // Estimated longitude, in degrees
if (alt != NULL)
*alt = streamGetFloat(','); // Estimated altitude, in meters - only for
// GNSS positioning, 0 in case of CellLocate
if (accuracy != NULL) {
if (alt != NULL) { // Estimated altitude, in meters - only for GNSS
// positioning, 0 in case of CellLocate
*alt = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
if (accuracy != NULL) { // Maximum possible error, in meters (0 - 20000000)
*accuracy = streamGetFloat(',');
} // Maximum possible error, in meters (0 - 20000000)
if (speed != NULL) *speed = streamGetFloat(','); // Speed over ground m/s3
} else {
streamSkipUntil(',');
}
if (speed != NULL) { // Speed over ground m/s3
*speed = streamGetFloat(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Course over ground in degree (0 deg - 360 deg)
streamSkipUntil(','); // Vertical accuracy, in meters
streamSkipUntil(','); // Sensor used for the position calculation
streamSkipUntil(','); // Number of satellite used to calculate the position
if (usat != NULL)
*usat = streamGetInt(
','); // Number of satellite used to calculate the position
streamSkipUntil(','); // Antenna status
if (vsat != NULL) *vsat = 0; // Number of satellites viewed not reported
if (usat != NULL) { // Number of satellite used to calculate the position
*usat = streamGetInt(',');
} else {
streamSkipUntil(',');
}
streamSkipUntil(','); // Antenna status
streamSkipUntil('\n'); // Jamming status
// final ok

View File

@@ -95,8 +95,11 @@ class TinyGsmGSMLocation {
}
*lat = thisModem().streamGetFloat(','); // Latitude
*lon = thisModem().streamGetFloat(','); // Longitude
if (accuracy != NULL)
*accuracy = thisModem().streamGetInt(','); // Positioning accuracy
if (accuracy != NULL) { // Positioning accuracy
*accuracy = thisModem().streamGetInt(',');
} else {
thisModem().streamSkipUntil(',');
}
// Date & Time
char dtSBuff[5] = {'\0'};