diff options
author | qctecmdr <qctecmdr@localhost> | 2020-12-28 10:11:57 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-12-28 10:11:57 -0800 |
commit | 64910a0babc4415a68c7731834ae83d04876e4c8 (patch) | |
tree | 0ec30b3926e1296dcc2c9c98b0061835aa37d729 | |
parent | a891b8fcf12e139e2b53445483a192f49af1b471 (diff) | |
parent | 91d61c0683fed7f0649259f0392d001f5804562a (diff) |
Merge "FR 67139: re-instate GTP WWAN support"
-rw-r--r-- | core/LocAdapterBase.h | 2 | ||||
-rw-r--r-- | location/LocationAPI.cpp | 67 | ||||
-rw-r--r-- | location/LocationAPI.h | 27 | ||||
-rw-r--r-- | location/LocationDataTypes.h | 8 |
4 files changed, 102 insertions, 2 deletions
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index b2188c7..24ed15c 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -140,7 +140,7 @@ public: return ContextBase::isFeatureSupported(featureVal); } - uint32_t generateSessionId(); + static uint32_t generateSessionId(); inline bool isAdapterMaster() { return mIsMaster; diff --git a/location/LocationAPI.cpp b/location/LocationAPI.cpp index ffe2d6f..08d1e8a 100644 --- a/location/LocationAPI.cpp +++ b/location/LocationAPI.cpp @@ -42,6 +42,13 @@ typedef const GeofenceInterface* (getGeofenceInterface)(); typedef void (createOSFramework)(); typedef void (destroyOSFramework)(); +// GTP services +typedef uint32_t (setOptInStatusGetter)(bool userConsent, responseCallback* callback); +typedef void (enableProviderGetter)(); +typedef void (disableProviderGetter)(); +typedef void (getSingleNetworkLocationGetter)(trackingCallback* callback); +typedef void (stopNetworkLocationGetter)(trackingCallback* callback); + typedef struct { // bit mask of the adpaters that we need to wait for the removeClientCompleteCallback // before we invoke the registered locationApiDestroyCompleteCallback @@ -187,6 +194,7 @@ LocationAPI::createInstance(LocationCallbacks& locationCallbacks) if (nullptr == locationCallbacks.capabilitiesCb || nullptr == locationCallbacks.responseCb || nullptr == locationCallbacks.collectiveResponseCb) { + LOC_LOGe("missing mandatory callback, return null"); return NULL; } @@ -655,6 +663,52 @@ LocationAPI::gnssNiResponse(uint32_t id, GnssNiResponse response) pthread_mutex_unlock(&gDataMutex); } +void LocationAPI::enableNetworkProvider() { + void* libHandle = nullptr; + enableProviderGetter* setter = (enableProviderGetter*)dlGetSymFromLib(libHandle, + "liblocationservice_glue.so", "enableNetworkProvider"); + if (setter != nullptr) { + (*setter)(); + } else { + LOC_LOGe("dlGetSymFromLib failed for liblocationservice_glue.so"); + } +} + +void LocationAPI::disableNetworkProvider() { + void* libHandle = nullptr; + disableProviderGetter* setter = (disableProviderGetter*)dlGetSymFromLib(libHandle, + "liblocationservice_glue.so", "disableNetworkProvider"); + if (setter != nullptr) { + (*setter)(); + } else { + LOC_LOGe("dlGetSymFromLib failed for liblocationservice_glue.so"); + } +} + +void LocationAPI::startNetworkLocation(trackingCallback* callback) { + void* libHandle = nullptr; + getSingleNetworkLocationGetter* setter = + (getSingleNetworkLocationGetter*)dlGetSymFromLib(libHandle, + "liblocationservice_glue.so", "startNetworkLocation"); + if (setter != nullptr) { + (*setter)(callback); + } else { + LOC_LOGe("dlGetSymFromLib failed for liblocationservice_glue.so"); + } +} + +void LocationAPI::stopNetworkLocation(trackingCallback* callback) { + void* libHandle = nullptr; + stopNetworkLocationGetter* setter = (stopNetworkLocationGetter*)dlGetSymFromLib(libHandle, + "liblocationservice_glue.so", "stopNetworkLocation"); + if (setter != nullptr) { + LOC_LOGe("called"); + (*setter)(callback); + } else { + LOC_LOGe("dlGetSymFromLib failed for liblocationservice_glue.so"); + } +} + LocationControlAPI* LocationControlAPI::createInstance(LocationControlCallbacks& locationControlCallbacks) { @@ -921,3 +975,16 @@ uint32_t LocationControlAPI::configEngineRunState( pthread_mutex_unlock(&gDataMutex); return id; } + +uint32_t LocationControlAPI::setOptInStatus(bool userConsent) { + void* libHandle = nullptr; + uint32_t sessionId = 0; + setOptInStatusGetter* setter = (setOptInStatusGetter*)dlGetSymFromLib(libHandle, + "liblocationservice_glue.so", "setOptInStatus"); + if (setter != nullptr) { + sessionId = (*setter)(userConsent, &gData.controlCallbacks.responseCb); + } else { + LOC_LOGe("dlGetSymFromLib failed for liblocationservice_glue.so"); + } + return sessionId; +} diff --git a/location/LocationAPI.h b/location/LocationAPI.h index 5ae5eda..7c70506 100644 --- a/location/LocationAPI.h +++ b/location/LocationAPI.h @@ -178,6 +178,20 @@ public: LOCATION_ERROR_INVALID_PARAMETER if any parameters in GnssNiResponse are invalid LOCATION_ERROR_ID_UNKNOWN if id does not match a gnssNiCallback */ virtual void gnssNiResponse(uint32_t id, GnssNiResponse response) override; + + /* ================================== NETWORK PROVIDER =========================== */ + + /* enableNetworkProvider enables Network Provider */ + virtual void enableNetworkProvider(); + + /* disableNetworkProvider disables Network Provider */ + virtual void disableNetworkProvider(); + + /* startNetworkLocation start a single shot network location request */ + virtual void startNetworkLocation(trackingCallback* callback); + + /* stopNetworkLocation stop any ongoing network location request */ + virtual void stopNetworkLocation(trackingCallback* callback); }; typedef struct { @@ -480,6 +494,19 @@ public: */ virtual uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState) override; + + /** @brief + Set the EULA opt-in status from system user. This is used as consent to + use network-based positioning. + + @param + userConsnt: user agrees to use GTP service or not. + + @return + A session id that will be returned in responseCallback to + match command with response. + */ + virtual uint32_t setOptInStatus(bool userConsent); }; #endif /* LOCATIONAPI_H */ diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h index 6d3af03..4530031 100644 --- a/location/LocationDataTypes.h +++ b/location/LocationDataTypes.h @@ -58,7 +58,8 @@ typedef enum { LOCATION_ERROR_ID_UNKNOWN, LOCATION_ERROR_ALREADY_STARTED, LOCATION_ERROR_GEOFENCES_AT_MAX, - LOCATION_ERROR_NOT_SUPPORTED + LOCATION_ERROR_NOT_SUPPORTED, + LOCATION_ERROR_TIMEOUT, } LocationError; // Flags to indicate which values are valid in a Location @@ -1613,6 +1614,11 @@ struct LocationSystemInfo { LeapSecondSystemInfo leapSecondSysInfo; }; +// Specify the set of terrestrial technologies +enum TerrestrialTechMask { + TERRESTRIAL_TECH_GTP_WWAN = 1 << 0, +}; + // Specify parameters related to lever arm struct LeverArmParams { // Offset along the vehicle forward axis |