diff options
author | Dante Russo <drusso@codeaurora.org> | 2019-03-06 09:36:20 -0800 |
---|---|---|
committer | Kevin Tang <zhikait@codeaurora.org> | 2019-03-27 14:54:49 -0700 |
commit | 5c1e23cf022ab1c06f4601bf0f2d8ca652784b87 (patch) | |
tree | 367ed17640c0bab1021feb10575645bd6d30c1ba /core/LocAdapterBase.h | |
parent | 01869b4004179870db2160ed41283dce7fbbdcde (diff) | |
download | gps-5c1e23cf022ab1c06f4601bf0f2d8ca652784b87.tar.gz |
Batching and Geofence moved to GNSS HAL
Addition of BatchingAdapter and GeofenceAdapter.
Deprecated Background LOC QMI Client and renamed
LocDualContext renamed to LocContext.
Moved some common Adapter functions into LocAdapterBase.
Added Distance Based Tracking logic into GnssAdapter.
Addition of flp.conf
Deprecated GEOFENCE capabilities configuration in
gps.conf
CRs-fixed: 2342200
Change-Id: I6b6257c4cf296e5a8c56bc0b149e4de77cf6cdf9
Diffstat (limited to 'core/LocAdapterBase.h')
-rw-r--r-- | core/LocAdapterBase.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 8aa7112..05b72db 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -51,8 +51,8 @@ inline bool operator ==(LocationSessionKey const& left, LocationSessionKey const inline bool operator !=(LocationSessionKey const& left, LocationSessionKey const& right) { return left.id != right.id || left.client != right.client; } -typedef std::map<LocationSessionKey, LocationOptions> LocationSessionMap; -typedef std::map<LocationSessionKey, TrackingOptions> TrackingOptionsMap; + +typedef void (*removeClientCompleteCallback)(LocationAPI* client); namespace loc_core { @@ -62,6 +62,8 @@ class LocAdapterBase { private: static uint32_t mSessionIdCounter; const bool mIsMaster; + bool mIsEngineCapabilitiesKnown = false; + protected: LOC_API_ADAPTER_EVENT_MASK_T mEvtMask; ContextBase* mContext; @@ -71,6 +73,20 @@ protected: inline LocAdapterBase(const MsgTask* msgTask) : mIsMaster(false), mEvtMask(0), mContext(NULL), mLocApi(NULL), mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {} + + /* ==== CLIENT ========================================================================= */ + typedef std::map<LocationAPI*, LocationCallbacks> ClientDataMap; + ClientDataMap mClientData; + std::vector<LocMsg*> mPendingMsgs; // For temporal storage of msgs before Open is completed + /* ======== UTILITIES ================================================================== */ + void saveClient(LocationAPI* client, const LocationCallbacks& callbacks); + void eraseClient(LocationAPI* client); + LocationCallbacks getClientCallbacks(LocationAPI* client); + LocationCapabilitiesMask getCapabilities(); + void broadcastCapabilities(LocationCapabilitiesMask mask); + virtual void updateClientsEventMask(); + virtual void stopClientSessions(LocationAPI* client); + public: inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); } LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, @@ -126,12 +142,11 @@ public: return mIsMaster; } + inline bool isEngineCapabilitiesKnown() { return mIsEngineCapabilitiesKnown;} + inline void setEngineCapabilitiesKnown(bool value) { mIsEngineCapabilitiesKnown = value;} + virtual void handleEngineUpEvent(); virtual void handleEngineDownEvent(); - inline virtual void setPositionModeCommand(LocPosMode& posMode) { - - (void)posMode; - } virtual void reportPositionEvent(const UlpLocation& location, const GpsLocationExtended& locationExtended, enum loc_sess_status status, @@ -174,6 +189,28 @@ public: virtual bool reportGnssAdditionalSystemInfoEvent( GnssAdditionalSystemInfo& additionalSystemInfo); virtual void reportNfwNotificationEvent(GnssNfwNotification& notification); + + virtual void geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location, + GeofenceBreachType breachType, uint64_t timestamp); + virtual void geofenceStatusEvent(GeofenceStatusAvailable available); + + virtual void reportPositionEvent(UlpLocation &location, + GpsLocationExtended &locationExtended, + enum loc_sess_status status, + LocPosTechMask loc_technology_mask); + + virtual void reportLocationsEvent(const Location* locations, size_t count, + BatchingMode batchingMode); + virtual void reportCompletedTripsEvent(uint32_t accumulated_distance); + virtual void reportBatchStatusChangeEvent(BatchingStatus batchStatus); + + /* ==== CLIENT ========================================================================= */ + /* ======== COMMANDS ====(Called from Client Thread)==================================== */ + void addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks); + void removeClientCommand(LocationAPI* client, + removeClientCompleteCallback rmClientCb); + void requestCapabilitiesCommand(LocationAPI* client); + }; } // namespace loc_core |