From 98b9fa2f337f1b0e4787a258a19cfedf0ef529ef Mon Sep 17 00:00:00 2001 From: Naresh Munagala Date: Wed, 10 Aug 2016 17:14:18 +0530 Subject: [PATCH] msm8974-common: gps: NMEA report indication to ULP Enabled NMEA report indication to ulp Change-Id: Ia27fe0d805f53bf17c86f7c27eaaedd960101370 CRs-Fixed: 1055201 --- gps/core/UlpProxyBase.h | 6 ++++++ gps/core/gps_extended_c.h | 8 ++++++++ gps/loc_api/libloc_api_50001/LocEngAdapter.cpp | 15 +++++++++++---- gps/loc_api/libloc_api_50001/LocEngAdapter.h | 1 + gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp | 3 +++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/gps/core/UlpProxyBase.h b/gps/core/UlpProxyBase.h index 79b5248..1f807a7 100644 --- a/gps/core/UlpProxyBase.h +++ b/gps/core/UlpProxyBase.h @@ -100,6 +100,12 @@ public: (void)number_of_locations; return false; } + inline virtual bool reportNmea(const char* nmea, int length) + { + (void)nmea; + (void)length; + return false; + } }; } // namespace loc_core diff --git a/gps/core/gps_extended_c.h b/gps/core/gps_extended_c.h index ebf9e5b..68d0d65 100644 --- a/gps/core/gps_extended_c.h +++ b/gps/core/gps_extended_c.h @@ -70,6 +70,7 @@ extern "C" { #define ULP_LOCATION_IS_FROM_PIP 0x0040 #define ULP_MIN_INTERVAL_INVALID 0xffffffff +#define ULP_MAX_NMEA_STRING_SIZE 201 /*Emergency SUPL*/ #define GPS_NI_TYPE_EMERGENCY_SUPL 4 @@ -97,6 +98,13 @@ typedef struct { unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE]; } UlpLocation; +typedef struct { + /** set to sizeof(UlpNmea) */ + size_t size; + char nmea_str[ULP_MAX_NMEA_STRING_SIZE]; + unsigned int len; +} UlpNmea; + /** AGPS type */ typedef int16_t AGpsExtType; #define AGPS_TYPE_INVALID -1 diff --git a/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp b/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp index f8c103a..89be583 100644 --- a/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -418,10 +418,17 @@ void LocEngAdapter::reportStatus(GpsStatusValue status) } } -inline -void LocEngAdapter::reportNmea(const char* nmea, int length) +void LocInternalAdapter::reportNmea(const char* nmea, int length) { - sendMsg(new LocEngReportNmea(mOwner, nmea, length)); + sendMsg(new LocEngReportNmea(mLocEngAdapter->getOwner(), nmea, length)); +} + +inline void LocEngAdapter::reportNmea(const char* nmea, int length) +{ + if (!mUlp->reportNmea(nmea, length)) { + //Report it to HAL + mInternalAdapter->reportNmea(nmea, length); + } } inline diff --git a/gps/loc_api/libloc_api_50001/LocEngAdapter.h b/gps/loc_api/libloc_api_50001/LocEngAdapter.h index b58c8e7..eabd0ea 100644 --- a/gps/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/gps/loc_api/libloc_api_50001/LocEngAdapter.h @@ -64,6 +64,7 @@ public: virtual void stopFixInt(); virtual void getZppInt(); virtual void setUlpProxy(UlpProxyBase* ulp); + virtual void reportNmea(const char* nmea, int length); }; typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp); diff --git a/gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp index ccfa2bb..c29ab91 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -62,6 +62,9 @@ void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_dat CALLBACK_LOG_CALLFLOW("nmea_cb", %p, pNmea); if (loc_eng_data_p->nmea_cb != NULL) loc_eng_data_p->nmea_cb(now, pNmea, length); + + loc_eng_data_p->adapter->getUlpProxy()->reportNmea(pNmea, length); + LOC_LOGD("NMEA <%s", pNmea); }