From 91d9d51f5d3371d64b089c63e06409f8e2c92ea0 Mon Sep 17 00:00:00 2001 From: Laurent Tu Date: Thu, 11 Oct 2012 20:41:23 -0700 Subject: [PATCH] Return accuracy in GPS emulation Accuracy is now a required field for location. To comply, set an accuracy in returned fix. The accuracy is constant for now since computing it from the NMEA sentence seems to be very complicated. Bug: 6864500 Change-Id: Iff4c36b440b095539c717d35a812ee2ed7c1725f --- tools/emulator/system/gps/gps_qemu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/emulator/system/gps/gps_qemu.c b/tools/emulator/system/gps/gps_qemu.c index eebe8d691..8f3d6e9ce 100644 --- a/tools/emulator/system/gps/gps_qemu.c +++ b/tools/emulator/system/gps/gps_qemu.c @@ -405,6 +405,16 @@ nmea_reader_update_speed( NmeaReader* r, return 0; } +static int +nmea_reader_update_accuracy( NmeaReader* r ) +{ + // Always return 20m accuracy. + // Possibly parse it from the NMEA sentence in the future. + r->fix.flags |= GPS_LOCATION_HAS_ACCURACY; + r->fix.accuracy = 20; + return 0; +} + static void nmea_reader_parse( NmeaReader* r ) @@ -488,6 +498,10 @@ nmea_reader_parse( NmeaReader* r ) tok.p -= 2; D("unknown sentence '%.*s", tok.end-tok.p, tok.p); } + + // Always update accuracy + nmea_reader_update_accuracy( r ); + if (r->fix.flags != 0) { #if GPS_DEBUG char temp[256];