diff options
Diffstat (limited to 'gnss')
-rw-r--r-- | gnss/GnssAdapter.cpp | 31 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 2 | ||||
-rw-r--r-- | gnss/location_gnss.cpp | 11 |
3 files changed, 41 insertions, 3 deletions
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index fe0fc9b..e1143fd 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -304,11 +304,11 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out, } if (GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV & locationExtended.flags) { out.flags |= GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT; - out.northVelocityStdDeviation = locationExtended.northStdDeviation; + out.northStdDeviation = locationExtended.northStdDeviation; } if (GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV & locationExtended.flags) { out.flags |= GNSS_LOCATION_INFO_EAST_STD_DEV_BIT; - out.eastVelocityStdDeviation = locationExtended.eastStdDeviation; + out.eastStdDeviation = locationExtended.eastStdDeviation; } if (GPS_LOCATION_EXTENDED_HAS_NORTH_VEL & locationExtended.flags) { out.flags |= GNSS_LOCATION_INFO_NORTH_VEL_BIT; @@ -1821,6 +1821,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 7b73ec1..6f652e6 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -438,6 +438,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); + } +} |