aboutsummaryrefslogtreecommitdiff
path: root/gps/gnss/Agps.h
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2024-10-14 20:38:19 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2024-10-14 20:38:19 +0530
commit86a968c3f424cb70e03cccb24cabf9751f6f636d (patch)
tree5aedd15a754e4c0de8a015a4fd2c2e5c0698a22b /gps/gnss/Agps.h
parentea30e6e77df9c7a651f22bcc5797b8a3f33703dc (diff)
update gps stack
Diffstat (limited to 'gps/gnss/Agps.h')
-rw-r--r--gps/gnss/Agps.h133
1 files changed, 35 insertions, 98 deletions
diff --git a/gps/gnss/Agps.h b/gps/gnss/Agps.h
index 703a475..d559377 100644
--- a/gps/gnss/Agps.h
+++ b/gps/gnss/Agps.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -40,18 +40,11 @@
/* ATL callback function pointers
* Passed in by Adapter to AgpsManager */
typedef std::function<void(
- int handle, int isSuccess, char* apn,
- AGpsBearerType bearerType, AGpsExtType agpsType)> AgpsAtlOpenStatusCb;
+ int handle, int isSuccess, char* apn, uint32_t apnLen,
+ AGpsBearerType bearerType, AGpsExtType agpsType,
+ LocApnTypeMask mask)> AgpsAtlOpenStatusCb;
-typedef std::function<void(int handle, int isSuccess)> AgpsAtlCloseStatusCb;
-
-/* DS Client control APIs
- * Passed in by Adapter to AgpsManager */
-typedef std::function<int(bool isDueToSSR)> AgpsDSClientInitFn;
-typedef std::function<int()> AgpsDSClientOpenAndStartDataCallFn;
-typedef std::function<void()> AgpsDSClientStopDataCallFn;
-typedef std::function<void()> AgpsDSClientCloseDataCallFn;
-typedef std::function<void()> AgpsDSClientReleaseFn;
+typedef std::function<void(int handle, int isSuccess)> AgpsAtlCloseStatusCb;
/* Post message to adapter's message queue */
typedef std::function<void(LocMsg* msg)> SendMsgToAdapterMsgQueueFn;
@@ -92,8 +85,6 @@ typedef enum {
class AgpsSubscriber;
class AgpsManager;
class AgpsStateMachine;
-class DSStateMachine;
-
/* SUBSCRIBER
* Each Subscriber instance corresponds to one AGPS request,
@@ -109,12 +100,15 @@ public:
* inactive state. */
bool mWaitForCloseComplete;
bool mIsInactive;
+ LocApnTypeMask mApnTypeMask;
inline AgpsSubscriber(
- int connHandle, bool waitForCloseComplete, bool isInactive) :
+ int connHandle, bool waitForCloseComplete, bool isInactive,
+ LocApnTypeMask apnTypeMask) :
mConnHandle(connHandle),
mWaitForCloseComplete(waitForCloseComplete),
- mIsInactive(isInactive) {}
+ mIsInactive(isInactive),
+ mApnTypeMask(apnTypeMask) {}
inline virtual ~AgpsSubscriber() {}
inline virtual bool equals(const AgpsSubscriber *s) const
@@ -122,7 +116,7 @@ public:
inline virtual AgpsSubscriber* clone()
{ return new AgpsSubscriber(
- mConnHandle, mWaitForCloseComplete, mIsInactive); }
+ mConnHandle, mWaitForCloseComplete, mIsInactive, mApnTypeMask); }
};
/* AGPS STATE MACHINE */
@@ -143,6 +137,7 @@ protected:
/* Current state for this state machine */
AgpsState mState;
+ AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
private:
/* AGPS Type for this state machine
LOC_AGPS_TYPE_ANY 0
@@ -150,6 +145,7 @@ private:
LOC_AGPS_TYPE_WWAN_ANY 3
LOC_AGPS_TYPE_SUPL_ES 5 */
AGpsExtType mAgpsType;
+ LocApnTypeMask mApnTypeMask;
/* APN and IP Type info for AGPS Call */
char* mAPN;
@@ -159,6 +155,7 @@ private:
public:
/* CONSTRUCTOR */
AgpsStateMachine(AgpsManager* agpsManager, AGpsExtType agpsType):
+ mFrameworkStatusV4Cb(NULL),
mAgpsManager(agpsManager), mSubscriberList(),
mCurrentSubscriber(NULL), mState(AGPS_STATE_RELEASED),
mAgpsType(agpsType), mAPN(NULL), mAPNLen(0),
@@ -169,12 +166,21 @@ public:
/* Getter/Setter methods */
void setAPN(char* apn, unsigned int len);
inline char* getAPN() const { return (char*)mAPN; }
+ inline uint32_t getAPNLen() const { return mAPNLen; }
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline LocApnTypeMask getApnTypeMask() const { return mApnTypeMask; }
+ inline void setApnTypeMask(LocApnTypeMask apnTypeMask)
+ { mApnTypeMask = apnTypeMask; }
inline AGpsBearerType getBearer() const { return mBearer; }
+ inline void setType(AGpsExtType type) { mAgpsType = type; }
inline AGpsExtType getType() const { return mAgpsType; }
inline void setCurrentSubscriber(AgpsSubscriber* subscriber)
{ mCurrentSubscriber = subscriber; }
+ inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
+ mFrameworkStatusV4Cb = frameworkStatusV4Cb;
+ }
+
/* Fetch subscriber with specified handle */
AgpsSubscriber* getSubscriber(int connHandle);
@@ -199,7 +205,7 @@ private:
/* Send call setup request to framework
* sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
* sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
- virtual int requestOrReleaseDataConn(bool request);
+ void requestOrReleaseDataConn(bool request);
/* Individual event processing methods */
void processAgpsEventSubscribe();
@@ -227,91 +233,33 @@ private:
void transitionState(AgpsState newState);
};
-/* DS STATE MACHINE */
-class DSStateMachine : public AgpsStateMachine {
-
-private:
- static const int MAX_START_DATA_CALL_RETRIES;
- static const int DATA_CALL_RETRY_DELAY_MSEC;
-
- int mRetries;
-
-public:
- /* CONSTRUCTOR */
- DSStateMachine(AgpsManager* agpsManager):
- AgpsStateMachine(agpsManager, LOC_AGPS_TYPE_SUPL_ES), mRetries(0) {}
-
- /* Overridden method
- * DS SM needs to handle one event differently */
- void processAgpsEvent(AgpsEvent event);
-
- /* Retry callback, used in case call failure */
- void retryCallback();
-
-private:
- /* Overridden method, different functionality for DS SM
- * Send call setup request to framework
- * sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
- * sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
- int requestOrReleaseDataConn(bool request);
-
- /* Overridden method, different functionality for DS SM */
- void notifyEventToSubscriber(
- AgpsEvent event, AgpsSubscriber* subscriber,
- bool deleteSubscriberPostNotify);
-};
-
/* LOC AGPS MANAGER */
class AgpsManager {
friend class AgpsStateMachine;
- friend class DSStateMachine;
-
public:
/* CONSTRUCTOR */
AgpsManager():
- mFrameworkStatusV4Cb(NULL),
mAtlOpenStatusCb(), mAtlCloseStatusCb(),
- mDSClientInitFn(), mDSClientOpenAndStartDataCallFn(),
- mDSClientStopDataCallFn(), mDSClientCloseDataCallFn(), mDSClientReleaseFn(),
- mSendMsgToAdapterQueueFn(),
- mAgnssNif(NULL), mInternetNif(NULL), mDsNif(NULL) {}
+ mAgnssNif(NULL), mInternetNif(NULL)/*, mDsNif(NULL)*/ {}
/* Register callbacks */
inline void registerATLCallbacks(AgpsAtlOpenStatusCb atlOpenStatusCb,
- AgpsAtlCloseStatusCb atlCloseStatusCb,
- AgpsDSClientInitFn dsClientInitFn,
- AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn,
- AgpsDSClientStopDataCallFn dsClientStopDataCallFn,
- AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn,
- AgpsDSClientReleaseFn dsClientReleaseFn,
- SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn) {
+ AgpsAtlCloseStatusCb atlCloseStatusCb) {
mAtlOpenStatusCb = atlOpenStatusCb;
mAtlCloseStatusCb = atlCloseStatusCb;
- mDSClientInitFn = dsClientInitFn;
- mDSClientOpenAndStartDataCallFn = dsClientOpenAndStartDataCallFn;
- mDSClientStopDataCallFn = dsClientStopDataCallFn;
- mDSClientCloseDataCallFn = dsClientCloseDataCallFn;
- mDSClientReleaseFn = dsClientReleaseFn;
- mSendMsgToAdapterQueueFn = sendMsgToAdapterQueueFn;
}
- inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
- mFrameworkStatusV4Cb = frameworkStatusV4Cb;
- }
+ /* Check if AGPS client is registered */
+ inline bool isRegistered() { return nullptr != mAgnssNif || nullptr != mInternetNif; }
/* Create all AGPS state machines */
- void createAgpsStateMachines();
+ void createAgpsStateMachines(const AgpsCbInfo& cbInfo);
/* Process incoming ATL requests */
- void requestATL(int connHandle, AGpsExtType agpsType);
+ void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask apnTypeMask);
void releaseATL(int connHandle);
-
- /* Process incoming DS Client data call events */
- void reportDataCallOpened();
- void reportDataCallClosed();
-
/* Process incoming framework data call events */
void reportAtlOpenSuccess(AGpsExtType agpsType, char* apnName, int apnLen,
AGpsBearerType bearerType);
@@ -322,23 +270,11 @@ public:
void handleModemSSR();
protected:
- AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
-
- AgpsDSClientInitFn mDSClientInitFn;
- AgpsDSClientOpenAndStartDataCallFn mDSClientOpenAndStartDataCallFn;
- AgpsDSClientStopDataCallFn mDSClientStopDataCallFn;
- AgpsDSClientCloseDataCallFn mDSClientCloseDataCallFn;
- AgpsDSClientReleaseFn mDSClientReleaseFn;
-
- SendMsgToAdapterMsgQueueFn mSendMsgToAdapterQueueFn;
-
AgpsStateMachine* mAgnssNif;
AgpsStateMachine* mInternetNif;
- AgpsStateMachine* mDsNif;
-
private:
/* Fetch state machine for handling request ATL call */
AgpsStateMachine* getAgpsStateMachine(AGpsExtType agpsType);
@@ -353,11 +289,12 @@ struct AgpsMsgRequestATL: public LocMsg {
AgpsManager* mAgpsManager;
int mConnHandle;
AGpsExtType mAgpsType;
+ LocApnTypeMask mApnTypeMask;
inline AgpsMsgRequestATL(AgpsManager* agpsManager, int connHandle,
- AGpsExtType agpsType) :
- LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle), mAgpsType(
- agpsType) {
+ AGpsExtType agpsType, LocApnTypeMask apnTypeMask) :
+ LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle),
+ mAgpsType(agpsType), mApnTypeMask(apnTypeMask){
LOC_LOGV("AgpsMsgRequestATL");
}
@@ -365,7 +302,7 @@ struct AgpsMsgRequestATL: public LocMsg {
inline virtual void proc() const {
LOC_LOGV("AgpsMsgRequestATL::proc()");
- mAgpsManager->requestATL(mConnHandle, mAgpsType);
+ mAgpsManager->requestATL(mConnHandle, mAgpsType, mApnTypeMask);
}
};