diff options
author | Wei Chen <weic@codeaurora.org> | 2019-02-22 17:55:39 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-05-01 09:45:04 -0700 |
commit | 3e62412eb0233619684ecdbc39b19cbc8ebbdc93 (patch) | |
tree | cf35fdee6917377f8fed369fc6e95fd7b378b8aa | |
parent | 0330e79d4a87db7e1ee358f0e87a49d34c8f3690 (diff) | |
download | gps-3e62412eb0233619684ecdbc39b19cbc8ebbdc93.tar.gz |
Gnss interface: add position injection for extended info
Add position injection interface with extended info, e.g.:
GnssLocationInfoNotification
Change-Id: I6ba8f1111d1511c7071fe358687a478b26e8f9a4
CRs-fixed: 2417450
-rw-r--r-- | gnss/GnssAdapter.cpp | 27 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 2 | ||||
-rw-r--r-- | gnss/location_gnss.cpp | 11 | ||||
-rw-r--r-- | location/location_interface.h | 1 |
4 files changed, 40 insertions, 1 deletions
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index edfc150..436681a 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -1820,6 +1820,33 @@ GnssAdapter::injectLocationCommand(double latitude, double longitude, float accu } void +GnssAdapter::injectLocationExtCommand(const GnssLocationInfoNotification &locationInfo) +{ + LOC_LOGd("latitude %8.4f longitude %8.4f accuracy %8.4f, tech mask 0x%x", + locationInfo.location.latitude, locationInfo.location.longitude, + locationInfo.location.accuracy, locationInfo.location.techMask); + + struct MsgInjectLocationExt : public LocMsg { + LocApiBase& mApi; + ContextBase& mContext; + GnssLocationInfoNotification mLocationInfo; + inline MsgInjectLocationExt(LocApiBase& api, + ContextBase& context, + GnssLocationInfoNotification locationInfo) : + LocMsg(), + mApi(api), + mContext(context), + mLocationInfo(locationInfo) {} + inline virtual void proc() const { + // false to indicate for none-ODCPI + mApi.injectPosition(mLocationInfo, false); + } + }; + + sendMsg(new MsgInjectLocationExt(*mLocApi, *mContext, locationInfo)); +} + +void GnssAdapter::injectTimeCommand(int64_t time, int64_t timeReference, int32_t uncertainty) { LOC_LOGD("%s]: time %lld timeReference %lld uncertainty %d", diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index 9720ba4..ae5f5f1 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -430,6 +430,8 @@ public: GnssSvId initialSvId, GnssSvType svType); void injectLocationCommand(double latitude, double longitude, float accuracy); + void injectLocationExtCommand(const GnssLocationInfoNotification &locationInfo); + void injectTimeCommand(int64_t time, int64_t timeReference, int32_t uncertainty); void blockCPICommand(double latitude, double longitude, float accuracy, int blockDurationMsec, double latLonDiffThreshold); diff --git a/gnss/location_gnss.cpp b/gnss/location_gnss.cpp index 43665b4..88fa15d 100644 --- a/gnss/location_gnss.cpp +++ b/gnss/location_gnss.cpp @@ -58,6 +58,7 @@ static void gnssGetSvTypeConfig(GnssSvTypeConfigCallback& callback); static void gnssResetSvTypeConfig(); static void injectLocation(double latitude, double longitude, float accuracy); +static void injectLocationExt(const GnssLocationInfoNotification &locationInfo); static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty); static void agpsInit(const AgpsCbInfo& cbInfo); @@ -113,7 +114,8 @@ static const GnssInterface gGnssInterface = { getGnssEnergyConsumed, enableNfwLocationAccess, nfwInit, - getPowerStateChanges + getPowerStateChanges, + injectLocationExt }; #ifndef DEBUG_X86 @@ -373,3 +375,10 @@ static void getPowerStateChanges(void* powerStateCb) gGnssAdapter->getPowerStateChangesCommand(powerStateCb); } } + +static void injectLocationExt(const GnssLocationInfoNotification &locationInfo) +{ + if (NULL != gGnssAdapter) { + gGnssAdapter->injectLocationExtCommand(locationInfo); + } +} diff --git a/location/location_interface.h b/location/location_interface.h index 4235a13..80f37c2 100644 --- a/location/location_interface.h +++ b/location/location_interface.h @@ -86,6 +86,7 @@ struct GnssInterface { void (*enableNfwLocationAccess)(bool enable); void (*nfwInit)(const NfwCbInfo& cbInfo); void (*getPowerStateChanges)(void* powerStateCb); + void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo); }; struct BatchingInterface { |