summaryrefslogtreecommitdiff
path: root/gps/gnss/XtraSystemStatusObserver.h
diff options
context:
space:
mode:
authorIsaac Chen <isaacchen@isaacchen.cn>2018-07-13 10:12:35 +0800
committerIsaac Chen <isaacchen@isaacchen.cn>2018-07-13 00:03:17 +0000
commit6a15b2379f90ba4f9222fea0a5f8c12e8cecbae5 (patch)
tree6b1789235069c986567127aa57a51bbe4122e5ee /gps/gnss/XtraSystemStatusObserver.h
parent71ad0c9e5399aba0ac3cd20f1df41c9757cd6ca5 (diff)
wayne: Import GPS
* QC Tag: LA.UM.6.2.r1-06100-sdm660.0 Change-Id: I26da3b90caa473ed5f88408627463ec7f7655f23 Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn>
Diffstat (limited to 'gps/gnss/XtraSystemStatusObserver.h')
-rw-r--r--gps/gnss/XtraSystemStatusObserver.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/gps/gnss/XtraSystemStatusObserver.h b/gps/gnss/XtraSystemStatusObserver.h
new file mode 100644
index 0000000..42f49b5
--- /dev/null
+++ b/gps/gnss/XtraSystemStatusObserver.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2017, 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
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef XTRA_SYSTEM_STATUS_OBS_H
+#define XTRA_SYSTEM_STATUS_OBS_H
+
+#include <cinttypes>
+#include <MsgTask.h>
+
+using namespace std;
+using loc_core::IOsObserver;
+using loc_core::IDataItemObserver;
+using loc_core::IDataItemCore;
+
+
+class XtraSystemStatusObserver : public IDataItemObserver {
+public :
+ // constructor & destructor
+ inline XtraSystemStatusObserver(IOsObserver* sysStatObs, const MsgTask* msgTask):
+ mSystemStatusObsrvr(sysStatObs), mMsgTask(msgTask) {
+ subscribe(true);
+ }
+ inline XtraSystemStatusObserver() {};
+ inline virtual ~XtraSystemStatusObserver() { subscribe(false); }
+
+ // IDataItemObserver overrides
+ inline virtual void getName(string& name);
+ virtual void notify(const list<IDataItemCore*>& dlist);
+
+ bool updateLockStatus(uint32_t lock);
+ bool updateConnectionStatus(bool connected, uint32_t type);
+ bool updateTac(const string& tac);
+ bool updateMccMnc(const string& mccmnc);
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ void subscribe(bool yes);
+
+private:
+ int createSocket();
+ void closeSocket(const int32_t socketFd);
+ bool sendEvent(const stringstream& event);
+ IOsObserver* mSystemStatusObsrvr;
+ const MsgTask* mMsgTask;
+
+};
+
+#endif