diff options
author | Isaac Chen <isaacchen@isaacchen.cn> | 2018-12-31 10:55:08 +0100 |
---|---|---|
committer | TingyiChen <tingyi364@gmail.com> | 2019-08-13 11:54:40 +0200 |
commit | e5c53750f06e9d9739b45ec108260ead7ff80941 (patch) | |
tree | fe1d84884caefc481e994ae9c59c84b11fddd408 /gps/gnss/GnssAdapter.h | |
parent | 3ac2a0309619515c9ac27a5b6ec7c212b86dc355 (diff) |
wayne-common: Synchorize gps to P
* QC Tag: LA.UM.7.2.r1-04900-sdm660.0
Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn>
Change-Id: I34383e8fbf394b774f83f8d662873e8786ff1bbf
Diffstat (limited to 'gps/gnss/GnssAdapter.h')
-rw-r--r-- | gps/gnss/GnssAdapter.h | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/gps/gnss/GnssAdapter.h b/gps/gnss/GnssAdapter.h index e7605f9..0609e6d 100644 --- a/gps/gnss/GnssAdapter.h +++ b/gps/gnss/GnssAdapter.h @@ -43,9 +43,39 @@ #define MAX_SATELLITES_IN_USE 12 #define LOC_NI_NO_RESPONSE_TIME 20 #define LOC_GPS_NI_RESPONSE_IGNORE 4 +#define ODCPI_EXPECTED_INJECTION_TIME_MS 10000 class GnssAdapter; +class OdcpiTimer : public LocTimer { +public: + OdcpiTimer(GnssAdapter* adapter) : + LocTimer(), mAdapter(adapter), mActive(false) {} + + inline void start() { + mActive = true; + LocTimer::start(ODCPI_EXPECTED_INJECTION_TIME_MS, false); + } + inline void stop() { + mActive = false; + LocTimer::stop(); + } + inline void restart() { + stop(); + start(); + } + inline bool isActive() { + return mActive; + } + +private: + // Override + virtual void timeOutCallback() override; + + GnssAdapter* mAdapter; + bool mActive; +}; + typedef struct { pthread_t thread; /* NI thread */ uint32_t respTimeLeft; /* examine time for NI response */ @@ -81,6 +111,7 @@ namespace loc_core { } class GnssAdapter : public LocAdapterBase { + /* ==== ULP ============================================================================ */ UlpProxyBase* mUlpProxy; @@ -102,10 +133,18 @@ class GnssAdapter : public LocAdapterBase { /* ==== NI ============================================================================= */ NiData mNiData; - /* ==== AGPS ========================================================*/ + /* ==== AGPS =========================================================================== */ // This must be initialized via initAgps() AgpsManager mAgpsManager; AgpsCbInfo mAgpsCbInfo; + void initAgps(const AgpsCbInfo& cbInfo); + + /* ==== ODCPI ========================================================================== */ + OdcpiRequestCallback mOdcpiRequestCb; + bool mOdcpiRequestActive; + OdcpiTimer mOdcpiTimer; + OdcpiRequestInfo mOdcpiRequest; + void odcpiTimerExpire(); /* === SystemStatus ===================================================================== */ SystemStatus* mSystemStatus; @@ -151,6 +190,7 @@ public: LocationCallbacks getClientCallbacks(LocationAPI* client); LocationCapabilitiesMask getCapabilities(); void broadcastCapabilities(LocationCapabilitiesMask); + LocationError setSuplHostServer(const char* server, int port); /* ==== TRACKING ======================================================================= */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */ @@ -198,6 +238,7 @@ public: void setConfigCommand(); uint32_t* gnssUpdateConfigCommand(GnssConfig config); uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data); + void gnssUpdateXtraThrottleCommand(const bool enabled); void initDefaultAgpsCommand(); void initAgpsCommand(const AgpsCbInfo& cbInfo); @@ -206,6 +247,15 @@ public: void dataConnClosedCommand(AGpsExtType agpsType); void dataConnFailedCommand(AGpsExtType agpsType); + /* ========= ODCPI ===================================================================== */ + /* ======== COMMANDS ====(Called from Client Thread)==================================== */ + void initOdcpiCommand(const OdcpiRequestCallback& callback); + void injectOdcpiCommand(const Location& location); + /* ======== UTILITIES ================================================================== */ + void initOdcpi(const OdcpiRequestCallback& callback); + void injectOdcpi(const Location& location); + void odcpiTimerExpireEvent(); + /* ======== RESPONSES ================================================================== */ void reportResponse(LocationError err, uint32_t sessionId); void reportResponse(size_t count, LocationError* errs, uint32_t* ids); @@ -239,8 +289,11 @@ public: virtual bool requestSuplES(int connHandle); virtual bool reportDataCallOpened(); virtual bool reportDataCallClosed(); + virtual bool reportOdcpiRequestEvent(OdcpiRequestInfo& request); /* ======== UTILITIES ================================================================= */ + bool needReport(const UlpLocation& ulpLocation, + enum loc_sess_status status, LocPosTechMask techMask); void reportPosition(const UlpLocation &ulpLocation, const GpsLocationExtended &locationExtended, enum loc_sess_status status, @@ -249,6 +302,7 @@ public: void reportNmea(const char* nmea, size_t length); bool requestNiNotify(const GnssNiNotification& notify, const void* data); void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements); + void reportOdcpiRequest(const OdcpiRequestInfo& request); /*======== GNSSDEBUG ================================================================*/ bool getDebugReport(GnssDebugReport& report); |