Bug 1726571 - Add gpsd API 11-12 support r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D123216
This commit is contained in:
Maciej S. Szmigiero 2021-08-20 13:08:07 +00:00
Родитель 8d2808b5c9
Коммит d764f6cb38
1 изменённых файлов: 6 добавлений и 11 удалений

Просмотреть файл

@ -153,7 +153,7 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
}
static bool IsSupported() {
return GPSD_API_MAJOR_VERSION >= 5 && GPSD_API_MAJOR_VERSION <= 10;
return GPSD_API_MAJOR_VERSION >= 5 && GPSD_API_MAJOR_VERSION <= 12;
}
bool IsRunning() const { return mRunning; }
@ -167,7 +167,7 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
int err;
switch (GPSD_API_MAJOR_VERSION) {
case 5 ... 10:
case 5 ... 12:
err = PollLoop5();
break;
default:
@ -187,7 +187,7 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
protected:
int PollLoop5() {
#if GPSD_API_MAJOR_VERSION >= 5 && GPSD_API_MAJOR_VERSION <= 10
#if GPSD_API_MAJOR_VERSION >= 5 && GPSD_API_MAJOR_VERSION <= 12
static const int GPSD_WAIT_TIMEOUT_US =
1000000; /* us to wait for GPS data */
@ -216,7 +216,6 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
while (IsRunning()) {
errno = 0;
auto hasGpsData = gps_waiting(&gpsData, GPSD_WAIT_TIMEOUT_US);
int status;
if (errno) {
err = ErrnoToError(errno);
@ -240,15 +239,11 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
continue; /* no data available */
}
# if GPSD_API_MAJOR_VERSION >= 10
status = gpsData.fix.status;
# else
status = gpsData.status;
# endif
if (status == STATUS_NO_FIX) {
# if GPSD_API_MAJOR_VERSION < 10
if (gpsData.status == STATUS_NO_FIX) {
continue;
}
# endif
switch (gpsData.fix.mode) {
case MODE_3D: