summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHarikrishnan Hariharan <hahariha@codeaurora.org>2017-09-04 11:55:13 +0530
committerHarikrishnan Hariharan <hahariha@codeaurora.org>2017-09-08 22:38:33 +0530
commitf0d7fe810f46662ae3d876b7b47540c24211be2b (patch)
treee21515ab6108cc63f59318bd9386c4d5ab32f6d4 /core
parent099f9405b1e87bc79dd63b276c14b2fd27df3f4e (diff)
downloadgps-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 'core')
-rw-r--r--core/Makefile.am1
-rw-r--r--core/SystemStatusOsObserver.cpp62
-rw-r--r--core/SystemStatusOsObserver.h14
-rw-r--r--core/observer/IFrameworkActionReq.h18
-rw-r--r--core/observer/IOsObserver.h4
5 files changed, 99 insertions, 0 deletions
diff --git a/core/Makefile.am b/core/Makefile.am
index 4258668..92aaded 100644
--- a/core/Makefile.am
+++ b/core/Makefile.am
@@ -1,5 +1,6 @@
AM_CFLAGS = -I./ \
-I../utils \
+ -I../gnss \
-I../location \
-I./data-items \
-I./data-items/common \
diff --git a/core/SystemStatusOsObserver.cpp b/core/SystemStatusOsObserver.cpp
index 319f1d7..dc08a76 100644
--- a/core/SystemStatusOsObserver.cpp
+++ b/core/SystemStatusOsObserver.cpp
@@ -41,6 +41,9 @@ namespace loc_core
{
SystemStatusOsObserver::SystemStatusOsObserver(const MsgTask* msgTask) :
mAddress("SystemStatusOsObserver"),
+#ifdef USE_GLIB
+ mBackHaulConnectReqCount(0),
+#endif
mClientIndex(IndexFactory<IDataItemObserver*, DataItemId> :: createClientIndex()),
mDataItemIndex(IndexFactory<IDataItemObserver*, DataItemId> :: createDataItemIndex())
{
@@ -506,6 +509,65 @@ void SystemStatusOsObserver::turnOff(DataItemId dit)
}
}
+#ifdef USE_GLIB
+bool SystemStatusOsObserver::connectBackhaul()
+{
+ bool result = false;
+
+ if (mContext.mFrameworkActionReqObj != NULL) {
+ struct HandleConnectBackhaul : public LocMsg {
+ HandleConnectBackhaul(IFrameworkActionReq* fwkActReq) :
+ mFwkActionReqObj(fwkActReq) {}
+ virtual ~HandleConnectBackhaul() {}
+ void proc() const {
+ LOC_LOGD("HandleConnectBackhaul");
+ mFwkActionReqObj->connectBackhaul();
+ }
+ IFrameworkActionReq* mFwkActionReqObj;
+ };
+ mContext.mMsgTask->sendMsg(
+ new (nothrow) HandleConnectBackhaul(mContext.mFrameworkActionReqObj));
+ result = true;
+ }
+ else {
+ ++mBackHaulConnectReqCount;
+ LOC_LOGE("Framework action request object is NULL.Caching connect request: %d",
+ mBackHaulConnectReqCount);
+ result = false;
+ }
+ return result;
+
+}
+
+bool SystemStatusOsObserver::disconnectBackhaul()
+{
+ bool result = false;
+
+ if (mContext.mFrameworkActionReqObj != NULL) {
+ struct HandleDisconnectBackhaul : public LocMsg {
+ HandleDisconnectBackhaul(IFrameworkActionReq* fwkActReq) :
+ mFwkActionReqObj(fwkActReq) {}
+ virtual ~HandleDisconnectBackhaul() {}
+ void proc() const {
+ LOC_LOGD("HandleDisconnectBackhaul");
+ mFwkActionReqObj->disconnectBackhaul();
+ }
+ IFrameworkActionReq* mFwkActionReqObj;
+ };
+ mContext.mMsgTask->sendMsg(
+ new (nothrow) HandleDisconnectBackhaul(mContext.mFrameworkActionReqObj));
+ }
+ else {
+ if (mBackHaulConnectReqCount > 0) {
+ --mBackHaulConnectReqCount;
+ }
+ LOC_LOGE("Framework action request object is NULL.Caching disconnect request: %d",
+ mBackHaulConnectReqCount);
+ result = false;
+ }
+ return result;
+}
+#endif
/******************************************************************************
Helpers
******************************************************************************/
diff --git a/core/SystemStatusOsObserver.h b/core/SystemStatusOsObserver.h
index 985e5c9..6892f22 100644
--- a/core/SystemStatusOsObserver.h
+++ b/core/SystemStatusOsObserver.h
@@ -85,6 +85,12 @@ public:
// To set the framework action request object
inline void setFrameworkActionReqObj(IFrameworkActionReq* frameworkActionReqObj) {
mContext.mFrameworkActionReqObj = frameworkActionReqObj;
+#ifdef USE_GLIB
+ if (mBackHaulConnectReqCount > 0) {
+ connectBackhaul();
+ mBackHaulConnectReqCount = 0;
+ }
+#endif
}
// IDataItemSubscription Overrides
@@ -103,6 +109,10 @@ public:
// IFrameworkActionReq Overrides
virtual void turnOn(DataItemId dit, int timeOut = 0);
virtual void turnOff(DataItemId dit);
+#ifdef USE_GLIB
+ virtual bool connectBackhaul();
+ virtual bool disconnectBackhaul();
+#endif
private:
SystemContext mContext;
@@ -117,6 +127,10 @@ private:
ObserverReqCache mReqDataCache;
void cacheObserverRequest(ObserverReqCache& reqCache,
const list<DataItemId>& l, IDataItemObserver* client);
+#ifdef USE_GLIB
+ // Cache the framework action request for connect/disconnect
+ int mBackHaulConnectReqCount;
+#endif
// Helpers
void sendFirstResponse(const list<DataItemId>& l, IDataItemObserver* to);
diff --git a/core/observer/IFrameworkActionReq.h b/core/observer/IFrameworkActionReq.h
index c7b3ebd..4be947f 100644
--- a/core/observer/IFrameworkActionReq.h
+++ b/core/observer/IFrameworkActionReq.h
@@ -70,6 +70,24 @@ public:
*/
virtual void turnOff (DataItemId dit) = 0;
+#ifdef USE_GLIB
+ /**
+ * @brief Setup WWAN backhaul
+ * @details Setup WWAN backhaul
+ *
+ * @param None
+ */
+ virtual bool connectBackhaul() = 0;
+
+ /**
+ * @brief Disconnects the WWANbackhaul
+ * @details Disconnects the WWANbackhaul, only if it was setup by us
+ *
+ * @param None
+ */
+ virtual bool disconnectBackhaul() = 0;
+#endif
+
/**
* @brief Destructor
* @details Destructor
diff --git a/core/observer/IOsObserver.h b/core/observer/IOsObserver.h
index 3db8a85..40d7671 100644
--- a/core/observer/IOsObserver.h
+++ b/core/observer/IOsObserver.h
@@ -90,6 +90,10 @@ public:
// IFrameworkActionReq Overrides
inline virtual void turnOn (DataItemId /*dit*/, int /*timeOut*/){}
inline virtual void turnOff (DataItemId /*dit*/) {}
+#ifdef USE_GLIB
+ inline virtual bool connectBackhaul() {}
+ inline virtual bool disconnectBackhaul() {}
+#endif
/**
* @brief Destructor