From 0a760c9f3b7c8b88b201565f8c6ac7dfff7f5d22 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Tue, 2 Apr 2013 11:32:43 -0700 Subject: [PATCH] GPS HAL: expose altitude and speed uncertainty Expose altitude and speed uncertainty from GPS fix via extended info. Change-Id: I0a478aa25d4b0a98793c946ba5fb883520a4ce58 --- .../libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp | 12 ++++++++++++ loc_api/libloc_api_50001/loc_eng_msg.h | 8 ++++++++ loc_api/loc_api_v02/LocApiV02Adapter.cpp | 12 ++++++++++++ 3 files changed, 32 insertions(+) diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp index b0bfe760..9c2749bd 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp @@ -702,6 +702,18 @@ void LocApiRpcAdapter::reportPosition(const rpc_loc_parsed_position_s_type *loca locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation; } + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC; + locationExtended.vert_unc = location_report_ptr->vert_unc; + } + + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC; + locationExtended.speed_unc = location_report_ptr->speed_unc; + } + LOC_LOGV("reportPosition: fire callback\n"); LocApiAdapter::reportPosition(location, locationExtended, diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index bd86defb..c64ad09d 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -113,6 +113,10 @@ typedef uint16_t GpsLocationExtendedFlags; #define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004 /** UlpLocation has valid mode indicator. */ #define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008 +/** GpsLocationExtended has valid vertical uncertainty */ +#define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010 +/** GpsLocationExtended has valid speed uncertainty */ +#define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020 /** Represents gps location extended. */ typedef struct { @@ -130,6 +134,10 @@ typedef struct { float vdop; /** Contains Magnetic Deviation. */ float magneticDeviation; + /** vertical uncertainty in meters */ + float vert_unc; + /** speed uncertainty in m/s */ + float speed_unc; } GpsLocationExtended; typedef enum { diff --git a/loc_api/loc_api_v02/LocApiV02Adapter.cpp b/loc_api/loc_api_v02/LocApiV02Adapter.cpp index adde61d4..d7276e95 100644 --- a/loc_api/loc_api_v02/LocApiV02Adapter.cpp +++ b/loc_api/loc_api_v02/LocApiV02Adapter.cpp @@ -1697,6 +1697,18 @@ void LocApiV02Adapter :: reportPosition ( locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitudeWrtMeanSeaLevel; } + if (location_report_ptr->vertUnc_valid) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC; + locationExtended.vert_unc = location_report_ptr->vertUnc; + } + + if (location_report_ptr->speedUnc_valid ) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC; + locationExtended.speed_unc = location_report_ptr->speedUnc; + } + LocApiAdapter::reportPosition( location, locationExtended, locEngHandle.extPosInfo((void*)location_report_ptr),