diff options
author | Harikrishnan Hariharan <hahariha@codeaurora.org> | 2017-09-04 11:55:13 +0530 |
---|---|---|
committer | Harikrishnan Hariharan <hahariha@codeaurora.org> | 2017-09-08 22:38:33 +0530 |
commit | f0d7fe810f46662ae3d876b7b47540c24211be2b (patch) | |
tree | e21515ab6108cc63f59318bd9386c4d5ab32f6d4 /gnss/XtraSystemStatusObserver.h | |
parent | 099f9405b1e87bc79dd63b276c14b2fd27df3f4e (diff) | |
download | gps-f0d7fe810f46662ae3d876b7b47540c24211be2b.tar.gz |
Xtra client interfacing with LocNetIface in LE
Interfacing LocnetIface with Xtra client for wwan/supl call
setup and teardown.
- XtraSystemStatusObserver must listen to connect/teardown wwan
call requests from xtra-daemon on the HAL side socket. This
request is then processed by libloc_net_iface module on LE.
- Caching the connect and disconnect backhaul requests received
before framework action request object is obtained.
Change-Id: I7cb6751efc64b27726b5d28be9a3df7b1bfb3d76
CRs-Fixed: 2092215
Diffstat (limited to 'gnss/XtraSystemStatusObserver.h')
-rw-r--r-- | gnss/XtraSystemStatusObserver.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gnss/XtraSystemStatusObserver.h b/gnss/XtraSystemStatusObserver.h index 42f49b5..6a001d9 100644 --- a/gnss/XtraSystemStatusObserver.h +++ b/gnss/XtraSystemStatusObserver.h @@ -31,17 +31,72 @@ #include <cinttypes> #include <MsgTask.h> +#ifdef USE_GLIB +#include <LocThread.h> +#endif using namespace std; using loc_core::IOsObserver; using loc_core::IDataItemObserver; using loc_core::IDataItemCore; +#ifdef USE_GLIB +// XtraHalListenerSocket class +// listener socket for getting msgs from xtra-daemon in LE for invoking +// LocNetIface functions +// TBD - this will be removed once bidirectional socket changes in +// xtra-daemon will be implemented +class XtraHalListenerSocket: public LocRunnable { +public : + // constructor & destructor + XtraHalListenerSocket(IOsObserver* sysStatObs) : + mThread(NULL), + mRunning(false) { + mSystemStatusObsrvr = sysStatObs; + mRunning = true; + // create listener socket in a thread + startListenerThread(); + } + XtraHalListenerSocket() {} + inline virtual ~XtraHalListenerSocket() { + if (mThread) { + stopListenXtraDaemon(); + delete mThread; + mThread = NULL; + } + } + + // Overrides of LocRunnable methods + // This method will be repeated called until it returns false; or + // until thread is stopped. + virtual bool run(); + + // The method to be run before thread loop (conditionally repeatedly) + // calls run() + inline virtual void prerun() {} + + // The method to be run after thread loop (conditionally repeatedly) + // calls run() + inline virtual void postrun() {} + +private: + IOsObserver* mSystemStatusObsrvr; + int mSocketFd; + LocThread* mThread; + bool mRunning; + void startListenerThread(); + void stopListenXtraDaemon(); + void receiveData(const int socketFd); +}; +#endif class XtraSystemStatusObserver : public IDataItemObserver { public : // constructor & destructor inline XtraSystemStatusObserver(IOsObserver* sysStatObs, const MsgTask* msgTask): +#ifdef USE_GLIB + mHalListenerSocket(sysStatObs), +#endif mSystemStatusObsrvr(sysStatObs), mMsgTask(msgTask) { subscribe(true); } @@ -52,6 +107,12 @@ public : inline virtual void getName(string& name); virtual void notify(const list<IDataItemCore*>& dlist); +#ifdef USE_GLIB + // IFrameworkActionReq functions reqd + virtual bool connectBackhaul(); + virtual bool disconnectBackhaul(); +#endif + bool updateLockStatus(uint32_t lock); bool updateConnectionStatus(bool connected, uint32_t type); bool updateTac(const string& tac); @@ -65,6 +126,12 @@ private: bool sendEvent(const stringstream& event); IOsObserver* mSystemStatusObsrvr; const MsgTask* mMsgTask; +#ifdef USE_GLIB + // XtraHalListenerSocket class + // TBD - this will be removed once bidirectional socket changes in + // xtra-daemon will be implemented + XtraHalListenerSocket mHalListenerSocket; +#endif }; |