summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Chen <isaacchen@isaacchen.cn>2018-12-31 10:55:08 +0100
committerTingyiChen <tingyi364@gmail.com>2019-08-13 11:54:40 +0200
commite5c53750f06e9d9739b45ec108260ead7ff80941 (patch)
treefe1d84884caefc481e994ae9c59c84b11fddd408
parent3ac2a0309619515c9ac27a5b6ec7c212b86dc355 (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
-rw-r--r--gps/Android.mk1
-rw-r--r--gps/Makefile.am2
-rw-r--r--gps/android/AGnss.cpp31
-rw-r--r--gps/android/AGnss.h12
-rw-r--r--gps/android/AGnssRil.cpp6
-rw-r--r--gps/android/AGnssRil.h6
-rw-r--r--gps/android/Android.mk17
-rw-r--r--gps/android/Gnss.cpp146
-rw-r--r--gps/android/Gnss.h75
-rw-r--r--gps/android/GnssBatching.cpp6
-rw-r--r--gps/android/GnssBatching.h6
-rw-r--r--gps/android/GnssConfiguration.cpp14
-rw-r--r--gps/android/GnssConfiguration.h14
-rw-r--r--gps/android/GnssDebug.cpp61
-rw-r--r--gps/android/GnssDebug.h4
-rw-r--r--gps/android/GnssGeofencing.cpp6
-rw-r--r--gps/android/GnssGeofencing.h6
-rw-r--r--gps/android/GnssMeasurement.cpp42
-rw-r--r--gps/android/GnssMeasurement.h25
-rw-r--r--gps/android/GnssNi.cpp6
-rw-r--r--gps/android/GnssNi.h6
-rw-r--r--gps/android/android.hardware.gnss@1.1-service-qti.rc (renamed from gps/android/android.hardware.gnss@1.0-service-qti.rc)2
-rw-r--r--gps/android/location_api/BatchingAPIClient.cpp13
-rw-r--r--gps/android/location_api/BatchingAPIClient.h15
-rw-r--r--gps/android/location_api/GeofenceAPIClient.cpp10
-rw-r--r--gps/android/location_api/GeofenceAPIClient.h10
-rw-r--r--gps/android/location_api/GnssAPIClient.cpp25
-rw-r--r--gps/android/location_api/GnssAPIClient.h32
-rw-r--r--gps/android/location_api/LocationUtil.cpp43
-rw-r--r--gps/android/location_api/LocationUtil.h11
-rw-r--r--gps/android/location_api/MeasurementAPIClient.cpp78
-rw-r--r--gps/android/location_api/MeasurementAPIClient.h20
-rw-r--r--gps/android/service.cpp8
-rw-r--r--gps/build/target_specific_features.mk17
-rw-r--r--gps/configure.ac34
-rw-r--r--gps/core/Android.mk8
-rw-r--r--gps/core/ContextBase.cpp6
-rw-r--r--gps/core/ContextBase.h5
-rw-r--r--gps/core/LocAdapterBase.cpp6
-rw-r--r--gps/core/LocAdapterBase.h1
-rw-r--r--gps/core/LocApiBase.cpp30
-rw-r--r--gps/core/LocApiBase.h5
-rw-r--r--gps/core/LocDualContext.cpp2
-rw-r--r--gps/core/Makefile.am18
-rw-r--r--gps/core/SystemStatus.cpp228
-rw-r--r--gps/core/SystemStatus.h91
-rw-r--r--gps/core/SystemStatusOsObserver.cpp690
-rw-r--r--gps/core/SystemStatusOsObserver.h109
-rw-r--r--gps/core/configure.ac (renamed from gps/utils/platform_lib_abstractions/loc_pla/configure.ac)39
-rw-r--r--gps/core/data-items/DataItemConcreteTypesBase.h83
-rw-r--r--gps/core/data-items/DataItemId.h8
-rw-r--r--gps/core/data-items/DataItemsFactoryProxy.cpp5
-rw-r--r--gps/core/data-items/common/ClientIndex.cpp171
-rw-r--r--gps/core/data-items/common/ClientIndex.h70
-rw-r--r--gps/core/data-items/common/DataItemIndex.cpp202
-rw-r--r--gps/core/data-items/common/DataItemIndex.h70
-rw-r--r--gps/core/data-items/common/IClientIndex.h83
-rw-r--r--gps/core/data-items/common/IDataItemIndex.h94
-rw-r--r--gps/core/data-items/common/IndexFactory.cpp64
-rw-r--r--gps/core/data-items/common/IndexFactory.h48
-rw-r--r--gps/core/loc-core.pc.in10
-rw-r--r--gps/core/loc_core_log.cpp23
-rw-r--r--gps/core/observer/IFrameworkActionReq.h18
-rw-r--r--gps/core/observer/IOsObserver.h4
-rw-r--r--gps/etc/gps.conf14
-rw-r--r--gps/gnss/Agps.cpp2
-rw-r--r--gps/gnss/Agps.h20
-rw-r--r--gps/gnss/Android.mk1
-rw-r--r--gps/gnss/GnssAdapter.cpp546
-rw-r--r--gps/gnss/GnssAdapter.h56
-rw-r--r--gps/gnss/Makefile.am84
-rw-r--r--gps/gnss/XtraSystemStatusObserver.cpp146
-rw-r--r--gps/gnss/XtraSystemStatusObserver.h44
-rw-r--r--gps/gnss/location_gnss.cpp33
-rw-r--r--gps/gnsspps/Android.mk36
-rw-r--r--gps/gnsspps/Makefile.am37
-rw-r--r--gps/gnsspps/configure.ac (renamed from gps/utils/platform_lib_abstractions/loc_stub/configure.ac)27
-rw-r--r--gps/gnsspps/gnsspps.c194
-rw-r--r--gps/gnsspps/gnsspps.h (renamed from gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h)21
-rw-r--r--gps/gnsspps/gnsspps.pc.in10
-rw-r--r--gps/gnsspps/timepps.h106
-rw-r--r--gps/loc-hal.pc.in4
-rw-r--r--gps/location/Android.mk1
-rw-r--r--gps/location/LocationAPI.cpp3
-rw-r--r--gps/location/LocationAPIClientBase.cpp39
-rw-r--r--gps/location/LocationAPIClientBase.h19
-rw-r--r--gps/location/Makefile.am22
-rw-r--r--gps/location/configure.ac82
-rw-r--r--gps/location/location-api.pc.in10
-rw-r--r--gps/location/location_interface.h5
-rw-r--r--gps/pla/Android.mk30
-rw-r--r--gps/pla/android/loc_pla.h (renamed from gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h)30
-rw-r--r--gps/pla/oe/loc_pla.h (renamed from gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h)55
-rw-r--r--gps/utils/Android.mk10
-rw-r--r--gps/utils/LocIpc.cpp237
-rw-r--r--gps/utils/LocIpc.h153
-rw-r--r--gps/utils/LocThread.cpp2
-rw-r--r--gps/utils/LocTimer.cpp5
-rw-r--r--gps/utils/LocTimer.h2
-rw-r--r--gps/utils/LocUnorderedSetMap.h192
-rw-r--r--gps/utils/Makefile.am46
-rw-r--r--gps/utils/MsgTask.cpp5
-rw-r--r--gps/utils/configure.ac29
-rw-r--r--gps/utils/gps-utils.pc.in2
-rw-r--r--gps/utils/gps_extended_c.h58
-rw-r--r--gps/utils/linked_list.c7
-rw-r--r--gps/utils/loc_cfg.cpp755
-rw-r--r--gps/utils/loc_cfg.h53
-rw-r--r--gps/utils/loc_log.cpp3
-rw-r--r--gps/utils/loc_misc_utils.cpp2
-rw-r--r--gps/utils/loc_nmea.cpp110
-rw-r--r--gps/utils/loc_target.cpp20
-rw-r--r--gps/utils/loc_target.h6
-rw-r--r--gps/utils/loc_timer.h3
-rw-r--r--gps/utils/log_util.h16
-rw-r--r--gps/utils/msg_q.c8
-rw-r--r--gps/utils/platform_lib_abstractions/Android.mk5
-rw-r--r--gps/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp46
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/Android.mk5
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/Makefile.am10
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h45
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h39
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h174
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h85
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h46
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h36
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in10
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/src/Android.mk67
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/src/Makefile.am39
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp46
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp81
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp39
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp41
-rw-r--r--gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp59
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/Android.mk5
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/Makefile.am9
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h45
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h42
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h46
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in10
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/src/Android.mk49
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/src/Makefile.am40
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp41
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp37
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp42
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp50
-rw-r--r--gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp55
-rw-r--r--wayne.mk5
148 files changed, 4173 insertions, 3578 deletions
diff --git a/gps/Android.mk b/gps/Android.mk
index e2c5a56..23b2a66 100644
--- a/gps/Android.mk
+++ b/gps/Android.mk
@@ -1,5 +1,6 @@
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
LOCAL_PATH := $(call my-dir)
+include $(LOCAL_PATH)/build/target_specific_features.mk
include $(call all-makefiles-under,$(LOCAL_PATH))
endif
diff --git a/gps/Makefile.am b/gps/Makefile.am
index f64790e..cd4a731 100644
--- a/gps/Makefile.am
+++ b/gps/Makefile.am
@@ -3,7 +3,7 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = core location gnss
+SUBDIRS = gnss
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = loc-hal.pc
diff --git a/gps/android/AGnss.cpp b/gps/android/AGnss.cpp
index 6213a08..fe50c9a 100644
--- a/gps/android/AGnss.cpp
+++ b/gps/android/AGnss.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,15 +27,26 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
-sp<IAGnssCallback> AGnss::sAGnssCbIface = nullptr;
+static AGnss* spAGnss = nullptr;
AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
+ spAGnss = this;
+}
+
+AGnss::~AGnss() {
+ spAGnss = nullptr;
}
void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){
+ if (nullptr != spAGnss) {
+ spAGnss->statusIpV4Cb(status);
+ }
+}
+
+void AGnss::statusIpV4Cb(AGnssExtStatusIpV4 status) {
IAGnssCallback::AGnssStatusIpV4 st = {};
switch (status.type) {
@@ -72,9 +83,13 @@ void AGnss::agnssStatusIpV4Cb(AGnssExtStatusIpV4 status){
}
st.ipV4Addr = status.ipV4Addr;
- auto r = sAGnssCbIface->agnssStatusIpV4Cb(st);
- if (!r.isOk()) {
- LOC_LOGE("Error invoking AGNSS status cb %s", r.description().c_str());
+ if (mAGnssCbIface != nullptr) {
+ auto r = mAGnssCbIface->agnssStatusIpV4Cb(st);
+ if (!r.isOk()) {
+ LOC_LOGw("Error invoking AGNSS status cb %s", r.description().c_str());
+ }
+ } else {
+ LOC_LOGw("setCallback has not been called yet");
}
}
@@ -86,7 +101,7 @@ Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
}
// Save the interface
- sAGnssCbIface = callback;
+ mAGnssCbIface = callback;
AgpsCbInfo cbInfo = {};
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
@@ -182,7 +197,7 @@ Return<bool> AGnss::setServer(IAGnssCallback::AGnssType type,
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/AGnss.h b/gps/android/AGnss.h
index a3f4a87..4b599b9 100644
--- a/gps/android/AGnss.h
+++ b/gps/android/AGnss.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -28,7 +28,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnss;
@@ -43,7 +43,7 @@ struct Gnss;
struct AGnss : public IAGnss {
AGnss(Gnss* gnss);
- ~AGnss() = default;
+ ~AGnss();
/*
* Methods from ::android::hardware::gnss::V1_0::IAGnss interface follow.
* These declarations were generated from IAGnss.hal.
@@ -60,16 +60,18 @@ struct AGnss : public IAGnss {
Return<bool> setServer(IAGnssCallback::AGnssType type,
const hidl_string& hostname, int32_t port) override;
+ void statusIpV4Cb(AGnssExtStatusIpV4 status);
+
/* Data call setup callback passed down to GNSS HAL implementation */
static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
private:
Gnss* mGnss = nullptr;
- static sp<IAGnssCallback> sAGnssCbIface;
+ sp<IAGnssCallback> mAGnssCbIface = nullptr;
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/AGnssRil.cpp b/gps/android/AGnssRil.cpp
index d790bae..10478aa 100644
--- a/gps/android/AGnssRil.cpp
+++ b/gps/android/AGnssRil.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -36,7 +36,7 @@ typedef void* (getLocationInterface)();
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
@@ -87,7 +87,7 @@ Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/AGnssRil.h b/gps/android/AGnssRil.h
index 61216d8..5c9298a 100644
--- a/gps/android/AGnssRil.h
+++ b/gps/android/AGnssRil.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -28,7 +28,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnssRil;
@@ -75,7 +75,7 @@ struct AGnssRil : public IAGnssRil {
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/Android.mk b/gps/android/Android.mk
index 18845ef..4f1cdf2 100644
--- a/gps/android/Android.mk
+++ b/gps/android/Android.mk
@@ -1,9 +1,8 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
+LOCAL_MODULE := android.hardware.gnss@1.1-impl-qti
LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
AGnss.cpp \
@@ -36,14 +35,15 @@ LOCAL_SHARED_LIBRARIES := \
libhidlbase \
libhidltransport \
libhwbinder \
+ libcutils \
libutils \
android.hardware.gnss@1.0 \
+ android.hardware.gnss@1.1 \
LOCAL_SHARED_LIBRARIES += \
libloc_core \
libgps.utils \
libdl \
- libloc_pla \
liblocation_api \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
@@ -52,20 +52,16 @@ include $(BUILD_SHARED_LIBRARY)
BUILD_GNSS_HIDL_SERVICE := true
ifneq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET), true)
ifneq ($(LW_FEATURE_SET),true)
-ifneq ($(TARGET_HAS_LOW_RAM),true)
BUILD_GNSS_HIDL_SERVICE := false
-endif # TARGET_HAS_LOW_RAM
endif # LW_FEATURE_SET
endif # BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET
ifeq ($(BUILD_GNSS_HIDL_SERVICE), true)
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
-LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc
+LOCAL_MODULE := android.hardware.gnss@1.1-service-qti
LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_INIT_RC := android.hardware.gnss@1.1-service-qti.rc
LOCAL_SRC_FILES := \
service.cpp \
@@ -90,6 +86,7 @@ LOCAL_SHARED_LIBRARIES += \
libhidlbase \
libhidltransport \
android.hardware.gnss@1.0 \
+ android.hardware.gnss@1.1 \
LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_EXECUTABLE)
diff --git a/gps/android/Gnss.cpp b/gps/android/Gnss.cpp
index e3fd64e..de1430c 100644
--- a/gps/android/Gnss.cpp
+++ b/gps/android/Gnss.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -20,17 +20,61 @@
#define LOG_TAG "LocSvc_GnssInterface"
+#include <fstream>
#include <log_util.h>
#include <dlfcn.h>
+#include <cutils/properties.h>
#include "Gnss.h"
+#include <LocationUtil.h>
+
typedef void* (getLocationInterface)();
+#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
+#define DELIMITER ";"
+
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
+static std::string getVersionString() {
+ static std::string version;
+ if (!version.empty())
+ return version;
+
+ char value[PROPERTY_VALUE_MAX] = {0};
+ property_get("ro.hardware", value, "unknown");
+ version.append(value).append(DELIMITER);
+
+ std::ifstream in(IMAGES_INFO_FILE);
+ std::string s;
+ while(getline(in, s)) {
+ std::size_t found = s.find("CRM:");
+ if (std::string::npos == found) {
+ continue;
+ }
+
+ // skip over space characters after "CRM:"
+ const char* substr = s.c_str();
+ found += 4;
+ while (0 != substr[found] && isspace(substr[found])) {
+ found++;
+ }
+ if (s.find("11:") != found) {
+ continue;
+ }
+ s.erase(0, found + 3);
+
+ found = s.find_first_of("\r\n");
+ if (std::string::npos != found) {
+ s.erase(s.begin() + found, s.end());
+ }
+ version.append(s).append(DELIMITER);
+ }
+ return version;
+}
+
void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who);
@@ -107,7 +151,7 @@ GnssInterface* Gnss::getGnssInterface() {
return mGnssInterface;
}
-Return<bool> Gnss::setCallback(const sp<IGnssCallback>& callback) {
+Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW();
if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
@@ -251,7 +295,7 @@ Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
}
}
-Return<void> Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
+Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
ENTRY_LOG_CALLFLOW();
GnssAPIClient* api = getApi();
if (api) {
@@ -260,8 +304,8 @@ Return<void> Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
return Void();
}
-Return<bool> Gnss::setPositionMode(IGnss::GnssPositionMode mode,
- IGnss::GnssPositionRecurrence recurrence,
+Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) {
@@ -275,52 +319,122 @@ Return<bool> Gnss::setPositionMode(IGnss::GnssPositionMode mode,
return retVal;
}
-Return<sp<IAGnss>> Gnss::getExtensionAGnss() {
+Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
ENTRY_LOG_CALLFLOW();
mAGnssIface = new AGnss(this);
return mAGnssIface;
}
-Return<sp<IGnssNi>> Gnss::getExtensionGnssNi() {
+Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
ENTRY_LOG_CALLFLOW();
mGnssNi = new GnssNi(this);
return mGnssNi;
}
-Return<sp<IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
ENTRY_LOG_CALLFLOW();
- mGnssMeasurement = new GnssMeasurement();
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement;
}
-Return<sp<IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
ENTRY_LOG_CALLFLOW();
mGnssConfig = new GnssConfiguration(this);
return mGnssConfig;
}
-Return<sp<IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
ENTRY_LOG_CALLFLOW();
mGnssGeofencingIface = new GnssGeofencing();
return mGnssGeofencingIface;
}
-Return<sp<IGnssBatching>> Gnss::getExtensionGnssBatching() {
+Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
mGnssBatching = new GnssBatching();
return mGnssBatching;
}
-Return<sp<IGnssDebug>> Gnss::getExtensionGnssDebug() {
+Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
ENTRY_LOG_CALLFLOW();
mGnssDebug = new GnssDebug(this);
return mGnssDebug;
}
-Return<sp<IAGnssRil>> Gnss::getExtensionAGnssRil() {
+Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
mGnssRil = new AGnssRil(this);
return mGnssRil;
}
+// Methods from ::android::hardware::gnss::V1_1::IGnss follow.
+Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+ callback->gnssNameCb(getVersionString());
+ mGnssCbIface_1_1 = callback;
+ GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
+ odcpiRequestCb(odcpiRequest);
+ };
+ gnssInterface->odcpiInit(cb);
+ }
+ return setCallback(callback);
+}
+
+Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs,
+ bool /*lowPowerMode*/) {
+ ENTRY_LOG_CALLFLOW();
+ return setPositionMode(mode, recurrence, minIntervalMs,
+ preferredAccuracyMeters, preferredTimeMs);
+}
+
+Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+}
+
+Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssConfig == nullptr)
+ mGnssConfig = new GnssConfiguration(this);
+ return mGnssConfig;
+}
+
+Return<bool> Gnss::injectBestLocation(const GnssLocation& gnssLocation) {
+ ENTRY_LOG_CALLFLOW();
+ GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ Location location = {};
+ convertGnssLocation(gnssLocation, location);
+ gnssInterface->odcpiInject(location);
+ }
+ return true;
+}
+
+void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssCbIface_1_1 != nullptr) {
+ // For emergency mode, request DBH (Device based hybrid) location
+ // Mark Independent from GNSS flag to false.
+ if (ODCPI_REQUEST_TYPE_START == request.type) {
+ auto r = mGnssCbIface_1_1->gnssRequestLocationCb(!request.isEmergencyMode);
+ if (!r.isOk()) {
+ LOC_LOGe("Error invoking gnssRequestLocationCb %s", r.description().c_str());
+ }
+ } else {
+ LOC_LOGv("Unsupported ODCPI request type: %d", request.type);
+ }
+ } else {
+ LOC_LOGe("ODCPI request not supported.");
+ }
+}
+
IGnss* HIDL_FETCH_IGnss(const char* hal) {
ENTRY_LOG_CALLFLOW();
IGnss* iface = nullptr;
@@ -332,7 +446,7 @@ IGnss* HIDL_FETCH_IGnss(const char* hal) {
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/Gnss.h b/gps/android/Gnss.h
index e4589d6..4c0c8b0 100644
--- a/gps/android/Gnss.h
+++ b/gps/android/Gnss.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018-2018-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -30,7 +30,8 @@
#include <GnssNi.h>
#include <GnssDebug.h>
-#include <android/hardware/gnss/1.0/IGnss.h>
+#include <android/hardware/gnss/1.1/IGnss.h>
+#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <GnssAPIClient.h>
@@ -39,37 +40,27 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
using ::android::sp;
+using ::android::hardware::gnss::V1_0::GnssLocation;
struct Gnss : public IGnss {
Gnss();
~Gnss();
- // registerAsService will call interfaceChain to determine the version of service
- /* comment this out until we know really how to manipulate hidl version
- using interfaceChain_cb = std::function<
- void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
- virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override {
- _hidl_cb({
- "android.hardware.gnss@1.1::IGnss",
- ::android::hidl::base::V1_0::IBase::descriptor,
- });
- return ::android::hardware::Void();
- }
- */
-
/*
* Methods from ::android::hardware::gnss::V1_0::IGnss follow.
* These declarations were generated from Gnss.hal.
*/
- Return<bool> setCallback(const sp<IGnssCallback>& callback) override;
+ Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
Return<bool> start() override;
Return<bool> stop() override;
Return<void> cleanup() override;
@@ -79,30 +70,40 @@ struct Gnss : public IGnss {
Return<bool> injectTime(int64_t timeMs,
int64_t timeReferenceMs,
int32_t uncertaintyMs) override;
- Return<void> deleteAidingData(IGnss::GnssAidingData aidingDataFlags) override;
- Return<bool> setPositionMode(IGnss::GnssPositionMode mode,
- IGnss::GnssPositionRecurrence recurrence,
+ Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
+ Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) override;
- Return<sp<IAGnss>> getExtensionAGnss() override;
- Return<sp<IGnssNi>> getExtensionGnssNi() override;
- Return<sp<IGnssMeasurement>> getExtensionGnssMeasurement() override;
- Return<sp<IGnssConfiguration>> getExtensionGnssConfiguration() override;
- Return<sp<IGnssGeofencing>> getExtensionGnssGeofencing() override;
- Return<sp<IGnssBatching>> getExtensionGnssBatching() override;
+ Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
+ Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
+ Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
+ Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
+ Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
+ Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
- Return<sp<IAGnssRil>> getExtensionAGnssRil() override;
+ Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
- inline Return<sp<IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
+ inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
return nullptr;
}
- inline Return<sp<IGnssXtra>> getExtensionXtra() override {
+ inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
return nullptr;
}
- Return<sp<IGnssDebug>> getExtensionGnssDebug() override;
+ Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
+
+ // Methods from ::android::hardware::gnss::V1_1::IGnss follow.
+ Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override;
+ Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs, bool lowPowerMode) override;
+ Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override;
+ Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override;
+ Return<bool> injectBestLocation(const GnssLocation& location) override;
// These methods are not part of the IGnss base class.
GnssAPIClient* getApi();
@@ -110,6 +111,9 @@ struct Gnss : public IGnss {
Return<bool> updateConfiguration(GnssConfig& gnssConfig);
GnssInterface* getGnssInterface();
+ // Callback for ODCPI request
+ void odcpiRequestCb(const OdcpiRequestInfo& request);
+
private:
struct GnssDeathRecipient : hidl_death_recipient {
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
@@ -132,8 +136,9 @@ struct Gnss : public IGnss {
sp<AGnssRil> mGnssRil = nullptr;
GnssAPIClient* mApi = nullptr;
- sp<IGnssCallback> mGnssCbIface = nullptr;
- sp<IGnssNiCallback> mGnssNiCbIface = nullptr;
+ sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
+ sp<V1_1::IGnssCallback> mGnssCbIface_1_1 = nullptr;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
GnssConfig mPendingConfig;
GnssInterface* mGnssInterface = nullptr;
};
@@ -141,7 +146,7 @@ struct Gnss : public IGnss {
extern "C" IGnss* HIDL_FETCH_IGnss(const char* name);
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssBatching.cpp b/gps/android/GnssBatching.cpp
index 6ffadc9..9701aff 100644
--- a/gps/android/GnssBatching.cpp
+++ b/gps/android/GnssBatching.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,7 +27,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
void GnssBatching::GnssBatchingDeathRecipient::serviceDied(
@@ -124,7 +124,7 @@ Return<void> GnssBatching::cleanup() {
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssBatching.h b/gps/android/GnssBatching.h
index de5d5c3..8e235d8 100644
--- a/gps/android/GnssBatching.h
+++ b/gps/android/GnssBatching.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -28,7 +28,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssBatching;
@@ -72,7 +72,7 @@ struct GnssBatching : public IGnssBatching {
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssConfiguration.cpp b/gps/android/GnssConfiguration.cpp
index 51ee892..9eeceac 100644
--- a/gps/android/GnssConfiguration.cpp
+++ b/gps/android/GnssConfiguration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,7 +27,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
@@ -220,8 +220,16 @@ Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) {
return mGnss->updateConfiguration(config);
}
+// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setBlacklist(
+ const hidl_vec<GnssConfiguration::BlacklistedSource>& /*blacklist*/) {
+
+ ENTRY_LOG_CALLFLOW();
+ return true;
+}
+
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssConfiguration.h b/gps/android/GnssConfiguration.h
index f9ea423..f46f607 100644
--- a/gps/android/GnssConfiguration.h
+++ b/gps/android/GnssConfiguration.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
@@ -22,16 +22,16 @@
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
-#include <android/hardware/gnss/1.0/IGnssConfiguration.h>
+#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
-using ::android::hardware::gnss::V1_0::IGnssConfiguration;
+using ::android::hardware::gnss::V1_1::IGnssConfiguration;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -58,12 +58,16 @@ struct GnssConfiguration : public IGnssConfiguration {
Return<bool> setEmergencySuplPdn(bool enable) override;
Return<bool> setGpsLock(uint8_t lock) override;
+ // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+ Return<bool> setBlacklist(
+ const hidl_vec<GnssConfiguration::BlacklistedSource>& blacklist) override;
+
private:
Gnss* mGnss = nullptr;
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssDebug.cpp b/gps/android/GnssDebug.cpp
index ff467d3..94238ab 100644
--- a/gps/android/GnssDebug.cpp
+++ b/gps/android/GnssDebug.cpp
@@ -25,13 +25,19 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::hardware::hidl_vec;
-#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000ULL) // 1/1/2017 00:00 GMT
-#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns
+#define GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS (20000000)
+#define GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS (20000)
+#define GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC (500)
+#define GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG (180)
+
+#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000LL) // 1/1/2017 00:00 GMT
+#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns
+#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm
GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
{
@@ -91,6 +97,40 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
data.position.valid = false;
}
+ if (data.position.horizontalAccuracyMeters <= 0 ||
+ data.position.horizontalAccuracyMeters > GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS) {
+ data.position.horizontalAccuracyMeters = GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS;
+ }
+ if (data.position.verticalAccuracyMeters <= 0 ||
+ data.position.verticalAccuracyMeters > GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS) {
+ data.position.verticalAccuracyMeters = GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS;
+ }
+ if (data.position.speedAccuracyMetersPerSecond <= 0 ||
+ data.position.speedAccuracyMetersPerSecond > GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC) {
+ data.position.speedAccuracyMetersPerSecond = GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC;
+ }
+ if (data.position.bearingAccuracyDegrees <= 0 ||
+ data.position.bearingAccuracyDegrees > GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG) {
+ data.position.bearingAccuracyDegrees = GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG;
+ }
+
+ if (data.position.horizontalAccuracyMeters <= 0 ||
+ data.position.horizontalAccuracyMeters > GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS) {
+ data.position.horizontalAccuracyMeters = GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS;
+ }
+ if (data.position.verticalAccuracyMeters <= 0 ||
+ data.position.verticalAccuracyMeters > GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS) {
+ data.position.verticalAccuracyMeters = GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS;
+ }
+ if (data.position.speedAccuracyMetersPerSecond <= 0 ||
+ data.position.speedAccuracyMetersPerSecond > GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC) {
+ data.position.speedAccuracyMetersPerSecond = GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC;
+ }
+ if (data.position.bearingAccuracyDegrees <= 0 ||
+ data.position.bearingAccuracyDegrees > GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG) {
+ data.position.bearingAccuracyDegrees = GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG;
+ }
+
// time block
if (reports.mTime.mValid) {
data.time.timeEstimate = reports.mTime.timeEstimate;
@@ -98,10 +138,17 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
data.time.frequencyUncertaintyNsPerSec =
reports.mTime.frequencyUncertaintyNsPerSec;
}
- else {
+
+ if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
- data.time.timeUncertaintyNs = (float)(GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC);
- data.time.frequencyUncertaintyNsPerSec = 0;
+ }
+ if (data.time.timeUncertaintyNs <= 0 ||
+ data.time.timeUncertaintyNs > (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC) {
+ data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC;
+ }
+ if (data.time.frequencyUncertaintyNsPerSec <= 0 ||
+ data.time.frequencyUncertaintyNsPerSec > (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC) {
+ data.time.frequencyUncertaintyNsPerSec = (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC;
}
// satellite data block
@@ -137,7 +184,7 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssDebug.h b/gps/android/GnssDebug.h
index 7d29131..cb818ac 100644
--- a/gps/android/GnssDebug.h
+++ b/gps/android/GnssDebug.h
@@ -24,7 +24,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssDebug;
@@ -51,7 +51,7 @@ private:
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssGeofencing.cpp b/gps/android/GnssGeofencing.cpp
index 035a092..5c11afe 100644
--- a/gps/android/GnssGeofencing.cpp
+++ b/gps/android/GnssGeofencing.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,7 +27,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
void GnssGeofencing::GnssGeofencingDeathRecipient::serviceDied(
@@ -135,7 +135,7 @@ Return<void> GnssGeofencing::removeAllGeofences() {
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssGeofencing.h b/gps/android/GnssGeofencing.h
index 7af5f91..94a73de 100644
--- a/gps/android/GnssGeofencing.h
+++ b/gps/android/GnssGeofencing.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,7 +27,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
@@ -83,7 +83,7 @@ struct GnssGeofencing : public IGnssGeofencing {
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssMeasurement.cpp b/gps/android/GnssMeasurement.cpp
index 8cbfabd..2578a85 100644
--- a/gps/android/GnssMeasurement.cpp
+++ b/gps/android/GnssMeasurement.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,7 +27,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
void GnssMeasurement::GnssMeasurementDeathRecipient::serviceDied(
@@ -52,8 +52,9 @@ GnssMeasurement::~GnssMeasurement() {
}
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+
Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
- const sp<IGnssMeasurementCallback>& callback) {
+ const sp<V1_0::IGnssMeasurementCallback>& callback) {
Return<IGnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
@@ -72,9 +73,10 @@ Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
}
mGnssMeasurementCbIface = callback;
- mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/);
+ mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
return mApi->measurementSetCallback(callback);
+
}
Return<void> GnssMeasurement::close() {
@@ -87,13 +89,43 @@ Return<void> GnssMeasurement::close() {
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface = nullptr;
}
+ if (mGnssMeasurementCbIface_1_1 != nullptr) {
+ mGnssMeasurementCbIface_1_1->unlinkToDeath(mGnssMeasurementDeathRecipient);
+ mGnssMeasurementCbIface_1_1 = nullptr;
+ }
mApi->measurementClose();
return Void();
}
+// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
+Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
+ const sp<IGnssMeasurementCallback>& callback, bool /*enableFullTracking*/) {
+
+ Return<IGnssMeasurement::GnssMeasurementStatus> ret =
+ IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
+ if (mGnssMeasurementCbIface_1_1 != nullptr) {
+ LOC_LOGE("%s]: GnssMeasurementCallback is already set", __FUNCTION__);
+ return IGnssMeasurement::GnssMeasurementStatus::ERROR_ALREADY_INIT;
+ }
+
+ if (callback == nullptr) {
+ LOC_LOGE("%s]: callback is nullptr", __FUNCTION__);
+ return ret;
+ }
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ return ret;
+ }
+
+ mGnssMeasurementCbIface_1_1 = callback;
+ mGnssMeasurementCbIface_1_1->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+
+ return mApi->measurementSetCallback_1_1(callback);
+}
+
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssMeasurement.h b/gps/android/GnssMeasurement.h
index 5073169..373f0d0 100644
--- a/gps/android/GnssMeasurement.h
+++ b/gps/android/GnssMeasurement.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -21,17 +21,18 @@
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
-#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
+#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
+#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
-using ::android::hardware::gnss::V1_0::IGnssMeasurement;
-using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback;
+using ::android::hardware::gnss::V1_1::IGnssMeasurement;
+using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -47,10 +48,15 @@ struct GnssMeasurement : public IGnssMeasurement {
* Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
* These declarations were generated from IGnssMeasurement.hal.
*/
- Return<GnssMeasurementStatus> setCallback(
- const sp<IGnssMeasurementCallback>& callback) override;
+ Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) override;
Return<void> close() override;
+ // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
+ Return<GnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
+ const sp<IGnssMeasurementCallback>& callback,
+ bool enableFullTracking) override;
+
private:
struct GnssMeasurementDeathRecipient : hidl_death_recipient {
GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
@@ -63,12 +69,13 @@ struct GnssMeasurement : public IGnssMeasurement {
private:
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
- sp<IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
+ sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
MeasurementAPIClient* mApi;
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssNi.cpp b/gps/android/GnssNi.cpp
index 4437932..5ce9569 100644
--- a/gps/android/GnssNi.cpp
+++ b/gps/android/GnssNi.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,7 +27,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
void GnssNi::GnssNiDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
@@ -79,7 +79,7 @@ Return<void> GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseT
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/GnssNi.h b/gps/android/GnssNi.h
index f6fe0bb..6733e5b 100644
--- a/gps/android/GnssNi.h
+++ b/gps/android/GnssNi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -27,7 +27,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssNi;
@@ -67,7 +67,7 @@ struct GnssNi : public IGnssNi {
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/android.hardware.gnss@1.0-service-qti.rc b/gps/android/android.hardware.gnss@1.1-service-qti.rc
index b5da6f9..41b105b 100644
--- a/gps/android/android.hardware.gnss@1.0-service-qti.rc
+++ b/gps/android/android.hardware.gnss@1.1-service-qti.rc
@@ -1,4 +1,4 @@
-service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti
+service gnss_service /vendor/bin/hw/android.hardware.gnss@1.1-service-qti
class hal
user gps
group system gps radio
diff --git a/gps/android/location_api/BatchingAPIClient.cpp b/gps/android/location_api/BatchingAPIClient.cpp
index 0b66d38..82a803f 100644
--- a/gps/android/location_api/BatchingAPIClient.cpp
+++ b/gps/android/location_api/BatchingAPIClient.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -42,9 +42,13 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
+using ::android::hardware::gnss::V1_0::IGnssBatching;
+using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask);
@@ -153,7 +157,8 @@ void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMa
mLocationCapabilitiesMask = capabilitiesMask;
}
-void BatchingAPIClient::onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions)
+void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
+ BatchingOptions /*batchOptions*/)
{
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
if (mGnssBatchingCbIface != nullptr && count > 0) {
@@ -185,7 +190,7 @@ static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/BatchingAPIClient.h b/gps/android/location_api/BatchingAPIClient.h
index c951a83..64d47a0 100644
--- a/gps/android/location_api/BatchingAPIClient.h
+++ b/gps/android/location_api/BatchingAPIClient.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -39,17 +39,17 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
class BatchingAPIClient : public LocationAPIClientBase
{
public:
- BatchingAPIClient(const sp<IGnssBatchingCallback>& callback);
+ BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
~BatchingAPIClient();
int getBatchSize();
- int startSession(const IGnssBatching::Options& options);
- int updateSessionOptions(const IGnssBatching::Options& options);
+ int startSession(const V1_0::IGnssBatching::Options& options);
+ int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
int stopSession();
void getBatchedLocation(int last_n_locations);
void flushBatchedLocations();
@@ -61,14 +61,13 @@ public:
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
private:
- sp<IGnssBatchingCallback> mGnssBatchingCbIface;
+ sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
uint32_t mDefaultId;
- int mBatchSize;
LocationCapabilitiesMask mLocationCapabilitiesMask;
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/GeofenceAPIClient.cpp b/gps/android/location_api/GeofenceAPIClient.cpp
index 6167177..93d175e 100644
--- a/gps/android/location_api/GeofenceAPIClient.cpp
+++ b/gps/android/location_api/GeofenceAPIClient.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -39,9 +39,11 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
+using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
+using ::android::hardware::gnss::V1_0::GnssLocation;
GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
LocationAPIClientBase(),
@@ -158,7 +160,7 @@ void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBr
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
geofenceBreachNotification.ids[i], gnssLocation, transition,
- static_cast<GnssUtcTime>(geofenceBreachNotification.timestamp));
+ static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
__func__, r.description().c_str());
@@ -267,7 +269,7 @@ void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors,
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/GeofenceAPIClient.h b/gps/android/location_api/GeofenceAPIClient.h
index f779bcb..c74a59a 100644
--- a/gps/android/location_api/GeofenceAPIClient.h
+++ b/gps/android/location_api/GeofenceAPIClient.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -37,7 +37,7 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::sp;
@@ -45,7 +45,7 @@ using ::android::sp;
class GeofenceAPIClient : public LocationAPIClientBase
{
public:
- GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback);
+ GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
virtual ~GeofenceAPIClient() = default;
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
@@ -65,11 +65,11 @@ public:
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
private:
- sp<IGnssGeofenceCallback> mGnssGeofencingCbIface;
+ sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/GnssAPIClient.cpp b/gps/android/location_api/GnssAPIClient.cpp
index 2e44c2e..4e3b0ac 100644
--- a/gps/android/location_api/GnssAPIClient.cpp
+++ b/gps/android/location_api/GnssAPIClient.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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,9 +40,14 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
+using ::android::hardware::gnss::V1_0::IGnss;
+using ::android::hardware::gnss::V1_0::IGnssCallback;
+using ::android::hardware::gnss::V1_0::IGnssNiCallback;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out);
GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb,
@@ -160,6 +165,10 @@ bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
mLocationOptions.size = sizeof(LocationOptions);
mLocationOptions.minInterval = minIntervalMs;
mLocationOptions.minDistance = preferredAccuracyMeters;
+ if (IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
+ mLocationOptions.minInterval =
+ std::numeric_limits<decltype(mLocationOptions.minInterval)>::max();
+ }
if (mode == IGnss::GnssPositionMode::STANDALONE)
mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
else if (mode == IGnss::GnssPositionMode::MS_BASED)
@@ -445,7 +454,7 @@ void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
android::hardware::hidl_string nmeaString;
nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
auto r = gnssCbIface->gnssNmeaCb(
- static_cast<GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
+ static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__,
gnssNmeaNotification.nmea, gnssNmeaNotification.length, r.description().c_str());
@@ -499,10 +508,10 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta
{
memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
out.numSvs = in.count;
- if (out.numSvs > static_cast<uint32_t>(GnssMax::SVS_COUNT)) {
- LOC_LOGW("%s]: Too many satellites %zd. Clamps to %d.",
- __FUNCTION__, out.numSvs, GnssMax::SVS_COUNT);
- out.numSvs = static_cast<uint32_t>(GnssMax::SVS_COUNT);
+ if (out.numSvs > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
+ LOC_LOGW("%s]: Too many satellites %u. Clamps to %d.",
+ __FUNCTION__, out.numSvs, V1_0::GnssMax::SVS_COUNT);
+ out.numSvs = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.numSvs; i++) {
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
@@ -522,7 +531,7 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/GnssAPIClient.h b/gps/android/location_api/GnssAPIClient.h
index b5cffb1..1589f39 100644
--- a/gps/android/location_api/GnssAPIClient.h
+++ b/gps/android/location_api/GnssAPIClient.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -30,16 +30,17 @@
#ifndef GNSS_API_CLINET_H
#define GNSS_API_CLINET_H
+
#include <mutex>
-#include <android/hardware/gnss/1.0/IGnss.h>
-#include <android/hardware/gnss/1.0/IGnssCallback.h>
+#include <android/hardware/gnss/1.1/IGnss.h>
+#include <android/hardware/gnss/1.1/IGnssCallback.h>
#include <android/hardware/gnss/1.0/IGnssNiCallback.h>
#include <LocationAPIClientBase.h>
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using ::android::sp;
@@ -47,28 +48,28 @@ using ::android::sp;
class GnssAPIClient : public LocationAPIClientBase
{
public:
- GnssAPIClient(const sp<IGnssCallback>& gpsCb,
- const sp<IGnssNiCallback>& niCb);
+ GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
virtual ~GnssAPIClient();
GnssAPIClient(const GnssAPIClient&) = delete;
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
// for GpsInterface
- void gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
- const sp<IGnssNiCallback>& niCb);
+ void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
bool gnssStart();
bool gnssStop();
- bool gnssSetPositionMode(IGnss::GnssPositionMode mode,
- IGnss::GnssPositionRecurrence recurrence,
+ bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs);
// for GpsNiInterface
- void gnssNiRespond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse);
+ void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
// these apis using LocationAPIControlClient
- void gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags);
+ void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
void gnssEnable(LocationTechnologyType techType);
void gnssDisable();
void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
@@ -89,17 +90,18 @@ public:
void onStopTrackingCb(LocationError error) final;
private:
- sp<IGnssCallback> mGnssCbIface;
- sp<IGnssNiCallback> mGnssNiCbIface;
+ sp<V1_0::IGnssCallback> mGnssCbIface;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
std::mutex mMutex;
LocationAPIControlClient* mControlClient;
LocationCapabilitiesMask mLocationCapabilitiesMask;
bool mLocationCapabilitiesCached;
+
LocationOptions mLocationOptions;
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/LocationUtil.cpp b/gps/android/location_api/LocationUtil.cpp
index 311c0b2..21c2e39 100644
--- a/gps/android/location_api/LocationUtil.cpp
+++ b/gps/android/location_api/LocationUtil.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -32,9 +32,13 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
+using ::android::hardware::gnss::V1_0::GnssLocation;
+using ::android::hardware::gnss::V1_0::GnssConstellationType;
+using ::android::hardware::gnss::V1_0::GnssLocationFlags;
+
void convertGnssLocation(Location& in, GnssLocation& out)
{
memset(&out, 0, sizeof(GnssLocation));
@@ -63,7 +67,38 @@ void convertGnssLocation(Location& in, GnssLocation& out)
out.verticalAccuracyMeters = in.verticalAccuracy;
out.speedAccuracyMetersPerSecond = in.speedAccuracy;
out.bearingAccuracyDegrees = in.bearingAccuracy;
- out.timestamp = static_cast<GnssUtcTime>(in.timestamp);
+ out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
+}
+
+void convertGnssLocation(const GnssLocation& in, Location& out)
+{
+ memset(&out, 0, sizeof(out));
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG)
+ out.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE)
+ out.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED)
+ out.flags |= LOCATION_HAS_SPEED_BIT;
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING)
+ out.flags |= LOCATION_HAS_BEARING_BIT;
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY)
+ out.flags |= LOCATION_HAS_ACCURACY_BIT;
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY)
+ out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY)
+ out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY)
+ out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ out.latitude = in.latitudeDegrees;
+ out.longitude = in.longitudeDegrees;
+ out.altitude = in.altitudeMeters;
+ out.speed = in.speedMetersPerSec;
+ out.bearing = in.bearingDegrees;
+ out.accuracy = in.horizontalAccuracyMeters;
+ out.verticalAccuracy = in.verticalAccuracyMeters;
+ out.speedAccuracy = in.speedAccuracyMetersPerSecond;
+ out.bearingAccuracy = in.bearingAccuracyDegrees;
+ out.timestamp = static_cast<uint64_t>(in.timestamp);
}
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
@@ -147,7 +182,7 @@ void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEph
}
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/LocationUtil.h b/gps/android/location_api/LocationUtil.h
index 44d5e02..63f4f6f 100644
--- a/gps/android/location_api/LocationUtil.h
+++ b/gps/android/location_api/LocationUtil.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -37,17 +37,18 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
-void convertGnssLocation(Location& in, GnssLocation& out);
-void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out);
+void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
+void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
+void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/MeasurementAPIClient.cpp b/gps/android/location_api/MeasurementAPIClient.cpp
index 731c7ed..f1a5d01 100644
--- a/gps/android/location_api/MeasurementAPIClient.cpp
+++ b/gps/android/location_api/MeasurementAPIClient.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -39,17 +39,23 @@
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
+using ::android::hardware::gnss::V1_0::IGnssMeasurement;
+using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
+
static void convertGnssData(GnssMeasurementsNotification& in,
+ V1_0::IGnssMeasurementCallback::GnssData& out);
+static void convertGnssData_1_1(GnssMeasurementsNotification& in,
IGnssMeasurementCallback::GnssData& out);
static void convertGnssMeasurement(GnssMeasurementsData& in,
- IGnssMeasurementCallback::GnssMeasurement& out);
+ V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
MeasurementAPIClient::MeasurementAPIClient() :
mGnssMeasurementCbIface(nullptr),
+ mGnssMeasurementCbIface_1_1(nullptr),
mTracking(false)
{
LOC_LOGD("%s]: ()", __FUNCTION__);
@@ -62,7 +68,7 @@ MeasurementAPIClient::~MeasurementAPIClient()
// for GpsInterface
Return<IGnssMeasurement::GnssMeasurementStatus>
-MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>& callback)
+MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
@@ -70,6 +76,24 @@ MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>&
mGnssMeasurementCbIface = callback;
mMutex.unlock();
+ return startTracking();
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::measurementSetCallback_1_1(const sp<IGnssMeasurementCallback>& callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface_1_1 = callback;
+ mMutex.unlock();
+
+ return startTracking();
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::startTracking()
+{
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
@@ -84,7 +108,7 @@ MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>&
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
- if (mGnssMeasurementCbIface != nullptr) {
+ if (mGnssMeasurementCbIface_1_1 != nullptr || mGnssMeasurementCbIface != nullptr) {
locationCallbacks.gnssMeasurementsCb =
[this](GnssMeasurementsNotification gnssMeasurementsNotification) {
onGnssMeasurementsCb(gnssMeasurementsNotification);
@@ -115,15 +139,29 @@ void MeasurementAPIClient::measurementClose() {
void MeasurementAPIClient::onGnssMeasurementsCb(
GnssMeasurementsNotification gnssMeasurementsNotification)
{
- LOC_LOGD("%s]: (count: %zu active: %zu)",
+ LOC_LOGD("%s]: (count: %zu active: %d)",
__FUNCTION__, gnssMeasurementsNotification.count, mTracking);
if (mTracking) {
mMutex.lock();
- auto gnssMeasurementCbIface(mGnssMeasurementCbIface);
+ sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
+ sp<IGnssMeasurementCallback> gnssMeasurementCbIface_1_1 = nullptr;
+ if (mGnssMeasurementCbIface_1_1 != nullptr) {
+ gnssMeasurementCbIface_1_1 = mGnssMeasurementCbIface_1_1;
+ } else if (mGnssMeasurementCbIface != nullptr) {
+ gnssMeasurementCbIface = mGnssMeasurementCbIface;
+ }
mMutex.unlock();
- if (gnssMeasurementCbIface != nullptr) {
+ if (gnssMeasurementCbIface_1_1 != nullptr) {
IGnssMeasurementCallback::GnssData gnssData;
+ convertGnssData_1_1(gnssMeasurementsNotification, gnssData);
+ auto r = gnssMeasurementCbIface_1_1->gnssMeasurementCb(gnssData);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssMeasurementCb description=%s",
+ __func__, r.description().c_str());
+ }
+ } else if (gnssMeasurementCbIface != nullptr) {
+ V1_0::IGnssMeasurementCallback::GnssData gnssData;
convertGnssData(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
if (!r.isOk()) {
@@ -135,7 +173,7 @@ void MeasurementAPIClient::onGnssMeasurementsCb(
}
static void convertGnssMeasurement(GnssMeasurementsData& in,
- IGnssMeasurementCallback::GnssMeasurement& out)
+ V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
{
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
@@ -242,13 +280,13 @@ static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback
}
static void convertGnssData(GnssMeasurementsNotification& in,
- IGnssMeasurementCallback::GnssData& out)
+ V1_0::IGnssMeasurementCallback::GnssData& out)
{
out.measurementCount = in.count;
- if (out.measurementCount > static_cast<uint32_t>(GnssMax::SVS_COUNT)) {
- LOC_LOGW("%s]: Too many measurement %zd. Clamps to %d.",
- __FUNCTION__, out.measurementCount, GnssMax::SVS_COUNT);
- out.measurementCount = static_cast<uint32_t>(GnssMax::SVS_COUNT);
+ if (out.measurementCount > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
+ LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.",
+ __FUNCTION__, out.measurementCount, V1_0::GnssMax::SVS_COUNT);
+ out.measurementCount = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.measurementCount; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i]);
@@ -256,8 +294,18 @@ static void convertGnssData(GnssMeasurementsNotification& in,
convertGnssClock(in.clock, out.clock);
}
+static void convertGnssData_1_1(GnssMeasurementsNotification& in,
+ IGnssMeasurementCallback::GnssData& out)
+{
+ out.measurements.resize(in.count);
+ for (size_t i = 0; i < in.count; i++) {
+ convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_0);
+ }
+ convertGnssClock(in.clock, out.clock);
+}
+
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/location_api/MeasurementAPIClient.h b/gps/android/location_api/MeasurementAPIClient.h
index 8de1326..117ad54 100644
--- a/gps/android/location_api/MeasurementAPIClient.h
+++ b/gps/android/location_api/MeasurementAPIClient.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2017-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
@@ -31,18 +31,17 @@
#define MEASUREMENT_API_CLINET_H
#include <mutex>
-#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
-#include <android/hardware/gnss/1.0/IGnssMeasurementCallback.h>
+#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
+#include <android/hardware/gnss/1.1/IGnssMeasurementCallback.h>
#include <LocationAPIClientBase.h>
#include <hidl/Status.h>
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
-using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::sp;
class MeasurementAPIClient : public LocationAPIClientBase
@@ -54,21 +53,26 @@ public:
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
// for GpsMeasurementInterface
- Return<IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback);
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_1_1(
const sp<IGnssMeasurementCallback>& callback);
void measurementClose();
+ Return<IGnssMeasurement::GnssMeasurementStatus> startTracking();
// callbacks we are interested in
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
private:
- sp<IGnssMeasurementCallback> mGnssMeasurementCbIface;
std::mutex mMutex;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
+ sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
+
bool mTracking;
};
} // namespace implementation
-} // namespace V1_0
+} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
diff --git a/gps/android/service.cpp b/gps/android/service.cpp
index 5779e67..72cb4e9 100644
--- a/gps/android/service.cpp
+++ b/gps/android/service.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution
*/
/*
@@ -18,12 +18,12 @@
* limitations under the License.
*/
-#define LOG_TAG "android.hardware.gnss@1.0-service-qti"
+#define LOG_TAG "android.hardware.gnss@1.1-service-qti"
-#include <android/hardware/gnss/1.0/IGnss.h>
+#include <android/hardware/gnss/1.1/IGnss.h>
#include <hidl/LegacySupport.h>
-using android::hardware::gnss::V1_0::IGnss;
+using android::hardware::gnss::V1_1::IGnss;
using android::hardware::defaultPassthroughServiceImplementation;
int main() {
diff --git a/gps/build/target_specific_features.mk b/gps/build/target_specific_features.mk
new file mode 100644
index 0000000..943e231
--- /dev/null
+++ b/gps/build/target_specific_features.mk
@@ -0,0 +1,17 @@
+GNSS_CFLAGS := \
+ -Werror \
+ -Wno-error=unused-parameter \
+ -Wno-error=format \
+ -Wno-error=macro-redefined \
+ -Wno-error=reorder \
+ -Wno-error=missing-braces \
+ -Wno-error=self-assign \
+ -Wno-error=enum-conversion \
+ -Wno-error=logical-op-parentheses \
+ -Wno-error=null-arithmetic \
+ -Wno-error=null-conversion \
+ -Wno-error=parentheses-equality \
+ -Wno-error=undefined-bool-conversion \
+ -Wno-error=tautological-compare \
+ -Wno-error=switch \
+ -Wno-error=date-time
diff --git a/gps/configure.ac b/gps/configure.ac
index ec41c86..0ab8e68 100644
--- a/gps/configure.ac
+++ b/gps/configure.ac
@@ -11,7 +11,7 @@ AM_INIT_AUTOMAKE([foreign])
# Disables auto rebuilding of configure, Makefile.ins
AM_MAINTAINER_MODE
# Verifies the --srcdir is correct by checking for the path
-AC_CONFIG_SRCDIR([utils/loc_cfg.cpp])
+AC_CONFIG_SRCDIR([Makefile.am])
# defines some macros variable to be included by source
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
@@ -29,26 +29,14 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
# Checks for libraries.
-PKG_CHECK_MODULES([QMI], [qmi])
-AC_SUBST([QMI_CFLAGS])
-AC_SUBST([QMI_LIBS])
-
-PKG_CHECK_MODULES([QMIF], [qmi-framework])
-AC_SUBST([QMIF_CFLAGS])
-AC_SUBST([QMIF_LIBS])
-
-PKG_CHECK_MODULES([DATA], [data])
-AC_SUBST([DATA_CFLAGS])
-AC_SUBST([DATA_LIBS])
-
-PKG_CHECK_MODULES([LOCPLA], [loc-pla])
-AC_SUBST([LOCPLA_CFLAGS])
-AC_SUBST([LOCPLA_LIBS])
-
PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
AC_SUBST([GPSUTILS_CFLAGS])
AC_SUBST([GPSUTILS_LIBS])
+PKG_CHECK_MODULES([LOCCORE], [loc-core])
+AC_SUBST([LOCCORE_CFLAGS])
+AC_SUBST([LOCCORE_LIBS])
+
AC_ARG_WITH([core_includes],
AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
[Specify the location of the core headers]),
@@ -59,6 +47,16 @@ if test "x$with_core_includes" != "xno"; then
CPPFLAGS="${CPPFLAGS} -I${core_incdir}"
fi
+AC_ARG_WITH([locpla_includes],
+ AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@],
+ [specify the path to locpla-includes in loc-pla_git.bb]),
+ [locpla_incdir=$withval],
+ with_locpla_includes=no)
+
+if test "x$with_locpla_includes" != "xno"; then
+ AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}")
+fi
+
AC_SUBST([CPPFLAGS])
AC_ARG_WITH([glib],
@@ -82,8 +80,6 @@ AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
AC_CONFIG_FILES([ \
Makefile \
- core/Makefile \
- location/Makefile \
gnss/Makefile \
loc-hal.pc \
])
diff --git a/gps/core/Android.mk b/gps/core/Android.mk
index 6e58dc9..1a4f51a 100644
--- a/gps/core/Android.mk
+++ b/gps/core/Android.mk
@@ -7,7 +7,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libloc_core
LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
LOCAL_MODULE_TAGS := optional
ifeq ($(TARGET_DEVICE),apq8026_lw)
@@ -22,8 +21,7 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libgps.utils \
libdl \
- liblog \
- libloc_pla
+ liblog
LOCAL_SRC_FILES += \
LocApiBase.cpp \
@@ -32,9 +30,6 @@ LOCAL_SRC_FILES += \
LocDualContext.cpp \
loc_core_log.cpp \
data-items/DataItemsFactoryProxy.cpp \
- data-items/common/ClientIndex.cpp \
- data-items/common/DataItemIndex.cpp \
- data-items/common/IndexFactory.cpp \
SystemStatusOsObserver.cpp \
SystemStatus.cpp
@@ -48,6 +43,7 @@ LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/observer \
LOCAL_HEADER_LIBRARIES := \
+ libutils_headers \
libgps.utils_headers \
libloc_pla_headers \
liblocation_api_headers
diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp
index 8af48fc..35e6585 100644
--- a/gps/core/ContextBase.cpp
+++ b/gps/core/ContextBase.cpp
@@ -35,7 +35,7 @@
#include <ContextBase.h>
#include <msg_q.h>
#include <loc_target.h>
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
#include <loc_log.h>
namespace loc_core {
@@ -65,6 +65,8 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
{"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
{"AGPS_CONFIG_INJECT", &mGps_conf.AGPS_CONFIG_INJECT, NULL, 'n'},
{"EXTERNAL_DR_ENABLED", &mGps_conf.EXTERNAL_DR_ENABLED, NULL, 'n'},
+ {"SUPL_HOST", &mGps_conf.SUPL_HOST, NULL, 's'},
+ {"SUPL_PORT", &mGps_conf.SUPL_PORT, NULL, 'n'},
};
const loc_param_s_type ContextBase::mSap_conf_table[] =
@@ -98,6 +100,8 @@ void ContextBase::readConfig()
mGps_conf.SUPL_VER = 0x10000;
mGps_conf.SUPL_MODE = 0x1;
mGps_conf.SUPL_ES = 0;
+ mGps_conf.SUPL_HOST[0] = 0;
+ mGps_conf.SUPL_PORT = 0;
mGps_conf.CAPABILITIES = 0x7;
/* LTE Positioning Profile configuration is disable by default*/
mGps_conf.LPP_PROFILE = 0;
diff --git a/gps/core/ContextBase.h b/gps/core/ContextBase.h
index 83de999..dc64b6a 100644
--- a/gps/core/ContextBase.h
+++ b/gps/core/ContextBase.h
@@ -36,7 +36,8 @@
#include <LBSProxyBase.h>
#include <loc_cfg.h>
-#define MAX_XTRA_SERVER_URL_LENGTH 256
+#define MAX_XTRA_SERVER_URL_LENGTH (256)
+#define MAX_SUPL_SERVER_URL_LENGTH (256)
/* GPS.conf support */
/* NOTE: the implementaiton of the parser casts number
@@ -64,6 +65,8 @@ typedef struct loc_gps_cfg_s
uint32_t LPPE_CP_TECHNOLOGY;
uint32_t LPPE_UP_TECHNOLOGY;
uint32_t EXTERNAL_DR_ENABLED;
+ char SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH];
+ uint32_t SUPL_PORT;
} loc_gps_cfg_s_type;
/* NOTE: the implementaiton of the parser casts number
diff --git a/gps/core/LocAdapterBase.cpp b/gps/core/LocAdapterBase.cpp
index 3943819..d0da3da 100644
--- a/gps/core/LocAdapterBase.cpp
+++ b/gps/core/LocAdapterBase.cpp
@@ -32,7 +32,7 @@
#include <dlfcn.h>
#include <LocAdapterBase.h>
#include <loc_target.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
#include <LocAdapterProxyBase.h>
namespace loc_core {
@@ -161,4 +161,8 @@ bool LocAdapterBase::
reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
DEFAULT_IMPL(false)
+bool LocAdapterBase::
+ reportOdcpiRequestEvent(OdcpiRequestInfo& /*request*/)
+DEFAULT_IMPL(false)
+
} // namespace loc_core
diff --git a/gps/core/LocAdapterBase.h b/gps/core/LocAdapterBase.h
index e7beca8..35fc48e 100644
--- a/gps/core/LocAdapterBase.h
+++ b/gps/core/LocAdapterBase.h
@@ -153,6 +153,7 @@ public:
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
int msInWeek);
virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
+ virtual bool reportOdcpiRequestEvent(OdcpiRequestInfo& request);
};
} // namespace loc_core
diff --git a/gps/core/LocApiBase.cpp b/gps/core/LocApiBase.cpp
index e0845de..426335d 100644
--- a/gps/core/LocApiBase.cpp
+++ b/gps/core/LocApiBase.cpp
@@ -33,7 +33,7 @@
#include <inttypes.h>
#include <LocApiBase.h>
#include <LocAdapterBase.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
#include <LocDualContext.h>
namespace loc_core {
@@ -107,19 +107,16 @@ struct LocSsrMsg : public LocMsg {
struct LocOpenMsg : public LocMsg {
LocApiBase* mLocApi;
- LOC_API_ADAPTER_EVENT_MASK_T mMask;
- inline LocOpenMsg(LocApiBase* locApi,
- LOC_API_ADAPTER_EVENT_MASK_T mask) :
- LocMsg(), mLocApi(locApi), mMask(mask)
+ inline LocOpenMsg(LocApiBase* locApi) :
+ LocMsg(), mLocApi(locApi)
{
locallog();
}
inline virtual void proc() const {
- mLocApi->open(mMask);
+ mLocApi->open(mLocApi->getEvtMask());
}
inline void locallog() const {
- LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
- __func__, __LINE__, mMask);
+ LOC_LOGv("LocOpen Mask: %" PRIx64 "\n", mLocApi->getEvtMask());
}
inline virtual void log() const {
locallog();
@@ -163,8 +160,7 @@ void LocApiBase::addAdapter(LocAdapterBase* adapter)
for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
if (mLocAdapters[i] == NULL) {
mLocAdapters[i] = adapter;
- mMsgTask->sendMsg(new LocOpenMsg(this,
- (adapter->getEvtMask())));
+ mMsgTask->sendMsg(new LocOpenMsg(this));
break;
}
}
@@ -200,7 +196,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
close();
} else {
// else we need to remove the bit
- mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ mMsgTask->sendMsg(new LocOpenMsg(this));
}
}
}
@@ -208,7 +204,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
void LocApiBase::updateEvtMask()
{
- mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ open(getEvtMask());
}
void LocApiBase::handleEngineUpEvent()
@@ -264,6 +260,12 @@ void LocApiBase::reportWwanZppFix(LocGpsLocation &zppLoc)
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
}
+void LocApiBase::reportOdcpiRequest(OdcpiRequestInfo& request)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportOdcpiRequestEvent(request));
+}
+
void LocApiBase::reportSv(GnssSvNotification& svNotify)
{
const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
@@ -441,6 +443,10 @@ enum loc_api_adapter_err LocApiBase::
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
+ injectPosition(const Location& /*location*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
diff --git a/gps/core/LocApiBase.h b/gps/core/LocApiBase.h
index f66bfe1..6563dea 100644
--- a/gps/core/LocApiBase.h
+++ b/gps/core/LocApiBase.h
@@ -34,7 +34,7 @@
#include <gps_extended.h>
#include <LocationAPI.h>
#include <MsgTask.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
namespace loc_core {
class ContextBase;
@@ -134,6 +134,7 @@ public:
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
void saveSupportedFeatureList(uint8_t *featureList);
void reportWwanZppFix(LocGpsLocation &zppLoc);
+ void reportOdcpiRequest(OdcpiRequestInfo& request);
// downward calls
// All below functions are to be defined by adapter specific modules:
@@ -154,6 +155,8 @@ public:
virtual enum loc_api_adapter_err
injectPosition(double latitude, double longitude, float accuracy);
virtual enum loc_api_adapter_err
+ injectPosition(const Location& location);
+ virtual enum loc_api_adapter_err
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
virtual enum loc_api_adapter_err
setXtraData(char* data, int length);
diff --git a/gps/core/LocDualContext.cpp b/gps/core/LocDualContext.cpp
index fd3450d..180d9dc 100644
--- a/gps/core/LocDualContext.cpp
+++ b/gps/core/LocDualContext.cpp
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <LocDualContext.h>
#include <msg_q.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
#include <loc_log.h>
namespace loc_core {
diff --git a/gps/core/Makefile.am b/gps/core/Makefile.am
index c83ccc3..77bc610 100644
--- a/gps/core/Makefile.am
+++ b/gps/core/Makefile.am
@@ -1,8 +1,11 @@
+ACLOCAL_AMFLAGS = -I m4
+
AM_CFLAGS = -I./ \
- -I../utils \
- -I../location \
$(LOCPLA_CFLAGS) \
$(GPSUTILS_CFLAGS) \
+ -I./data-items/ \
+ -I./data-items/common \
+ -I./observer \
-I$(WORKSPACE)/gps-noship/flp \
-D__func__=__PRETTY_FUNCTION__ \
-fno-short-enums \
@@ -34,13 +37,10 @@ libloc_core_la_c_sources = \
LocDualContext.cpp \
loc_core_log.cpp \
data-items/DataItemsFactoryProxy.cpp \
- data-items/common/ClientIndex.cpp \
- data-items/common/DataItemIndex.cpp \
- data-items/common/IndexFactory.cpp \
SystemStatusOsObserver.cpp \
SystemStatus.cpp
-library_includedir = $(pkgincludedir)/core
+library_includedir = $(pkgincludedir)
library_include_HEADERS = $(libloc_core_la_h_sources)
@@ -56,7 +56,11 @@ libloc_core_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
libloc_core_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libloc_core_la_LIBADD = -lstdc++ -ldl $(LOCPLA_LIBS) $(GPSUTILS_LIBS)
+libloc_core_la_LIBADD = -ldl $(GPSUTILS_LIBS)
#Create and Install libraries
lib_LTLIBRARIES = libloc_core.la
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-core.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/core/SystemStatus.cpp b/gps/core/SystemStatus.cpp
index 50c19eb..f4316ca 100644
--- a/gps/core/SystemStatus.cpp
+++ b/gps/core/SystemStatus.cpp
@@ -34,8 +34,8 @@
#include <string.h>
#include <sys/time.h>
#include <pthread.h>
-#include <platform_lib_log_util.h>
-#include <MsgTask.h>
+#include <loc_pla.h>
+#include <log_util.h>
#include <loc_nmea.h>
#include <DataItemsFactoryProxy.h>
#include <SystemStatus.h>
@@ -120,6 +120,12 @@ public:
double mAgcGal; // x16
int32_t mLeapSeconds;// x17
int32_t mLeapSecUnc; // x18
+ uint32_t mGloBpAmpI; // x19
+ uint32_t mGloBpAmpQ; // x1A
+ uint32_t mBdsBpAmpI; // x1B
+ uint32_t mBdsBpAmpQ; // x1C
+ uint32_t mGalBpAmpI; // x1D
+ uint32_t mGalBpAmpQ; // x1E
};
// parser
@@ -151,8 +157,15 @@ private:
eAgcGlo = 20,
eAgcBds = 21,
eAgcGal = 22,
+ eMax0 = eAgcGal,
eLeapSeconds = 23,
eLeapSecUnc = 24,
+ eGloBpAmpI = 25,
+ eGloBpAmpQ = 26,
+ eBdsBpAmpI = 27,
+ eBdsBpAmpQ = 28,
+ eGalBpAmpI = 29,
+ eGalBpAmpQ = 30,
eMax
};
SystemStatusPQWM1 mM1;
@@ -182,12 +195,18 @@ public:
inline uint32_t getRecErrorRecovery() { return mM1.mRecErrorRecovery; }
inline int32_t getLeapSeconds(){ return mM1.mLeapSeconds; }
inline int32_t getLeapSecUnc() { return mM1.mLeapSecUnc; }
+ inline uint32_t getGloBpAmpI() { return mM1.mGloBpAmpI; }
+ inline uint32_t getGloBpAmpQ() { return mM1.mGloBpAmpQ; }
+ inline uint32_t getBdsBpAmpI() { return mM1.mBdsBpAmpI; }
+ inline uint32_t getBdsBpAmpQ() { return mM1.mBdsBpAmpQ; }
+ inline uint32_t getGalBpAmpI() { return mM1.mGalBpAmpI; }
+ inline uint32_t getGalBpAmpQ() { return mM1.mGalBpAmpQ; }
SystemStatusPQWM1parser(const char *str_in, uint32_t len_in)
: SystemStatusNmeaBase(str_in, len_in)
{
memset(&mM1, 0, sizeof(mM1));
- if (mField.size() < eMax) {
+ if (mField.size() <= eMax0) {
LOC_LOGE("PQWM1parser - invalid size=%zu", mField.size());
mM1.mTimeValid = 0;
return;
@@ -214,8 +233,18 @@ public:
mM1.mAgcGlo = atof(mField[eAgcGlo].c_str());
mM1.mAgcBds = atof(mField[eAgcBds].c_str());
mM1.mAgcGal = atof(mField[eAgcGal].c_str());
- mM1.mLeapSeconds = atoi(mField[eLeapSeconds].c_str());
- mM1.mLeapSecUnc = atoi(mField[eLeapSecUnc].c_str());
+ if (mField.size() > eLeapSecUnc) {
+ mM1.mLeapSeconds = atoi(mField[eLeapSeconds].c_str());
+ mM1.mLeapSecUnc = atoi(mField[eLeapSecUnc].c_str());
+ }
+ if (mField.size() > eGalBpAmpQ) {
+ mM1.mGloBpAmpI = atoi(mField[eGloBpAmpI].c_str());
+ mM1.mGloBpAmpQ = atoi(mField[eGloBpAmpQ].c_str());
+ mM1.mBdsBpAmpI = atoi(mField[eBdsBpAmpI].c_str());
+ mM1.mBdsBpAmpQ = atoi(mField[eBdsBpAmpQ].c_str());
+ mM1.mGalBpAmpI = atoi(mField[eGalBpAmpI].c_str());
+ mM1.mGalBpAmpQ = atoi(mField[eGalBpAmpQ].c_str());
+ }
}
inline SystemStatusPQWM1& get() { return mM1;} //getparser
@@ -762,7 +791,13 @@ SystemStatusRfAndParams::SystemStatusRfAndParams(const SystemStatusPQWM1& nmea)
mAgcGps(nmea.mAgcGps),
mAgcGlo(nmea.mAgcGlo),
mAgcBds(nmea.mAgcBds),
- mAgcGal(nmea.mAgcGal)
+ mAgcGal(nmea.mAgcGal),
+ mGloBpAmpI(nmea.mGloBpAmpI),
+ mGloBpAmpQ(nmea.mGloBpAmpQ),
+ mBdsBpAmpI(nmea.mBdsBpAmpI),
+ mBdsBpAmpQ(nmea.mBdsBpAmpQ),
+ mGalBpAmpI(nmea.mGalBpAmpI),
+ mGalBpAmpQ(nmea.mGalBpAmpQ)
{
}
@@ -780,7 +815,13 @@ bool SystemStatusRfAndParams::equals(const SystemStatusRfAndParams& peer)
(mAgcGps != peer.mAgcGps) ||
(mAgcGlo != peer.mAgcGlo) ||
(mAgcBds != peer.mAgcBds) ||
- (mAgcGal != peer.mAgcGal)) {
+ (mAgcGal != peer.mAgcGal) ||
+ (mGloBpAmpI != peer.mGloBpAmpI) ||
+ (mGloBpAmpQ != peer.mGloBpAmpQ) ||
+ (mBdsBpAmpI != peer.mBdsBpAmpI) ||
+ (mBdsBpAmpQ != peer.mBdsBpAmpQ) ||
+ (mGalBpAmpI != peer.mGalBpAmpI) ||
+ (mGalBpAmpQ != peer.mGalBpAmpQ)) {
return false;
}
return true;
@@ -1214,8 +1255,7 @@ IOsObserver* SystemStatus::getOsObserver()
}
SystemStatus::SystemStatus(const MsgTask* msgTask) :
- mSysStatusObsvr(this, msgTask),
- mConnected(false)
+ mSysStatusObsvr(this, msgTask)
{
int result = 0;
ENTRY_LOG ();
@@ -1265,17 +1305,10 @@ SystemStatus::SystemStatus(const MsgTask* msgTask) :
/******************************************************************************
SystemStatus - storing dataitems
******************************************************************************/
-template <typename TYPE_SYSTEMSTATUS_ITEM, typename TYPE_REPORT, typename TYPE_ITEMBASE>
-bool SystemStatus::setItemBaseinReport(TYPE_REPORT& report, const TYPE_ITEMBASE& s)
-{
- TYPE_SYSTEMSTATUS_ITEM sout(s);
- return setIteminReport(report, sout);
-}
-
template <typename TYPE_REPORT, typename TYPE_ITEM>
-bool SystemStatus::setIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s)
+bool SystemStatus::setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s)
{
- if (!report.empty() && report.back().equals(s)) {
+ if (!report.empty() && report.back().equals(static_cast<TYPE_ITEM&>(s.collate(report.back())))) {
// there is no change - just update reported timestamp
report.back().mUtcReported = s.mUtcReported;
return false;
@@ -1314,11 +1347,10 @@ void SystemStatus::getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) c
@param[In] data pointer to the NMEA string
@param[In] len length of the NMEA string
-@return true when successfully done
+@return true when the NMEA is consumed by the method.
******************************************************************************/
bool SystemStatus::setNmeaString(const char *data, uint32_t len)
{
- bool ret = false;
if (!loc_nmea_is_debug(data, len)) {
return false;
}
@@ -1329,43 +1361,43 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len)
pthread_mutex_lock(&mMutexSystemStatus);
// parse the received nmea strings here
- if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
SystemStatusPQWM1 s = SystemStatusPQWM1parser(buf, len).get();
- ret |= setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s));
- ret |= setIteminReport(mCache.mXoState, SystemStatusXoState(s));
- ret |= setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s));
- ret |= setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s));
+ setIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock(s));
+ setIteminReport(mCache.mXoState, SystemStatusXoState(s));
+ setIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams(s));
+ setIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery(s));
}
else if (0 == strncmp(data, "$PQWP1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mInjectedPosition,
+ setIteminReport(mCache.mInjectedPosition,
SystemStatusInjectedPosition(SystemStatusPQWP1parser(buf, len).get()));
}
else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mBestPosition,
+ setIteminReport(mCache.mBestPosition,
SystemStatusBestPosition(SystemStatusPQWP2parser(buf, len).get()));
}
else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mXtra,
+ setIteminReport(mCache.mXtra,
SystemStatusXtra(SystemStatusPQWP3parser(buf, len).get()));
}
else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mEphemeris,
+ setIteminReport(mCache.mEphemeris,
SystemStatusEphemeris(SystemStatusPQWP4parser(buf, len).get()));
}
else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mSvHealth,
+ setIteminReport(mCache.mSvHealth,
SystemStatusSvHealth(SystemStatusPQWP5parser(buf, len).get()));
}
else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mPdr,
+ setIteminReport(mCache.mPdr,
SystemStatusPdr(SystemStatusPQWP6parser(buf, len).get()));
}
else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mNavData,
+ setIteminReport(mCache.mNavData,
SystemStatusNavData(SystemStatusPQWP7parser(buf, len).get()));
}
else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
- ret = setIteminReport(mCache.mPositionFailure,
+ setIteminReport(mCache.mPositionFailure,
SystemStatusPositionFailure(SystemStatusPQWS1parser(buf, len).get()));
}
else {
@@ -1373,7 +1405,7 @@ bool SystemStatus::setNmeaString(const char *data, uint32_t len)
}
pthread_mutex_unlock(&mMutexSystemStatus);
- return ret;
+ return true;
}
/******************************************************************************
@@ -1414,94 +1446,92 @@ bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
switch(dataitem->getId())
{
case AIRPLANEMODE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusAirplaneMode>(mCache.mAirplaneMode,
- *(static_cast<AirplaneModeDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mAirplaneMode,
+ SystemStatusAirplaneMode(*(static_cast<AirplaneModeDataItemBase*>(dataitem))));
break;
case ENH_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusENH>(mCache.mENH,
- *(static_cast<ENHDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mENH,
+ SystemStatusENH(*(static_cast<ENHDataItemBase*>(dataitem))));
break;
case GPSSTATE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusGpsState>(mCache.mGPSState,
- *(static_cast<GPSStateDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mGPSState,
+ SystemStatusGpsState(*(static_cast<GPSStateDataItemBase*>(dataitem))));
break;
case NLPSTATUS_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusNLPStatus>(mCache.mNLPStatus,
- *(static_cast<NLPStatusDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mNLPStatus,
+ SystemStatusNLPStatus(*(static_cast<NLPStatusDataItemBase*>(dataitem))));
break;
case WIFIHARDWARESTATE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusWifiHardwareState>(mCache.mWifiHardwareState,
- *(static_cast<WifiHardwareStateDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mWifiHardwareState,
+ SystemStatusWifiHardwareState(*(static_cast<WifiHardwareStateDataItemBase*>(dataitem))));
break;
case NETWORKINFO_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusNetworkInfo>(mCache.mNetworkInfo,
- *(static_cast<NetworkInfoDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mNetworkInfo,
+ SystemStatusNetworkInfo(*(static_cast<NetworkInfoDataItemBase*>(dataitem))));
break;
case RILSERVICEINFO_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusServiceInfo>(mCache.mRilServiceInfo,
- *(static_cast<RilServiceInfoDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mRilServiceInfo,
+ SystemStatusServiceInfo(*(static_cast<RilServiceInfoDataItemBase*>(dataitem))));
break;
case RILCELLINFO_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusRilCellInfo>(mCache.mRilCellInfo,
- *(static_cast<RilCellInfoDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mRilCellInfo,
+ SystemStatusRilCellInfo(*(static_cast<RilCellInfoDataItemBase*>(dataitem))));
break;
case SERVICESTATUS_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusServiceStatus>(mCache.mServiceStatus,
- *(static_cast<ServiceStatusDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mServiceStatus,
+ SystemStatusServiceStatus(*(static_cast<ServiceStatusDataItemBase*>(dataitem))));
break;
case MODEL_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusModel>(mCache.mModel,
- *(static_cast<ModelDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mModel,
+ SystemStatusModel(*(static_cast<ModelDataItemBase*>(dataitem))));
break;
case MANUFACTURER_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusManufacturer>(mCache.mManufacturer,
- *(static_cast<ManufacturerDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mManufacturer,
+ SystemStatusManufacturer(*(static_cast<ManufacturerDataItemBase*>(dataitem))));
break;
case ASSISTED_GPS_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusAssistedGps>(mCache.mAssistedGps,
- *(static_cast<AssistedGpsDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mAssistedGps,
+ SystemStatusAssistedGps(*(static_cast<AssistedGpsDataItemBase*>(dataitem))));
break;
case SCREEN_STATE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusScreenState>(mCache.mScreenState,
- *(static_cast<ScreenStateDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mScreenState,
+ SystemStatusScreenState(*(static_cast<ScreenStateDataItemBase*>(dataitem))));
break;
case POWER_CONNECTED_STATE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusPowerConnectState>(mCache.mPowerConnectState,
- *(static_cast<PowerConnectStateDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mPowerConnectState,
+ SystemStatusPowerConnectState(*(static_cast<PowerConnectStateDataItemBase*>(dataitem))));
break;
case TIMEZONE_CHANGE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusTimeZoneChange>(mCache.mTimeZoneChange,
- *(static_cast<TimeZoneChangeDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mTimeZoneChange,
+ SystemStatusTimeZoneChange(*(static_cast<TimeZoneChangeDataItemBase*>(dataitem))));
break;
case TIME_CHANGE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusTimeChange>(mCache.mTimeChange,
- *(static_cast<TimeChangeDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mTimeChange,
+ SystemStatusTimeChange(*(static_cast<TimeChangeDataItemBase*>(dataitem))));
break;
case WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusWifiSupplicantStatus>(
- mCache.mWifiSupplicantStatus,
- *(static_cast<WifiSupplicantStatusDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mWifiSupplicantStatus,
+ SystemStatusWifiSupplicantStatus(*(static_cast<WifiSupplicantStatusDataItemBase*>(dataitem))));
break;
case SHUTDOWN_STATE_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusShutdownState>(mCache.mShutdownState,
- *(static_cast<ShutdownStateDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mShutdownState,
+ SystemStatusShutdownState(*(static_cast<ShutdownStateDataItemBase*>(dataitem))));
break;
case TAC_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusTac>(mCache.mTac,
- *(static_cast<TacDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mTac,
+ SystemStatusTac(*(static_cast<TacDataItemBase*>(dataitem))));
break;
case MCCMNC_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusMccMnc>(mCache.mMccMnc,
- *(static_cast<MccmncDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mMccMnc,
+ SystemStatusMccMnc(*(static_cast<MccmncDataItemBase*>(dataitem))));
break;
case BTLE_SCAN_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusBtDeviceScanDetail>(mCache.mBtDeviceScanDetail,
- *(static_cast<BtDeviceScanDetailsDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mBtDeviceScanDetail,
+ SystemStatusBtDeviceScanDetail(*(static_cast<BtDeviceScanDetailsDataItemBase*>(dataitem))));
break;
case BT_SCAN_DATA_ITEM_ID:
- ret = setItemBaseinReport<SystemStatusBtleDeviceScanDetail>(
- mCache.mBtLeDeviceScanDetail,
- *(static_cast<BtLeDeviceScanDetailsDataItemBase*>(dataitem)));
+ ret = setIteminReport(mCache.mBtLeDeviceScanDetail,
+ SystemStatusBtleDeviceScanDetail(*(static_cast<BtLeDeviceScanDetailsDataItemBase*>(dataitem))));
break;
default:
break;
@@ -1620,7 +1650,7 @@ bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) con
@return true when successfully done
******************************************************************************/
-bool SystemStatus::setDefaultReport(void)
+bool SystemStatus::setDefaultGnssEngineStates(void)
{
pthread_mutex_lock(&mMutexSystemStatus);
@@ -1641,29 +1671,6 @@ bool SystemStatus::setDefaultReport(void)
setDefaultIteminReport(mCache.mPositionFailure, SystemStatusPositionFailure());
- setDefaultIteminReport(mCache.mAirplaneMode, SystemStatusAirplaneMode());
- setDefaultIteminReport(mCache.mENH, SystemStatusENH());
- setDefaultIteminReport(mCache.mGPSState, SystemStatusGpsState());
- setDefaultIteminReport(mCache.mNLPStatus, SystemStatusNLPStatus());
- setDefaultIteminReport(mCache.mWifiHardwareState, SystemStatusWifiHardwareState());
- setDefaultIteminReport(mCache.mNetworkInfo, SystemStatusNetworkInfo());
- setDefaultIteminReport(mCache.mRilServiceInfo, SystemStatusServiceInfo());
- setDefaultIteminReport(mCache.mRilCellInfo, SystemStatusRilCellInfo());
- setDefaultIteminReport(mCache.mServiceStatus, SystemStatusServiceStatus());
- setDefaultIteminReport(mCache.mModel, SystemStatusModel());
- setDefaultIteminReport(mCache.mManufacturer, SystemStatusManufacturer());
- setDefaultIteminReport(mCache.mAssistedGps, SystemStatusAssistedGps());
- setDefaultIteminReport(mCache.mScreenState, SystemStatusScreenState());
- setDefaultIteminReport(mCache.mPowerConnectState, SystemStatusPowerConnectState());
- setDefaultIteminReport(mCache.mTimeZoneChange, SystemStatusTimeZoneChange());
- setDefaultIteminReport(mCache.mTimeChange, SystemStatusTimeChange());
- setDefaultIteminReport(mCache.mWifiSupplicantStatus, SystemStatusWifiSupplicantStatus());
- setDefaultIteminReport(mCache.mShutdownState, SystemStatusShutdownState());
- setDefaultIteminReport(mCache.mTac, SystemStatusTac());
- setDefaultIteminReport(mCache.mMccMnc, SystemStatusMccMnc());
- setDefaultIteminReport(mCache.mBtDeviceScanDetail, SystemStatusBtDeviceScanDetail());
- setDefaultIteminReport(mCache.mBtLeDeviceScanDetail, SystemStatusBtleDeviceScanDetail());
-
pthread_mutex_unlock(&mMutexSystemStatus);
return true;
}
@@ -1675,17 +1682,12 @@ bool SystemStatus::setDefaultReport(void)
@return true when successfully done
******************************************************************************/
-bool SystemStatus::eventConnectionStatus(bool connected, uint8_t type)
+bool SystemStatus::eventConnectionStatus(bool connected, int8_t type)
{
- if (connected != mConnected) {
- mConnected = connected;
+ // send networkinof dataitem to systemstatus observer clients
+ SystemStatusNetworkInfo s(type, "", "", connected);
+ mSysStatusObsvr.notify({&s});
- // send networkinof dataitem to systemstatus observer clients
- SystemStatusNetworkInfo s(type, "", "", false, connected, false);
- list<IDataItemCore*> dl(0);
- dl.push_back(&s);
- mSysStatusObsvr.notify(dl);
- }
return true;
}
diff --git a/gps/core/SystemStatus.h b/gps/core/SystemStatus.h
index 1bcef10..b2f4fb6 100644
--- a/gps/core/SystemStatus.h
+++ b/gps/core/SystemStatus.h
@@ -30,9 +30,10 @@
#define __SYSTEM_STATUS__
#include <stdint.h>
-#include <string>
+#include <sys/time.h>
#include <vector>
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
#include <MsgTask.h>
#include <IDataItemCore.h>
#include <IOsObserver.h>
@@ -70,14 +71,17 @@ public:
static const uint32_t maxItem = 5;
SystemStatusItemBase() {
- timeval tv;
- gettimeofday(&tv, NULL);
+ struct timespec tv;
+ clock_gettime(CLOCK_MONOTONIC, &tv);
mUtcTime.tv_sec = tv.tv_sec;
- mUtcTime.tv_nsec = tv.tv_usec *1000ULL;
+ mUtcTime.tv_nsec = tv.tv_nsec;
mUtcReported = mUtcTime;
};
- virtual ~SystemStatusItemBase() { };
- virtual void dump(void) { };
+ virtual ~SystemStatusItemBase() {};
+ inline virtual SystemStatusItemBase& collate(SystemStatusItemBase&) {
+ return *this;
+ }
+ virtual void dump(void) {};
};
class SystemStatusLocation : public SystemStatusItemBase
@@ -92,7 +96,7 @@ public:
const GpsLocationExtended& locationEx) :
mValid(true),
mLocation(location),
- mLocationEx(locationEx) { }
+ mLocationEx(locationEx) {}
bool equals(const SystemStatusLocation& peer);
void dump(void);
};
@@ -152,6 +156,12 @@ public:
double mAgcGlo;
double mAgcBds;
double mAgcGal;
+ uint32_t mGloBpAmpI;
+ uint32_t mGloBpAmpQ;
+ uint32_t mBdsBpAmpI;
+ uint32_t mBdsBpAmpQ;
+ uint32_t mGalBpAmpI;
+ uint32_t mGalBpAmpQ;
inline SystemStatusRfAndParams() :
mPgaGain(0),
mGpsBpAmpI(0),
@@ -165,7 +175,13 @@ public:
mAgcGps(0),
mAgcGlo(0),
mAgcBds(0),
- mAgcGal(0) {}
+ mAgcGal(0),
+ mGloBpAmpI(0),
+ mGloBpAmpQ(0),
+ mBdsBpAmpI(0),
+ mBdsBpAmpQ(0),
+ mGalBpAmpI(0),
+ mGalBpAmpQ(0) {}
inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea);
bool equals(const SystemStatusRfAndParams& peer);
void dump(void);
@@ -444,38 +460,49 @@ public:
class SystemStatusNetworkInfo : public SystemStatusItemBase,
public NetworkInfoDataItemBase
{
+ NetworkInfoDataItemBase* mSrcObjPtr;
public:
inline SystemStatusNetworkInfo(
int32_t type=0,
std::string typeName="",
string subTypeName="",
- bool available=false,
bool connected=false,
bool roaming=false) :
NetworkInfoDataItemBase(
+ (NetworkType)type,
type,
typeName,
subTypeName,
- available,
+ connected && (!roaming),
connected,
- roaming) {}
+ roaming),
+ mSrcObjPtr(nullptr) {}
inline SystemStatusNetworkInfo(const NetworkInfoDataItemBase& itemBase) :
- NetworkInfoDataItemBase(itemBase) {
+ NetworkInfoDataItemBase(itemBase),
+ mSrcObjPtr((NetworkInfoDataItemBase*)&itemBase) {
mType = itemBase.getType();
}
inline bool equals(const SystemStatusNetworkInfo& peer) {
- if ((mType == peer.mType) &&
- (mTypeName == peer.mTypeName) &&
- (mSubTypeName == peer.mSubTypeName) &&
- (mAvailable == peer.mAvailable) &&
- (mConnected == peer.mConnected) &&
- (mRoaming == peer.mRoaming)) {
- return true;
+ return (mAllTypes == peer.mAllTypes);
+ }
+ inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) {
+ uint64_t allTypes = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mAllTypes;
+ if (mConnected) {
+ mAllTypes |= allTypes;
+ } else if (0 != mAllTypes) {
+ mAllTypes = (allTypes & (~mAllTypes));
+ } // else (mConnected == false && mAllTypes == 0)
+ // we keep mAllTypes as 0, which means no more connections.
+
+ if (nullptr != mSrcObjPtr) {
+ // this is critical, changing mAllTypes of the original obj
+ mSrcObjPtr->mAllTypes = mAllTypes;
}
- return false;
+ return *this;
}
inline void dump(void) override {
- LOC_LOGD("NetworkInfo: type=%u connected=%u", mType, mConnected);
+ LOC_LOGD("NetworkInfo: mAllTypes=%" PRIx64 " connected=%u mType=%x",
+ mAllTypes, mConnected, mType);
}
};
@@ -487,8 +514,9 @@ public:
RilServiceInfoDataItemBase() {}
inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) :
RilServiceInfoDataItemBase(itemBase) {}
- inline bool equals(const SystemStatusServiceInfo& /*peer*/) {
- return true;
+ inline bool equals(const SystemStatusServiceInfo& peer) {
+ return static_cast<const RilServiceInfoDataItemBase&>(peer) ==
+ static_cast<const RilServiceInfoDataItemBase&>(*this);
}
};
@@ -500,8 +528,9 @@ public:
RilCellInfoDataItemBase() {}
inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) :
RilCellInfoDataItemBase(itemBase) {}
- inline bool equals(const SystemStatusRilCellInfo& /*peer*/) {
- return true;
+ inline bool equals(const SystemStatusRilCellInfo& peer) {
+ return static_cast<const RilCellInfoDataItemBase&>(peer) ==
+ static_cast<const RilCellInfoDataItemBase&>(*this);
}
};
@@ -770,13 +799,9 @@ private:
// Data members
static pthread_mutex_t mMutexSystemStatus;
SystemStatusReports mCache;
- bool mConnected;
-
- template <typename TYPE_SYSTEMSTATUS_ITEM, typename TYPE_REPORT, typename TYPE_ITEMBASE>
- bool setItemBaseinReport(TYPE_REPORT& report, const TYPE_ITEMBASE& s);
template <typename TYPE_REPORT, typename TYPE_ITEM>
- bool setIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s);
+ bool setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s);
// set default dataitem derived item in report cache
template <typename TYPE_REPORT, typename TYPE_ITEM>
@@ -796,8 +821,8 @@ public:
bool eventDataItemNotify(IDataItemCore* dataitem);
bool setNmeaString(const char *data, uint32_t len);
bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const;
- bool setDefaultReport(void);
- bool eventConnectionStatus(bool connected, uint8_t type);
+ bool setDefaultGnssEngineStates(void);
+ bool eventConnectionStatus(bool connected, int8_t type);
};
} // namespace loc_core
diff --git a/gps/core/SystemStatusOsObserver.cpp b/gps/core/SystemStatusOsObserver.cpp
index 541b5fd..8127e86 100644
--- a/gps/core/SystemStatusOsObserver.cpp
+++ b/gps/core/SystemStatusOsObserver.cpp
@@ -32,25 +32,20 @@
#include <SystemStatus.h>
#include <SystemStatusOsObserver.h>
#include <IDataItemCore.h>
-#include <IClientIndex.h>
-#include <IDataItemIndex.h>
-#include <IndexFactory.h>
#include <DataItemsFactoryProxy.h>
namespace loc_core
{
-SystemStatusOsObserver::SystemStatusOsObserver(
- SystemStatus* systemstatus, const MsgTask* msgTask) :
- mSystemStatus(systemstatus),
- mAddress("SystemStatusOsObserver"),
- mClientIndex(IndexFactory<IDataItemObserver*, DataItemId> :: createClientIndex()),
- mDataItemIndex(IndexFactory<IDataItemObserver*, DataItemId> :: createDataItemIndex())
-{
- mContext.mMsgTask = msgTask;
+template <typename CINT, typename COUT>
+COUT SystemStatusOsObserver::containerTransfer(CINT& inContainer) {
+ COUT outContainer(0);
+ for (auto item : inContainer) {
+ outContainer.insert(outContainer.begin(), item);
+ }
+ return outContainer;
}
-SystemStatusOsObserver::~SystemStatusOsObserver()
-{
+SystemStatusOsObserver::~SystemStatusOsObserver() {
// Close data-item library handle
DataItemsFactoryProxy::closeDataItemLibraryHandle();
@@ -62,290 +57,238 @@ SystemStatusOsObserver::~SystemStatusOsObserver()
}
mDataItemCache.clear();
- delete mClientIndex;
- delete mDataItemIndex;
}
void SystemStatusOsObserver::setSubscriptionObj(IDataItemSubscription* subscriptionObj)
{
- mContext.mSubscriptionObj = subscriptionObj;
-
- LOC_LOGD("Request cache size - Subscribe:%zu RequestData:%zu",
- mSubscribeReqCache.size(), mReqDataCache.size());
-
- // we have received the subscription object. process cached requests
- // process - subscribe request cache
- for (auto each : mSubscribeReqCache) {
- subscribe(each.second, each.first);
- }
- // process - requestData request cache
- for (auto each : mReqDataCache) {
- requestData(each.second, each.first);
- }
-}
-
-// Helper to cache requests subscribe and requestData till subscription obj is obtained
-void SystemStatusOsObserver::cacheObserverRequest(ObserverReqCache& reqCache,
- const list<DataItemId>& l, IDataItemObserver* client)
-{
- ObserverReqCache::iterator dicIter = reqCache.find(client);
- if (dicIter != reqCache.end()) {
- // found
- list<DataItemId> difference(0);
- set_difference(l.begin(), l.end(),
- dicIter->second.begin(), dicIter->second.end(),
- inserter(difference, difference.begin()));
- if (!difference.empty()) {
- difference.sort();
- dicIter->second.merge(difference);
- dicIter->second.unique();
+ struct SetSubsObj : public LocMsg {
+ ObserverContext& mContext;
+ IDataItemSubscription* mSubsObj;
+ inline SetSubsObj(ObserverContext& context, IDataItemSubscription* subscriptionObj) :
+ mContext(context), mSubsObj(subscriptionObj) {}
+ void proc() const {
+ mContext.mSubscriptionObj = mSubsObj;
+
+ if (!mContext.mSSObserver->mDataItemToClients.empty()) {
+ list<DataItemId> dis(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ mContext.mSSObserver->mDataItemToClients.getKeys()));
+ mContext.mSubscriptionObj->subscribe(dis, mContext.mSSObserver);
+ mContext.mSubscriptionObj->requestData(dis, mContext.mSSObserver);
+ }
}
- }
- else {
- // not found
- reqCache[client] = l;
+ };
+
+ if (nullptr == subscriptionObj) {
+ LOC_LOGw("subscriptionObj is NULL");
+ } else {
+ mContext.mMsgTask->sendMsg(new SetSubsObj(mContext, subscriptionObj));
}
}
/******************************************************************************
IDataItemSubscription Overrides
******************************************************************************/
-void SystemStatusOsObserver::subscribe(
- const list<DataItemId>& l, IDataItemObserver* client)
+void SystemStatusOsObserver::subscribe(const list<DataItemId>& l, IDataItemObserver* client,
+ bool toRequestData)
{
- if (nullptr == mContext.mSubscriptionObj) {
- LOC_LOGD("%s]: Subscription object is NULL. Caching requests", __func__);
- cacheObserverRequest(mSubscribeReqCache, l, client);
- return;
- }
-
struct HandleSubscribeReq : public LocMsg {
- HandleSubscribeReq(SystemStatusOsObserver* parent,
- const list<DataItemId>& l, IDataItemObserver* client) :
- mParent(parent), mClient(client), mDataItemList(l) {}
- virtual ~HandleSubscribeReq() {}
- void proc() const {
+ inline HandleSubscribeReq(SystemStatusOsObserver* parent,
+ list<DataItemId>& l, IDataItemObserver* client, bool requestData) :
+ mParent(parent), mClient(client),
+ mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)),
+ mToRequestData(requestData) {}
- if (mDataItemList.empty()) {
- LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
- return;
- }
-
- // Handle First Response
- list<DataItemId> pendingFirstResponseList(0);
- mParent->mClientIndex->add(mClient, mDataItemList, pendingFirstResponseList);
-
- // Do not send first response for only pendingFirstResponseList,
- // instead send for all the data items (present in the cache) that
- // have been subscribed for each time.
- mParent->sendFirstResponse(mDataItemList, mClient);
+ void proc() const {
+ unordered_set<DataItemId> dataItemsToSubscribe(0);
+ mParent->mDataItemToClients.add(mDataItemSet, {mClient}, &dataItemsToSubscribe);
+ mParent->mClientToDataItems.add(mClient, mDataItemSet);
- list<DataItemId> yetToSubscribeDataItemsList(0);
- mParent->mDataItemIndex->add(mClient, mDataItemList, yetToSubscribeDataItemsList);
+ mParent->sendCachedDataItems(mDataItemSet, mClient);
- // Send subscription list to framework
- if (!yetToSubscribeDataItemsList.empty()) {
- mParent->mContext.mSubscriptionObj->subscribe(yetToSubscribeDataItemsList, mParent);
+ // Send subscription set to framework
+ if (nullptr != mParent->mContext.mSubscriptionObj && !dataItemsToSubscribe.empty()) {
LOC_LOGD("Subscribe Request sent to framework for the following");
- mParent->logMe(yetToSubscribeDataItemsList);
+ mParent->logMe(dataItemsToSubscribe);
+
+ if (mToRequestData) {
+ mParent->mContext.mSubscriptionObj->requestData(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ std::move(dataItemsToSubscribe)),
+ mParent);
+ } else {
+ mParent->mContext.mSubscriptionObj->subscribe(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ std::move(dataItemsToSubscribe)),
+ mParent);
+ }
}
}
- SystemStatusOsObserver* mParent;
+ mutable SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
- const list<DataItemId> mDataItemList;
+ const unordered_set<DataItemId> mDataItemSet;
+ bool mToRequestData;
};
- mContext.mMsgTask->sendMsg(new (nothrow) HandleSubscribeReq(this, l, client));
+
+ if (l.empty() || nullptr == client) {
+ LOC_LOGw("Data item set is empty or client is nullptr");
+ } else {
+ mContext.mMsgTask->sendMsg(
+ new HandleSubscribeReq(this, (list<DataItemId>&)l, client, toRequestData));
+ }
}
void SystemStatusOsObserver::updateSubscription(
const list<DataItemId>& l, IDataItemObserver* client)
{
- if (nullptr == mContext.mSubscriptionObj) {
- LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__);
- return;
- }
-
struct HandleUpdateSubscriptionReq : public LocMsg {
HandleUpdateSubscriptionReq(SystemStatusOsObserver* parent,
- const list<DataItemId>& l, IDataItemObserver* client) :
- mParent(parent), mClient(client), mDataItemList(l) {}
- virtual ~HandleUpdateSubscriptionReq() {}
- void proc() const {
- if (mDataItemList.empty()) {
- LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
- return;
- }
-
- list<DataItemId> currentlySubscribedList(0);
- mParent->mClientIndex->getSubscribedList(mClient, currentlySubscribedList);
+ list<DataItemId>& l, IDataItemObserver* client) :
+ mParent(parent), mClient(client),
+ mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
- list<DataItemId> removeDataItemList(0);
- set_difference(currentlySubscribedList.begin(), currentlySubscribedList.end(),
- mDataItemList.begin(), mDataItemList.end(),
- inserter(removeDataItemList,removeDataItemList.begin()));
-
- // Handle First Response
- list<DataItemId> pendingFirstResponseList(0);
- mParent->mClientIndex->add(mClient, mDataItemList, pendingFirstResponseList);
+ void proc() const {
+ unordered_set<DataItemId> dataItemsToSubscribe(0);
+ unordered_set<DataItemId> dataItemsToUnsubscribe(0);
+ unordered_set<IDataItemObserver*> clients({mClient});
+ // below removes clients from all entries keyed with the return of the
+ // mClientToDataItems.update() call. If leaving an empty set of clients as the
+ // result, the entire entry will be removed. dataItemsToUnsubscribe will be
+ // populated to keep the keys of the removed entries.
+ mParent->mDataItemToClients.trimOrRemove(
+ // this call updates <IDataItemObserver*, DataItemId> map; removes
+ // the DataItemId's that are not new to the clietn from mDataItemSet;
+ // and returns a set of mDataItemSet's that are no longer used by client.
+ // This unused set of mDataItemSet's is passed to trimOrRemove method of
+ // <DataItemId, IDataItemObserver*> map to remove the client from the
+ // corresponding entries, and gets a set of the entries that are
+ // removed from the <DataItemId, IDataItemObserver*> map as a result.
+ mParent->mClientToDataItems.update(mClient,
+ (unordered_set<DataItemId>&)mDataItemSet),
+ clients, &dataItemsToUnsubscribe, nullptr);
+ // below adds mClient to <DataItemId, IDataItemObserver*> map, and populates
+ // new keys added to that map, which are DataItemIds to be subscribed.
+ mParent->mDataItemToClients.add(mDataItemSet, clients, &dataItemsToSubscribe);
// Send First Response
- mParent->sendFirstResponse(pendingFirstResponseList, mClient);
-
- list<DataItemId> yetToSubscribeDataItemsList(0);
- mParent->mDataItemIndex->add(
- mClient, mDataItemList, yetToSubscribeDataItemsList);
-
- // Send subscription list to framework
- if (!yetToSubscribeDataItemsList.empty()) {
- mParent->mContext.mSubscriptionObj->subscribe(
- yetToSubscribeDataItemsList, mParent);
- LOC_LOGD("Subscribe Request sent to framework for the following");
- mParent->logMe(yetToSubscribeDataItemsList);
- }
-
- list<DataItemId> unsubscribeList(0);
- list<DataItemId> unused(0);
- mParent->mClientIndex->remove(mClient, removeDataItemList, unused);
+ mParent->sendCachedDataItems(mDataItemSet, mClient);
+
+ if (nullptr != mParent->mContext.mSubscriptionObj) {
+ // Send subscription set to framework
+ if (!dataItemsToSubscribe.empty()) {
+ LOC_LOGD("Subscribe Request sent to framework for the following");
+ mParent->logMe(dataItemsToSubscribe);
+
+ mParent->mContext.mSubscriptionObj->subscribe(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ std::move(dataItemsToSubscribe)),
+ mParent);
+ }
- if (!mParent->mClientIndex->isSubscribedClient(mClient)) {
- mParent->mDataItemIndex->remove(
- list<IDataItemObserver*> (1,mClient), unsubscribeList);
- }
- if (!unsubscribeList.empty()) {
// Send unsubscribe to framework
- mParent->mContext.mSubscriptionObj->unsubscribe(unsubscribeList, mParent);
- LOC_LOGD("Unsubscribe Request sent to framework for the following");
- mParent->logMe(unsubscribeList);
+ if (!dataItemsToUnsubscribe.empty()) {
+ LOC_LOGD("Unsubscribe Request sent to framework for the following");
+ mParent->logMe(dataItemsToUnsubscribe);
+
+ mParent->mContext.mSubscriptionObj->unsubscribe(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ std::move(dataItemsToUnsubscribe)),
+ mParent);
+ }
}
}
SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
- const list<DataItemId> mDataItemList;
+ unordered_set<DataItemId> mDataItemSet;
};
- mContext.mMsgTask->sendMsg(new (nothrow) HandleUpdateSubscriptionReq(this, l, client));
-}
-void SystemStatusOsObserver::requestData(
- const list<DataItemId>& l, IDataItemObserver* client)
-{
- if (nullptr == mContext.mSubscriptionObj) {
- LOC_LOGD("%s]: Subscription object is NULL. Caching requests", __func__);
- cacheObserverRequest(mReqDataCache, l, client);
- return;
+ if (l.empty() || nullptr == client) {
+ LOC_LOGw("Data item set is empty or client is nullptr");
+ } else {
+ mContext.mMsgTask->sendMsg(
+ new HandleUpdateSubscriptionReq(this, (list<DataItemId>&)l, client));
}
-
- struct HandleRequestData : public LocMsg {
- HandleRequestData(SystemStatusOsObserver* parent,
- const list<DataItemId>& l, IDataItemObserver* client) :
- mParent(parent), mClient(client), mDataItemList(l) {}
- virtual ~HandleRequestData() {}
- void proc() const {
- if (mDataItemList.empty()) {
- LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
- return;
- }
-
- list<DataItemId> yetToSubscribeDataItemsList(0);
- mParent->mClientIndex->add(
- mClient, mDataItemList, yetToSubscribeDataItemsList);
- mParent->mDataItemIndex->add(
- mClient, mDataItemList, yetToSubscribeDataItemsList);
-
- // Send subscription list to framework
- if (!mDataItemList.empty()) {
- mParent->mContext.mSubscriptionObj->requestData(mDataItemList, mParent);
- LOC_LOGD("Subscribe Request sent to framework for the following");
- mParent->logMe(yetToSubscribeDataItemsList);
- }
- }
- SystemStatusOsObserver* mParent;
- IDataItemObserver* mClient;
- const list<DataItemId> mDataItemList;
- };
- mContext.mMsgTask->sendMsg(new (nothrow) HandleRequestData(this, l, client));
}
void SystemStatusOsObserver::unsubscribe(
const list<DataItemId>& l, IDataItemObserver* client)
{
- if (nullptr == mContext.mSubscriptionObj) {
- LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__);
- return;
- }
struct HandleUnsubscribeReq : public LocMsg {
HandleUnsubscribeReq(SystemStatusOsObserver* parent,
- const list<DataItemId>& l, IDataItemObserver* client) :
- mParent(parent), mClient(client), mDataItemList(l) {}
- virtual ~HandleUnsubscribeReq() {}
- void proc() const {
- if (mDataItemList.empty()) {
- LOC_LOGV("mDataItemList is empty. Nothing to do. Exiting");
- return;
- }
+ list<DataItemId>& l, IDataItemObserver* client) :
+ mParent(parent), mClient(client),
+ mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
- list<DataItemId> unsubscribeList(0);
- list<DataItemId> unused(0);
- mParent->mClientIndex->remove(mClient, mDataItemList, unused);
-
- for (auto each : mDataItemList) {
- list<IDataItemObserver*> clientListSubs(0);
- list<IDataItemObserver*> clientListOut(0);
- mParent->mDataItemIndex->remove(
- each, list<IDataItemObserver*> (1,mClient), clientListOut);
- // check if there are any other subscribed client for this data item id
- mParent->mDataItemIndex->getListOfSubscribedClients(each, clientListSubs);
- if (clientListSubs.empty())
- {
- LOC_LOGD("Client list subscribed is empty for dataitem - %d", each);
- unsubscribeList.push_back(each);
- }
- }
+ void proc() const {
+ unordered_set<DataItemId> dataItemsUnusedByClient(0);
+ unordered_set<IDataItemObserver*> clientToRemove(0);
+ mParent->mClientToDataItems.trimOrRemove({mClient}, mDataItemSet, &clientToRemove,
+ &dataItemsUnusedByClient);
+ unordered_set<DataItemId> dataItemsToUnsubscribe(0);
+ mParent->mDataItemToClients.trimOrRemove(dataItemsUnusedByClient, {mClient},
+ &dataItemsToUnsubscribe, nullptr);
+
+ if (nullptr != mParent->mContext.mSubscriptionObj && !dataItemsToUnsubscribe.empty()) {
+ LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
+ mParent->logMe(dataItemsToUnsubscribe);
- if (!unsubscribeList.empty()) {
// Send unsubscribe to framework
- mParent->mContext.mSubscriptionObj->unsubscribe(unsubscribeList, mParent);
- LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
- mParent->logMe(unsubscribeList);
+ mParent->mContext.mSubscriptionObj->unsubscribe(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ std::move(dataItemsToUnsubscribe)),
+ mParent);
}
}
SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
- const list<DataItemId> mDataItemList;
+ unordered_set<DataItemId> mDataItemSet;
};
- mContext.mMsgTask->sendMsg(new (nothrow) HandleUnsubscribeReq(this, l, client));
+
+ if (l.empty() || nullptr == client) {
+ LOC_LOGw("Data item set is empty or client is nullptr");
+ } else {
+ mContext.mMsgTask->sendMsg(new HandleUnsubscribeReq(this, (list<DataItemId>&)l, client));
+ }
}
void SystemStatusOsObserver::unsubscribeAll(IDataItemObserver* client)
{
- if (nullptr == mContext.mSubscriptionObj) {
- LOC_LOGE("%s:%d]: Subscription object is NULL", __func__, __LINE__);
- return;
- }
-
struct HandleUnsubscribeAllReq : public LocMsg {
HandleUnsubscribeAllReq(SystemStatusOsObserver* parent,
IDataItemObserver* client) :
mParent(parent), mClient(client) {}
- virtual ~HandleUnsubscribeAllReq() {}
- void proc() const {
- list<IDataItemObserver*> clients(1, mClient);
- list<DataItemId> unsubscribeList(0);
- if(0 == mParent->mClientIndex->remove(mClient)) {
- return;
- }
- mParent->mDataItemIndex->remove(clients, unsubscribeList);
- if (!unsubscribeList.empty()) {
- // Send unsubscribe to framework
- mParent->mContext.mSubscriptionObj->unsubscribe(unsubscribeList, mParent);
- LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
- mParent->logMe(unsubscribeList);
+ void proc() const {
+ unordered_set<DataItemId> diByClient = mParent->mClientToDataItems.getValSet(mClient);
+ if (!diByClient.empty()) {
+ unordered_set<DataItemId> dataItemsToUnsubscribe;
+ mParent->mClientToDataItems.remove(mClient);
+ mParent->mDataItemToClients.trimOrRemove(diByClient, {mClient},
+ &dataItemsToUnsubscribe, nullptr);
+
+ if (!dataItemsToUnsubscribe.empty() &&
+ nullptr != mParent->mContext.mSubscriptionObj) {
+
+ LOC_LOGD("Unsubscribe Request sent to framework for the following data items");
+ mParent->logMe(dataItemsToUnsubscribe);
+
+ // Send unsubscribe to framework
+ mParent->mContext.mSubscriptionObj->unsubscribe(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ std::move(dataItemsToUnsubscribe)),
+ mParent);
+ }
}
}
SystemStatusOsObserver* mParent;
IDataItemObserver* mClient;
};
- mContext.mMsgTask->sendMsg(new (nothrow) HandleUnsubscribeAllReq(this, client));
+
+ if (nullptr == client) {
+ LOC_LOGw("Data item set is empty or client is nullptr");
+ } else {
+ mContext.mMsgTask->sendMsg(new HandleUnsubscribeAllReq(this, client));
+ }
}
/******************************************************************************
@@ -353,84 +296,81 @@ void SystemStatusOsObserver::unsubscribeAll(IDataItemObserver* client)
******************************************************************************/
void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
{
- list<IDataItemCore*> dataItemList(0);
-
- for (auto each : dlist) {
- string dv;
- each->stringify(dv);
- LOC_LOGD("notify: DataItem In Value:%s", dv.c_str());
-
- IDataItemCore* di = DataItemsFactoryProxy::createNewDataItem(each->getId());
- if (nullptr == di) {
- LOC_LOGE("Unable to create dataitem:%d", each->getId());
- return;
- }
-
- // Copy contents into the newly created data item
- di->copy(each);
-
- // Request systemstatus to record this dataitem in its cache
- if (mSystemStatus->eventDataItemNotify(di)) {
- // add this dataitem if updated from last one
- dataItemList.push_back(di);
- }
- }
-
struct HandleNotify : public LocMsg {
- HandleNotify(SystemStatusOsObserver* parent, const list<IDataItemCore*>& l) :
- mParent(parent), mDList(l) {}
- virtual ~HandleNotify() {
- for (auto each : mDList) {
- delete each;
+ HandleNotify(SystemStatusOsObserver* parent, vector<IDataItemCore*>& v) :
+ mParent(parent), mDiVec(std::move(v)) {}
+
+ inline virtual ~HandleNotify() {
+ for (auto item : mDiVec) {
+ delete item;
}
}
+
void proc() const {
// Update Cache with received data items and prepare
// list of data items to be sent.
- list<DataItemId> dataItemIdsToBeSent(0);
- for (auto item : mDList) {
- bool dataItemUpdated = false;
- mParent->updateCache(item, dataItemUpdated);
- if (dataItemUpdated) {
- dataItemIdsToBeSent.push_back(item->getId());
+ unordered_set<DataItemId> dataItemIdsToBeSent(0);
+ for (auto item : mDiVec) {
+ if (mParent->updateCache(item)) {
+ dataItemIdsToBeSent.insert(item->getId());
}
}
// Send data item to all subscribed clients
- list<IDataItemObserver*> clientList(0);
+ unordered_set<IDataItemObserver*> clientSet(0);
for (auto each : dataItemIdsToBeSent) {
- list<IDataItemObserver*> clients(0);
- mParent->mDataItemIndex->getListOfSubscribedClients(each, clients);
- for (auto each_cient: clients) {
- clientList.push_back(each_cient);
+ auto clients = mParent->mDataItemToClients.getValSetPtr(each);
+ if (nullptr != clients) {
+ clientSet.insert(clients->begin(), clients->end());
}
}
- clientList.unique();
-
- for (auto client : clientList) {
- list<DataItemId> dataItemIdsSubscribedByThisClient(0);
- list<DataItemId> dataItemIdsToBeSentForThisClient(0);
- mParent->mClientIndex->getSubscribedList(
- client, dataItemIdsSubscribedByThisClient);
- dataItemIdsSubscribedByThisClient.sort();
- dataItemIdsToBeSent.sort();
-
- set_intersection(dataItemIdsToBeSent.begin(),
- dataItemIdsToBeSent.end(),
- dataItemIdsSubscribedByThisClient.begin(),
- dataItemIdsSubscribedByThisClient.end(),
- inserter(dataItemIdsToBeSentForThisClient,
- dataItemIdsToBeSentForThisClient.begin()));
-
- mParent->sendCachedDataItems(dataItemIdsToBeSentForThisClient, client);
- dataItemIdsSubscribedByThisClient.clear();
- dataItemIdsToBeSentForThisClient.clear();
+
+ for (auto client : clientSet) {
+ unordered_set<DataItemId> dataItemIdsForThisClient(
+ mParent->mClientToDataItems.getValSet(client));
+ for (auto itr = dataItemIdsForThisClient.begin();
+ itr != dataItemIdsForThisClient.end(); ) {
+ if (dataItemIdsToBeSent.find(*itr) == dataItemIdsToBeSent.end()) {
+ itr = dataItemIdsForThisClient.erase(itr);
+ } else {
+ itr++;
+ }
+ }
+
+ mParent->sendCachedDataItems(dataItemIdsForThisClient, client);
}
}
SystemStatusOsObserver* mParent;
- const list<IDataItemCore*> mDList;
+ const vector<IDataItemCore*> mDiVec;
};
- mContext.mMsgTask->sendMsg(new (nothrow) HandleNotify(this, dataItemList));
+
+ if (!dlist.empty()) {
+ vector<IDataItemCore*> dataItemVec(dlist.size());
+
+ for (auto each : dlist) {
+ IF_LOC_LOGD {
+ string dv;
+ each->stringify(dv);
+ LOC_LOGD("notify: DataItem In Value:%s", dv.c_str());
+ }
+
+ IDataItemCore* di = DataItemsFactoryProxy::createNewDataItem(each->getId());
+ if (nullptr == di) {
+ LOC_LOGw("Unable to create dataitem:%d", each->getId());
+ continue;
+ }
+
+ // Copy contents into the newly created data item
+ di->copy(each);
+
+ // add this dataitem if updated from last one
+ dataItemVec.push_back(di);
+ }
+
+ if (!dataItemVec.empty()) {
+ mContext.mMsgTask->sendMsg(new HandleNotify(this, dataItemVec));
+ }
+ }
}
/******************************************************************************
@@ -444,7 +384,7 @@ void SystemStatusOsObserver::turnOn(DataItemId dit, int timeOut)
}
// Check if data item exists in mActiveRequestCount
- map<DataItemId, int>::iterator citer = mActiveRequestCount.find(dit);
+ DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit);
if (citer == mActiveRequestCount.end()) {
// Data item not found in map
// Add reference count as 1 and add dataitem to map
@@ -482,7 +422,7 @@ void SystemStatusOsObserver::turnOff(DataItemId dit)
}
// Check if data item exists in mActiveRequestCount
- map<DataItemId, int>::iterator citer = mActiveRequestCount.find(dit);
+ DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit);
if (citer != mActiveRequestCount.end()) {
// found
citer->second--;
@@ -508,87 +448,127 @@ void SystemStatusOsObserver::turnOff(DataItemId dit)
}
}
-/******************************************************************************
- Helpers
-******************************************************************************/
-void SystemStatusOsObserver::sendFirstResponse(
- const list<DataItemId>& l, IDataItemObserver* to)
+#ifdef USE_GLIB
+bool SystemStatusOsObserver::connectBackhaul()
{
- if (l.empty()) {
- LOC_LOGV("list is empty. Nothing to do. Exiting");
- return;
- }
+ bool result = false;
- string clientName;
- to->getName(clientName);
- list<IDataItemCore*> dataItems(0);
-
- for (auto each : l) {
- map<DataItemId, IDataItemCore*>::const_iterator citer = mDataItemCache.find(each);
- if (citer != mDataItemCache.end()) {
- string dv;
- citer->second->stringify(dv);
- LOC_LOGI("DataItem: %s >> %s", dv.c_str(), clientName.c_str());
- dataItems.push_back(citer->second);
- }
+ 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;
}
- if (dataItems.empty()) {
- LOC_LOGV("No items to notify. Nothing to do. Exiting");
- return;
+ else {
+ ++mBackHaulConnectReqCount;
+ LOC_LOGE("Framework action request object is NULL.Caching connect request: %d",
+ mBackHaulConnectReqCount);
+ result = false;
}
- to->notify(dataItems);
+ return result;
+
}
-void SystemStatusOsObserver::sendCachedDataItems(
- const list<DataItemId>& l, IDataItemObserver* to)
+bool SystemStatusOsObserver::disconnectBackhaul()
{
- string clientName;
- to->getName(clientName);
- list<IDataItemCore*> dataItems(0);
-
- for (auto each : l) {
- string dv;
- IDataItemCore* di = mDataItemCache[each];
- di->stringify(dv);
- LOC_LOGI("DataItem: %s >> %s", dv.c_str(), clientName.c_str());
- dataItems.push_back(di);
+ 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;
}
- to->notify(dataItems);
+ return result;
}
-
-void SystemStatusOsObserver::updateCache(IDataItemCore* d, bool& dataItemUpdated)
+#endif
+/******************************************************************************
+ Helpers
+******************************************************************************/
+void SystemStatusOsObserver::sendCachedDataItems(
+ const unordered_set<DataItemId>& s, IDataItemObserver* to)
{
- if (nullptr == d) {
- return;
+ if (nullptr == to) {
+ LOC_LOGv("client pointer is NULL.");
+ } else {
+ string clientName;
+ to->getName(clientName);
+ list<IDataItemCore*> dataItems(0);
+
+ for (auto each : s) {
+ auto citer = mDataItemCache.find(each);
+ if (citer != mDataItemCache.end()) {
+ string dv;
+ citer->second->stringify(dv);
+ LOC_LOGI("DataItem: %s >> %s", dv.c_str(), clientName.c_str());
+ dataItems.push_front(citer->second);
+ }
+ }
+
+ if (dataItems.empty()) {
+ LOC_LOGv("No items to notify.");
+ } else {
+ to->notify(dataItems);
+ }
}
+}
- // Check if data item exists in cache
- map<DataItemId, IDataItemCore*>::iterator citer =
- mDataItemCache.find(d->getId());
- if (citer == mDataItemCache.end()) {
- // New data item; not found in cache
- IDataItemCore* dataitem = DataItemsFactoryProxy::createNewDataItem(d->getId());
- if (nullptr == dataitem) {
- return;
+bool SystemStatusOsObserver::updateCache(IDataItemCore* d)
+{
+ bool dataItemUpdated = false;
+
+ // Request systemstatus to record this dataitem in its cache
+ // if the return is false, it means that SystemStatus is not
+ // handling it, so SystemStatusOsObserver also doesn't.
+ // So it has to be true to proceed.
+ if (nullptr != d && mSystemStatus->eventDataItemNotify(d)) {
+ auto citer = mDataItemCache.find(d->getId());
+ if (citer == mDataItemCache.end()) {
+ // New data item; not found in cache
+ IDataItemCore* dataitem = DataItemsFactoryProxy::createNewDataItem(d->getId());
+ if (nullptr != dataitem) {
+ // Copy the contents of the data item
+ dataitem->copy(d);
+ // Insert in mDataItemCache
+ mDataItemCache.insert(std::make_pair(d->getId(), dataitem));
+ dataItemUpdated = true;
+ }
+ } else {
+ // Found in cache; Update cache if necessary
+ citer->second->copy(d, &dataItemUpdated);
}
- // Copy the contents of the data item
- dataitem->copy(d);
- pair<DataItemId, IDataItemCore*> cpair(d->getId(), dataitem);
- // Insert in mDataItemCache
- mDataItemCache.insert(cpair);
- dataItemUpdated = true;
- }
- else {
- // Found in cache; Update cache if necessary
- if(0 == citer->second->copy(d, &dataItemUpdated)) {
- return;
+ if (dataItemUpdated) {
+ LOC_LOGV("DataItem:%d updated:%d", d->getId(), dataItemUpdated);
}
}
- if (dataItemUpdated) {
- LOC_LOGV("DataItem:%d updated:%d", d->getId(), dataItemUpdated);
- }
+ return dataItemUpdated;
}
} // namespace loc_core
diff --git a/gps/core/SystemStatusOsObserver.h b/gps/core/SystemStatusOsObserver.h
index fa114ee..fd60606 100644
--- a/gps/core/SystemStatusOsObserver.h
+++ b/gps/core/SystemStatusOsObserver.h
@@ -39,7 +39,9 @@
#include <MsgTask.h>
#include <DataItemId.h>
#include <IOsObserver.h>
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
+#include <LocUnorderedSetMap.h>
namespace loc_core
{
@@ -47,86 +49,123 @@ namespace loc_core
SystemStatusOsObserver
******************************************************************************/
using namespace std;
+using namespace loc_util;
// Forward Declarations
class IDataItemCore;
-template<typename CT, typename DIT> class IClientIndex;
-template<typename CT, typename DIT> class IDataItemIndex;
+class SystemStatus;
+class SystemStatusOsObserver;
+typedef map<IDataItemObserver*, list<DataItemId>> ObserverReqCache;
+typedef LocUnorderedSetMap<IDataItemObserver*, DataItemId> ClientToDataItems;
+typedef LocUnorderedSetMap<DataItemId, IDataItemObserver*> DataItemToClients;
+typedef unordered_map<DataItemId, IDataItemCore*> DataItemIdToCore;
+typedef unordered_map<DataItemId, int> DataItemIdToInt;
-struct SystemContext {
+struct ObserverContext {
IDataItemSubscription* mSubscriptionObj;
IFrameworkActionReq* mFrameworkActionReqObj;
const MsgTask* mMsgTask;
+ SystemStatusOsObserver* mSSObserver;
- inline SystemContext() :
- mSubscriptionObj(NULL),
- mFrameworkActionReqObj(NULL),
- mMsgTask(NULL) {}
+ inline ObserverContext(const MsgTask* msgTask, SystemStatusOsObserver* observer) :
+ mSubscriptionObj(NULL), mFrameworkActionReqObj(NULL),
+ mMsgTask(msgTask), mSSObserver(observer) {}
};
-typedef map<IDataItemObserver*, list<DataItemId>> ObserverReqCache;
-
// Clients wanting to get data from OS/Framework would need to
// subscribe with OSObserver using IDataItemSubscription interface.
// Such clients would need to implement IDataItemObserver interface
// to receive data when it becomes available.
-class SystemStatus;
class SystemStatusOsObserver : public IOsObserver {
public:
// ctor
- SystemStatusOsObserver(
- SystemStatus* systemstatus, const MsgTask* msgTask);
+ inline SystemStatusOsObserver(SystemStatus* systemstatus, const MsgTask* msgTask) :
+ mSystemStatus(systemstatus), mContext(msgTask, this),
+ mAddress("SystemStatusOsObserver"),
+ mClientToDataItems(MAX_DATA_ITEM_ID), mDataItemToClients(MAX_DATA_ITEM_ID)
+#ifdef USE_GLIB
+ , mBackHaulConnectReqCount(0)
+#endif
+ {
+ }
+
// dtor
~SystemStatusOsObserver();
+ template <typename CINT, typename COUT>
+ static COUT containerTransfer(CINT& s);
+ template <typename CINT, typename COUT>
+ inline static COUT containerTransfer(CINT&& s) {
+ return containerTransfer<CINT, COUT>(s);
+ }
+
// To set the subscription object
virtual void setSubscriptionObj(IDataItemSubscription* subscriptionObj);
// 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
- virtual void subscribe(const list<DataItemId>& l, IDataItemObserver* client);
- virtual void updateSubscription(const list<DataItemId>& l, IDataItemObserver* client);
- virtual void requestData(const list<DataItemId>& l, IDataItemObserver* client);
- virtual void unsubscribe(const list<DataItemId>& l, IDataItemObserver* client);
- virtual void unsubscribeAll(IDataItemObserver* client);
+ inline virtual void subscribe(const list<DataItemId>& l, IDataItemObserver* client) override {
+ subscribe(l, client, false);
+ }
+ virtual void updateSubscription(const list<DataItemId>& l, IDataItemObserver* client) override;
+ inline virtual void requestData(const list<DataItemId>& l, IDataItemObserver* client) override {
+ subscribe(l, client, true);
+ }
+ virtual void unsubscribe(const list<DataItemId>& l, IDataItemObserver* client) override;
+ virtual void unsubscribeAll(IDataItemObserver* client) override;
// IDataItemObserver Overrides
- virtual void notify(const list<IDataItemCore*>& dlist);
- inline virtual void getName(string& name) {
+ virtual void notify(const list<IDataItemCore*>& dlist) override;
+ inline virtual void getName(string& name) override {
name = mAddress;
}
// IFrameworkActionReq Overrides
- virtual void turnOn(DataItemId dit, int timeOut = 0);
- virtual void turnOff(DataItemId dit);
+ virtual void turnOn(DataItemId dit, int timeOut = 0) override;
+ virtual void turnOff(DataItemId dit) override;
+#ifdef USE_GLIB
+ virtual bool connectBackhaul() override;
+ virtual bool disconnectBackhaul();
+#endif
private:
SystemStatus* mSystemStatus;
- SystemContext mContext;
+ ObserverContext mContext;
const string mAddress;
- IClientIndex<IDataItemObserver*, DataItemId>* mClientIndex;
- IDataItemIndex<IDataItemObserver*, DataItemId>* mDataItemIndex;
- map<DataItemId, IDataItemCore*> mDataItemCache;
- map<DataItemId, int> mActiveRequestCount;
+ ClientToDataItems mClientToDataItems;
+ DataItemToClients mDataItemToClients;
+ DataItemIdToCore mDataItemCache;
+ DataItemIdToInt mActiveRequestCount;
// Cache the subscribe and requestData till subscription obj is obtained
- ObserverReqCache mSubscribeReqCache;
- 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
+
+ void subscribe(const list<DataItemId>& l, IDataItemObserver* client, bool toRequestData);
// Helpers
- void sendFirstResponse(const list<DataItemId>& l, IDataItemObserver* to);
- void sendCachedDataItems(const list<DataItemId>& l, IDataItemObserver* to);
- void updateCache(IDataItemCore* d, bool& dataItemUpdated);
- inline void logMe(const list<DataItemId>& l) {
- for (auto id : l) {
- LOC_LOGD("DataItem %d", id);
+ void sendCachedDataItems(const unordered_set<DataItemId>& s, IDataItemObserver* to);
+ bool updateCache(IDataItemCore* d);
+ inline void logMe(const unordered_set<DataItemId>& l) {
+ IF_LOC_LOGD {
+ for (auto id : l) {
+ LOC_LOGD("DataItem %d", id);
+ }
}
}
};
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/configure.ac b/gps/core/configure.ac
index a8b892b..ea0a128 100644
--- a/gps/utils/platform_lib_abstractions/loc_pla/configure.ac
+++ b/gps/core/configure.ac
@@ -1,17 +1,17 @@
-# configure.ac -- Autoconf script for gps loc-pla
+# configure.ac -- Autoconf script for gps loc-core
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
-# Initialize the gps loc-pla package version 1.0.0
-AC_INIT([loc-pla],1.0.0)
+# Initialize the gps loc-hal package version 1.0.0
+AC_INIT([loc-core],1.0.0)
# Does not strictly follow GNU Coding standards
AM_INIT_AUTOMAKE([foreign])
# Disables auto rebuilding of configure, Makefile.ins
AM_MAINTAINER_MODE
# Verifies the --srcdir is correct by checking for the path
-AC_CONFIG_SRCDIR([include/platform_lib_includes.h])
+AC_CONFIG_SRCDIR([loc-core.pc.in])
# defines some macros variable to be included by source
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
@@ -29,9 +29,31 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
# Checks for libraries.
-PKG_CHECK_MODULES([LOCSTUB], [loc-stub])
-AC_SUBST([LOCSTUB_CFLAGS])
-AC_SUBST([LOCSTUB_LIBS])
+PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
+AC_SUBST([GPSUTILS_CFLAGS])
+AC_SUBST([GPSUTILS_LIBS])
+
+AC_ARG_WITH([core_includes],
+ AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
+ [Specify the location of the core headers]),
+ [core_incdir=$withval],
+ with_core_includes=no)
+
+if test "x$with_core_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${core_incdir}"
+fi
+
+AC_ARG_WITH([locpla_includes],
+ AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@],
+ [specify the path to locpla-includes in loc-pla_git.bb]),
+ [locpla_incdir=$withval],
+ with_locpla_includes=no)
+
+if test "x$with_locpla_includes" != "xno"; then
+ AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}")
+fi
+
+AC_SUBST([CPPFLAGS])
AC_ARG_WITH([glib],
AC_HELP_STRING([--with-glib],
@@ -54,8 +76,7 @@ AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
AC_CONFIG_FILES([ \
Makefile \
- src/Makefile \
- loc-pla.pc \
+ loc-core.pc \
])
AC_OUTPUT
diff --git a/gps/core/data-items/DataItemConcreteTypesBase.h b/gps/core/data-items/DataItemConcreteTypesBase.h
index df3bf9a..bcb8d72 100644
--- a/gps/core/data-items/DataItemConcreteTypesBase.h
+++ b/gps/core/data-items/DataItemConcreteTypesBase.h
@@ -221,9 +221,22 @@ protected:
class NetworkInfoDataItemBase : public IDataItemCore {
public:
+ enum NetworkType {
+ TYPE_MOBILE,
+ TYPE_WIFI,
+ TYPE_ETHERNET,
+ TYPE_BLUETOOTH,
+ TYPE_MMS,
+ TYPE_SUPL,
+ TYPE_DUN,
+ TYPE_HIPRI,
+ TYPE_WIMAX,
+ TYPE_UNKNOWN,
+ };
NetworkInfoDataItemBase(
- int32_t type, string typeName, string subTypeName,
+ NetworkType initialType, int32_t type, string typeName, string subTypeName,
bool available, bool connected, bool roaming ):
+ mAllTypes(typeToAllTypes(initialType)),
mType(type),
mTypeName(typeName),
mSubTypeName(subTypeName),
@@ -235,22 +248,12 @@ public:
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
- enum NetworkType {
- TYPE_UNKNOWN,
- TYPE_MOBILE,
- TYPE_WIFI,
- TYPE_ETHERNET,
- TYPE_BLUETOOTH,
- TYPE_MMS,
- TYPE_SUPL,
- TYPE_DUN,
- TYPE_HIPRI,
- TYPE_WIMAX
- };
inline virtual NetworkType getType(void) const {
return (NetworkType)mType;
}
-// Data members
+ inline uint64_t getAllTypes() { return mAllTypes; }
+ // Data members
+ uint64_t mAllTypes;
int32_t mType;
string mTypeName;
string mSubTypeName;
@@ -259,7 +262,9 @@ public:
bool mRoaming;
protected:
DataItemId mId;
-
+ inline uint64_t typeToAllTypes(NetworkType type) {
+ return (type >= TYPE_UNKNOWN || type < TYPE_MOBILE) ? 0 : (1<<type);
+ }
};
class ServiceStatusDataItemBase : public IDataItemCore {
@@ -309,24 +314,42 @@ protected:
class RilServiceInfoDataItemBase : public IDataItemCore {
public:
- RilServiceInfoDataItemBase() :
- mId(RILSERVICEINFO_DATA_ITEM_ID) {}
- virtual ~RilServiceInfoDataItemBase() {}
+ inline RilServiceInfoDataItemBase() :
+ mData(nullptr), mId(RILSERVICEINFO_DATA_ITEM_ID) {}
+ inline virtual ~RilServiceInfoDataItemBase() { if (nullptr != mData) free(mData); }
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+ inline RilServiceInfoDataItemBase(const RilServiceInfoDataItemBase& peer) :
+ RilServiceInfoDataItemBase() {
+ peer.setPeerData(*this);
+ }
+ inline virtual bool operator==(const RilServiceInfoDataItemBase& other) const {
+ return other.mData == mData;
+ }
+ inline virtual void setPeerData(RilServiceInfoDataItemBase& /*peer*/) const {}
+ void* mData;
protected:
DataItemId mId;
};
class RilCellInfoDataItemBase : public IDataItemCore {
public:
- RilCellInfoDataItemBase() :
- mId(RILCELLINFO_DATA_ITEM_ID) {}
- virtual ~RilCellInfoDataItemBase() {}
+ inline RilCellInfoDataItemBase() :
+ mData(nullptr), mId(RILCELLINFO_DATA_ITEM_ID) {}
+ inline virtual ~RilCellInfoDataItemBase() { if (nullptr != mData) free(mData); }
inline virtual DataItemId getId() { return mId; }
virtual void stringify(string& /*valueStr*/) {}
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+ inline RilCellInfoDataItemBase(const RilCellInfoDataItemBase& peer) :
+ RilCellInfoDataItemBase() {
+ peer.setPeerData(*this);
+ }
+ inline virtual bool operator==(const RilCellInfoDataItemBase& other) const {
+ return other.mData == mData;
+ }
+ inline virtual void setPeerData(RilCellInfoDataItemBase& /*peer*/) const {}
+ void* mData;
protected:
DataItemId mId;
};
@@ -393,7 +416,7 @@ protected:
class MccmncDataItemBase : public IDataItemCore {
public:
MccmncDataItemBase(const string & name) :
- mValue (name),
+ mValue(name),
mId(MCCMNC_DATA_ITEM_ID) {}
virtual ~MccmncDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
@@ -407,7 +430,7 @@ protected:
class SrnDeviceScanDetailsDataItemBase : public IDataItemCore {
public:
- SrnDeviceScanDetailsDataItemBase (DataItemId Id) :
+ SrnDeviceScanDetailsDataItemBase(DataItemId Id) :
mValidSrnData(false),
mApSrnRssi(-1),
mApSrnTimestamp(0),
@@ -415,7 +438,7 @@ public:
mReceiveTimestamp(0),
mErrorCause(-1),
mId(Id) {}
- virtual ~SrnDeviceScanDetailsDataItemBase () {}
+ virtual ~SrnDeviceScanDetailsDataItemBase() {}
inline virtual DataItemId getId() { return mId; }
// Data members common to all SRN tech types
/* Represents info on whether SRN data is valid (no error)*/
@@ -456,6 +479,18 @@ public:
virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
};
+class BatteryLevelDataItemBase : public IDataItemCore {
+public:
+ inline BatteryLevelDataItemBase(uint8_t batteryPct) :
+ mBatteryPct(batteryPct), mId(BATTERY_LEVEL_DATA_ITEM_ID) {}
+ inline ~BatteryLevelDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+// Data members
+ uint8_t mBatteryPct;
+protected:
+ DataItemId mId;
+};
+
} // namespace loc_core
#endif //__DATAITEMCONCRETEBASETYPES__
diff --git a/gps/core/data-items/DataItemId.h b/gps/core/data-items/DataItemId.h
index 1bf132a..1661be6 100644
--- a/gps/core/data-items/DataItemId.h
+++ b/gps/core/data-items/DataItemId.h
@@ -67,7 +67,13 @@ typedef enum e_DataItemId {
BTLE_SCAN_DATA_ITEM_ID,
BT_SCAN_DATA_ITEM_ID,
OEM_GTP_UPLOAD_TRIGGER_READY_ITEM_ID,
- MAX_DATA_ITEM_ID
+
+ MAX_DATA_ITEM_ID,
+
+ // 26 -
+ BATTERY_LEVEL_DATA_ITEM_ID,
+
+ MAX_DATA_ITEM_ID_1_1,
} DataItemId;
#endif // #ifndef __DATAITEMID_H__
diff --git a/gps/core/data-items/DataItemsFactoryProxy.cpp b/gps/core/data-items/DataItemsFactoryProxy.cpp
index 130eecf..f8a5e03 100644
--- a/gps/core/data-items/DataItemsFactoryProxy.cpp
+++ b/gps/core/data-items/DataItemsFactoryProxy.cpp
@@ -32,7 +32,8 @@
#include <DataItemId.h>
#include <IDataItemCore.h>
#include <DataItemsFactoryProxy.h>
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
namespace loc_core
{
@@ -68,7 +69,7 @@ IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id)
getConcreteDIFunc = (get_concrete_data_item_fn * )
dlsym(dataItemLibHandle, DATA_ITEMS_GET_CONCRETE_DI);
if (NULL != getConcreteDIFunc) {
- LOC_LOGD("Loaded function %s : %x",DATA_ITEMS_GET_CONCRETE_DI,getConcreteDIFunc);
+ LOC_LOGD("Loaded function %s : %p",DATA_ITEMS_GET_CONCRETE_DI,getConcreteDIFunc);
mydi = (*getConcreteDIFunc)(id);
}
else {
diff --git a/gps/core/data-items/common/ClientIndex.cpp b/gps/core/data-items/common/ClientIndex.cpp
deleted file mode 100644
index ffb5e1d..0000000
--- a/gps/core/data-items/common/ClientIndex.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Copyright (c) 2015, 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.
- *
- */
-#include <algorithm>
-#include <iterator>
-#include <string>
-#include <platform_lib_log_util.h>
-#include <ClientIndex.h>
-#include <IDataItemObserver.h>
-#include <DataItemId.h>
-
-using namespace std;
-using namespace loc_core;
-
-template <typename CT, typename DIT>
-inline ClientIndex <CT,DIT> :: ClientIndex () {}
-
-template <typename CT, typename DIT>
-inline ClientIndex <CT,DIT> :: ~ClientIndex () {}
-
-template <typename CT, typename DIT>
-bool ClientIndex <CT,DIT> :: isSubscribedClient (CT client) {
- bool result = false;
- ENTRY_LOG ();
- typename map < CT, list <DIT> > :: iterator it =
- mDataItemsPerClientMap.find (client);
- if (it != mDataItemsPerClientMap.end ()) {
- result = true;
- }
- EXIT_LOG_WITH_ERROR ("%d",result);
- return result;
-}
-
-template <typename CT, typename DIT>
-void ClientIndex <CT,DIT> :: getSubscribedList (CT client, list <DIT> & out) {
- ENTRY_LOG ();
- typename map < CT, list <DIT> > :: iterator it =
- mDataItemsPerClientMap.find (client);
- if (it != mDataItemsPerClientMap.end ()) {
- out = it->second;
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-template <typename CT, typename DIT>
-int ClientIndex <CT,DIT> :: remove (CT client) {
- int result = 0;
- ENTRY_LOG ();
- mDataItemsPerClientMap.erase (client);
- EXIT_LOG_WITH_ERROR ("%d",result);
- return result;
-}
-
-template <typename CT, typename DIT>
-void ClientIndex <CT,DIT> :: remove (const list <DIT> & r, list <CT> & out) {
- ENTRY_LOG ();
- typename map < CT, list <DIT> > :: iterator dicIter =
- mDataItemsPerClientMap.begin ();
- while (dicIter != mDataItemsPerClientMap.end()) {
- typename list <DIT> :: const_iterator it = r.begin ();
- for (; it != r.end (); ++it) {
- typename list <DIT> :: iterator iter =
- find (dicIter->second.begin (), dicIter->second.end (), *it);
- if (iter != dicIter->second.end ()) {
- dicIter->second.erase (iter);
- }
- }
- if (dicIter->second.empty ()) {
- out.push_back (dicIter->first);
- // Post-increment operator increases the iterator but returns the
- // prevous one that will be invalidated by erase()
- mDataItemsPerClientMap.erase (dicIter++);
- } else {
- ++dicIter;
- }
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-template <typename CT, typename DIT>
-void ClientIndex <CT,DIT> :: remove
-(
- CT client,
- const list <DIT> & r,
- list <DIT> & out
-)
-{
- ENTRY_LOG ();
- typename map < CT, list <DIT> > :: iterator dicIter =
- mDataItemsPerClientMap.find (client);
- if (dicIter != mDataItemsPerClientMap.end ()) {
- set_intersection (dicIter->second.begin (), dicIter->second.end (),
- r.begin (), r.end (),
- inserter (out,out.begin ()));
- if (!out.empty ()) {
- typename list <DIT> :: iterator it = out.begin ();
- for (; it != out.end (); ++it) {
- dicIter->second.erase (find (dicIter->second.begin (),
- dicIter->second.end (),
- *it));
- }
- }
- if (dicIter->second.empty ()) {
- mDataItemsPerClientMap.erase (dicIter);
- EXIT_LOG_WITH_ERROR ("%d",0);
- }
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-template <typename CT, typename DIT>
-void ClientIndex <CT,DIT> :: add
-(
- CT client,
- const list <DIT> & l,
- list <DIT> & out
-)
-{
- ENTRY_LOG ();
- list <DIT> difference;
- typename map < CT, list <DIT> > :: iterator dicIter =
- mDataItemsPerClientMap.find (client);
- if (dicIter != mDataItemsPerClientMap.end ()) {
- set_difference (l.begin (), l.end (),
- dicIter->second.begin (), dicIter->second.end (),
- inserter (difference,difference.begin ()));
- if (!difference.empty ()) {
- difference.sort ();
- out = difference;
- dicIter->second.merge (difference);
- dicIter->second.unique ();
- }
- } else {
- out = l;
- pair < CT, list <DIT> > dicnpair (client, out);
- mDataItemsPerClientMap.insert (dicnpair);
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-// Explicit instantiation must occur in same namespace where class is defined
-namespace loc_core
-{
- template class ClientIndex <IDataItemObserver *, DataItemId>;
- template class ClientIndex <string, DataItemId>;
-}
diff --git a/gps/core/data-items/common/ClientIndex.h b/gps/core/data-items/common/ClientIndex.h
deleted file mode 100644
index feccb05..0000000
--- a/gps/core/data-items/common/ClientIndex.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (c) 2015, 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 __CLIENTINDEX_H__
-#define __CLIENTINDEX_H__
-
-#include <list>
-#include <map>
-#include <IClientIndex.h>
-
-using loc_core::IClientIndex;
-
-namespace loc_core
-{
-
-template <typename CT, typename DIT>
-
-class ClientIndex : public IClientIndex <CT, DIT> {
-
-public:
-
- ClientIndex ();
-
- ~ClientIndex ();
-
- bool isSubscribedClient (CT client);
-
- void getSubscribedList (CT client, std :: list <DIT> & out);
-
- int remove (CT client);
-
- void remove (const std :: list <DIT> & r, std :: list <CT> & out);
-
- void remove (CT client, const std :: list <DIT> & r, std :: list <DIT> & out);
-
- void add (CT client, const std :: list <DIT> & l, std :: list <DIT> & out);
-
-private:
- //Data members
- std :: map < CT , std :: list <DIT> > mDataItemsPerClientMap;
-};
-
-} // namespace loc_core
-
-#endif // #ifndef __CLIENTINDEX_H__
diff --git a/gps/core/data-items/common/DataItemIndex.cpp b/gps/core/data-items/common/DataItemIndex.cpp
deleted file mode 100644
index 7869b43..0000000
--- a/gps/core/data-items/common/DataItemIndex.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Copyright (c) 2015, 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.
- *
- */
-
-#include <string>
-#include <algorithm>
-#include <iterator>
-#include <DataItemIndex.h>
-#include <platform_lib_log_util.h>
-#include <IDataItemObserver.h>
-#include <DataItemId.h>
-
-using namespace std;
-using namespace loc_core;
-
-template <typename CT, typename DIT>
-inline DataItemIndex <CT,DIT> :: DataItemIndex () {}
-
-template <typename CT, typename DIT>
-inline DataItemIndex <CT,DIT> :: ~DataItemIndex () {}
-
-template <typename CT, typename DIT>
-void DataItemIndex <CT,DIT> :: getListOfSubscribedClients
- (
- DIT id,
- list <CT> & out
-)
-{
- typename map < DIT, list <CT> > :: iterator cdiIter =
- mClientsPerDataItemMap.find (id);
- if (cdiIter != mClientsPerDataItemMap.end ()) {
- out = cdiIter->second;
- }
-}
-
-
-template <typename CT, typename DIT>
-int DataItemIndex <CT,DIT> :: remove (DIT id) {
- int result = 0;
- ENTRY_LOG ();
- mClientsPerDataItemMap.erase (id);
- EXIT_LOG_WITH_ERROR ("%d",result);
- return result;
-}
-
-template <typename CT, typename DIT>
-void DataItemIndex <CT,DIT> :: remove (const list <CT> & r, list <DIT> & out) {
- ENTRY_LOG ();
- typename map < DIT, list <CT> > :: iterator cdiIter =
- mClientsPerDataItemMap.begin ();
- while (cdiIter != mClientsPerDataItemMap.end()) {
- typename list <CT> :: const_iterator it = r.begin ();
- for (; it != r.end (); ++it) {
- typename list <CT> :: iterator iter =
- find
- (
- cdiIter->second.begin (),
- cdiIter->second.end (),
- *it
- );
- if (iter != cdiIter->second.end ()) {
- cdiIter->second.erase (iter);
- }
- }
-
- if (cdiIter->second.empty ()) {
- out.push_back (cdiIter->first);
- // Post-increment operator increases the iterator but returns the
- // prevous one that will be invalidated by erase()
- mClientsPerDataItemMap.erase (cdiIter++);
- } else {
- ++cdiIter;
- }
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-template <typename CT, typename DIT>
-void DataItemIndex <CT,DIT> :: remove
-(
- DIT id,
- const list <CT> & r,
- list <CT> & out
-)
-{
- ENTRY_LOG ();
-
- typename map < DIT, list <CT> > :: iterator cdiIter =
- mClientsPerDataItemMap.find (id);
- if (cdiIter != mClientsPerDataItemMap.end ()) {
- set_intersection (cdiIter->second.begin (), cdiIter->second.end (),
- r.begin (), r.end (),
- inserter (out, out.begin ()));
- if (!out.empty ()) {
- typename list <CT> :: iterator it = out.begin ();
- for (; it != out.end (); ++it) {
- cdiIter->second.erase (find (cdiIter->second.begin (),
- cdiIter->second.end (),
- *it));
- }
- }
- if (cdiIter->second.empty ()) {
- mClientsPerDataItemMap.erase (cdiIter);
- EXIT_LOG_WITH_ERROR ("%d",0);
- }
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-template <typename CT, typename DIT>
-void DataItemIndex <CT,DIT> :: add
-(
- DIT id,
- const list <CT> & l,
- list <CT> & out
-)
-{
- ENTRY_LOG ();
- list <CT> difference;
- typename map < DIT, list <CT> > :: iterator cdiIter =
- mClientsPerDataItemMap.find (id);
- if (cdiIter != mClientsPerDataItemMap.end ()) {
- set_difference (l.begin (), l.end (),
- cdiIter->second.begin (), cdiIter->second.end (),
- inserter (difference, difference.begin ()));
- if (!difference.empty ()) {
- difference.sort ();
- out = difference;
- cdiIter->second.merge (difference);
- }
- } else {
- out = l;
- pair < DIT, list <CT> > cndipair (id, out);
- mClientsPerDataItemMap.insert (cndipair);
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-template <typename CT, typename DIT>
-void DataItemIndex <CT,DIT> :: add
-(
- CT client,
- const list <DIT> & l,
- list <DIT> & out
-)
-{
- ENTRY_LOG ();
- typename map < DIT, list <CT> > :: iterator cdiIter;
- typename list <DIT> :: const_iterator it = l.begin ();
- for (; it != l.end (); ++it) {
- cdiIter = mClientsPerDataItemMap.find (*it);
- if (cdiIter == mClientsPerDataItemMap.end ()) {
- out.push_back (*it);
- pair < DIT, list <CT> > cndiPair (*it, list <CT> (1, client));
- mClientsPerDataItemMap.insert (cndiPair);
- } else {
- typename list<CT> :: iterator clientIter =
- find
- (
- cdiIter->second.begin (),
- cdiIter->second.end (),
- client
- );
- if (clientIter == cdiIter->second.end()) {
- cdiIter->second.push_back (client);
- }
- }
- }
- EXIT_LOG_WITH_ERROR ("%d",0);
-}
-
-// Explicit instantiation must occur in same namespace where class is defined
-namespace loc_core
-{
- template class DataItemIndex <IDataItemObserver *, DataItemId>;
- template class DataItemIndex <string, DataItemId>;
-}
diff --git a/gps/core/data-items/common/DataItemIndex.h b/gps/core/data-items/common/DataItemIndex.h
deleted file mode 100644
index d72e89e..0000000
--- a/gps/core/data-items/common/DataItemIndex.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (c) 2015, 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 __DATAITEMINDEX_H__
-#define __DATAITEMINDEX_H__
-
-#include <list>
-#include <map>
-#include <IDataItemIndex.h>
-
-using loc_core::IDataItemIndex;
-
-namespace loc_core
-{
-
-template <typename CT, typename DIT>
-
-class DataItemIndex : public IDataItemIndex <CT, DIT> {
-
-public:
-
- DataItemIndex ();
-
- ~DataItemIndex ();
-
- void getListOfSubscribedClients (DIT id, std :: list <CT> & out);
-
- int remove (DIT id);
-
- void remove (const std :: list <CT> & r, std :: list <DIT> & out);
-
- void remove (DIT id, const std :: list <CT> & r, std :: list <CT> & out);
-
- void add (DIT id, const std :: list <CT> & l, std :: list <CT> & out);
-
- void add (CT client, const std :: list <DIT> & l, std :: list <DIT> & out);
-
-private:
- std :: map < DIT, std :: list <CT> > mClientsPerDataItemMap;
-};
-
-} // namespace loc_core
-
-#endif // #ifndef __DATAITEMINDEX_H__
diff --git a/gps/core/data-items/common/IClientIndex.h b/gps/core/data-items/common/IClientIndex.h
deleted file mode 100644
index 0272e7b..0000000
--- a/gps/core/data-items/common/IClientIndex.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (c) 2015, 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 __ICLIENTINDEX_H__
-#define __ICLIENTINDEX_H__
-
-#include <list>
-
-namespace loc_core
-{
-
-template <typename CT, typename DIT>
-
-class IClientIndex {
-public:
-
- // Checks if client is subscribed
- virtual bool isSubscribedClient (CT client) = 0;
-
- // gets subscription list
- virtual void getSubscribedList (CT client, std :: list <DIT> & out) = 0;
-
- // removes an entry
- virtual int remove (CT client) = 0;
-
- // removes std :: list of data items and returns a list of clients
- // removed if any.
- virtual void remove
- (
- const std :: list <DIT> & r,
- std :: list <CT> & out
- ) = 0;
-
- // removes list of data items indexed by client and returns list
- // of data items removed if any.
- virtual void remove
- (
- CT client,
- const std :: list <DIT> & r,
- std :: list <DIT> & out
- ) = 0;
-
- // adds/modifies entry in map and returns new data items added.
- virtual void add
- (
- CT client,
- const std :: list <DIT> & l,
- std :: list <DIT> & out
- ) = 0;
-
- // dtor
- virtual ~IClientIndex () {}
-};
-
-} // namespace loc_core
-
-#endif // #ifndef __ICLIENTINDEX_H__
diff --git a/gps/core/data-items/common/IDataItemIndex.h b/gps/core/data-items/common/IDataItemIndex.h
deleted file mode 100644
index 9185582..0000000
--- a/gps/core/data-items/common/IDataItemIndex.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (c) 2015, 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 __IDATAITEMINDEX_H__
-#define __IDATAITEMINDEX_H__
-
-#include <list>
-
-namespace loc_core
-{
-
-template <typename CT, typename DIT>
-
-class IDataItemIndex {
-
-public:
-
- // gets std :: list of subscribed clients
- virtual void getListOfSubscribedClients
- (
- DIT id,
- std :: list <CT> & out
- ) = 0;
-
- // removes an entry from
- virtual int remove (DIT id) = 0;
-
- // removes list of clients and returns a list of data items
- // removed if any.
- virtual void remove
- (
- const std :: list <CT> & r,
- std :: list <DIT> & out
- ) = 0;
-
- // removes list of clients indexed by data item and returns list of
- // clients removed if any.
- virtual void remove
- (
- DIT id,
- const std :: list <CT> & r,
- std :: list <CT> & out
- ) = 0;
-
- // adds/modifies entry and returns new clients added
- virtual void add
- (
- DIT id,
- const std :: list <CT> & l,
- std :: list <CT> & out
- ) = 0;
-
- // adds/modifies entry and returns yet to subscribe list of data items
- virtual void add
- (
- CT client,
- const std :: list <DIT> & l,
- std :: list <DIT> & out
- ) = 0;
-
- // dtor
- virtual ~IDataItemIndex () {}
-};
-
-} // namespace loc_core
-
-#endif // #ifndef __IDATAITEMINDEX_H__
-
diff --git a/gps/core/data-items/common/IndexFactory.cpp b/gps/core/data-items/common/IndexFactory.cpp
deleted file mode 100644
index cf49475..0000000
--- a/gps/core/data-items/common/IndexFactory.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (c) 2015, 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.
- *
- */
-
-#include <string>
-#include <IndexFactory.h>
-#include <IClientIndex.h>
-#include <ClientIndex.h>
-#include <IDataItemIndex.h>
-#include <DataItemIndex.h>
-#include <IDataItemObserver.h>
-#include <DataItemId.h>
-
-using namespace std;
-using loc_core::IClientIndex;
-using loc_core::IDataItemIndex;
-using loc_core::IDataItemObserver;
-using namespace loc_core;
-
-template <typename CT, typename DIT>
-inline IClientIndex <CT, DIT> * IndexFactory <CT, DIT> :: createClientIndex
-()
-{
- return new (nothrow) ClientIndex <CT, DIT> ();
-}
-
-template <typename CT, typename DIT>
-inline IDataItemIndex <CT, DIT> * IndexFactory <CT, DIT> :: createDataItemIndex
-()
-{
- return new (nothrow) DataItemIndex <CT, DIT> ();
-}
-
-// Explicit instantiation must occur in same namespace where class is defined
-namespace loc_core
-{
- template class IndexFactory <IDataItemObserver *, DataItemId>;
- template class IndexFactory <string, DataItemId>;
-}
diff --git a/gps/core/data-items/common/IndexFactory.h b/gps/core/data-items/common/IndexFactory.h
deleted file mode 100644
index 9a2070e..0000000
--- a/gps/core/data-items/common/IndexFactory.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (c) 2015, 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 __INDEXFACTORY_H__
-#define __INDEXFACTORY_H__
-
-#include <IClientIndex.h>
-#include <IDataItemIndex.h>
-
-namespace loc_core
-{
-template <typename CT, typename DIT>
-class IndexFactory {
-
-public:
- static IClientIndex <CT, DIT> * createClientIndex ();
- static IDataItemIndex <CT, DIT> * createDataItemIndex ();
-};
-
-} // namespace loc_core
-
-#endif // #ifndef __INDEXFACTORY_H__
diff --git a/gps/core/loc-core.pc.in b/gps/core/loc-core.pc.in
new file mode 100644
index 0000000..76b514c
--- /dev/null
+++ b/gps/core/loc-core.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-core
+Description: QTI GPS Loc Core
+Version: @VERSION@
+Libs: -L${libdir} -lloc_core
+Cflags: -I${includedir}/loc-core
diff --git a/gps/core/loc_core_log.cpp b/gps/core/loc_core_log.cpp
index 5a627dd..67d68f0 100644
--- a/gps/core/loc_core_log.cpp
+++ b/gps/core/loc_core_log.cpp
@@ -30,9 +30,10 @@
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_core_log"
+#include <log_util.h>
#include <loc_log.h>
#include <loc_core_log.h>
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
void LocPosMode::logv() const
{
@@ -100,26 +101,6 @@ const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur)
return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
}
-
-
-static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
-{
- NAME_VAL( LOC_GPS_DELETE_EPHEMERIS ),
- NAME_VAL( LOC_GPS_DELETE_ALMANAC ),
- NAME_VAL( LOC_GPS_DELETE_POSITION ),
- NAME_VAL( LOC_GPS_DELETE_TIME ),
- NAME_VAL( LOC_GPS_DELETE_IONO ),
- NAME_VAL( LOC_GPS_DELETE_UTC ),
- NAME_VAL( LOC_GPS_DELETE_HEALTH ),
- NAME_VAL( LOC_GPS_DELETE_SVDIR ),
- NAME_VAL( LOC_GPS_DELETE_SVSTEER ),
- NAME_VAL( LOC_GPS_DELETE_SADATA ),
- NAME_VAL( LOC_GPS_DELETE_RTI ),
- NAME_VAL( LOC_GPS_DELETE_CELLDB_INFO ),
- NAME_VAL( LOC_GPS_DELETE_ALL)
-};
-static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
-
const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
{
return NULL;
diff --git a/gps/core/observer/IFrameworkActionReq.h b/gps/core/observer/IFrameworkActionReq.h
index c7b3ebd..4be947f 100644
--- a/gps/core/observer/IFrameworkActionReq.h
+++ b/gps/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/gps/core/observer/IOsObserver.h b/gps/core/observer/IOsObserver.h
index 3db8a85..40d7671 100644
--- a/gps/core/observer/IOsObserver.h
+++ b/gps/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
diff --git a/gps/etc/gps.conf b/gps/etc/gps.conf
index 1027d76..d30461e 100644
--- a/gps/etc/gps.conf
+++ b/gps/etc/gps.conf
@@ -205,3 +205,17 @@ MISSING_PULSE_TIME_DELTA = 900
# This settings enables time uncertainty propagation
# logic incase of missing PPS pulse
PROPAGATION_TIME_UNCERTAINTY = 1
+
+#######################################
+# APN / IP Type Configuration
+# APN and IP Type to use for setting
+# up WWAN call.
+# Use below values for IP Type:
+# v4 = 4
+# v6 = 6
+# v4v6 = 10
+#######################################
+# INTERNET_APN = abc.xyz
+# INTERNET_IP_TYPE = 4
+# SUPL_APN = abc.xyz
+# SUPL_IP_TYPE = 4
diff --git a/gps/gnss/Agps.cpp b/gps/gnss/Agps.cpp
index 72ce293..6ce0c34 100644
--- a/gps/gnss/Agps.cpp
+++ b/gps/gnss/Agps.cpp
@@ -30,7 +30,7 @@
#define LOG_TAG "LocSvc_Agps"
#include <Agps.h>
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
#include <ContextBase.h>
#include <loc_timer.h>
diff --git a/gps/gnss/Agps.h b/gps/gnss/Agps.h
index 2f89c8c..703a475 100644
--- a/gps/gnss/Agps.h
+++ b/gps/gnss/Agps.h
@@ -34,7 +34,8 @@
#include <list>
#include <MsgTask.h>
#include <gps_extended_c.h>
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
/* ATL callback function pointers
* Passed in by Adapter to AgpsManager */
@@ -277,34 +278,29 @@ public:
mAgnssNif(NULL), mInternetNif(NULL), mDsNif(NULL) {}
/* Register callbacks */
- void registerCallbacks(
- AgnssStatusIpV4Cb frameworkStatusV4Cb,
-
- AgpsAtlOpenStatusCb atlOpenStatusCb,
+ inline void registerATLCallbacks(AgpsAtlOpenStatusCb atlOpenStatusCb,
AgpsAtlCloseStatusCb atlCloseStatusCb,
-
AgpsDSClientInitFn dsClientInitFn,
AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn,
AgpsDSClientStopDataCallFn dsClientStopDataCallFn,
AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn,
AgpsDSClientReleaseFn dsClientReleaseFn,
-
- SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn ){
-
- mFrameworkStatusV4Cb = frameworkStatusV4Cb;
+ SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn) {
mAtlOpenStatusCb = atlOpenStatusCb;
mAtlCloseStatusCb = atlCloseStatusCb;
-
mDSClientInitFn = dsClientInitFn;
mDSClientOpenAndStartDataCallFn = dsClientOpenAndStartDataCallFn;
mDSClientStopDataCallFn = dsClientStopDataCallFn;
mDSClientCloseDataCallFn = dsClientCloseDataCallFn;
mDSClientReleaseFn = dsClientReleaseFn;
-
mSendMsgToAdapterQueueFn = sendMsgToAdapterQueueFn;
}
+ inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
+ mFrameworkStatusV4Cb = frameworkStatusV4Cb;
+ }
+
/* Create all AGPS state machines */
void createAgpsStateMachines();
diff --git a/gps/gnss/Android.mk b/gps/gnss/Android.mk
index e5b9dcc..d809bc2 100644
--- a/gps/gnss/Android.mk
+++ b/gps/gnss/Android.mk
@@ -7,7 +7,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libgnss
LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \
diff --git a/gps/gnss/GnssAdapter.cpp b/gps/gnss/GnssAdapter.cpp
index cdda01d..751c148 100644
--- a/gps/gnss/GnssAdapter.cpp
+++ b/gps/gnss/GnssAdapter.cpp
@@ -74,12 +74,79 @@ GnssAdapter::GnssAdapter() :
mNiData(),
mAgpsManager(),
mAgpsCbInfo(),
+ mOdcpiRequestCb(nullptr),
+ mOdcpiRequestActive(false),
+ mOdcpiTimer(this),
+ mOdcpiRequest(),
mSystemStatus(SystemStatus::getInstance(mMsgTask)),
- mServerUrl(""),
+ mServerUrl(":"),
mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask)
{
LOC_LOGD("%s]: Constructor %p", __func__, this);
mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
+
+ pthread_condattr_t condAttr;
+ pthread_condattr_init(&condAttr);
+ pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC);
+ pthread_cond_init(&mNiData.session.tCond, &condAttr);
+ pthread_cond_init(&mNiData.sessionEs.tCond, &condAttr);
+ pthread_condattr_destroy(&condAttr);
+
+ /* Set ATL open/close callbacks */
+ AgpsAtlOpenStatusCb atlOpenStatusCb =
+ [this](int handle, int isSuccess, char* apn,
+ AGpsBearerType bearerType, AGpsExtType agpsType) {
+
+ mLocApi->atlOpenStatus(
+ handle, isSuccess, apn, bearerType, agpsType);
+ };
+ AgpsAtlCloseStatusCb atlCloseStatusCb =
+ [this](int handle, int isSuccess) {
+
+ mLocApi->atlCloseStatus(handle, isSuccess);
+ };
+
+ /* Register DS Client APIs */
+ AgpsDSClientInitFn dsClientInitFn =
+ [this](bool isDueToSSR) {
+
+ return mLocApi->initDataServiceClient(isDueToSSR);
+ };
+
+ AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn =
+ [this] {
+
+ return mLocApi->openAndStartDataCall();
+ };
+
+ AgpsDSClientStopDataCallFn dsClientStopDataCallFn =
+ [this] {
+
+ mLocApi->stopDataCall();
+ };
+
+ AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn =
+ [this] {
+
+ mLocApi->closeDataCall();
+ };
+
+ AgpsDSClientReleaseFn dsClientReleaseFn =
+ [this] {
+
+ mLocApi->releaseDataServiceClient();
+ };
+
+ /* Send Msg function */
+ SendMsgToAdapterMsgQueueFn sendMsgFn =
+ [this](LocMsg* msg) {
+
+ sendMsg(msg);
+ };
+ mAgpsManager.registerATLCallbacks(atlOpenStatusCb, atlCloseStatusCb,
+ dsClientInitFn, dsClientOpenAndStartDataCallFn, dsClientStopDataCallFn,
+ dsClientCloseDataCallFn, dsClientReleaseFn, sendMsgFn);
+
readConfigCommand();
setConfigCommand();
initDefaultAgpsCommand();
@@ -522,6 +589,38 @@ GnssAdapter::readConfigCommand()
}
}
+LocationError
+GnssAdapter::setSuplHostServer(const char* server, int port)
+{
+ LocationError locErr = LOCATION_ERROR_SUCCESS;
+ if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
+ char serverUrl[MAX_URL_LEN] = {};
+ int32_t length = -1;
+ const char noHost[] = "NONE";
+
+ locErr = LOCATION_ERROR_INVALID_PARAMETER;
+
+ if ((NULL == server) || (server[0] == 0) ||
+ (strncasecmp(noHost, server, sizeof(noHost)) == 0)) {
+ serverUrl[0] = '\0';
+ length = 0;
+ } else if (port > 0) {
+ length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u", server, port);
+ }
+
+ if (length >= 0 && strncasecmp(getServerUrl().c_str(),
+ serverUrl, sizeof(serverUrl)) != 0) {
+ setServerUrl(serverUrl);
+ locErr = mLocApi->setServer(serverUrl, length);
+ if (locErr != LOCATION_ERROR_SUCCESS) {
+ LOC_LOGE("%s]:Error while setting SUPL_HOST server:%s",
+ __func__, serverUrl);
+ }
+ }
+ }
+ return locErr;
+}
+
void
GnssAdapter::setConfigCommand()
{
@@ -541,6 +640,8 @@ GnssAdapter::setConfigCommand()
mApi.setLPPConfig(mAdapter.convertLppProfile(ContextBase::mGps_conf.LPP_PROFILE));
mApi.setAGLONASSProtocol(ContextBase::mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT);
}
+ mAdapter.setSuplHostServer(ContextBase::mGps_conf.SUPL_HOST,
+ ContextBase::mGps_conf.SUPL_PORT);
mApi.setSensorControlConfig(ContextBase::mSap_conf.SENSOR_USAGE,
ContextBase::mSap_conf.SENSOR_PROVIDER);
mApi.setLPPeProtocolCp(
@@ -683,30 +784,8 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
}
if (mConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
if (GNSS_ASSISTANCE_TYPE_SUPL == mConfig.assistanceServer.type) {
- if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
- char serverUrl[MAX_URL_LEN] = {};
- int32_t length = 0;
- const char noHost[] = "NONE";
- if (NULL == mConfig.assistanceServer.hostName ||
- strncasecmp(noHost,
- mConfig.assistanceServer.hostName,
- sizeof(noHost)) == 0) {
- err = LOCATION_ERROR_INVALID_PARAMETER;
- } else {
- length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u",
- mConfig.assistanceServer.hostName,
- mConfig.assistanceServer.port);
- }
-
- if (length > 0 && strncasecmp(mAdapter.getServerUrl().c_str(),
- serverUrl, sizeof(serverUrl)) != 0) {
- mAdapter.setServerUrl(serverUrl);
- err = mApi.setServer(serverUrl, length);
- }
-
- } else {
- err = LOCATION_ERROR_SUCCESS;
- }
+ err = mAdapter.setSuplHostServer(mConfig.assistanceServer.hostName,
+ mConfig.assistanceServer.port);
} else if (GNSS_ASSISTANCE_TYPE_C2K == mConfig.assistanceServer.type) {
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
struct in_addr addr;
@@ -859,7 +938,7 @@ GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data)
mAdapter.reportResponse(err, mSessionId);
SystemStatus* s = mAdapter.getSystemStatus();
if ((nullptr != s) && (mData.deleteAll)) {
- s->setDefaultReport();
+ s->setDefaultGnssEngineStates();
}
}
};
@@ -869,6 +948,26 @@ GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data)
}
void
+GnssAdapter::gnssUpdateXtraThrottleCommand(const bool enabled)
+{
+ LOC_LOGD("%s] enabled:%d", __func__, enabled);
+
+ struct UpdateXtraThrottleMsg : public LocMsg {
+ GnssAdapter& mAdapter;
+ const bool mEnabled;
+ inline UpdateXtraThrottleMsg(GnssAdapter& adapter, const bool enabled) :
+ LocMsg(),
+ mAdapter(adapter),
+ mEnabled(enabled) {}
+ inline virtual void proc() const {
+ mAdapter.mXtraObserver.updateXtraThrottle(mEnabled);
+ }
+ };
+
+ sendMsg(new UpdateXtraThrottleMsg(*this, enabled));
+}
+
+void
GnssAdapter::injectLocationCommand(double latitude, double longitude, float accuracy)
{
LOC_LOGD("%s]: latitude %8.4f longitude %8.4f accuracy %8.4f",
@@ -1077,7 +1176,16 @@ GnssAdapter::updateClientsEventMask()
mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
- LOC_LOGD("%s]: Auto usecase, Enable MEAS/POLY - mask 0x%x", __func__, mask);
+ LOC_LOGD("%s]: Auto usecase, Enable MEAS/POLY - mask 0x%" PRIu64 "", __func__, mask);
+ }
+
+ if (mAgpsCbInfo.statusV4Cb != NULL) {
+ mask |= LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST;
+ }
+
+ // Add ODCPI handling
+ if (nullptr != mOdcpiRequestCb) {
+ mask |= LOC_API_ADAPTER_BIT_REQUEST_WIFI;
}
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
@@ -1105,6 +1213,9 @@ GnssAdapter::restartSessions()
{
LOC_LOGD("%s]: ", __func__);
+ // odcpi session is no longer active after restart
+ mOdcpiRequestActive = false;
+
if (mTrackingSessions.empty()) {
return;
}
@@ -1943,7 +2054,8 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
inline virtual void proc() const {
// extract bug report info - this returns true if consumed by systemstatus
SystemStatus* s = mAdapter.getSystemStatus();
- if ((nullptr != s) && (LOC_SESS_SUCCESS == mStatus)){
+ if ((nullptr != s) &&
+ ((LOC_SESS_SUCCESS == mStatus) || (LOC_SESS_INTERMEDIATE == mStatus))){
s->eventPosition(mUlpLocation, mLocationExtended);
}
mAdapter.reportPosition(mUlpLocation, mLocationExtended, mStatus, mTechMask);
@@ -1953,34 +2065,41 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
sendMsg(new MsgReportPosition(*this, ulpLocation, locationExtended, status, techMask));
}
+bool
+GnssAdapter::needReport(const UlpLocation& ulpLocation,
+ enum loc_sess_status status,
+ LocPosTechMask techMask) {
+ bool reported = false;
+ if (LOC_SESS_SUCCESS == status) {
+ // this is a final fix
+ LocPosTechMask mask =
+ LOC_POS_TECH_MASK_SATELLITE | LOC_POS_TECH_MASK_SENSORS | LOC_POS_TECH_MASK_HYBRID;
+ // it is a Satellite fix or a sensor fix
+ reported = (mask & techMask);
+ } else if (LOC_SESS_INTERMEDIATE == status &&
+ LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS) {
+ // this is a intermediate fix and we accepte intermediate
+
+ // it is NOT the case that
+ // there is inaccuracy; and
+ // we care about inaccuracy; and
+ // the inaccuracy exceeds our tolerance
+ reported = !((ulpLocation.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ACCURACY) &&
+ (ContextBase::mGps_conf.ACCURACY_THRES != 0) &&
+ (ulpLocation.gpsLocation.accuracy > ContextBase::mGps_conf.ACCURACY_THRES));
+ }
+
+ return reported;
+}
+
void
GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask)
{
- bool reported = false;
- // what's in the if is... (line by line)
- // 1. this is a final fix; and
- // 1.1 it is a Satellite fix; or
- // 1.2 it is a sensor fix
- // 2. (must be intermediate fix... implicit)
- // 2.1 we accepte intermediate; and
- // 2.2 it is NOT the case that
- // 2.2.1 there is inaccuracy; and
- // 2.2.2 we care about inaccuracy; and
- // 2.2.3 the inaccuracy exceeds our tolerance
- if ((LOC_SESS_SUCCESS == status &&
- ((LOC_POS_TECH_MASK_SATELLITE |
- LOC_POS_TECH_MASK_SENSORS |
- LOC_POS_TECH_MASK_HYBRID) &
- techMask)) ||
- (LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS &&
- !((ulpLocation.gpsLocation.flags &
- LOC_GPS_LOCATION_HAS_ACCURACY) &&
- (ContextBase::mGps_conf.ACCURACY_THRES != 0) &&
- (ulpLocation.gpsLocation.accuracy >
- ContextBase::mGps_conf.ACCURACY_THRES)))) {
+ bool reported = needReport(ulpLocation, status, techMask);
+ if (reported) {
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA) {
mGnssSvIdUsedInPosAvail = true;
mGnssSvIdUsedInPosition = locationExtended.gnss_sv_used_ids;
@@ -1997,7 +2116,6 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
it->second.gnssLocationInfoCb(locationInfo);
}
}
- reported = true;
}
if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER && !mTrackingSessions.empty()) {
@@ -2224,14 +2342,14 @@ static void* niThreadProc(void *args)
NiSession* pSession = (NiSession*)args;
int rc = 0; /* return code from pthread calls */
- struct timeval present_time;
+ struct timespec present_time;
struct timespec expire_time;
pthread_mutex_lock(&pSession->tLock);
/* Calculate absolute expire time */
- gettimeofday(&present_time, NULL);
+ clock_gettime(CLOCK_MONOTONIC, &present_time);
expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
- expire_time.tv_nsec = present_time.tv_usec * 1000;
+ expire_time.tv_nsec = present_time.tv_nsec;
LOC_LOGD("%s]: time out set for abs time %ld with delay %d sec",
__func__, (long)expire_time.tv_sec, pSession->respTimeLeft);
@@ -2356,7 +2474,7 @@ void
GnssAdapter::reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
int msInWeek)
{
- LOC_LOGD("%s]: ", __func__);
+ LOC_LOGD("%s]: msInWeek=%d", __func__, msInWeek);
struct MsgReportGnssMeasurementData : public LocMsg {
GnssAdapter& mAdapter;
@@ -2407,19 +2525,170 @@ GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
mUlpProxy->reportSvPolynomial(svPolynomial);
}
-void GnssAdapter::initDefaultAgps() {
- LOC_LOGD("%s]: ", __func__);
+bool
+GnssAdapter::reportOdcpiRequestEvent(OdcpiRequestInfo& request)
+{
+ struct MsgReportOdcpiRequest : public LocMsg {
+ GnssAdapter& mAdapter;
+ OdcpiRequestInfo mOdcpiRequest;
+ inline MsgReportOdcpiRequest(GnssAdapter& adapter, OdcpiRequestInfo& request) :
+ LocMsg(),
+ mAdapter(adapter),
+ mOdcpiRequest(request) {}
+ inline virtual void proc() const {
+ mAdapter.reportOdcpiRequest(mOdcpiRequest);
+ }
+ };
- LocationCapabilitiesMask mask = getCapabilities();
- if (!(mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT) &&
- !(mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)) {
- LOC_LOGI("%s]: Target does not support MSB and MSA.", __func__);
- return;
+ sendMsg(new MsgReportOdcpiRequest(*this, request));
+ return true;
+}
+
+void GnssAdapter::reportOdcpiRequest(const OdcpiRequestInfo& request)
+{
+ if (nullptr != mOdcpiRequestCb) {
+ LOC_LOGd("request: type %d, tbf %d, isEmergency %d"
+ " requestActive: %d timerActive: %d",
+ request.type, request.tbfMillis, request.isEmergencyMode,
+ mOdcpiRequestActive, mOdcpiTimer.isActive());
+ // ODCPI START and ODCPI STOP from modem can come in quick succession
+ // so the mOdcpiTimer helps avoid spamming the framework as well as
+ // extending the odcpi session past 30 seconds if needed
+ if (ODCPI_REQUEST_TYPE_START == request.type) {
+ if (false == mOdcpiRequestActive && false == mOdcpiTimer.isActive()) {
+ mOdcpiRequestCb(request);
+ mOdcpiRequestActive = true;
+ mOdcpiTimer.start();
+ // if the current active odcpi session is non-emergency, and the new
+ // odcpi request is emergency, replace the odcpi request with new request
+ // and restart the timer
+ } else if (false == mOdcpiRequest.isEmergencyMode &&
+ true == request.isEmergencyMode) {
+ mOdcpiRequestCb(request);
+ mOdcpiRequestActive = true;
+ if (true == mOdcpiTimer.isActive()) {
+ mOdcpiTimer.restart();
+ } else {
+ mOdcpiTimer.start();
+ }
+ // if ODCPI request is not active but the timer is active, then
+ // just update the active state and wait for timer to expire
+ // before requesting new ODCPI to avoid spamming ODCPI requests
+ } else if (false == mOdcpiRequestActive && true == mOdcpiTimer.isActive()) {
+ mOdcpiRequestActive = true;
+ }
+ mOdcpiRequest = request;
+ // the request is being stopped, but allow timer to expire first
+ // before stopping the timer just in case more ODCPI requests come
+ // to avoid spamming more odcpi requests to the framework
+ } else {
+ mOdcpiRequestActive = false;
+ }
+ } else {
+ LOC_LOGw("ODCPI request not supported");
+ }
+}
+
+void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback)
+{
+ struct MsgInitOdcpi : public LocMsg {
+ GnssAdapter& mAdapter;
+ OdcpiRequestCallback mOdcpiCb;
+ inline MsgInitOdcpi(GnssAdapter& adapter,
+ const OdcpiRequestCallback& callback) :
+ LocMsg(),
+ mAdapter(adapter),
+ mOdcpiCb(callback) {}
+ inline virtual void proc() const {
+ mAdapter.initOdcpi(mOdcpiCb);
+ }
+ };
+
+ sendMsg(new MsgInitOdcpi(*this, callback));
+}
+
+void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback)
+{
+ mOdcpiRequestCb = callback;
+
+ /* Register for WIFI request */
+ updateEvtMask(LOC_API_ADAPTER_BIT_REQUEST_WIFI,
+ LOC_REGISTRATION_MASK_ENABLED);
+}
+
+void GnssAdapter::injectOdcpiCommand(const Location& location)
+{
+ struct MsgInjectOdcpi : public LocMsg {
+ GnssAdapter& mAdapter;
+ Location mLocation;
+ inline MsgInjectOdcpi(GnssAdapter& adapter, const Location& location) :
+ LocMsg(),
+ mAdapter(adapter),
+ mLocation(location) {}
+ inline virtual void proc() const {
+ mAdapter.injectOdcpi(mLocation);
+ }
+ };
+
+ sendMsg(new MsgInjectOdcpi(*this, location));
+}
+
+void GnssAdapter::injectOdcpi(const Location& location)
+{
+ LOC_LOGd("ODCPI Injection: requestActive: %d timerActive: %d"
+ "lat %.7f long %.7f",
+ mOdcpiRequestActive, mOdcpiTimer.isActive(),
+ location.latitude, location.longitude);
+
+ loc_api_adapter_err err = mLocApi->injectPosition(location);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != err) {
+ LOC_LOGe("Inject Position API error %d", err);
+ }
+}
+
+// Called in the context of LocTimer thread
+void OdcpiTimer::timeOutCallback()
+{
+ if (nullptr != mAdapter) {
+ mAdapter->odcpiTimerExpireEvent();
+ }
+}
+
+// Called in the context of LocTimer thread
+void GnssAdapter::odcpiTimerExpireEvent()
+{
+ struct MsgOdcpiTimerExpire : public LocMsg {
+ GnssAdapter& mAdapter;
+ inline MsgOdcpiTimerExpire(GnssAdapter& adapter) :
+ LocMsg(),
+ mAdapter(adapter) {}
+ inline virtual void proc() const {
+ mAdapter.odcpiTimerExpire();
+ }
+ };
+ sendMsg(new MsgOdcpiTimerExpire(*this));
+}
+void GnssAdapter::odcpiTimerExpire()
+{
+ LOC_LOGd("requestActive: %d timerActive: %d",
+ mOdcpiRequestActive, mOdcpiTimer.isActive());
+
+ // if ODCPI request is still active after timer
+ // expires, request again and restart timer
+ if (mOdcpiRequestActive) {
+ mOdcpiRequestCb(mOdcpiRequest);
+ mOdcpiTimer.restart();
+ } else {
+ mOdcpiTimer.stop();
}
+}
+
+void GnssAdapter::initDefaultAgps() {
+ LOC_LOGD("%s]: ", __func__);
void *handle = nullptr;
if ((handle = dlopen("libloc_net_iface.so", RTLD_NOW)) == nullptr) {
- LOC_LOGE("%s]: libloc_net_iface.so not found !", __func__);
+ LOC_LOGD("%s]: libloc_net_iface.so not found !", __func__);
return;
}
@@ -2437,7 +2706,7 @@ void GnssAdapter::initDefaultAgps() {
return;
}
- initAgpsCommand(cbInfo);
+ initAgps(cbInfo);
}
void GnssAdapter::initDefaultAgpsCommand() {
@@ -2448,7 +2717,6 @@ void GnssAdapter::initDefaultAgpsCommand() {
inline MsgInitDefaultAgps(GnssAdapter& adapter) :
LocMsg(),
mAdapter(adapter) {
- LOC_LOGV("MsgInitDefaultAgps");
}
inline virtual void proc() const {
mAdapter.initDefaultAgps();
@@ -2459,141 +2727,53 @@ void GnssAdapter::initDefaultAgpsCommand() {
}
/* INIT LOC AGPS MANAGER */
-void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
- LOC_LOGI("GnssAdapter::initAgpsCommand");
+void GnssAdapter::initAgps(const AgpsCbInfo& cbInfo) {
+ LOC_LOGD("%s]: mAgpsCbInfo.cbPriority - %d; cbInfo.cbPriority - %d",
+ __func__, mAgpsCbInfo.cbPriority, cbInfo.cbPriority)
- /* Set ATL open/close callbacks */
- AgpsAtlOpenStatusCb atlOpenStatusCb =
- [this](int handle, int isSuccess, char* apn,
- AGpsBearerType bearerType, AGpsExtType agpsType) {
-
- mLocApi->atlOpenStatus(
- handle, isSuccess, apn, bearerType, agpsType);
- };
- AgpsAtlCloseStatusCb atlCloseStatusCb =
- [this](int handle, int isSuccess) {
-
- mLocApi->atlCloseStatus(handle, isSuccess);
- };
-
- /* Register DS Client APIs */
- AgpsDSClientInitFn dsClientInitFn =
- [this](bool isDueToSSR) {
-
- return mLocApi->initDataServiceClient(isDueToSSR);
- };
-
- AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn =
- [this] {
-
- return mLocApi->openAndStartDataCall();
- };
-
- AgpsDSClientStopDataCallFn dsClientStopDataCallFn =
- [this] {
-
- mLocApi->stopDataCall();
- };
-
- AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn =
- [this] {
+ if (!((ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB) ||
+ (ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA))) {
+ return;
+ }
- mLocApi->closeDataCall();
- };
+ if (mAgpsCbInfo.cbPriority > cbInfo.cbPriority) {
+ return;
+ } else {
+ mAgpsCbInfo = cbInfo;
- AgpsDSClientReleaseFn dsClientReleaseFn =
- [this] {
+ mAgpsManager.registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb);
- mLocApi->releaseDataServiceClient();
- };
+ mAgpsManager.createAgpsStateMachines();
- /* Send Msg function */
- SendMsgToAdapterMsgQueueFn sendMsgFn =
- [this](LocMsg* msg) {
+ /* Register for AGPS event mask */
+ updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST,
+ LOC_REGISTRATION_MASK_ENABLED);
+ }
+}
- sendMsg(msg);
- };
+void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
+ LOC_LOGI("GnssAdapter::initAgpsCommand");
/* Message to initialize AGPS module */
struct AgpsMsgInit: public LocMsg {
-
- AgpsManager* mAgpsManager;
-
- AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
-
- AgpsAtlOpenStatusCb mAtlOpenStatusCb;
- AgpsAtlCloseStatusCb mAtlCloseStatusCb;
-
- AgpsDSClientInitFn mDSClientInitFn;
- AgpsDSClientOpenAndStartDataCallFn mDSClientOpenAndStartDataCallFn;
- AgpsDSClientStopDataCallFn mDSClientStopDataCallFn;
- AgpsDSClientCloseDataCallFn mDSClientCloseDataCallFn;
- AgpsDSClientReleaseFn mDSClientReleaseFn;
-
- SendMsgToAdapterMsgQueueFn mSendMsgFn;
+ const AgpsCbInfo mCbInfo;
GnssAdapter& mAdapter;
- inline AgpsMsgInit(AgpsManager* agpsManager,
- AgnssStatusIpV4Cb frameworkStatusV4Cb,
- AgpsAtlOpenStatusCb atlOpenStatusCb,
- AgpsAtlCloseStatusCb atlCloseStatusCb,
- AgpsDSClientInitFn dsClientInitFn,
- AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn,
- AgpsDSClientStopDataCallFn dsClientStopDataCallFn,
- AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn,
- AgpsDSClientReleaseFn dsClientReleaseFn,
- SendMsgToAdapterMsgQueueFn sendMsgFn,
+ inline AgpsMsgInit(const AgpsCbInfo& cbInfo,
GnssAdapter& adapter) :
- LocMsg(), mAgpsManager(agpsManager), mFrameworkStatusV4Cb(
- frameworkStatusV4Cb), mAtlOpenStatusCb(atlOpenStatusCb), mAtlCloseStatusCb(
- atlCloseStatusCb), mDSClientInitFn(dsClientInitFn), mDSClientOpenAndStartDataCallFn(
- dsClientOpenAndStartDataCallFn), mDSClientStopDataCallFn(
- dsClientStopDataCallFn), mDSClientCloseDataCallFn(
- dsClientCloseDataCallFn), mDSClientReleaseFn(
- dsClientReleaseFn), mSendMsgFn(sendMsgFn),
- mAdapter(adapter) {
-
+ LocMsg(), mCbInfo(cbInfo), mAdapter(adapter) {
LOC_LOGV("AgpsMsgInit");
}
inline virtual void proc() const {
-
LOC_LOGV("AgpsMsgInit::proc()");
-
- mAgpsManager->registerCallbacks(mFrameworkStatusV4Cb, mAtlOpenStatusCb,
- mAtlCloseStatusCb, mDSClientInitFn,
- mDSClientOpenAndStartDataCallFn, mDSClientStopDataCallFn,
- mDSClientCloseDataCallFn, mDSClientReleaseFn, mSendMsgFn);
-
- mAgpsManager->createAgpsStateMachines();
-
- /* Register for AGPS event mask */
- mAdapter.updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST,
- LOC_REGISTRATION_MASK_ENABLED);
+ mAdapter.initAgps(mCbInfo);
}
};
- if (mAgpsCbInfo.cbPriority > cbInfo.cbPriority) {
- LOC_LOGI("Higher priority AGPS CB already registered (%d > %d) !",
- mAgpsCbInfo.cbPriority, cbInfo.cbPriority);
- return;
- } else {
- mAgpsCbInfo = cbInfo;
- LOC_LOGI("Registering AGPS CB %p with priority %d",
- mAgpsCbInfo.statusV4Cb, mAgpsCbInfo.cbPriority);
- }
-
/* Send message to initialize AGPS Manager */
- sendMsg(new AgpsMsgInit(
- &mAgpsManager,
- (AgnssStatusIpV4Cb)cbInfo.statusV4Cb,
- atlOpenStatusCb, atlCloseStatusCb,
- dsClientInitFn, dsClientOpenAndStartDataCallFn,
- dsClientStopDataCallFn, dsClientCloseDataCallFn,
- dsClientReleaseFn,
- sendMsgFn,
- *this));
+ sendMsg(new AgpsMsgInit(cbInfo, *this));
}
/* GnssAdapter::requestATL
@@ -2993,6 +3173,9 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
r.mLocation.mLocation.longitude =
(double)(reports.mBestPosition.back().mBestLon) * RAD2DEG;
r.mLocation.mLocation.altitude = reports.mBestPosition.back().mBestAlt;
+ r.mLocation.mLocation.accuracy =
+ (double)(reports.mBestPosition.back().mBestHepe);
+
r.mLocation.mUtcReported = reports.mBestPosition.back().mUtcReported;
}
else {
@@ -3018,8 +3201,8 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
(int64_t)(reports.mTimeAndClock.back().mGpsTowMs);
r.mTime.timeUncertaintyNs =
- (float)((reports.mTimeAndClock.back().mTimeUnc +
- reports.mTimeAndClock.back().mLeapSecUnc)*1000);
+ ((float)(reports.mTimeAndClock.back().mTimeUnc) +
+ (float)(reports.mTimeAndClock.back().mLeapSecUnc))*1000.0f;
r.mTime.frequencyUncertaintyNsPerSec =
(float)(reports.mTimeAndClock.back().mClockFreqBiasUnc);
LOC_LOGV("getDebugReport - timeestimate=%" PRIu64 " unc=%f frequnc=%f",
@@ -3052,12 +3235,12 @@ GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int m
systemstatus->getReport(reports, true);
if ((!reports.mRfAndParams.empty()) && (!reports.mTimeAndClock.empty()) &&
- reports.mTimeAndClock.back().mTimeValid &&
(abs(msInWeek - (int)reports.mTimeAndClock.back().mGpsTowMs) < 2000)) {
for (size_t i = 0; i < measurements.count; i++) {
switch (measurements.measurements[i].svType) {
case GNSS_SV_TYPE_GPS:
+ case GNSS_SV_TYPE_QZSS:
measurements.measurements[i].agcLevelDb =
reports.mRfAndParams.back().mAgcGps;
measurements.measurements[i].flags |=
@@ -3085,7 +3268,6 @@ GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int m
GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
break;
- case GNSS_SV_TYPE_QZSS:
case GNSS_SV_TYPE_SBAS:
case GNSS_SV_TYPE_UNKNOWN:
default:
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);
diff --git a/gps/gnss/Makefile.am b/gps/gnss/Makefile.am
index 3afdcd7..c818cae 100644
--- a/gps/gnss/Makefile.am
+++ b/gps/gnss/Makefile.am
@@ -1,99 +1,31 @@
AM_CFLAGS = \
$(LOCPLA_CFLAGS) \
$(LOCHAL_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ $(LOCCORE_CFLAGS) \
-I./ \
-I../utils \
- -I../core \
+ -I$(WORKSPACE)/hardware/qcom/gps/core/data-items \
-I../location \
-std=c++11
libgnss_la_SOURCES = \
location_gnss.cpp \
GnssAdapter.cpp \
+ XtraSystemStatusObserver.cpp \
Agps.cpp
if USE_GLIB
libgnss_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
-libgnss_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -avoid-version
+libgnss_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -avoid-version
libgnss_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
libgnss_la_CFLAGS = $(AM_CFLAGS)
-libgnss_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgnss_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
libgnss_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libgnss_la_LIBADD = -lstdc++ $(LOCPLA_LIBS) $(LOCHAL_LIBS)
-
-
-#Create and Install libraries
-#lib_LTLIBRARIES = libgnss.la
-
-#library_includedir = $(pkgincludedir)
-#pkgconfigdir = $(libdir)/pkgconfig
-#pkgconfig_DATA = location-api.pc
-#EXTRA_DIST = $(pkgconfig_DATA)
-
-
-libloc_ds_api_CFLAGS = \
- $(QMIF_CFLAGS) \
- $(QMI_CFLAGS) \
- $(DATA_CFLAGS) \
- $(GPSUTILS_CFLAGS) \
- -I$(WORKSPACE)/qcom-opensource/location/loc_api/ds_api
-
-libloc_ds_api_la_SOURCES = \
- $(WORKSPACE)/qcom-opensource/location/loc_api/ds_api/ds_client.c
-
-if USE_GLIB
-libloc_ds_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_ds_api_CFLAGS) @GLIB_CFLAGS@
-libloc_ds_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
-libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic
-libloc_ds_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_ds_api_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
-else
-libloc_ds_api_la_CFLAGS = $(AM_CFLAGS) $(libloc_ds_api_CFLAGS)
-libloc_ds_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -Wl,--export-dynamic -shared -version-info 1:0:0
-libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic
-libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS)
-endif
-
-libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl $(GPSUTILS_LIBS) $(LOCPLA_LIBS)
-
-libloc_api_v02_CFLAGS = \
- $(QMIF_CFLAGS) \
- $(GPSUTILS_CFLAGS) \
- -I$(WORKSPACE)/qcom-opensource/location/loc_api/ds_api \
- -I$(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02
-
-libloc_api_v02_la_SOURCES = \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/LocApiV02.cpp \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_log.c \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_client.c \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_sync_req.c \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/location_service_v02.c
-
-if USE_GLIB
-libloc_api_v02_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_api_v02_CFLAGS) @GLIB_CFLAGS@
-libloc_api_v02_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
-libloc_api_v02_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_api_v02_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
-else
-libloc_api_v02_la_CFLAGS = $(AM_CFLAGS) $(libloc_api_v02_CFLAGS)
-libloc_api_v02_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
-libloc_api_v02_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_api_v02_CFLAGS)
-endif
-
-libloc_api_v02_la_CXXFLAGS = -std=c++0x
-libloc_api_v02_la_LIBADD = -lstdc++ -lqmi_cci -lqmi_common_so $(QMIF_LIBS) $(GPSUTILS_LIBS) $(LOCPLA_LIBS) ../core/libloc_core.la libloc_ds_api.la
-
-library_include_HEADERS = \
- $(WORKSPACE)/qcom-opensource/location/loc_api/ds_api/ds_client.h \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/location_service_v02.h \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_log.h \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_client.h \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_sync_req.h \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/LocApiV02.h \
- $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_util_log.h
-
-library_includedir = $(pkgincludedir)
+libgnss_la_LIBADD = -lstdc++ $(GPSUTILS_LIBS) $(LOCCORE_LIBS)
#Create and Install libraries
-lib_LTLIBRARIES = libgnss.la libloc_ds_api.la libloc_api_v02.la
+lib_LTLIBRARIES = libgnss.la
diff --git a/gps/gnss/XtraSystemStatusObserver.cpp b/gps/gnss/XtraSystemStatusObserver.cpp
index e27e698..91c395f 100644
--- a/gps/gnss/XtraSystemStatusObserver.cpp
+++ b/gps/gnss/XtraSystemStatusObserver.cpp
@@ -52,94 +52,121 @@
using namespace loc_core;
-#define XTRA_HAL_SOCKET_NAME "/data/vendor/location/xtra/socket_hal_xtra"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LocSvc_XSSO"
bool XtraSystemStatusObserver::updateLockStatus(uint32_t lock) {
+ mGpsLock = lock;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
stringstream ss;
ss << "gpslock";
ss << " " << lock;
- ss << "\n"; // append seperator
- return ( sendEvent(ss) );
+ return ( send(LOC_IPC_XTRA, ss.str()) );
}
-bool XtraSystemStatusObserver::updateConnectionStatus(bool connected, uint32_t type) {
+bool XtraSystemStatusObserver::updateConnections(uint64_t allConnections) {
+ mIsConnectivityStatusKnown = true;
+ mConnections = allConnections;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
stringstream ss;
ss << "connection";
- ss << " " << (connected ? "1" : "0");
- ss << " " << (int)type;
- ss << "\n"; // append seperator
- return ( sendEvent(ss) );
+ ss << " " << mConnections;
+ return ( send(LOC_IPC_XTRA, ss.str()) );
}
+
bool XtraSystemStatusObserver::updateTac(const string& tac) {
+ mTac = tac;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
stringstream ss;
ss << "tac";
ss << " " << tac.c_str();
- ss << "\n"; // append seperator
- return ( sendEvent(ss) );
+ return ( send(LOC_IPC_XTRA, ss.str()) );
}
bool XtraSystemStatusObserver::updateMccMnc(const string& mccmnc) {
+ mMccmnc = mccmnc;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
stringstream ss;
ss << "mncmcc";
ss << " " << mccmnc.c_str();
- ss << "\n"; // append seperator
- return ( sendEvent(ss) );
+ return ( send(LOC_IPC_XTRA, ss.str()) );
}
-bool XtraSystemStatusObserver::sendEvent(const stringstream& event) {
- int socketFd = createSocket();
- if (socketFd < 0) {
- LOC_LOGe("XTRA unreachable. sending failed.");
- return false;
- }
+bool XtraSystemStatusObserver::updateXtraThrottle(const bool enabled) {
+ mXtraThrottle = enabled;
- const string& data = event.str();
- int remain = data.length();
- ssize_t sent = 0;
- while (remain > 0 &&
- (sent = ::send(socketFd, data.c_str() + (data.length() - remain),
- remain, MSG_NOSIGNAL)) > 0) {
- remain -= sent;
+ if (!mReqStatusReceived) {
+ return true;
}
- if (sent < 0) {
- LOC_LOGe("sending error. reason:%s", strerror(errno));
+ stringstream ss;
+ ss << "xtrathrottle";
+ ss << " " << (enabled ? 1 : 0);
+ return ( send(LOC_IPC_XTRA, ss.str()) );
+}
+
+inline bool XtraSystemStatusObserver::onStatusRequested(int32_t xtraStatusUpdated) {
+ mReqStatusReceived = true;
+
+ if (xtraStatusUpdated) {
+ return true;
}
- closeSocket(socketFd);
+ stringstream ss;
- return (remain == 0);
-}
+ ss << "respondStatus" << endl;
+ (mGpsLock == -1 ? ss : ss << mGpsLock) << endl << mConnections << endl
+ << mTac << endl << mMccmnc << endl << mIsConnectivityStatusKnown;
+ return ( send(LOC_IPC_XTRA, ss.str()) );
+}
-int XtraSystemStatusObserver::createSocket() {
- int socketFd = -1;
+void XtraSystemStatusObserver::onReceive(const std::string& data) {
+ if (!strncmp(data.c_str(), "ping", sizeof("ping") - 1)) {
+ LOC_LOGd("ping received");
- if ((socketFd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- LOC_LOGe("create socket error. reason:%s", strerror(errno));
+#ifdef USE_GLIB
+ } else if (!strncmp(data.c_str(), "connectBackhaul", sizeof("connectBackhaul") - 1)) {
+ mSystemStatusObsrvr->connectBackhaul();
- } else {
- const char* socketPath = XTRA_HAL_SOCKET_NAME ;
- struct sockaddr_un addr = { .sun_family = AF_UNIX };
- snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socketPath);
+ } else if (!strncmp(data.c_str(), "disconnectBackhaul", sizeof("disconnectBackhaul") - 1)) {
+ mSystemStatusObsrvr->disconnectBackhaul();
+#endif
- if (::connect(socketFd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
- LOC_LOGe("cannot connect to XTRA. reason:%s", strerror(errno));
- if (::close(socketFd)) {
- LOC_LOGe("close socket error. reason:%s", strerror(errno));
- }
- socketFd = -1;
- }
- }
+ } else if (!strncmp(data.c_str(), "requestStatus", sizeof("requestStatus") - 1)) {
+ int32_t xtraStatusUpdated = 0;
+ sscanf(data.c_str(), "%*s %d", &xtraStatusUpdated);
- return socketFd;
-}
+ struct HandleStatusRequestMsg : public LocMsg {
+ XtraSystemStatusObserver& mXSSO;
+ int32_t mXtraStatusUpdated;
+ inline HandleStatusRequestMsg(XtraSystemStatusObserver& xsso,
+ int32_t xtraStatusUpdated) :
+ mXSSO(xsso), mXtraStatusUpdated(xtraStatusUpdated) {}
+ inline void proc() const override { mXSSO.onStatusRequested(mXtraStatusUpdated); }
+ };
+ mMsgTask->sendMsg(new (nothrow) HandleStatusRequestMsg(*this, xtraStatusUpdated));
-void XtraSystemStatusObserver::closeSocket(const int socketFd) {
- if (socketFd >= 0) {
- if(::close(socketFd)) {
- LOC_LOGe("close socket error. reason:%s", strerror(errno));
- }
+ } else {
+ LOC_LOGw("unknown event: %s", data.c_str());
}
}
@@ -171,11 +198,11 @@ void XtraSystemStatusObserver::getName(string& name)
void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
{
- struct handleOsObserverUpdateMsg : public LocMsg {
+ struct HandleOsObserverUpdateMsg : public LocMsg {
XtraSystemStatusObserver* mXtraSysStatObj;
list <IDataItemCore*> mDataItemList;
- inline handleOsObserverUpdateMsg(XtraSystemStatusObserver* xtraSysStatObs,
+ inline HandleOsObserverUpdateMsg(XtraSystemStatusObserver* xtraSysStatObs,
const list<IDataItemCore*>& dataItemList) :
mXtraSysStatObj(xtraSysStatObs) {
for (auto eachItem : dataItemList) {
@@ -191,7 +218,7 @@ void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
}
}
- inline ~handleOsObserverUpdateMsg() {
+ inline ~HandleOsObserverUpdateMsg() {
for (auto each : mDataItemList) {
delete each;
}
@@ -205,8 +232,7 @@ void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
{
NetworkInfoDataItemBase* networkInfo =
static_cast<NetworkInfoDataItemBase*>(each);
- mXtraSysStatObj->updateConnectionStatus(networkInfo->mConnected,
- networkInfo->mType);
+ mXtraSysStatObj->updateConnections(networkInfo->getAllTypes());
}
break;
@@ -232,7 +258,5 @@ void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
}
}
};
- mMsgTask->sendMsg(new (nothrow) handleOsObserverUpdateMsg(this, dlist));
+ mMsgTask->sendMsg(new (nothrow) HandleOsObserverUpdateMsg(this, dlist));
}
-
-
diff --git a/gps/gnss/XtraSystemStatusObserver.h b/gps/gnss/XtraSystemStatusObserver.h
index 42f49b5..af0789b 100644
--- a/gps/gnss/XtraSystemStatusObserver.h
+++ b/gps/gnss/XtraSystemStatusObserver.h
@@ -31,41 +31,67 @@
#include <cinttypes>
#include <MsgTask.h>
+#include <LocIpc.h>
+#include <LocTimer.h>
using namespace std;
using loc_core::IOsObserver;
using loc_core::IDataItemObserver;
using loc_core::IDataItemCore;
+using loc_util::LocIpc;
-
-class XtraSystemStatusObserver : public IDataItemObserver {
+class XtraSystemStatusObserver : public IDataItemObserver, public LocIpc{
public :
// constructor & destructor
inline XtraSystemStatusObserver(IOsObserver* sysStatObs, const MsgTask* msgTask):
- mSystemStatusObsrvr(sysStatObs), mMsgTask(msgTask) {
+ mSystemStatusObsrvr(sysStatObs), mMsgTask(msgTask),
+ mGpsLock(-1), mConnections(0), mXtraThrottle(true), mReqStatusReceived(false),
+ mDelayLocTimer(*this), mIsConnectivityStatusKnown (false) {
subscribe(true);
+ startListeningNonBlocking(LOC_IPC_HAL);
+ mDelayLocTimer.start(100 /*.1 sec*/, false);
+ }
+ inline virtual ~XtraSystemStatusObserver() {
+ subscribe(false);
+ stopListening();
}
- 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 updateConnections(uint64_t allConnections);
bool updateTac(const string& tac);
bool updateMccMnc(const string& mccmnc);
+ bool updateXtraThrottle(const bool enabled);
inline const MsgTask* getMsgTask() { return mMsgTask; }
void subscribe(bool yes);
+protected:
+ void onReceive(const std::string& data) override;
+
private:
- int createSocket();
- void closeSocket(const int32_t socketFd);
- bool sendEvent(const stringstream& event);
IOsObserver* mSystemStatusObsrvr;
const MsgTask* mMsgTask;
+ int32_t mGpsLock;
+ uint64_t mConnections;
+ string mTac;
+ string mMccmnc;
+ bool mXtraThrottle;
+ bool mReqStatusReceived;
+ bool mIsConnectivityStatusKnown;
+
+ class DelayLocTimer : public LocTimer {
+ XtraSystemStatusObserver& mXSSO;
+ public:
+ DelayLocTimer(XtraSystemStatusObserver& xsso) : mXSSO(xsso) {}
+ void timeOutCallback() override {
+ mXSSO.send(LOC_IPC_XTRA, "halinit");
+ }
+ } mDelayLocTimer;
+ bool onStatusRequested(int32_t xtraStatusUpdated);
};
#endif
diff --git a/gps/gnss/location_gnss.cpp b/gps/gnss/location_gnss.cpp
index b5623e1..21763dd 100644
--- a/gps/gnss/location_gnss.cpp
+++ b/gps/gnss/location_gnss.cpp
@@ -45,6 +45,7 @@ static void stopTracking(LocationAPI* client, uint32_t id);
static void gnssNiResponse(LocationAPI* client, uint32_t id, GnssNiResponse response);
static uint32_t gnssDeleteAidingData(GnssAidingData& data);
+static void gnssUpdateXtraThrottle(const bool enabled);
static void setControlCallbacks(LocationControlCallbacks& controlCallbacks);
static uint32_t enable(LocationTechnologyType techType);
@@ -59,7 +60,10 @@ static void agpsDataConnOpen(AGpsExtType agpsType, const char* apnName, int apnL
static void agpsDataConnClosed(AGpsExtType agpsType);
static void agpsDataConnFailed(AGpsExtType agpsType);
static void getDebugReport(GnssDebugReport& report);
-static void updateConnectionStatus(bool connected, uint8_t type);
+static void updateConnectionStatus(bool connected, int8_t type);
+
+static void odcpiInit(const OdcpiRequestCallback& callback);
+static void odcpiInject(const Location& location);
static const GnssInterface gGnssInterface = {
sizeof(GnssInterface),
@@ -77,6 +81,7 @@ static const GnssInterface gGnssInterface = {
disable,
gnssUpdateConfig,
gnssDeleteAidingData,
+ gnssUpdateXtraThrottle,
injectLocation,
injectTime,
agpsInit,
@@ -85,6 +90,8 @@ static const GnssInterface gGnssInterface = {
agpsDataConnFailed,
getDebugReport,
updateConnectionStatus,
+ odcpiInit,
+ odcpiInject,
};
#ifndef DEBUG_X86
@@ -203,6 +210,13 @@ static uint32_t gnssDeleteAidingData(GnssAidingData& data)
}
}
+static void gnssUpdateXtraThrottle(const bool enabled)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->gnssUpdateXtraThrottleCommand(enabled);
+ }
+}
+
static void injectLocation(double latitude, double longitude, float accuracy)
{
if (NULL != gGnssAdapter) {
@@ -251,8 +265,23 @@ static void getDebugReport(GnssDebugReport& report) {
}
}
-static void updateConnectionStatus(bool connected, uint8_t type) {
+static void updateConnectionStatus(bool connected, int8_t type) {
if (NULL != gGnssAdapter) {
gGnssAdapter->getSystemStatus()->eventConnectionStatus(connected, type);
}
}
+
+static void odcpiInit(const OdcpiRequestCallback& callback)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->initOdcpiCommand(callback);
+ }
+}
+
+static void odcpiInject(const Location& location)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->injectOdcpiCommand(location);
+ }
+}
+
diff --git a/gps/gnsspps/Android.mk b/gps/gnsspps/Android.mk
new file mode 100644
index 0000000..f87b674
--- /dev/null
+++ b/gps/gnsspps/Android.mk
@@ -0,0 +1,36 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libgnsspps
+LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libgps.utils \
+ liblog
+
+LOCAL_SRC_FILES += \
+ gnsspps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+## Includes
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_pla_headers
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libgnsspps_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
+
+endif
diff --git a/gps/gnsspps/Makefile.am b/gps/gnsspps/Makefile.am
new file mode 100644
index 0000000..c990be0
--- /dev/null
+++ b/gps/gnsspps/Makefile.am
@@ -0,0 +1,37 @@
+AM_CFLAGS = \
+ $(LOCPLA_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ -I$(WORKSPACE)/system/core/include \
+ -I./
+
+ACLOCAL_AMFLAGS = -I m4
+
+libgnsspps_la_SOURCES = \
+ gnsspps.c
+
+if USE_GLIB
+libgnsspps_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgnsspps_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgnsspps_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgnsspps_la_CFLAGS = $(AM_CFLAGS)
+libgnsspps_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libgnsspps_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgnsspps_la_LIBADD = -lstdc++ $(GPSUTILS_LIBS)
+
+library_include_HEADERS = \
+ gnsspps.h
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgnsspps.la
+
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gnsspps.pc
+EXTRA_DIST = $(pkgconfig_DATA)
+
+
+
+
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/configure.ac b/gps/gnsspps/configure.ac
index 8900f04..eb87bc1 100644
--- a/gps/utils/platform_lib_abstractions/loc_stub/configure.ac
+++ b/gps/gnsspps/configure.ac
@@ -1,11 +1,11 @@
-# configure.ac -- Autoconf script for gps loc-stub
+# configure.ac -- Autoconf script for gps lbs-core
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
-# Initialize the gps loc-stub package version 1.0.0
-AC_INIT([loc-stub],1.0.0)
+# Initialize the gps lbs-core package version 1.0.0
+AC_INIT([gnsspps],1.0.0)
# Does not strictly follow GNU Coding standards
AM_INIT_AUTOMAKE([foreign])
# Disables auto rebuilding of configure, Makefile.ins
@@ -29,14 +29,18 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
# Checks for libraries.
-AC_ARG_WITH([hardware_include],
- AC_HELP_STRING([--with-hardware-include=@<:@dir@:>@],
- [Specify the location of the hardware headers]),
- [hardware_incdir=$withval],
- with_hardware_include=no)
+PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
+AC_SUBST([GPSUTILS_CFLAGS])
+AC_SUBST([GPSUTILS_LIBS])
-if test "x$with_hardware_include" != "xno"; then
- CPPFLAGS="${CPPFLAGS} -I${hardware_incdir}"
+AC_ARG_WITH([locpla_includes],
+ AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@],
+ [Specify the path to locpla-includes in loc-pla_git.bb]),
+ [locpla_incdir=$withval],
+ with_locpla_includes=no)
+
+if test "x${with_locpla_includes}" != "xno"; then
+ AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}")
fi
AC_ARG_WITH([glib],
@@ -60,8 +64,7 @@ AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
AC_CONFIG_FILES([ \
Makefile \
- src/Makefile \
- loc-stub.pc
+ gnsspps.pc
])
AC_OUTPUT
diff --git a/gps/gnsspps/gnsspps.c b/gps/gnsspps/gnsspps.c
new file mode 100644
index 0000000..70b23f5
--- /dev/null
+++ b/gps/gnsspps/gnsspps.c
@@ -0,0 +1,194 @@
+/* Copyright (c) 2011-2015, 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 Foundatoin, 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.
+ */
+#include <log_util.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <pthread.h>
+#include <timepps.h>
+#include <linux/types.h>
+
+//DRsync kernel timestamp
+static struct timespec drsyncKernelTs = {0,0};
+//DRsync userspace timestamp
+static struct timespec drsyncUserTs = {0,0};
+//flag to stop fetching timestamp
+static int isActive = 0;
+static pps_handle handle;
+
+static pthread_mutex_t ts_lock;
+
+ /* checks the PPS source and opens it */
+int check_device(char *path, pps_handle *handle)
+{
+ int ret;
+
+ /* Try to find the source by using the supplied "path" name */
+ ret = open(path, O_RDWR);
+ if (ret < 0)
+ {
+ LOC_LOGV("%s:%d unable to open device %s", __func__, __LINE__, path);
+ return ret;
+ }
+
+ /* Open the PPS source */
+ ret = pps_create(ret, handle);
+ if (ret < 0)
+ {
+ LOC_LOGV( "%s:%d cannot create a PPS source from device %s", __func__, __LINE__, path);
+ return -1;
+ }
+ return 0;
+}
+
+/* fetches the timestamp from the PPS source */
+int read_pps(pps_handle *handle)
+{
+ struct timespec timeout;
+ pps_info infobuf;
+ int ret;
+ // 3sec timeout
+ timeout.tv_sec = 3;
+ timeout.tv_nsec = 0;
+
+ ret = pps_fetch(*handle, PPS_TSFMT_TSPEC, &infobuf,&timeout);
+
+ if (ret < 0 && ret !=-EINTR)
+ {
+ LOC_LOGV("%s:%d pps_fetch() error %d", __func__, __LINE__, ret);
+ return -1;
+ }
+
+ pthread_mutex_lock(&ts_lock);
+ drsyncKernelTs.tv_sec = infobuf.tv_sec;
+ drsyncKernelTs.tv_nsec = infobuf.tv_nsec;
+ ret = clock_gettime(CLOCK_BOOTTIME,&drsyncUserTs);
+ pthread_mutex_unlock(&ts_lock);
+
+ if(ret != 0)
+ {
+ LOC_LOGV("%s:%d clock_gettime() error",__func__,__LINE__);
+ }
+ return 0;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* infinitely calls read_pps() */
+void *thread_handle(void *input)
+{
+ int ret;
+ if(input != NULL)
+ {
+ LOC_LOGV("%s:%d Thread Input is present", __func__, __LINE__);
+ }
+ while(isActive)
+ {
+ ret = read_pps(&handle);
+
+ if (ret == -1 && errno != ETIMEDOUT )
+ {
+ LOC_LOGV("%s:%d Could not fetch PPS source", __func__, __LINE__);
+ }
+ }
+ return NULL;
+}
+
+/* opens the device and fetches from PPS source */
+int initPPS(char *devname)
+{
+ int ret,pid;
+ pthread_t thread;
+ isActive = 1;
+
+ ret = check_device(devname, &handle);
+ if (ret < 0)
+ {
+ LOC_LOGV("%s:%d Could not find PPS source", __func__, __LINE__);
+ return 0;
+ }
+
+ pthread_mutex_init(&ts_lock,NULL);
+
+ pid = pthread_create(&thread,NULL,&thread_handle,NULL);
+ if(pid != 0)
+ {
+ LOC_LOGV("%s:%d Could not create thread in InitPPS", __func__, __LINE__);
+ return 0;
+ }
+ return 1;
+}
+
+/* stops fetching and closes the device */
+void deInitPPS()
+{
+ pthread_mutex_lock(&ts_lock);
+ isActive = 0;
+ pthread_mutex_unlock(&ts_lock);
+
+ pthread_mutex_destroy(&ts_lock);
+ pps_destroy(handle);
+}
+
+/* retrieves DRsync kernel timestamp,DRsync userspace timestamp
+ and updates current timestamp */
+/* Returns:
+ * 1. @Param out DRsync kernel timestamp
+ * 2. @Param out DRsync userspace timestamp
+ * 3. @Param out current timestamp
+ */
+int getPPS(struct timespec *fineKernelTs ,struct timespec *currentTs,
+ struct timespec *fineUserTs)
+{
+ int ret;
+
+ pthread_mutex_lock(&ts_lock);
+ fineKernelTs->tv_sec = drsyncKernelTs.tv_sec;
+ fineKernelTs->tv_nsec = drsyncKernelTs.tv_nsec;
+
+ fineUserTs->tv_sec = drsyncUserTs.tv_sec;
+ fineUserTs->tv_nsec = drsyncUserTs.tv_nsec;
+
+ ret = clock_gettime(CLOCK_BOOTTIME,currentTs);
+ pthread_mutex_unlock(&ts_lock);
+ if(ret != 0)
+ {
+ LOC_LOGV("%s:%d clock_gettime() error",__func__,__LINE__);
+ return 0;
+ }
+ return 1;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h b/gps/gnsspps/gnsspps.h
index 677bc81..3642f3b 100644
--- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h
+++ b/gps/gnsspps/gnsspps.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2015, 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
@@ -9,7 +9,7 @@
* 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
+ * * Neither the name of The Linux Foundatoin, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -25,20 +25,21 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-#ifndef __LOC_STUB_GETTID_H__
-#define __LOC_STUB_GETTID_H__
-
-#include <pthread.h>
+#ifndef _GNSSPPS_H
+#define _GNSSPPS_H
#ifdef __cplusplus
extern "C" {
#endif
-pid_t gettid(void);
+/* opens the device and fetches from PPS source */
+int initPPS(char *devname);
+/* updates the fine time stamp */
+int getPPS(struct timespec *current_ts, struct timespec *current_boottime, struct timespec *last_boottime);
+/* stops fetching and closes the device */
+void deInitPPS();
#ifdef __cplusplus
}
#endif
-
-#endif /* __LOC_STUB_GETTID_H__ */
+#endif
diff --git a/gps/gnsspps/gnsspps.pc.in b/gps/gnsspps/gnsspps.pc.in
new file mode 100644
index 0000000..8931ebd
--- /dev/null
+++ b/gps/gnsspps/gnsspps.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnsspps
+Description: QTI GPS gnsspps
+Version: @VERSION
+Libs: -L${libdir} -lgnsspps
+Cflags: -I${includedir}/gnsspps
diff --git a/gps/gnsspps/timepps.h b/gps/gnsspps/timepps.h
new file mode 100644
index 0000000..fe0d8f0
--- /dev/null
+++ b/gps/gnsspps/timepps.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2015, 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 Foundatoin, 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.
+ */
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <linux/types.h>
+#include <linux/pps.h>
+
+#ifndef _TIMEPPS_H
+#define _TIMEPPS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* time of assert event */
+typedef struct timespec pps_info;
+/* represents pps source */
+typedef int pps_handle;
+
+ /* Open the PPS source */
+static __inline int pps_create(int source, pps_handle *handle)
+{
+ int ret;
+ struct pps_kparams dummy;
+
+ if (!handle)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ /* check if current device is valid pps */
+ ret = ioctl(source, PPS_GETPARAMS, &dummy);
+ if (ret)
+ {
+ errno = EOPNOTSUPP;
+ return -1;
+ }
+ *handle = source;
+
+ return 0;
+}
+/* close the pps source */
+static __inline int pps_destroy(pps_handle handle)
+{
+ return close(handle);
+}
+/*reads timestamp from pps device*/
+static __inline int pps_fetch(pps_handle handle, const int tsformat,
+ pps_info *ppsinfobuf,
+ const struct timespec *timeout)
+{
+ struct pps_fdata fdata;
+ int ret;
+
+ if (tsformat != PPS_TSFMT_TSPEC)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ if (timeout)
+ {
+ fdata.timeout.sec = timeout->tv_sec;
+ fdata.timeout.nsec = timeout->tv_nsec;
+ fdata.timeout.flags = ~PPS_TIME_INVALID;
+ }
+ else
+ {
+ fdata.timeout.flags = PPS_TIME_INVALID;
+ }
+ ret = ioctl(handle, PPS_FETCH, &fdata);
+
+ ppsinfobuf->tv_sec = fdata.info.assert_tu.sec;
+ ppsinfobuf->tv_nsec = fdata.info.assert_tu.nsec;
+
+ return ret;
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/gps/loc-hal.pc.in b/gps/loc-hal.pc.in
index 64750db..22d174b 100644
--- a/gps/loc-hal.pc.in
+++ b/gps/loc-hal.pc.in
@@ -6,5 +6,5 @@ includedir=@includedir@
Name: loc-hal
Description: QTI GPS Loc HAL
Version: @VERSION
-Libs: -L${libdir} -lloc_core -llocation_api -lgnss -lloc_ds_api -lloc_api_v02
-Cflags: -I${includedir} -I${includedir}/loc-hal -I${includedir}/loc-hal/location -I${includedir}/loc-hal/gnss -I${includedir}/loc-hal/core
+Libs: -L${libdir} -lgnss
+Cflags: -I${includedir} -I${includedir}/utils -I${includedir}/core -I${includedir}/loc-hal
diff --git a/gps/location/Android.mk b/gps/location/Android.mk
index 2792b12..bbd6fbd 100644
--- a/gps/location/Android.mk
+++ b/gps/location/Android.mk
@@ -7,7 +7,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := liblocation_api
LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \
diff --git a/gps/location/LocationAPI.cpp b/gps/location/LocationAPI.cpp
index 21d2de0..0111a9c 100644
--- a/gps/location/LocationAPI.cpp
+++ b/gps/location/LocationAPI.cpp
@@ -29,7 +29,8 @@
#include <location_interface.h>
#include <dlfcn.h>
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
#include <pthread.h>
#include <map>
diff --git a/gps/location/LocationAPIClientBase.cpp b/gps/location/LocationAPIClientBase.cpp
index 50b4b83..626968c 100644
--- a/gps/location/LocationAPIClientBase.cpp
+++ b/gps/location/LocationAPIClientBase.cpp
@@ -29,12 +29,12 @@
#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_APIClientBase"
-#include <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
#include <inttypes.h>
#include <loc_cfg.h>
#include "LocationAPIClientBase.h"
-#define FLP_CONF_FILE "/etc/flp.conf"
#define GEOFENCE_SESSION_ID 0xFFFFFFFF
#define CONFIG_SESSION_ID 0xFFFFFFFF
@@ -153,7 +153,6 @@ uint32_t LocationAPIControlClient::locAPIGnssUpdateConfig(GnssConfig config)
memcpy(&mConfig, &config, sizeof(GnssConfig));
- uint32_t session = 0;
uint32_t* idArray = mLocationControlAPI->gnssUpdateConfig(config);
LOC_LOGV("%s:%d] gnssUpdateConfig return array: %p", __FUNCTION__, __LINE__, idArray);
if (idArray != nullptr) {
@@ -365,7 +364,7 @@ int32_t LocationAPIClientBase::locAPIGetBatchSize()
{
{"BATCH_SIZE", &mBatchSize, nullptr, 'n'},
};
- UTIL_READ_CONF(FLP_CONF_FILE, flp_conf_param_table);
+ UTIL_READ_CONF(LOC_PATH_FLP_CONF, flp_conf_param_table);
if (mBatchSize < 0) {
// set mBatchSize to 0 if we got an illegal value from config file
mBatchSize = 0;
@@ -562,10 +561,16 @@ uint32_t LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t co
if (mLocationAPI) {
if (mSessionBiDict.hasId(id)) {
SessionEntity entity = mSessionBiDict.getExtById(id);
- uint32_t batchingSession = entity.batchingSession;
- mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this));
- mLocationAPI->getBatchedLocations(batchingSession, count);
- retVal = LOCATION_ERROR_SUCCESS;
+ if (entity.sessionMode != SESSION_MODE_ON_FIX) {
+ uint32_t batchingSession = entity.batchingSession;
+ mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this));
+ mLocationAPI->getBatchedLocations(batchingSession, count);
+ retVal = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGE("%s:%d] Unsupported for session id: %d, mode is SESSION_MODE_ON_FIX",
+ __FUNCTION__, __LINE__, id);
+ retVal = LOCATION_ERROR_NOT_SUPPORTED;
+ }
} else {
retVal = LOCATION_ERROR_ID_UNKNOWN;
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, id);
@@ -614,26 +619,24 @@ void LocationAPIClientBase::locAPIRemoveGeofences(size_t count, uint32_t* ids)
}
if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
+ BiDict<GeofenceBreachTypeMask>* removedGeofenceBiDict =
+ new BiDict<GeofenceBreachTypeMask>();
size_t j = 0;
- uint32_t id_cb;
- LocationError err;
for (size_t i = 0; i < count; i++) {
sessions[j] = mGeofenceBiDict.getSession(ids[i]);
- id_cb = ids[i];
if (sessions[j] > 0) {
+ GeofenceBreachTypeMask type = mGeofenceBiDict.getExtBySession(sessions[j]);
mGeofenceBiDict.rmBySession(sessions[j]);
- err = LOCATION_ERROR_SUCCESS;
- onRemoveGeofencesCb(1, &err, &id_cb);
+ removedGeofenceBiDict->set(ids[i], sessions[j], type);
j++;
- } else {
- err = LOCATION_ERROR_ID_UNKNOWN;
- onRemoveGeofencesCb(1, &err, &id_cb);
}
}
-
if (j > 0) {
- mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this));
+ mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this,
+ removedGeofenceBiDict));
mLocationAPI->removeGeofences(j, sessions);
+ } else {
+ delete(removedGeofenceBiDict);
}
} else {
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__,
diff --git a/gps/location/LocationAPIClientBase.h b/gps/location/LocationAPIClientBase.h
index c6ea05c..4bd1466 100644
--- a/gps/location/LocationAPIClientBase.h
+++ b/gps/location/LocationAPIClientBase.h
@@ -36,6 +36,8 @@
#include <map>
#include "LocationAPI.h"
+#include <loc_pla.h>
+#include <log_util.h>
enum SESSION_MODE {
SESSION_MODE_NONE = 0,
@@ -469,11 +471,24 @@ private:
class RemoveGeofencesRequest : public LocationAPIRequest {
public:
- RemoveGeofencesRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ RemoveGeofencesRequest(LocationAPIClientBase& API,
+ BiDict<GeofenceBreachTypeMask>* removedGeofenceBiDict) :
+ mAPI(API), mRemovedGeofenceBiDict(removedGeofenceBiDict) {}
inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) {
- // No need to handle collectiveResponse, cbs already notified
+ if (nullptr != mRemovedGeofenceBiDict) {
+ uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (size_t i = 0; i < count; i++) {
+ ids[i] = mRemovedGeofenceBiDict->getId(sessions[i]);
+ }
+ mAPI.onRemoveGeofencesCb(count, errors, ids);
+ free(ids);
+ delete(mRemovedGeofenceBiDict);
+ } else {
+ LOC_LOGE("%s:%d] Unable to access removed geofences data.", __FUNCTION__, __LINE__);
+ }
}
LocationAPIClientBase& mAPI;
+ BiDict<GeofenceBreachTypeMask>* mRemovedGeofenceBiDict;
};
class ModifyGeofencesRequest : public LocationAPIRequest {
diff --git a/gps/location/Makefile.am b/gps/location/Makefile.am
index d1d0131..3688cc8 100644
--- a/gps/location/Makefile.am
+++ b/gps/location/Makefile.am
@@ -1,9 +1,10 @@
+ACLOCAL_AMFLAGS = -I m4
+
AM_CFLAGS = \
- $(LOCPLA_CFLAGS) \
- $(GPSUTILS_CFLAGS) \
- $(LOCHAL_CFLAGS) \
-I./ \
-I../utils \
+ $(LOCPLA_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
-std=c++11
liblocation_api_la_SOURCES = \
@@ -12,15 +13,15 @@ liblocation_api_la_SOURCES = \
if USE_GLIB
liblocation_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
-liblocation_api_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+liblocation_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
liblocation_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
liblocation_api_la_CFLAGS = $(AM_CFLAGS)
-liblocation_api_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+liblocation_api_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
liblocation_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-liblocation_api_la_LIBADD = -lstdc++ $(LOCPLA_LIBS) $(GPSUTILS_LIBS) $(LOCHAL_LIBS)
+liblocation_api_la_LIBADD = -lstdc++ -ldl $(GPSUTILS_LIBS)
library_include_HEADERS = \
LocationAPI.h \
@@ -31,10 +32,7 @@ library_include_HEADERS = \
lib_LTLIBRARIES = liblocation_api.la
library_includedir = $(pkgincludedir)
-#pkgconfigdir = $(libdir)/pkgconfig
-#pkgconfig_DATA = location-api.pc
-#EXTRA_DIST = $(pkgconfig_DATA)
-
-
-
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-api.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/location/configure.ac b/gps/location/configure.ac
new file mode 100644
index 0000000..6391d65
--- /dev/null
+++ b/gps/location/configure.ac
@@ -0,0 +1,82 @@
+# configure.ac -- Autoconf script for gps location-api-iface
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the gps location-api-iface package version 1.0.0
+AC_INIT([location-api-iface],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([location-api.pc.in])
+# defines some macros variable to be included by source
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_LIBTOOL
+AC_PROG_CXX
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_AWK
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+PKG_PROG_PKG_CONFIG
+
+# Checks for libraries.
+PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
+AC_SUBST([GPSUTILS_CFLAGS])
+AC_SUBST([GPSUTILS_LIBS])
+
+AC_ARG_WITH([core_includes],
+ AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
+ [Specify the location of the core headers]),
+ [core_incdir=$withval],
+ with_core_includes=no)
+
+if test "x$with_core_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${core_incdir}"
+fi
+
+AC_ARG_WITH([locpla_includes],
+ AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@],
+ [Specify the path to locpla-includes in loc-pla_git.bb]),
+ [locpla_incdir=$withval],
+ with_locpla_includes=no)
+
+if test "x${with_locpla_includes}" != "xno"; then
+ AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}")
+fi
+
+AC_SUBST([CPPFLAGS])
+
+AC_ARG_WITH([glib],
+ AC_HELP_STRING([--with-glib],
+ [enable glib, building HLOS systems which use glib]))
+
+if (test "x${with_glib}" = "xyes"); then
+ AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib])
+ PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
+ AC_MSG_ERROR(GThread >= 2.16 is required))
+ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
+ AC_MSG_ERROR(GLib >= 2.16 is required))
+ GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
+ GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
+
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+fi
+
+AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
+
+AC_CONFIG_FILES([ \
+ Makefile \
+ location-api.pc \
+ ])
+
+AC_OUTPUT
diff --git a/gps/location/location-api.pc.in b/gps/location/location-api.pc.in
new file mode 100644
index 0000000..c7b146a
--- /dev/null
+++ b/gps/location/location-api.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-api
+Description: Location API
+Version: @VERSION
+Libs: -L${libdir} -llocation_api
+Cflags: -I${includedir}/location-api
diff --git a/gps/location/location_interface.h b/gps/location/location_interface.h
index 33ec29e..9229052 100644
--- a/gps/location/location_interface.h
+++ b/gps/location/location_interface.h
@@ -48,6 +48,7 @@ struct GnssInterface {
void (*disable)(uint32_t id);
uint32_t* (*gnssUpdateConfig)(GnssConfig config);
uint32_t (*gnssDeleteAidingData)(GnssAidingData& data);
+ void (*gnssUpdateXtraThrottle)(const bool enabled);
void (*injectLocation)(double latitude, double longitude, float accuracy);
void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty);
void (*agpsInit)(const AgpsCbInfo& cbInfo);
@@ -55,7 +56,9 @@ struct GnssInterface {
void (*agpsDataConnClosed)(AGpsExtType agpsType);
void (*agpsDataConnFailed)(AGpsExtType agpsType);
void (*getDebugReport)(GnssDebugReport& report);
- void (*updateConnectionStatus)(bool connected, uint8_t type);
+ void (*updateConnectionStatus)(bool connected, int8_t type);
+ void (*odcpiInit)(const OdcpiRequestCallback& callback);
+ void (*odcpiInject)(const Location& location);
};
struct FlpInterface {
diff --git a/gps/pla/Android.mk b/gps/pla/Android.mk
new file mode 100644
index 0000000..ce062bb
--- /dev/null
+++ b/gps/pla/Android.mk
@@ -0,0 +1,30 @@
+GNSS_CFLAGS := \
+ -Werror \
+ -Wno-error=unused-parameter \
+ -Wno-error=format \
+ -Wno-error=macro-redefined \
+ -Wno-error=reorder \
+ -Wno-error=missing-braces \
+ -Wno-error=self-assign \
+ -Wno-error=enum-conversion \
+ -Wno-error=logical-op-parentheses \
+ -Wno-error=null-arithmetic \
+ -Wno-error=null-conversion \
+ -Wno-error=parentheses-equality \
+ -Wno-error=undefined-bool-conversion \
+ -Wno-error=tautological-compare \
+ -Wno-error=switch \
+ -Wno-error=date-time
+
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libloc_pla_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/android
+include $(BUILD_HEADER_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h b/gps/pla/android/loc_pla.h
index ed2041f..9caae73 100644
--- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
+++ b/gps/pla/android/loc_pla.h
@@ -26,19 +26,33 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __PLATFORM_LIB_PROPERTY_SERVICE_H__
-#define __PLATFORM_LIB_PROPERTY_SERVICE_H__
+#ifndef __LOC_PLA__
+#define __LOC_PLA__
#ifdef __cplusplus
-extern "C" {
+#include <utils/SystemClock.h>
+#define uptimeMillis android::uptimeMillis
#endif
-#ifndef PROPERTY_VALUE_MAX
-#define PROPERTY_VALUE_MAX 92
+
+#ifdef __cplusplus
+extern "C" {
#endif
-int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value);
+
+#include <cutils/properties.h>
+#include <cutils/threads.h>
+#include <cutils/sched_policy.h>
+
+#define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf"
+#define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf"
+#define LOC_PATH_FLP_CONF_STR "/vendor/etc/flp.conf"
+#define LOC_PATH_LOWI_CONF_STR "/vendor/etc/lowi.conf"
+#define LOC_PATH_SAP_CONF_STR "/vendor/etc/sap.conf"
+#define LOC_PATH_APDR_CONF_STR "/vendor/etc/apdr.conf"
+#define LOC_PATH_XTWIFI_CONF_STR "/vendor/etc/xtwifi.conf"
+#define LOC_PATH_QUIPC_CONF_STR "/vendor/etc/quipc.conf"
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /*__cplusplus */
-#endif /* __PLATFORM_LIB_PROPERTY_SERVICE_H__ */
+#endif /* __LOC_PLA__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h b/gps/pla/oe/loc_pla.h
index a42b117..3ca1964 100644
--- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h
+++ b/gps/pla/oe/loc_pla.h
@@ -26,39 +26,42 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __LOC_STUB_SCHED_POLICY_H__
-#define __LOC_STUB_SCHED_POLICY_H__
+#ifndef __LOC_PLA__
+#define __LOC_PLA__
#ifdef __cplusplus
+#include <utils/SystemClock.h>
+#define uptimeMillis android::uptimeMillis
+
extern "C" {
#endif
-typedef enum {
- SP_BACKGROUND = 0,
- SP_FOREGROUND = 1,
-} SchedPolicy;
-
-/*===========================================================================
-FUNCTION set_sched_policy
-
-DESCRIPTION
- Local copy of this function which bypasses android set_sched_policy
-
-DEPENDENCIES
- None
-
-RETURN VALUE
- 0
-
-SIDE EFFECTS
- N/A
+#include <cutils/properties.h>
+#include <cutils/threads.h>
+#include <cutils/sched_policy.h>
+#include <sys/time.h>
+#include <string.h>
+#include <stdlib.h>
+#ifndef OFF_TARGET
+#include <glib.h>
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+#else
+#define strlcat strncat
+#define strlcpy strncpy
+#endif
-===========================================================================*/
-int set_sched_policy(int tid, SchedPolicy policy);
+#define LOC_PATH_GPS_CONF_STR "/etc/gps.conf"
+#define LOC_PATH_IZAT_CONF_STR "/etc/izat.conf"
+#define LOC_PATH_FLP_CONF_STR "/etc/flp.conf"
+#define LOC_PATH_LOWI_CONF_STR "/etc/lowi.conf"
+#define LOC_PATH_SAP_CONF_STR "/etc/sap.conf"
+#define LOC_PATH_APDR_CONF_STR "/etc/apdr.conf"
+#define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf"
+#define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf"
#ifdef __cplusplus
}
-#endif /* __cplusplus */
-
-#endif /* __LOC_STUB_SCHED_POLICY_H__ */
+#endif /*__cplusplus */
+#endif /* __LOC_PLA__ */
diff --git a/gps/utils/Android.mk b/gps/utils/Android.mk
index 197cd76..b8320de 100644
--- a/gps/utils/Android.mk
+++ b/gps/utils/Android.mk
@@ -11,8 +11,7 @@ include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
- liblog \
- libloc_pla
+ liblog
LOCAL_SRC_FILES += \
loc_log.cpp \
@@ -20,13 +19,13 @@ LOCAL_SRC_FILES += \
msg_q.c \
linked_list.c \
loc_target.cpp \
- platform_lib_abstractions/elapsed_millis_since_boot.cpp \
LocHeap.cpp \
LocTimer.cpp \
LocThread.cpp \
MsgTask.cpp \
loc_misc_utils.cpp \
- loc_nmea.cpp
+ loc_nmea.cpp \
+ LocIpc.cpp
# Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true
LOCAL_CFLAGS += \
@@ -41,12 +40,12 @@ LOCAL_LDFLAGS += -Wl,--export-dynamic
## Includes
LOCAL_HEADER_LIBRARIES := \
+ libutils_headers \
libloc_pla_headers \
liblocation_api_headers
LOCAL_MODULE := libgps.utils
LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
@@ -60,6 +59,5 @@ LOCAL_MODULE := libgps.utils_headers
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
include $(BUILD_HEADER_LIBRARY)
-include $(addsuffix /Android.mk, $(addprefix $(LOCAL_PATH)/, platform_lib_abstractions))
endif # not BUILD_TINY_ANDROID
endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/utils/LocIpc.cpp b/gps/utils/LocIpc.cpp
new file mode 100644
index 0000000..675664a
--- /dev/null
+++ b/gps/utils/LocIpc.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2017-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
+ * 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.
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <log_util.h>
+#include "LocIpc.h"
+
+namespace loc_util {
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LocSvc_LocIpc"
+
+#define LOC_MSG_BUF_LEN 8192
+#define LOC_MSG_HEAD "$MSGLEN$"
+#define LOC_MSG_ABORT "LocIpcMsg::ABORT"
+
+class LocIpcRunnable : public LocRunnable {
+friend LocIpc;
+public:
+ LocIpcRunnable(LocIpc& locIpc, const std::string& ipcName)
+ : mLocIpc(locIpc), mIpcName(ipcName) {}
+ bool run() override {
+ if (!mLocIpc.startListeningBlocking(mIpcName)) {
+ LOC_LOGe("listen to socket failed");
+ }
+
+ return false;
+ }
+private:
+ LocIpc& mLocIpc;
+ const std::string mIpcName;
+};
+
+bool LocIpc::startListeningNonBlocking(const std::string& name) {
+ mRunnable = new LocIpcRunnable(*this, name);
+ std::string threadName("LocIpc-");
+ threadName.append(name);
+ return mThread.start(threadName.c_str(), mRunnable);
+}
+
+bool LocIpc::startListeningBlocking(const std::string& name) {
+
+ int fd = socket(AF_UNIX, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ LOC_LOGe("create socket error. reason:%s", strerror(errno));
+ return false;
+ }
+
+ if ((unlink(name.c_str()) < 0) && (errno != ENOENT)) {
+ LOC_LOGw("unlink socket error. reason:%s", strerror(errno));
+ }
+
+ struct sockaddr_un addr = { .sun_family = AF_UNIX };
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", name.c_str());
+
+ umask(0157);
+
+ if (::bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ LOC_LOGe("bind socket error. reason:%s", strerror(errno));
+ ::close(fd);
+ fd = -1;
+ return false;
+ }
+
+ mIpcFd = fd;
+
+ // inform that the socket is ready to receive message
+ onListenerReady();
+
+ ssize_t nBytes = 0;
+ std::string msg = "";
+ std::string abort = LOC_MSG_ABORT;
+ while (1) {
+ msg.resize(LOC_MSG_BUF_LEN);
+ nBytes = ::recvfrom(mIpcFd, (void*)(msg.data()), msg.size(), 0, NULL, NULL);
+ if (nBytes < 0) {
+ break;
+ } else if (nBytes == 0) {
+ continue;
+ }
+
+ if (strncmp(msg.data(), abort.c_str(), abort.length()) == 0) {
+ LOC_LOGi("recvd abort msg.data %s", msg.data());
+ break;
+ }
+
+ if (strncmp(msg.data(), LOC_MSG_HEAD, sizeof(LOC_MSG_HEAD) - 1)) {
+ // short message
+ msg.resize(nBytes);
+ onReceive(msg);
+ } else {
+ // long message
+ size_t msgLen = 0;
+ sscanf(msg.data(), LOC_MSG_HEAD"%zu", &msgLen);
+ msg.resize(msgLen);
+ size_t msgLenReceived = 0;
+ while ((msgLenReceived < msgLen) && (nBytes > 0)) {
+ nBytes = recvfrom(mIpcFd, (void*)&(msg[msgLenReceived]),
+ msg.size() - msgLenReceived, 0, NULL, NULL);
+ msgLenReceived += nBytes;
+ }
+ if (nBytes > 0) {
+ onReceive(msg);
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (mStopRequested) {
+ mStopRequested = false;
+ return true;
+ } else {
+ LOC_LOGe("cannot read socket. reason:%s", strerror(errno));
+ (void)::close(mIpcFd);
+ mIpcFd = -1;
+ return false;
+ }
+}
+
+void LocIpc::stopListening() {
+
+ const char *socketName = nullptr;
+ mStopRequested = true;
+
+ if (mRunnable) {
+ std::string abort = LOC_MSG_ABORT;
+ socketName = (reinterpret_cast<LocIpcRunnable *>(mRunnable))->mIpcName.c_str();
+ send(socketName, abort);
+ mRunnable = nullptr;
+ }
+
+ if (mIpcFd >= 0) {
+ if (::close(mIpcFd)) {
+ LOC_LOGe("cannot close socket:%s", strerror(errno));
+ }
+ mIpcFd = -1;
+ }
+
+ //delete from the file system at the end
+ if (socketName) {
+ unlink(socketName);
+ }
+}
+
+bool LocIpc::send(const char name[], const std::string& data) {
+ return send(name, (const uint8_t*)data.c_str(), data.length());
+}
+
+bool LocIpc::send(const char name[], const uint8_t data[], uint32_t length) {
+
+ bool result = true;
+ int fd = ::socket(AF_UNIX, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ LOC_LOGe("create socket error. reason:%s", strerror(errno));
+ return false;
+ }
+
+ struct sockaddr_un addr = { .sun_family = AF_UNIX };
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", name);
+
+ result = sendData(fd, addr, data, length);
+
+ (void)::close(fd);
+ return result;
+}
+
+
+bool LocIpc::sendData(int fd, const sockaddr_un &addr, const uint8_t data[], uint32_t length) {
+
+ bool result = true;
+
+ if (length <= LOC_MSG_BUF_LEN) {
+ if (::sendto(fd, data, length, 0,
+ (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ LOC_LOGe("cannot send to socket. reason:%s", strerror(errno));
+ result = false;
+ }
+ } else {
+ std::string head = LOC_MSG_HEAD;
+ head.append(std::to_string(length));
+ if (::sendto(fd, head.c_str(), head.length(), 0,
+ (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ LOC_LOGe("cannot send to socket. reason:%s", strerror(errno));
+ result = false;
+ } else {
+ size_t sentBytes = 0;
+ while(sentBytes < length) {
+ size_t partLen = length - sentBytes;
+ if (partLen > LOC_MSG_BUF_LEN) {
+ partLen = LOC_MSG_BUF_LEN;
+ }
+ ssize_t rv = ::sendto(fd, data + sentBytes, partLen, 0,
+ (struct sockaddr*)&addr, sizeof(addr));
+ if (rv < 0) {
+ LOC_LOGe("cannot send to socket. reason:%s", strerror(errno));
+ result = false;
+ break;
+ }
+ sentBytes += rv;
+ }
+ }
+ }
+ return result;
+}
+
+}
diff --git a/gps/utils/LocIpc.h b/gps/utils/LocIpc.h
new file mode 100644
index 0000000..364093b
--- /dev/null
+++ b/gps/utils/LocIpc.h
@@ -0,0 +1,153 @@
+/* Copyright (c) 2017-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
+ * 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 __LOC_SOCKET__
+#define __LOC_SOCKET__
+
+#include <string>
+#include <memory>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <LocThread.h>
+
+namespace loc_util {
+
+class LocIpcSender;
+
+class LocIpc {
+friend LocIpcSender;
+public:
+ inline LocIpc() : mIpcFd(-1), mStopRequested(false), mRunnable(nullptr) {}
+ inline virtual ~LocIpc() { stopListening(); }
+
+ // Listen for new messages in current thread. Calling this funciton will
+ // block current thread. The listening can be stopped by calling stopListening().
+ //
+ // Argument name is the path of the unix local socket to be listened.
+ // The function will return true on success, and false on failure.
+ bool startListeningBlocking(const std::string& name);
+
+ // Create a new LocThread and listen for new messages in it.
+ // Calling this function will return immediately and won't block current thread.
+ // The listening can be stopped by calling stopListening().
+ //
+ // Argument name is the path of the unix local socket to be be listened.
+ // The function will return true on success, and false on failure.
+ bool startListeningNonBlocking(const std::string& name);
+
+ // Stop listening to new messages.
+ void stopListening();
+
+ // Send out a message.
+ // Call this function to send a message in argument data to socket in argument name.
+ //
+ // Argument name contains the name of the target unix socket. data contains the
+ // message to be sent out. Convert your message to a string before calling this function.
+ // The function will return true on success, and false on failure.
+ static bool send(const char name[], const std::string& data);
+ static bool send(const char name[], const uint8_t data[], uint32_t length);
+
+protected:
+ // Callback function for receiving incoming messages.
+ // Override this function in your derived class to process incoming messages.
+ // For each received message, this callback function will be called once.
+ // This callback function will be called in the calling thread of startListeningBlocking
+ // or in the new LocThread created by startListeningNonBlocking.
+ //
+ // Argument data contains the received message. You need to parse it.
+ inline virtual void onReceive(const std::string& /*data*/) {}
+
+ // LocIpc client can overwrite this function to get notification
+ // when the socket for LocIpc is ready to receive messages.
+ inline virtual void onListenerReady() {}
+
+private:
+ static bool sendData(int fd, const sockaddr_un& addr,
+ const uint8_t data[], uint32_t length);
+
+ int mIpcFd;
+ bool mStopRequested;
+ LocThread mThread;
+ LocRunnable *mRunnable;
+};
+
+class LocIpcSender {
+public:
+ // Constructor of LocIpcSender class
+ //
+ // Argument destSocket contains the full path name of destination socket.
+ // This class hides generated fd and destination address object from user.
+ inline LocIpcSender(const char* destSocket):
+ LocIpcSender(std::make_shared<int>(::socket(AF_UNIX, SOCK_DGRAM, 0)), destSocket) {
+ if (-1 == *mSocket) {
+ mSocket = nullptr;
+ }
+ }
+
+ // Replicate a new LocIpcSender object with new destination socket.
+ inline LocIpcSender* replicate(const char* destSocket) {
+ return (nullptr == mSocket) ? nullptr : new LocIpcSender(mSocket, destSocket);
+ }
+
+ inline ~LocIpcSender() {
+ if (nullptr != mSocket && mSocket.unique()) {
+ ::close(*mSocket);
+ }
+ }
+
+ // Send out a message.
+ // Call this function to send a message
+ //
+ // Argument data and length contains the message to be sent out.
+ // Return true when succeeded
+ inline bool send(const uint8_t data[], uint32_t length) {
+ bool rtv = false;
+ if (nullptr != mSocket && nullptr != data) {
+ rtv = LocIpc::sendData(*mSocket, mDestAddr, data, length);
+ }
+ return rtv;
+ }
+
+private:
+ std::shared_ptr<int> mSocket;
+ struct sockaddr_un mDestAddr;
+
+ inline LocIpcSender(
+ const std::shared_ptr<int>& mySocket, const char* destSocket) : mSocket(mySocket) {
+ if ((nullptr != mSocket) && (-1 != *mSocket) && (nullptr != destSocket)) {
+ mDestAddr.sun_family = AF_UNIX;
+ snprintf(mDestAddr.sun_path, sizeof(mDestAddr.sun_path), "%s", destSocket);
+ }
+ }
+};
+
+}
+
+#endif //__LOC_SOCKET__
diff --git a/gps/utils/LocThread.cpp b/gps/utils/LocThread.cpp
index d112f61..c1052cb 100644
--- a/gps/utils/LocThread.cpp
+++ b/gps/utils/LocThread.cpp
@@ -29,7 +29,7 @@
#include <LocThread.h>
#include <string.h>
#include <pthread.h>
-#include <platform_lib_macros.h>
+#include <loc_pla.h>
class LocThreadDelegate {
LocRunnable* mRunnable;
diff --git a/gps/utils/LocTimer.cpp b/gps/utils/LocTimer.cpp
index 5bcdd7b..93775d0 100644
--- a/gps/utils/LocTimer.cpp
+++ b/gps/utils/LocTimer.cpp
@@ -27,14 +27,15 @@
*
*/
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include <loc_timer.h>
#include <sys/timerfd.h>
#include <sys/epoll.h>
-#include <unistd.h>
+#include <log_util.h>
+#include <loc_timer.h>
#include <LocTimer.h>
#include <LocHeap.h>
#include <LocThread.h>
diff --git a/gps/utils/LocTimer.h b/gps/utils/LocTimer.h
index c6a6362..abc7f64 100644
--- a/gps/utils/LocTimer.h
+++ b/gps/utils/LocTimer.h
@@ -31,7 +31,7 @@
#define __LOC_TIMER_CPP_H__
#include <stddef.h>
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
// opaque class to provide service implementation.
class LocTimerDelegate;
diff --git a/gps/utils/LocUnorderedSetMap.h b/gps/utils/LocUnorderedSetMap.h
new file mode 100644
index 0000000..8748134
--- /dev/null
+++ b/gps/utils/LocUnorderedSetMap.h
@@ -0,0 +1,192 @@
+/* Copyright (c) 2015, 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 __LOC_UNORDERDED_SETMAP_H__
+#define __LOC_UNORDERDED_SETMAP_H__
+
+#include <algorithm>
+#include <unordered_set>
+#include <unordered_map>
+
+using std::unordered_set;
+using std::unordered_map;
+
+namespace loc_util {
+
+// Trim from *fromSet* any elements that also exist in *rVals*.
+// The optional *goneVals*, if not null, will be populated with removed elements.
+template <typename T>
+inline static void trimSet(unordered_set<T>& fromSet, const unordered_set<T>& rVals,
+ unordered_set<T>* goneVals) {
+ for (auto val : rVals) {
+ if (fromSet.erase(val) > 0 && nullptr != goneVals) {
+ goneVals->insert(val);
+ }
+ }
+}
+
+// this method is destructive to the input unordered_sets.
+// the return set is the interset extracted out from the two input sets, *s1* and *s2*.
+// *s1* and *s2* will be left with the intersect removed from them.
+template <typename T>
+static unordered_set<T> removeAndReturnInterset(unordered_set<T>& s1, unordered_set<T>& s2) {
+ unordered_set<T> common(0);
+ for (auto b = s2.begin(); b != s2.end(); b++) {
+ auto a = find(s1.begin(), s1.end(), *b);
+ if (a != s1.end()) {
+ // this is a common item of both l1 and l2, remove from both
+ // but after we add to common
+ common.insert(*a);
+ s1.erase(a);
+ s2.erase(b);
+ }
+ }
+ return common;
+}
+
+template <typename KEY, typename VAL>
+class LocUnorderedSetMap {
+ unordered_map<KEY, unordered_set<VAL>> mMap;
+
+
+ // Trim the VALs pointed to by *iter*, with everything that also exist in *rVals*.
+ // If the set becomes empty, remove the map entry. *goneVals*, if not null, records
+ // the trimmed VALs.
+ bool trimOrRemove(typename unordered_map<KEY, unordered_set<VAL>>::iterator iter,
+ const unordered_set<VAL>& rVals, unordered_set<VAL>* goneVals) {
+ trimSet<VAL>(iter->second, rVals, goneVals);
+ bool removeEntry = (iter->second.empty());
+ if (removeEntry) {
+ mMap.erase(iter);
+ }
+ return removeEntry;
+ }
+
+public:
+ inline LocUnorderedSetMap() {}
+ inline LocUnorderedSetMap(size_t size) : mMap(size) {}
+
+ inline bool empty() { return mMap.empty(); }
+
+ // This gets the raw pointer to the VALs pointed to by *key*
+ // If the entry is not in the map, nullptr will be returned.
+ inline unordered_set<VAL>* getValSetPtr(const KEY& key) {
+ auto entry = mMap.find(key);
+ return (entry != mMap.end()) ? &(entry->second) : nullptr;
+ }
+
+ // This gets a copy of VALs pointed to by *key*
+ // If the entry is not in the map, an empty set will be returned.
+ inline unordered_set<VAL> getValSet(const KEY& key) {
+ auto entry = mMap.find(key);
+ return (entry != mMap.end()) ? entry->second : unordered_set<VAL>(0);
+ }
+
+ // This gets all the KEYs from the map
+ inline unordered_set<KEY> getKeys() {
+ unordered_set<KEY> keys(0);
+ for (auto entry : mMap) {
+ keys.insert(entry.first);
+ }
+ return keys;
+ }
+
+ inline bool remove(const KEY& key) {
+ return mMap.erase(key) > 0;
+ }
+
+ // This looks into all the entries keyed by *keys*. Remove any VALs from the entries
+ // that also exist in *rVals*. If the entry is left with an empty set, the entry will
+ // be removed. The optional parameters *goneKeys* and *goneVals* will record the KEYs
+ // (or entries) and the collapsed VALs removed from the map, respectively.
+ inline void trimOrRemove(unordered_set<KEY>&& keys, const unordered_set<VAL>& rVals,
+ unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) {
+ trimOrRemove(keys, rVals, goneKeys, goneVals);
+ }
+ inline void trimOrRemove(unordered_set<KEY>& keys, const unordered_set<VAL>& rVals,
+ unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) {
+ for (auto key : keys) {
+ auto iter = mMap.find(key);
+ if (iter != mMap.end() && trimOrRemove(iter, rVals, goneVals) && nullptr != goneKeys) {
+ goneKeys->insert(iter->first);
+ }
+ }
+ }
+
+ // This adds all VALs from *newVals* to the map entry keyed by *key*. Or if it
+ // doesn't exist yet, add the set to the map.
+ bool add(const KEY& key, const unordered_set<VAL>& newVals) {
+ bool newEntryAdded = false;
+ if (!newVals.empty()) {
+ auto iter = mMap.find(key);
+ if (iter != mMap.end()) {
+ iter->second.insert(newVals.begin(), newVals.end());
+ } else {
+ mMap[key] = newVals;
+ newEntryAdded = true;
+ }
+ }
+ return newEntryAdded;
+ }
+
+ // This adds to each of entries in the map keyed by *keys* with the VALs in the
+ // *enwVals*. If there new entries added (new key in *keys*), *newKeys*, if not
+ // null, would be populated with those keys.
+ inline void add(const unordered_set<KEY>& keys, const unordered_set<VAL>&& newVals,
+ unordered_set<KEY>* newKeys) {
+ add(keys, newVals, newKeys);
+ }
+ inline void add(const unordered_set<KEY>& keys, const unordered_set<VAL>& newVals,
+ unordered_set<KEY>* newKeys) {
+ for (auto key : keys) {
+ if (add(key, newVals) && nullptr != newKeys) {
+ newKeys->insert(key);
+ }
+ }
+ }
+
+ // This puts *newVals* into the map keyed by *key*, and returns the VALs that are
+ // in effect removed from the keyed VAL set in the map entry.
+ // This call would also remove those same VALs from *newVals*.
+ inline unordered_set<VAL> update(const KEY& key, unordered_set<VAL>& newVals) {
+ unordered_set<VAL> goneVals(0);
+
+ if (newVals.empty()) {
+ mMap.erase(key);
+ } else {
+ auto curVals = mMap[key];
+ mMap[key] = newVals;
+ goneVals = removeAndReturnInterset(curVals, newVals);
+ }
+ return goneVals;
+ }
+};
+
+} // namespace loc_util
+
+#endif // #ifndef __LOC_UNORDERDED_SETMAP_H__
diff --git a/gps/utils/Makefile.am b/gps/utils/Makefile.am
index 33a87da..3801fdd 100644
--- a/gps/utils/Makefile.am
+++ b/gps/utils/Makefile.am
@@ -1,14 +1,17 @@
-AM_CFLAGS = -Wundef \
- -I./ \
- -std=c++11 \
- $(LOCPLA_CFLAGS)
+ACLOCAL_AMFLAGS = -I m4
-AM_CPPFLAGS = -Wundef \
+AM_CFLAGS = -Wundef \
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
-I./ \
-std=c++11 \
$(LOCPLA_CFLAGS)
-libgps_utils_so_la_h_sources = \
+libgps_utils_la_h_sources = \
msg_q.h \
linked_list.h \
loc_cfg.h \
@@ -19,13 +22,15 @@ libgps_utils_so_la_h_sources = \
LocHeap.h \
LocThread.h \
LocTimer.h \
+ LocIpc.h \
loc_misc_utils.h \
loc_nmea.h \
gps_extended_c.h \
gps_extended.h \
- loc_gps.h
+ loc_gps.h \
+ log_util.h
-libgps_utils_so_la_c_sources = \
+libgps_utils_la_c_sources = \
linked_list.c \
msg_q.c \
loc_cfg.cpp \
@@ -34,31 +39,32 @@ libgps_utils_so_la_c_sources = \
LocHeap.cpp \
LocTimer.cpp \
LocThread.cpp \
+ LocIpc.cpp \
MsgTask.cpp \
loc_misc_utils.cpp \
loc_nmea.cpp
+library_includedir = $(pkgincludedir)
-library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+library_include_HEADERS = $(libgps_utils_la_h_sources)
-libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+libgps_utils_la_SOURCES = $(libgps_utils_la_c_sources)
if USE_GLIB
-libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
-libgps_utils_so_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
-libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+libgps_utils_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
-libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
-libgps_utils_so_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
-libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+libgps_utils_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libgps_utils_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libgps_utils_so_la_LIBADD = -lcutils -lstdc++ -llog $(LOCPLA_LIBS)
+libgps_utils_la_LIBADD = $(CUTILS_LIBS)
#Create and Install libraries
-lib_LTLIBRARIES = libgps_utils_so.la
-library_includedir = $(pkgincludedir)
-pkgconfigdir = $(libdir)/pkgconfig
+lib_LTLIBRARIES = libgps_utils.la
+pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gps-utils.pc
EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/utils/MsgTask.cpp b/gps/utils/MsgTask.cpp
index 80abeec..eaead5c 100644
--- a/gps/utils/MsgTask.cpp
+++ b/gps/utils/MsgTask.cpp
@@ -32,8 +32,9 @@
#include <unistd.h>
#include <MsgTask.h>
#include <msg_q.h>
+#include <log_util.h>
#include <loc_log.h>
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
static void LocMsgDestroy(void* msg) {
delete (LocMsg*)msg;
@@ -82,7 +83,7 @@ void MsgTask::sendMsg(const LocMsg* msg) const {
void MsgTask::prerun() {
// make sure we do not run in background scheduling group
- platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND);
+ set_sched_policy(gettid(), SP_FOREGROUND);
}
bool MsgTask::run() {
diff --git a/gps/utils/configure.ac b/gps/utils/configure.ac
index a7ab9b4..639f8c4 100644
--- a/gps/utils/configure.ac
+++ b/gps/utils/configure.ac
@@ -28,9 +28,32 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
-PKG_CHECK_MODULES([LOCPLA], [loc-pla])
-AC_SUBST([LOCPLA_CFLAGS])
-AC_SUBST([LOCPLA_LIBS])
+# Checks for libraries.
+PKG_CHECK_MODULES([CUTILS], [libcutils])
+AC_SUBST([CUTILS_CFLAGS])
+AC_SUBST([CUTILS_LIBS])
+
+AC_ARG_WITH([core_includes],
+ AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
+ [Specify the location of the core headers]),
+ [core_incdir=$withval],
+ with_core_includes=no)
+
+if test "x$with_core_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${core_incdir}"
+fi
+
+AC_ARG_WITH([locpla_includes],
+ AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@],
+ [specify the path to locpla-includes in loc-pla_git.bb]),
+ [locpla_incdir=$withval],
+ with_locpla_includes=no)
+
+if test "x$with_locpla_includes" != "xno"; then
+ AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}")
+fi
+
+AC_SUBST([CPPFLAGS])
AC_ARG_WITH([glib],
AC_HELP_STRING([--with-glib],
diff --git a/gps/utils/gps-utils.pc.in b/gps/utils/gps-utils.pc.in
index 3ed3d90..a988731 100644
--- a/gps/utils/gps-utils.pc.in
+++ b/gps/utils/gps-utils.pc.in
@@ -6,5 +6,5 @@ includedir=@includedir@
Name: gps-utils
Description: QTI GPS Location utils
Version: @VERSION
-Libs: -L${libdir} -lgps_utils_so
+Libs: -L${libdir} -lgps_utils
Cflags: -I${includedir}/gps-utils
diff --git a/gps/utils/gps_extended_c.h b/gps/utils/gps_extended_c.h
index f87a942..5479bec 100644
--- a/gps/utils/gps_extended_c.h
+++ b/gps/utils/gps_extended_c.h
@@ -115,7 +115,9 @@ enum loc_registration_mask_status {
typedef enum {
LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0, /**< Support ODCPI version 2 feature */
LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02, /**< Support Wifi AP data inject version 2 feature */
- LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02 /**< Support debug NMEA feature */
+ LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02, /**< Support debug NMEA feature */
+ LOC_SUPPORTED_FEATURE_GNSS_ONLY_POSITION_REPORT, /**< Support GNSS Only position reports */
+ LOC_SUPPORTED_FEATURE_FDCL /**< Support FDCL */
} loc_supported_feature_enum;
typedef struct {
@@ -308,6 +310,10 @@ typedef uint32_t GpsLocationExtendedFlags;
#define GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA 0x10000
/** GpsLocationExtended has GPS Time */
#define GPS_LOCATION_EXTENDED_HAS_GPS_TIME 0x20000
+/** GpsLocationExtended has Extended Dilution of Precision */
+#define GPS_LOCATION_EXTENDED_HAS_EXT_DOP 0x40000
+/** GpsLocationExtended has Elapsed Time */
+#define GPS_LOCATION_EXTENDED_HAS_ELAPSED_TIME 0x80000
typedef uint32_t LocNavSolutionMask;
/* Bitmask to specify whether SBAS ionospheric correction is used */
@@ -393,6 +399,29 @@ typedef struct {
float pitch;
}LocPositionDynamics;
+typedef struct {
+
+ /** Position dilution of precision.
+ Range: 1 (highest accuracy) to 50 (lowest accuracy) */
+ float PDOP;
+
+ /** Horizontal dilution of precision.
+ Range: 1 (highest accuracy) to 50 (lowest accuracy) */
+ float HDOP;
+
+ /** Vertical dilution of precision.
+ Range: 1 (highest accuracy) to 50 (lowest accuracy) */
+ float VDOP;
+
+ /** geometric dilution of precision.
+ Range: 1 (highest accuracy) to 50 (lowest accuracy) */
+ float GDOP;
+
+ /** time dilution of precision.
+ Range: 1 (highest accuracy) to 50 (lowest accuracy) */
+ float TDOP;
+}LocExtDOP;
+
/* GPS Time structure */
typedef struct {
@@ -451,6 +480,10 @@ typedef struct {
LocPositionDynamics bodyFrameData;
/** GPS Time */
GPSTimeStruct gpsTime;
+ /** Elapsed Time */
+ int64_t elapsedTime;
+ /** Dilution of precision associated with this position*/
+ LocExtDOP extDOP;
} GpsLocationExtended;
enum loc_sess_status {
@@ -559,7 +592,8 @@ enum loc_api_adapter_event_index {
LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report
LOC_API_ADAPTER_REQUEST_SRN_DATA, // request srn data from AP
LOC_API_ADAPTER_REQUEST_POSITION_INJECTION, // Position injection request
- LOC_API_ADAPTER_BATCH_STATUS, // batch status
+ LOC_API_ADAPTER_BATCH_STATUS, // batch status
+ LOC_API_ADAPTER_FDCL_SERVICE_REQ, // FDCL service request
LOC_API_ADAPTER_EVENT_MAX
};
@@ -595,9 +629,10 @@ enum loc_api_adapter_event_index {
#define LOC_API_ADAPTER_BIT_REQUEST_SRN_DATA (1<<LOC_API_ADAPTER_REQUEST_SRN_DATA)
#define LOC_API_ADAPTER_BIT_POSITION_INJECTION_REQUEST (1<<LOC_API_ADAPTER_REQUEST_POSITION_INJECTION)
#define LOC_API_ADAPTER_BIT_BATCH_STATUS (1<<LOC_API_ADAPTER_BATCH_STATUS)
+#define LOC_API_ADAPTER_BIT_FDCL_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_FDCL_SERVICE_REQ)
-typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
+typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T;
typedef enum loc_api_adapter_msg_to_check_supported {
LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING, // Batching 1.0
@@ -1262,6 +1297,20 @@ struct AGnssExtStatusIpV6 {
uint8_t ipV6Addr[16];
};
+/* ODCPI Request Info */
+enum OdcpiRequestType {
+ ODCPI_REQUEST_TYPE_START,
+ ODCPI_REQUEST_TYPE_STOP
+};
+struct OdcpiRequestInfo {
+ size_t size;
+ OdcpiRequestType type;
+ uint32_t tbfMillis;
+ bool isEmergencyMode;
+};
+/* Callback to send ODCPI request to framework */
+typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallback;
+
/*
* Callback with AGNSS(IpV4) status information.
*
@@ -1282,6 +1331,9 @@ typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const
typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
+/* Shared resources of LocIpc */
+#define LOC_IPC_HAL "/dev/socket/location/socket_hal"
+#define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra"
#ifdef __cplusplus
}
diff --git a/gps/utils/linked_list.c b/gps/utils/linked_list.c
index 33185d0..02e1463 100644
--- a/gps/utils/linked_list.c
+++ b/gps/utils/linked_list.c
@@ -26,14 +26,15 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define LOG_TAG "LocSvc_utils_ll"
+
#include "linked_list.h"
#include <stdio.h>
#include <string.h>
-
-#define LOG_TAG "LocSvc_utils_ll"
-#include <platform_lib_includes.h>
#include <stdlib.h>
#include <stdint.h>
+#include <loc_pla.h>
+#include <log_util.h>
typedef struct list_element {
struct list_element* next;
diff --git a/gps/utils/loc_cfg.cpp b/gps/utils/loc_cfg.cpp
index d2364f6..d7adad1 100644
--- a/gps/utils/loc_cfg.cpp
+++ b/gps/utils/loc_cfg.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2015, 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
@@ -37,13 +37,16 @@
#include <ctype.h>
#include <unistd.h>
#include <time.h>
+#include <pwd.h>
+#include <errno.h>
#include <loc_cfg.h>
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
+#include <loc_target.h>
#include <loc_misc_utils.h>
#ifdef USE_GLIB
#include <glib.h>
#endif
-#include "platform_lib_includes.h"
+#include "log_util.h"
/*=============================================================================
*
@@ -54,12 +57,14 @@
/* Parameter data */
static uint32_t DEBUG_LEVEL = 0xff;
static uint32_t TIMESTAMP = 0;
+static uint32_t LOC_MODEM_EMULATOR = 0;
/* Parameter spec table */
static const loc_param_s_type loc_param_table[] =
{
- {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
- {"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
+ {"LOC_MODEM_EMULATOR", &LOC_MODEM_EMULATOR, NULL, 'n'},
};
static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type);
@@ -71,6 +76,28 @@ typedef struct loc_param_v_type
double param_double_value;
}loc_param_v_type;
+// Reference below arrays wherever needed to avoid duplicating
+// same conf path string over and again in location code.
+const char LOC_PATH_GPS_CONF[] = LOC_PATH_GPS_CONF_STR;
+const char LOC_PATH_IZAT_CONF[] = LOC_PATH_IZAT_CONF_STR;
+const char LOC_PATH_FLP_CONF[] = LOC_PATH_FLP_CONF_STR;
+const char LOC_PATH_LOWI_CONF[] = LOC_PATH_LOWI_CONF_STR;
+const char LOC_PATH_SAP_CONF[] = LOC_PATH_SAP_CONF_STR;
+const char LOC_PATH_APDR_CONF[] = LOC_PATH_APDR_CONF_STR;
+const char LOC_PATH_XTWIFI_CONF[] = LOC_PATH_XTWIFI_CONF_STR;
+const char LOC_PATH_QUIPC_CONF[] = LOC_PATH_QUIPC_CONF_STR;
+
+/*===========================================================================
+FUNCTION loc_modem_emulator_enabled
+
+DESCRIPTION
+ Provides access to Modem Emulator config item.
+===========================================================================*/
+uint32_t loc_modem_emulator_enabled()
+{
+ return LOC_MODEM_EMULATOR;
+}
+
/*===========================================================================
FUNCTION loc_set_config_entry
@@ -381,9 +408,6 @@ void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_ta
uint32_t table_length)
{
FILE *conf_fp = NULL;
- char *lasts;
- loc_param_v_type config_value;
- uint32_t i;
if((conf_fp = fopen(conf_file_name, "r")) != NULL)
{
@@ -398,3 +422,718 @@ void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_ta
/* Initialize logging mechanism with parsed data */
loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
}
+
+/*=============================================================================
+ *
+ * Define and Structures for Parsing Location Process Configuration File
+ *
+ *============================================================================*/
+#define MAX_NUM_STRINGS 20
+
+//We can have 8 masks for now
+#define CONFIG_MASK_TARGET_ALL 0X01
+#define CONFIG_MASK_TARGET_FOUND 0X02
+#define CONFIG_MASK_TARGET_CHECK 0X03
+#define CONFIG_MASK_BASEBAND_ALL 0X04
+#define CONFIG_MASK_BASEBAND_FOUND 0X08
+#define CONFIG_MASK_BASEBAND_CHECK 0x0c
+#define CONFIG_MASK_AUTOPLATFORM_ALL 0x10
+#define CONFIG_MASK_AUTOPLATFORM_FOUND 0x20
+#define CONFIG_MASK_AUTOPLATFORM_CHECK 0x30
+
+#define LOC_FEATURE_MASK_GTP_WIFI_BASIC 0x01
+#define LOC_FEATURE_MASK_GTP_WIFI_PREMIUM 0X02
+#define LOC_FEATURE_MASK_GTP_CELL_BASIC 0X04
+#define LOC_FEATURE_MASK_GTP_CELL_PREMIUM 0X08
+#define LOC_FEATURE_MASK_GTP_AP_CELL_BASIC LOC_FEATURE_MASK_GTP_CELL_BASIC
+#define LOC_FEATURE_MASK_GTP_AP_CELL_PREMIUM LOC_FEATURE_MASK_GTP_CELL_PREMIUM
+#define LOC_FEATURE_MASK_SAP_BASIC 0x40
+#define LOC_FEATURE_MASK_SAP_PREMIUM 0X80
+#define LOC_FEATURE_MASK_GTP_WAA_BASIC 0X100
+#define LOC_FEATURE_MASK_GTP_WAA_PREMIUM 0x200
+#define LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC 0X400
+#define LOC_FEATURE_MASK_GTP_MODEM_CELL_PREMIUM 0X800
+#define LOC_FEATURE_MASK_ODCPI 0x1000
+#define LOC_FEATURE_MASK_FREE_WIFI_SCAN_INJECT 0x2000
+#define LOC_FEATURE_MASK_SUPL_WIFI 0x4000
+#define LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO 0x8000
+
+typedef struct {
+ char proc_name[LOC_MAX_PARAM_STRING];
+ char proc_argument[LOC_MAX_PARAM_STRING];
+ char proc_status[LOC_MAX_PARAM_STRING];
+ char group_list[LOC_MAX_PARAM_STRING];
+ unsigned int premium_feature;
+ unsigned int loc_feature_mask;
+ char platform_list[LOC_MAX_PARAM_STRING];
+ char baseband[LOC_MAX_PARAM_STRING];
+ unsigned int sglte_target;
+ char feature_gtp_cell_proc[LOC_MAX_PARAM_STRING];
+ char feature_gtp_waa[LOC_MAX_PARAM_STRING];
+ char feature_gtp_cell[LOC_MAX_PARAM_STRING];
+ char feature_gtp_wifi[LOC_MAX_PARAM_STRING];
+ char feature_sap[LOC_MAX_PARAM_STRING];
+ char feature_odcpi[LOC_MAX_PARAM_STRING];
+ char feature_free_wifi_scan_inject[LOC_MAX_PARAM_STRING];
+ char feature_supl_wifi[LOC_MAX_PARAM_STRING];
+ char feature_wifi_supplicant_info[LOC_MAX_PARAM_STRING];
+ char auto_platform[LOC_MAX_PARAM_STRING];
+} loc_launcher_conf;
+
+/* process configuration parameters */
+static loc_launcher_conf conf;
+
+/* gps.conf Parameter spec table */
+static const loc_param_s_type gps_conf_parameter_table[] = {
+ {"SGLTE_TARGET", &conf.sglte_target, NULL, 'n'},
+};
+
+/* location feature conf, e.g.: izat.conf feature mode table*/
+static const loc_param_s_type loc_feature_conf_table[] = {
+ {"GTP_CELL_PROC", &conf.feature_gtp_cell_proc, NULL, 's'},
+ {"GTP_CELL", &conf.feature_gtp_cell, NULL, 's'},
+ {"GTP_WIFI", &conf.feature_gtp_wifi, NULL, 's'},
+ {"GTP_WAA", &conf.feature_gtp_waa, NULL, 's'},
+ {"SAP", &conf.feature_sap, NULL, 's'},
+ {"ODCPI", &conf.feature_odcpi, NULL, 's'},
+ {"FREE_WIFI_SCAN_INJECT", &conf.feature_free_wifi_scan_inject, NULL, 's'},
+ {"SUPL_WIFI", &conf.feature_supl_wifi, NULL, 's'},
+ {"WIFI_SUPPLICANT_INFO", &conf.feature_wifi_supplicant_info, NULL, 's'},
+};
+
+/* location process conf, e.g.: izat.conf Parameter spec table */
+static const loc_param_s_type loc_process_conf_parameter_table[] = {
+ {"PROCESS_NAME", &conf.proc_name, NULL, 's'},
+ {"PROCESS_ARGUMENT", &conf.proc_argument, NULL, 's'},
+ {"PROCESS_STATE", &conf.proc_status, NULL, 's'},
+ {"PROCESS_GROUPS", &conf.group_list, NULL, 's'},
+ {"PREMIUM_FEATURE", &conf.premium_feature, NULL, 'n'},
+ {"IZAT_FEATURE_MASK", &conf.loc_feature_mask, NULL, 'n'},
+ {"PLATFORMS", &conf.platform_list, NULL, 's'},
+ {"BASEBAND", &conf.baseband, NULL, 's'},
+ {"HARDWARE_TYPE", &conf.auto_platform, NULL, 's'},
+};
+
+/*===========================================================================
+FUNCTION loc_read_process_conf
+
+DESCRIPTION
+ Parse the specified conf file and return info for the processes defined.
+ The format of the file should conform with izat.conf.
+
+PARAMETERS:
+ conf_file_name: configuration file to read
+ process_count_ptr: pointer to store number of processes defined in the conf file.
+ process_info_table_ptr: pointer to store the process info table.
+
+DEPENDENCIES
+ The file must be in izat.conf format.
+
+RETURN VALUE
+ 0: success
+ none-zero: failure
+
+SIDE EFFECTS
+ N/A
+
+NOTES:
+ On success, memory pointed by (*process_info_table_ptr) must be freed.
+===========================================================================*/
+int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_ptr,
+ loc_process_info_s_type** process_info_table_ptr) {
+ loc_process_info_s_type *child_proc = nullptr;
+ volatile int i=0;
+ unsigned int j=0;
+ gid_t gid_list[LOC_PROCESS_MAX_NUM_GROUPS];
+ char *split_strings[MAX_NUM_STRINGS];
+ int name_length=0, group_list_length=0, platform_length=0, baseband_length=0, ngroups=0, ret=0;
+ int auto_platform_length = 0;
+ int group_index=0, nstrings=0, status_length=0;
+ FILE* conf_fp = nullptr;
+ char platform_name[PROPERTY_VALUE_MAX], baseband_name[PROPERTY_VALUE_MAX];
+ char autoplatform_name[PROPERTY_VALUE_MAX];
+ unsigned int loc_service_mask=0;
+ char config_mask = 0;
+ unsigned char proc_list_length=0;
+ int gtp_cell_ap_enabled = 0;
+ char arg_gtp_waa[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";
+ char arg_gtp_ap_cell[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";
+ char arg_gtp_modem_cell[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";
+ char arg_gtp_wifi[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";
+ char arg_sap[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";
+ char arg_disabled[LOC_PROCESS_MAX_ARG_STR_LENGTH] = LOC_FEATURE_MODE_DISABLED;
+ char arg_basic[LOC_PROCESS_MAX_ARG_STR_LENGTH] = LOC_FEATURE_MODE_BASIC;
+ char arg_premium[LOC_PROCESS_MAX_ARG_STR_LENGTH] = LOC_FEATURE_MODE_PREMIUM;
+
+ if (process_count_ptr == NULL || process_info_table_ptr == NULL) {
+ return -1;
+ }
+
+ //Read gps.conf and fill parameter table
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, gps_conf_parameter_table);
+
+ //Form argument strings
+ strlcat(arg_gtp_waa, LOC_FEATURE_GTP_WAA, LOC_PROCESS_MAX_ARG_STR_LENGTH-3);
+ strlcat(arg_gtp_ap_cell, LOC_FEATURE_GTP_AP_CELL, LOC_PROCESS_MAX_ARG_STR_LENGTH-3);
+ strlcat(arg_gtp_modem_cell, LOC_FEATURE_GTP_MODEM_CELL, LOC_PROCESS_MAX_ARG_STR_LENGTH-3);
+ strlcat(arg_gtp_wifi, LOC_FEATURE_GTP_WIFI, LOC_PROCESS_MAX_ARG_STR_LENGTH-3);
+ strlcat(arg_sap, LOC_FEATURE_SAP, LOC_PROCESS_MAX_ARG_STR_LENGTH-3);
+
+ //Get platform name from ro.board.platform property
+ loc_get_platform_name(platform_name, sizeof(platform_name));
+ //Get baseband name from ro.baseband property
+ loc_get_target_baseband(baseband_name, sizeof(baseband_name));
+ //Identify if this is an automotive platform
+ loc_get_auto_platform_name(autoplatform_name,sizeof(autoplatform_name));
+
+ UTIL_READ_CONF(conf_file_name, loc_feature_conf_table);
+
+ //Set service mask for GTP_WIFI
+ if(strcmp(conf.feature_gtp_wifi, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: GTP WIFI DISABLED", __func__, __LINE__);
+ }
+ else if(strcmp(conf.feature_gtp_wifi, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting GTP WIFI to mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_WIFI_BASIC;
+ }
+ //conf file has a garbage value
+ else {
+ LOC_LOGE("%s:%d]: Unrecognized value for GTP WIFI Mode."\
+ " Setting GTP WIFI to default mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_WIFI_BASIC;
+ }
+
+ //Set service mask for GTP_CELL
+ //Using a temp variable here to indicate wheter GTP cell is
+ //enabled on the AP or modem. This variable will be used in
+ //further checks below. An alternative was to compare the
+ //string again in each place which would've been more expensive
+ if(strcmp(conf.feature_gtp_cell_proc, "AP") == 0) {
+ gtp_cell_ap_enabled = 1;
+ }
+
+ if(strcmp(conf.feature_gtp_cell, "PREMIUM") == 0) {
+ LOC_LOGE("%s:%d]: Error: location feature GTP CELL does not support PREMIUM mode" \
+ " available modes are BASIC and DISABLED. Starting feature in BASIC mode",
+ __func__, __LINE__);
+ if(gtp_cell_ap_enabled) {
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_AP_CELL_BASIC;
+ }
+ else {
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC;
+ }
+ }
+ else if(strcmp(conf.feature_gtp_cell, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting GTP CELL to mode: BASIC", __func__, __LINE__);
+ if(gtp_cell_ap_enabled) {
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_AP_CELL_BASIC;
+ }
+ else {
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC;
+ }
+ }
+ else if(strcmp(conf.feature_gtp_cell, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: GTP CELL DISABLED", __func__, __LINE__);
+ }
+ //conf file has a garbage value
+ else {
+ LOC_LOGE("%s:%d]: Unrecognized value for GTP CELL Mode." \
+ " Setting GTP CELL to default mode: BASIC", __func__, __LINE__);
+ if(gtp_cell_ap_enabled) {
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_AP_CELL_BASIC;
+ }
+ else {
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC;
+ }
+ }
+
+ //Set service mask for GTP_WAA
+ if(strcmp(conf.feature_gtp_waa, "PREMIUM") == 0) {
+ LOC_LOGE("%s:%d]: Error: location feature GTP WAA does not support PREMIUM mode" \
+ " available modes are BASIC and DISABLED. Starting feature in BASIC mode",
+ __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_WAA_BASIC;
+ }
+ else if(strcmp(conf.feature_gtp_waa, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting GTP WAA to mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_WAA_BASIC;
+ }
+ else if(strcmp(conf.feature_gtp_waa, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: GTP WAA DISABLED", __func__, __LINE__);
+ }
+ //conf file has a garbage value
+ else {
+ LOC_LOGE("%s:%d]: Unrecognized value for GTP WAA Mode."\
+ " Setting GTP WAA to default mode: DISABLED", __func__, __LINE__);
+ }
+
+ //Set service mask for SAP
+ if(strcmp(conf.feature_sap, "PREMIUM") == 0) {
+ LOC_LOGD("%s:%d]: Setting SAP to mode: PREMIUM", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_SAP_PREMIUM;
+ }
+ else if(strcmp(conf.feature_sap, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting SAP to mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_SAP_BASIC;
+ }
+ else if(strcmp(conf.feature_sap, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: Setting SAP to mode: DISABLED", __func__, __LINE__);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Unrecognized value for SAP Mode."\
+ " Setting SAP to default mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_SAP_BASIC;
+ }
+
+ // Set service mask for ODCPI
+ if(strcmp(conf.feature_odcpi, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting ODCPI to mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_ODCPI;
+ }
+ else if(strcmp(conf.feature_odcpi, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: Setting ODCPI to mode: DISABLED", __func__, __LINE__);
+ }
+ else if(strcmp(conf.feature_odcpi, "PREMIUM") == 0) {
+ LOC_LOGD("%s:%d]: Unrecognized value for ODCPI mode."\
+ "Setting ODCPI to default mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_ODCPI;
+ }
+
+ // Set service mask for FREE_WIFI_SCAN_INJECT
+ if(strcmp(conf.feature_free_wifi_scan_inject, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting FREE_WIFI_SCAN_INJECT to mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_FREE_WIFI_SCAN_INJECT;
+ }
+ else if(strcmp(conf.feature_free_wifi_scan_inject, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: Setting FREE_WIFI_SCAN_INJECT to mode: DISABLED", __func__, __LINE__);
+ }
+ else if(strcmp(conf.feature_free_wifi_scan_inject, "PREMIUM") == 0) {
+ LOC_LOGD("%s:%d]: Unrecognized value for FREE_WIFI_SCAN_INJECT mode."\
+ "Setting FREE_WIFI_SCAN_INJECT to default mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_FREE_WIFI_SCAN_INJECT;
+ }
+
+ // Set service mask for SUPL_WIFI
+ if(strcmp(conf.feature_supl_wifi, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting SUPL_WIFI to mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_SUPL_WIFI;
+ }
+ else if(strcmp(conf.feature_supl_wifi, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: Setting SUPL_WIFI to mode: DISABLED", __func__, __LINE__);
+ }
+ else if(strcmp(conf.feature_supl_wifi, "PREMIUM") == 0) {
+ LOC_LOGD("%s:%d]: Unrecognized value for SUPL_WIFI mode."\
+ "Setting SUPL_WIFI to default mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_SUPL_WIFI;
+ }
+
+ // Set service mask for WIFI_SUPPLICANT_INFO
+ if(strcmp(conf.feature_wifi_supplicant_info, "BASIC") == 0) {
+ LOC_LOGD("%s:%d]: Setting WIFI_SUPPLICANT_INFO to mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO;
+ }
+ else if(strcmp(conf.feature_wifi_supplicant_info, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: Setting WIFI_SUPPLICANT_INFO to mode: DISABLED", __func__, __LINE__);
+ }
+ else if(strcmp(conf.feature_wifi_supplicant_info, "PREMIUM") == 0) {
+ LOC_LOGD("%s:%d]: Unrecognized value for WIFI_SUPPLICANT_INFO mode."\
+ "Setting LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO to default mode: BASIC", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_WIFI_SUPPLICANT_INFO;
+ }
+
+ LOC_LOGD("%s:%d]: loc_service_mask: %x\n", __func__, __LINE__, loc_service_mask);
+
+ if((conf_fp = fopen(conf_file_name, "r")) == NULL) {
+ LOC_LOGE("%s:%d]: Error opening %s %s\n", __func__,
+ __LINE__, conf_file_name, strerror(errno));
+ ret = -1;
+ goto err;
+ }
+
+ //Parse through the file to find out how many processes are to be launched
+ proc_list_length = 0;
+ do {
+ conf.proc_name[0] = 0;
+ //Here note that the 3rd parameter is passed as 1.
+ //This is so that only the first parameter in the table which is "PROCESS_NAME"
+ //is read. We do not want to read the entire block of parameters at this time
+ //since we are only counting the number of processes to launch.
+ //Therefore, only counting the occurrences of PROCESS_NAME parameter
+ //should suffice
+ if(loc_read_conf_r(conf_fp, loc_process_conf_parameter_table, 1)) {
+ LOC_LOGE("%s:%d]: Unable to read conf file. Failing\n", __func__, __LINE__);
+ ret = -1;
+ goto err;
+ }
+ name_length=(int)strlen(conf.proc_name);
+ if(name_length) {
+ proc_list_length++;
+ LOC_LOGD("Process name:%s", conf.proc_name);
+ }
+ } while(name_length);
+ LOC_LOGD("Process cnt = %d", proc_list_length);
+
+ child_proc = (loc_process_info_s_type *)calloc(proc_list_length, sizeof(loc_process_info_s_type));
+ if(child_proc == NULL) {
+ LOC_LOGE("%s:%d]: ERROR: Malloc returned NULL\n", __func__, __LINE__);
+ ret = -1;
+ goto err;
+ }
+
+ //Move file descriptor to the beginning of the file
+ //so that the parameters can be read
+ rewind(conf_fp);
+
+ for(j=0; j<proc_list_length; j++) {
+ //Set defaults for all the child process structs
+ child_proc[j].proc_status = DISABLED;
+ memset(child_proc[j].group_list, 0, sizeof(child_proc[j].group_list));
+ config_mask=0;
+ if(loc_read_conf_r(conf_fp, loc_process_conf_parameter_table,
+ sizeof(loc_process_conf_parameter_table)/sizeof(loc_process_conf_parameter_table[0]))) {
+ LOC_LOGE("%s:%d]: Unable to read conf file. Failing\n", __func__, __LINE__);
+ ret = -1;
+ goto err;
+ }
+
+ name_length=(int)strlen(conf.proc_name);
+ group_list_length=(int)strlen(conf.group_list);
+ platform_length = (int)strlen(conf.platform_list);
+ baseband_length = (int)strlen(conf.baseband);
+ status_length = (int)strlen(conf.proc_status);
+ auto_platform_length = (int)strlen(conf.auto_platform);
+
+ if(!name_length || !group_list_length || !platform_length ||
+ !baseband_length || !status_length || !auto_platform_length) {
+ LOC_LOGE("%s:%d]: Error: i: %d; One of the parameters not specified in conf file",
+ __func__, __LINE__, i);
+ continue;
+ }
+
+ if(strcmp(conf.proc_status, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: Process %s is disabled in conf file",
+ __func__, __LINE__, conf.proc_name);
+ child_proc[j].proc_status = DISABLED_FROM_CONF;
+ continue;
+ }
+ else if(strcmp(conf.proc_status, "ENABLED") == 0) {
+ LOC_LOGD("%s:%d]: Process %s is enabled in conf file",
+ __func__, __LINE__, conf.proc_name);
+ }
+
+ //Since strlcpy copies length-1 characters, we add 1 to name_length
+ if((name_length+1) > LOC_MAX_PARAM_STRING) {
+ LOC_LOGE("%s:%d]: i: %d; Length of name parameter too long. Max length: %d",
+ __func__, __LINE__, i, LOC_MAX_PARAM_STRING);
+ continue;
+ }
+ strlcpy(child_proc[j].name[0], conf.proc_name, sizeof (child_proc[j].name[0]));
+
+ child_proc[j].num_groups = 0;
+ ngroups = loc_util_split_string(conf.group_list, split_strings, MAX_NUM_STRINGS, ' ');
+#ifdef __ANDROID__
+ for(i=0; i<ngroups; i++) {
+ struct passwd* pwd = getpwnam(split_strings[i]);
+ if (pwd) {
+ child_proc[j].group_list[i] = pwd->pw_gid;
+ child_proc[j].num_groups++;
+ LOC_LOGD("%s:%d]:Group %s = %d matches child_group: %d\n",
+ __func__, __LINE__, split_strings[i],
+ pwd->pw_gid,child_proc[j].group_list[i]);
+ }
+ }
+#endif
+ nstrings = loc_util_split_string(conf.platform_list, split_strings, MAX_NUM_STRINGS, ' ');
+ if(strcmp("all", split_strings[0]) == 0) {
+ if (nstrings == 1 || (nstrings == 2 && (strcmp("exclude", split_strings[1]) == 0))) {
+ LOC_LOGD("%s:%d]: Enabled for all targets\n", __func__, __LINE__);
+ config_mask |= CONFIG_MASK_TARGET_ALL;
+ }
+ else if (nstrings > 2 && (strcmp("exclude", split_strings[1]) == 0)) {
+ config_mask |= CONFIG_MASK_TARGET_FOUND;
+ for (i=2; i<nstrings; i++) {
+ if(strcmp(platform_name, split_strings[i]) == 0) {
+ LOC_LOGD("%s:%d]: Disabled platform %s\n", __func__, __LINE__, platform_name);
+ config_mask &= ~CONFIG_MASK_TARGET_FOUND;
+ break;
+ }
+ }
+ }
+ }
+ else {
+ for(i=0; i<nstrings; i++) {
+ if(strcmp(platform_name, split_strings[i]) == 0) {
+ LOC_LOGD("%s:%d]: Matched platform: %s\n",
+ __func__, __LINE__, split_strings[i]);
+ config_mask |= CONFIG_MASK_TARGET_FOUND;
+ break;
+ }
+ }
+ }
+
+ nstrings = loc_util_split_string(conf.baseband, split_strings, MAX_NUM_STRINGS, ' ');
+ if(strcmp("all", split_strings[0]) == 0) {
+ if (nstrings == 1 || (nstrings == 2 && (strcmp("exclude", split_strings[1]) == 0))) {
+ LOC_LOGD("%s:%d]: Enabled for all basebands\n", __func__, __LINE__);
+ config_mask |= CONFIG_MASK_BASEBAND_ALL;
+ }
+ else if (nstrings > 2 && (strcmp("exclude", split_strings[1]) == 0)) {
+ config_mask |= CONFIG_MASK_BASEBAND_FOUND;
+ for (i=2; i<nstrings; i++) {
+ if(strcmp(baseband_name, split_strings[i]) == 0) {
+ LOC_LOGD("%s:%d]: Disabled band %s\n", __func__, __LINE__, baseband_name);
+ config_mask &= ~CONFIG_MASK_BASEBAND_FOUND;
+ break;
+ }
+ }
+ }
+ }
+ else {
+ for(i=0; i<nstrings; i++) {
+ if(strcmp(baseband_name, split_strings[i]) == 0) {
+ LOC_LOGD("%s:%d]: Matched baseband: %s\n",
+ __func__, __LINE__, split_strings[i]);
+ config_mask |= CONFIG_MASK_BASEBAND_FOUND;
+ break;
+ }
+ //Since ro.baseband is not a reliable source for detecting sglte
+ //the alternative is to read the SGLTE_TARGET parameter from gps.conf
+ //this parameter is read into conf_sglte_target
+ else if((strcmp("sglte", split_strings[i]) == 0 ) && conf.sglte_target) {
+ LOC_LOGD("%s:%d]: Matched baseband SGLTE\n", __func__, __LINE__);
+ config_mask |= CONFIG_MASK_BASEBAND_FOUND;
+ break;
+ }
+ }
+ }
+
+ nstrings = loc_util_split_string(conf.auto_platform, split_strings, MAX_NUM_STRINGS, ' ');
+ if(strcmp("all", split_strings[0]) == 0) {
+ LOC_LOGD("%s:%d]: Enabled for all auto platforms\n", __func__, __LINE__);
+ config_mask |= CONFIG_MASK_AUTOPLATFORM_ALL;
+ }
+ else {
+ for(i=0; i<nstrings; i++) {
+ if(strcmp(autoplatform_name, split_strings[i]) == 0) {
+ LOC_LOGD("%s:%d]: Matched auto platform: %s\n",
+ __func__, __LINE__, split_strings[i]);
+ config_mask |= CONFIG_MASK_AUTOPLATFORM_FOUND;
+ break;
+ }
+ }
+ }
+
+ if((config_mask & CONFIG_MASK_TARGET_CHECK) &&
+ (config_mask & CONFIG_MASK_BASEBAND_CHECK) &&
+ (config_mask & CONFIG_MASK_AUTOPLATFORM_CHECK) &&
+ (child_proc[j].proc_status != DISABLED_FROM_CONF)) {
+
+ //Set args
+ //The first argument passed through argv is usually the name of the
+ //binary when started from commandline.
+ //getopt() seems to ignore this first argument and hence we assign it
+ //to the process name for consistency with command line args
+ i = 0;
+ char* temp_arg = ('/' == child_proc[j].name[0][0]) ?
+ (strrchr(child_proc[j].name[0], '/') + 1) : child_proc[j].name[0];
+ strlcpy (child_proc[j].args[i++], temp_arg, sizeof (child_proc[j].args[i++]));
+
+ if(conf.premium_feature) {
+ if(conf.loc_feature_mask & loc_service_mask) {
+ LOC_LOGD("%s:%d]: Enabled. %s has service mask: %x\n",
+ __func__, __LINE__, child_proc[j].name[0], conf.loc_feature_mask);
+ child_proc[j].proc_status = ENABLED;
+
+ if(conf.loc_feature_mask &
+ (LOC_FEATURE_MASK_GTP_WIFI_BASIC | LOC_FEATURE_MASK_GTP_WIFI_PREMIUM)) {
+ if(loc_service_mask & LOC_FEATURE_MASK_GTP_WIFI_BASIC) {
+ strlcpy(child_proc[j].args[i++], arg_gtp_wifi,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_basic,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else if(loc_service_mask & LOC_FEATURE_MASK_GTP_WIFI_PREMIUM) {
+ strlcpy(child_proc[j].args[i++], arg_gtp_wifi,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_premium,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else
+ {
+ strlcpy(child_proc[j].args[i++], arg_gtp_wifi,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ }
+ if(conf.loc_feature_mask &
+ (LOC_FEATURE_MASK_GTP_CELL_BASIC | LOC_FEATURE_MASK_GTP_CELL_PREMIUM )) {
+ if(loc_service_mask & LOC_FEATURE_MASK_GTP_AP_CELL_BASIC){
+ strlcpy(child_proc[j].args[i++], arg_gtp_ap_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_basic,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_gtp_modem_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else if(loc_service_mask & LOC_FEATURE_MASK_GTP_AP_CELL_PREMIUM){
+ strlcpy(child_proc[j].args[i++], arg_gtp_ap_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_premium,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_gtp_modem_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else if(loc_service_mask & LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC) {
+ strlcpy(child_proc[j].args[i++], arg_gtp_modem_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_basic,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_gtp_ap_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else if(loc_service_mask & LOC_FEATURE_MASK_GTP_MODEM_CELL_PREMIUM) {
+ strlcpy(child_proc[j].args[i++], arg_gtp_modem_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_premium,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_gtp_ap_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else {
+ strlcpy(child_proc[j].args[i++], arg_gtp_ap_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_gtp_modem_cell,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ }
+ if(conf.loc_feature_mask &
+ (LOC_FEATURE_MASK_GTP_WAA_BASIC | LOC_FEATURE_MASK_GTP_WAA_PREMIUM)) {
+ if(loc_service_mask & LOC_FEATURE_MASK_GTP_WAA_BASIC) {
+ strlcpy(child_proc[j].args[i++], arg_gtp_waa,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_basic,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else if(loc_service_mask & LOC_FEATURE_MASK_GTP_WAA_PREMIUM) {
+ strlcpy(child_proc[j].args[i++], arg_gtp_waa,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_premium,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else
+ {
+ strlcpy(child_proc[j].args[i++], arg_gtp_waa,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ }
+ if(conf.loc_feature_mask &
+ (LOC_FEATURE_MASK_SAP_BASIC | LOC_FEATURE_MASK_SAP_PREMIUM)) {
+ if(loc_service_mask & LOC_FEATURE_MASK_SAP_BASIC) {
+ strlcpy(child_proc[j].args[i++], arg_sap,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_basic,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else if(loc_service_mask & LOC_FEATURE_MASK_SAP_PREMIUM) {
+ strlcpy(child_proc[j].args[i++], arg_sap,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_premium,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ else
+ {
+ strlcpy(child_proc[j].args[i++], arg_sap,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ strlcpy(child_proc[j].args[i++], arg_disabled,
+ LOC_PROCESS_MAX_ARG_STR_LENGTH);
+ }
+ }
+ IF_LOC_LOGD {
+ LOC_LOGD("%s:%d]: %s args\n", __func__, __LINE__, child_proc[j].name[0]);
+ for(unsigned int k=0; k<LOC_PROCESS_MAX_NUM_ARGS; k++) {
+ if(child_proc[j].args[k][0] != '\0') {
+ LOC_LOGD("%s:%d]: k: %d, %s\n", __func__, __LINE__, k,
+ child_proc[j].args[k]);
+ }
+ }
+ LOC_LOGD("%s:%d]: \n", __func__, __LINE__);
+ }
+ }
+ else {
+ LOC_LOGD("%s:%d]: Disabled. %s has service mask: %x \n",
+ __func__, __LINE__, child_proc[j].name[0], conf.loc_feature_mask);
+ }
+ }
+ else {
+ LOC_LOGD("%s:%d]: %s not a premium feature. Enabled\n",
+ __func__, __LINE__, child_proc[j].name[0]);
+ child_proc[j].proc_status = ENABLED;
+ }
+
+ /*Fill up the remaining arguments from configuration file*/
+ LOC_LOGD("%s] Parsing Process_Arguments from Configuration: %s \n",
+ __func__, conf.proc_argument);
+ if(0 != conf.proc_argument[0])
+ {
+ /**************************************
+ ** conf_proc_argument is shared by all the programs getting launched,
+ ** hence copy to process specific argument string and parse the same.
+ ***************************************/
+ strlcpy(child_proc[j].argumentString, conf.proc_argument,
+ sizeof(child_proc[j].argumentString));
+ char *temp_args[LOC_PROCESS_MAX_NUM_ARGS];
+ memset (temp_args, 0, sizeof (temp_args));
+ loc_util_split_string(child_proc[j].argumentString, &temp_args[i],
+ (LOC_PROCESS_MAX_NUM_ARGS - i), ' ');
+ // copy argument from the pointer to the memory
+ for (unsigned int index = i; index < LOC_PROCESS_MAX_NUM_ARGS; index++) {
+ if (temp_args[index] == NULL) {
+ break;
+ }
+ strlcpy (child_proc[j].args[index], temp_args[index],
+ sizeof (child_proc[j].args[index]));
+ }
+ }
+ }
+ else {
+ LOC_LOGD("%s:%d]: Process %s is disabled\n",
+ __func__, __LINE__, child_proc[j].name[0]);
+ }
+ }
+
+err:
+ if (conf_fp) {
+ fclose(conf_fp);
+ }
+ if (ret != 0) {
+ LOC_LOGE("%s:%d]: ret: %d", __func__, __LINE__, ret);
+ if (child_proc) {
+ free (child_proc);
+ child_proc = nullptr;
+ }
+ *process_count_ptr = 0;
+ *process_info_table_ptr = nullptr;
+
+ }
+ else {
+ *process_count_ptr = proc_list_length;
+ *process_info_table_ptr = child_proc;
+ }
+
+ return ret;
+}
diff --git a/gps/utils/loc_cfg.h b/gps/utils/loc_cfg.h
index 0a0f100..652d86e 100644
--- a/gps/utils/loc_cfg.h
+++ b/gps/utils/loc_cfg.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2015, 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
@@ -32,11 +32,29 @@
#include <stdio.h>
#include <stdint.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
#define LOC_MAX_PARAM_NAME 80
#define LOC_MAX_PARAM_STRING 80
#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING)
+#define LOC_FEATURE_MODE_DISABLED "DISABLED"
+#define LOC_FEATURE_MODE_BASIC "BASIC"
+#define LOC_FEATURE_MODE_PREMIUM "PREMIUM"
+
+#define LOC_FEATURE_GTP_AP_CELL "gtp-ap-cell"
+#define LOC_FEATURE_GTP_MODEM_CELL "gtp-modem-cell"
+#define LOC_FEATURE_GTP_CELL_ENH "gtp-cell-enh"
+#define LOC_FEATURE_GTP_WIFI "gtp-wifi"
+#define LOC_FEATURE_GTP_WAA "gtp-waa"
+#define LOC_FEATURE_SAP "sap"
+
+#define LOC_PROCESS_MAX_NUM_GROUPS 20
+#define LOC_PROCESS_MAX_NUM_ARGS 25
+#define LOC_PROCESS_MAX_ARG_STR_LENGTH 32
+
#define UTIL_UPDATE_CONF(conf_data, len, config_table) \
loc_update_conf((conf_data), (len), (config_table), \
sizeof(config_table) / sizeof(config_table[0]))
@@ -62,6 +80,23 @@ typedef struct
'f' for double */
} loc_param_s_type;
+typedef enum {
+ ENABLED,
+ RUNNING,
+ DISABLED,
+ DISABLED_FROM_CONF
+} loc_process_e_status;
+
+typedef struct {
+ loc_process_e_status proc_status;
+ pid_t proc_id;
+ char name[2][LOC_MAX_PARAM_STRING];
+ gid_t group_list[LOC_PROCESS_MAX_NUM_GROUPS];
+ unsigned char num_groups;
+ char args[LOC_PROCESS_MAX_NUM_ARGS][LOC_PROCESS_MAX_ARG_STR_LENGTH];
+ char argumentString[LOC_MAX_PARAM_STRING];
+} loc_process_info_s_type;
+
/*=============================================================================
*
* MODULE EXTERNAL DATA
@@ -84,6 +119,22 @@ int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table,
uint32_t table_length);
int loc_update_conf(const char* conf_data, int32_t length,
const loc_param_s_type* config_table, uint32_t table_length);
+
+// Below are the location conf file paths
+extern const char LOC_PATH_GPS_CONF[];
+extern const char LOC_PATH_IZAT_CONF[];
+extern const char LOC_PATH_FLP_CONF[];
+extern const char LOC_PATH_LOWI_CONF[];
+extern const char LOC_PATH_SAP_CONF[];
+extern const char LOC_PATH_APDR_CONF[];
+extern const char LOC_PATH_XTWIFI_CONF[];
+extern const char LOC_PATH_QUIPC_CONF[];
+
+int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_ptr,
+ loc_process_info_s_type** process_info_table_ptr);
+
+uint32_t loc_modem_emulator_enabled();
+
#ifdef __cplusplus
}
#endif
diff --git a/gps/utils/loc_log.cpp b/gps/utils/loc_log.cpp
index fd9a236..50d9e4d 100644
--- a/gps/utils/loc_log.cpp
+++ b/gps/utils/loc_log.cpp
@@ -33,9 +33,10 @@
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
+#include "log_util.h"
#include "loc_log.h"
#include "msg_q.h"
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
#define BUFFER_SIZE 120
diff --git a/gps/utils/loc_misc_utils.cpp b/gps/utils/loc_misc_utils.cpp
index fd3ee6b..b7c8406 100644
--- a/gps/utils/loc_misc_utils.cpp
+++ b/gps/utils/loc_misc_utils.cpp
@@ -30,7 +30,7 @@
#define LOG_TAG "LocSvc_misc_utils"
#include <stdio.h>
#include <string.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
diff --git a/gps/utils/loc_nmea.cpp b/gps/utils/loc_nmea.cpp
index eb193cc..558dc65 100644
--- a/gps/utils/loc_nmea.cpp
+++ b/gps/utils/loc_nmea.cpp
@@ -31,7 +31,8 @@
#define LOG_TAG "LocSvc_nmea"
#include <loc_nmea.h>
#include <math.h>
-#include <platform_lib_includes.h>
+#include <log_util.h>
+#include <loc_pla.h>
#define GLONASS_SV_ID_OFFSET 64
#define MAX_SATELLITES_IN_USE 12
@@ -51,6 +52,7 @@ typedef struct loc_nmea_sv_meta_s
uint32_t mask;
uint32_t svCount;
uint32_t svIdOffset;
+ uint32_t signalId;
uint32_t systemId;
} loc_nmea_sv_meta;
@@ -71,8 +73,6 @@ typedef struct loc_sv_cache_info_s
float vdop;
} loc_sv_cache_info;
-static loc_sv_cache_info sv_cache_info;
-
/*===========================================================================
FUNCTION loc_nmea_sv_meta_init
@@ -90,6 +90,7 @@ SIDE EFFECTS
===========================================================================*/
static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
+ loc_sv_cache_info& sv_cache_info,
GnssSvType svType,
bool needCombine)
{
@@ -103,6 +104,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.talker[1] = 'P';
sv_meta.mask = sv_cache_info.gps_used_mask;
sv_meta.svCount = sv_cache_info.gps_count;
+ sv_meta.signalId = 1;
sv_meta.systemId = SYSTEM_ID_GPS;
break;
case GNSS_SV_TYPE_GLONASS:
@@ -112,6 +114,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.svCount = sv_cache_info.glo_count;
// GLONASS SV ids are from 65-96
sv_meta.svIdOffset = GLONASS_SV_ID_OFFSET;
+ sv_meta.signalId = 1;
sv_meta.systemId = SYSTEM_ID_GLONASS;
break;
case GNSS_SV_TYPE_GALILEO:
@@ -119,6 +122,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.talker[1] = 'A';
sv_meta.mask = sv_cache_info.gal_used_mask;
sv_meta.svCount = sv_cache_info.gal_count;
+ sv_meta.signalId = 7;
sv_meta.systemId = SYSTEM_ID_GALILEO;
break;
case GNSS_SV_TYPE_QZSS:
@@ -127,6 +131,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.mask = sv_cache_info.qzss_used_mask;
sv_meta.svCount = sv_cache_info.qzss_count;
// QZSS SV ids are from 193-197. So keep svIdOffset 0
+ sv_meta.signalId = 0;
sv_meta.systemId = SYSTEM_ID_QZSS;
break;
case GNSS_SV_TYPE_BEIDOU:
@@ -135,6 +140,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.mask = sv_cache_info.bds_used_mask;
sv_meta.svCount = sv_cache_info.bds_count;
// BDS SV ids are from 201-235. So keep svIdOffset 0
+ sv_meta.signalId = 0;
sv_meta.systemId = SYSTEM_ID_BEIDOU;
break;
default:
@@ -260,13 +266,14 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
fixType = '3'; // 3D fix
// Start printing the sentence
- // Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v*cc
+ // Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v,s*cc
// a : Mode : A : Automatic, allowed to automatically switch 2D/3D
// x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix)
// xx : 12 SV ID
// p.p : Position DOP (Dilution of Precision)
// h.h : Horizontal DOP
// v.v : Vertical DOP
+ // s : GNSS System Id
// cc : Checksum value
length = snprintf(pMarker, lengthRemaining, "$%sGSA,A,%c,", talker, fixType);
@@ -329,7 +336,7 @@ DESCRIPTION
Generate NMEA GSV sentences generated based on sv report
Currently below sentences are generated:
- $GPGSV: GPS Satellites in View
- - $GNGSV: GLONASS Satellites in View
+ - $GLGSV: GLONASS Satellites in View
- $GAGSV: GALILEO Satellites in View
DEPENDENCIES
@@ -368,7 +375,7 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
if (svCount <= 0)
{
// no svs in view, so just send a blank $--GSV sentence
- snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,", talker);
+ snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,%d", talker, sv_meta_p->signalId);
length = loc_nmea_put_checksum(sentence, bufSize);
nmeaArraystr.push_back(sentence);
return;
@@ -430,15 +437,10 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
}
- // The following entries are specific to QZSS and BDS
- if ((sv_meta_p->svType == GNSS_SV_TYPE_QZSS) ||
- (sv_meta_p->svType == GNSS_SV_TYPE_BEIDOU))
- {
- // last one is System id and second last is Signal Id which is always zero
- length = snprintf(pMarker, lengthRemaining,",%d,%d",0,sv_meta_p->systemId);
- pMarker += length;
- lengthRemaining -= length;
- }
+ // append signalId
+ length = snprintf(pMarker, lengthRemaining,",%d",sv_meta_p->signalId);
+ pMarker += length;
+ lengthRemaining -= length;
length = loc_nmea_put_checksum(sentence, bufSize);
nmeaArraystr.push_back(sentence);
@@ -495,7 +497,20 @@ void loc_nmea_generate_pos(const UlpLocation &location,
int utcMinutes = pTm->tm_min;
int utcSeconds = pTm->tm_sec;
int utcMSeconds = (location.gpsLocation.timestamp)%1000;
-
+ loc_sv_cache_info sv_cache_info = {};
+
+ if (GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA & locationExtended.flags) {
+ sv_cache_info.gps_used_mask =
+ (uint32_t)locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask;
+ sv_cache_info.glo_used_mask =
+ (uint32_t)locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask;
+ sv_cache_info.gal_used_mask =
+ (uint32_t)locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask;
+ sv_cache_info.qzss_used_mask =
+ (uint32_t)locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask;
+ sv_cache_info.bds_used_mask =
+ (uint32_t)locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask;
+ }
if (generate_nmea) {
char talker[3] = {'G', 'P', '\0'};
uint32_t svUsedCount = 0;
@@ -506,7 +521,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// -------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GPS, true), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS, true),
+ nmeaArraystr);
if (count > 0)
{
svUsedCount += count;
@@ -519,7 +535,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// -------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GLONASS, true), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS, true),
+ nmeaArraystr);
if (count > 0)
{
svUsedCount += count;
@@ -532,7 +549,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// -------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GALILEO, true), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO, true),
+ nmeaArraystr);
if (count > 0)
{
svUsedCount += count;
@@ -545,7 +563,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// --------------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS, false),
+ nmeaArraystr);
if (count > 0)
{
svUsedCount += count;
@@ -556,7 +575,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
// ---$PQGSA/$GNGSA (BEIDOU)---
// ----------------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU, false),
+ nmeaArraystr);
if (count > 0)
{
svUsedCount += count;
@@ -787,6 +807,14 @@ void loc_nmea_generate_pos(const UlpLocation &location,
else // A means autonomous
length = snprintf(pMarker, lengthRemaining, "%c", 'A');
+ pMarker += length;
+ lengthRemaining -= length;
+
+ // hardcode Navigation Status field to 'V'
+ length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
+ pMarker += length;
+ lengthRemaining -= length;
+
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);
@@ -920,13 +948,6 @@ void loc_nmea_generate_pos(const UlpLocation &location,
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);
-
- // clear the cache so they can't be used again
- sv_cache_info.gps_used_mask = 0;
- sv_cache_info.glo_used_mask = 0;
- sv_cache_info.gal_used_mask = 0;
- sv_cache_info.qzss_used_mask = 0;
- sv_cache_info.bds_used_mask = 0;
}
//Send blank NMEA reports for non-final fixes
else {
@@ -946,7 +967,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);
- strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N,V", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);
@@ -982,27 +1003,11 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
ENTRY_LOG();
char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
- char* pMarker = sentence;
- int lengthRemaining = sizeof(sentence);
- int length = 0;
int svCount = svNotify.count;
- int sentenceCount = 0;
- int sentenceNumber = 1;
int svNumber = 1;
+ loc_sv_cache_info sv_cache_info = {};
//Count GPS SVs for saparating GPS from GLONASS and throw others
-
- sv_cache_info.gps_used_mask = 0;
- sv_cache_info.glo_used_mask = 0;
- sv_cache_info.gal_used_mask = 0;
- sv_cache_info.qzss_used_mask = 0;
- sv_cache_info.bds_used_mask = 0;
-
- sv_cache_info.gps_count = 0;
- sv_cache_info.glo_count = 0;
- sv_cache_info.gal_count = 0;
- sv_cache_info.qzss_count = 0;
- sv_cache_info.bds_count = 0;
for(svNumber=1; svNumber <= svCount; svNumber++) {
if (GNSS_SV_TYPE_GPS == svNotify.gnssSvs[svNumber - 1].type)
{
@@ -1072,35 +1077,38 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
// ------------------
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GPS, false), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS, false), nmeaArraystr);
// ------------------
// ------$GLGSV------
// ------------------
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GLONASS, false), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS, false),
+ nmeaArraystr);
// ------------------
// ------$GAGSV------
// ------------------
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GALILEO, false), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO, false),
+ nmeaArraystr);
// -------------------------
// ------$PQGSV (QZSS)------
// -------------------------
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS, false), nmeaArraystr);
// ---------------------------
// ------$PQGSV (BEIDOU)------
// ---------------------------
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
- loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr);
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU, false),
+ nmeaArraystr);
EXIT_LOG(%d, 0);
}
diff --git a/gps/utils/loc_target.cpp b/gps/utils/loc_target.cpp
index b7ba07b..569f3a7 100644
--- a/gps/utils/loc_target.cpp
+++ b/gps/utils/loc_target.cpp
@@ -27,18 +27,18 @@
*
*/
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#include <cutils/properties.h>
+#include <log_util.h>
#include "loc_target.h"
#include "loc_log.h"
-#include <platform_lib_includes.h>
+#include <loc_pla.h>
#define APQ8064_ID_1 "109"
#define APQ8064_ID_2 "153"
@@ -206,17 +206,3 @@ detected:
LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget);
return gTarget;
}
-
-/*Reads the property ro.lean to identify if this is a lean target
- Returns:
- 0 if not a lean and mean target
- 1 if this is a lean and mean target
-*/
-int loc_identify_lean_target()
-{
- int ret = 0;
- char lean_target[PROPERTY_VALUE_MAX];
- property_get("ro.lean", lean_target, "");
- LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
- return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
-}
diff --git a/gps/utils/loc_target.h b/gps/utils/loc_target.h
index 47a67d9..172b475 100644
--- a/gps/utils/loc_target.h
+++ b/gps/utils/loc_target.h
@@ -55,12 +55,6 @@ void loc_get_platform_name(char *platform_name, int array_length);
of atleast PROPERTY_VALUE_MAX*/
void loc_get_auto_platform_name(char *platform_name, int array_length);
-/*Reads the property ro.lean to identify if this is a lean target
- Returns:
- 0 if not a lean and mean target
- 1 if this is a lean and mean target*/
-int loc_identify_lean_target();
-
/* Please remember to update 'target_name' in loc_log.cpp,
if do any changes to this enum. */
typedef enum {
diff --git a/gps/utils/loc_timer.h b/gps/utils/loc_timer.h
index 25fd179..fff0c46 100644
--- a/gps/utils/loc_timer.h
+++ b/gps/utils/loc_timer.h
@@ -34,7 +34,8 @@
extern "C" {
#endif /* __cplusplus */
#include <stddef.h>
-#include <platform_lib_includes.h>
+#include <stdint.h>
+#include <loc_pla.h>
/*
user_data: client context pointer, passthrough. Originally received
from calling client when loc_timer_start() is called.
diff --git a/gps/utils/log_util.h b/gps/utils/log_util.h
index 7eb338a..feb4d3c 100644
--- a/gps/utils/log_util.h
+++ b/gps/utils/log_util.h
@@ -30,22 +30,23 @@
#ifndef __LOG_UTIL_H__
#define __LOG_UTIL_H__
-#ifndef USE_GLIB
+#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
+// Android and LE targets with logcat support
#include <utils/Log.h>
-#endif /* USE_GLIB */
-
-#ifdef USE_GLIB
+#elif defined (USE_GLIB)
+// LE targets with no logcat support
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#include <cutils/log.h>
#ifndef LOG_TAG
#define LOG_TAG "GPS_UTILS"
+#endif /* LOG_TAG */
-#endif // LOG_TAG
-
-#endif /* USE_GLIB */
+#endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */
#ifdef __cplusplus
extern "C"
@@ -140,6 +141,7 @@ extern char* get_timestamp(char* str, unsigned long buf_size);
#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt
#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGi(fmt,...) LOC_LOGI(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
diff --git a/gps/utils/msg_q.c b/gps/utils/msg_q.c
index e8b4ffe..76c1478 100644
--- a/gps/utils/msg_q.c
+++ b/gps/utils/msg_q.c
@@ -26,14 +26,14 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "msg_q.h"
-
#define LOG_TAG "LocSvc_utils_q"
-#include <platform_lib_includes.h>
-#include "linked_list.h"
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
+#include <loc_pla.h>
+#include <log_util.h>
+#include "linked_list.h"
+#include "msg_q.h"
typedef struct msg_q {
void* msg_list; /* Linked list to store information */
diff --git a/gps/utils/platform_lib_abstractions/Android.mk b/gps/utils/platform_lib_abstractions/Android.mk
deleted file mode 100644
index b923a4c..0000000
--- a/gps/utils/platform_lib_abstractions/Android.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-ifneq ($(BUILD_TINY_ANDROID),true)
-
-include $(call all-subdir-makefiles)
-
-endif
diff --git a/gps/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/gps/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
deleted file mode 100644
index 6c183a8..0000000
--- a/gps/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (c) 2013, 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.
- */
-
-#include <stdlib.h>
-#include <sys/time.h>
-#include "platform_lib_time.h"
-
-int64_t systemTime(int /*clock*/)
-{
- struct timeval t;
- t.tv_sec = t.tv_usec = 0;
- gettimeofday(&t, NULL);
- return t.tv_sec*1000000LL + t.tv_usec;
-}
-
-
-int64_t elapsedMillisSinceBoot()
-{
- int64_t t_us = systemTime(0);
- return (int64_t) t_us / 1000LL;
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/Android.mk b/gps/utils/platform_lib_abstractions/loc_pla/Android.mk
deleted file mode 100644
index b923a4c..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/Android.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-ifneq ($(BUILD_TINY_ANDROID),true)
-
-include $(call all-subdir-makefiles)
-
-endif
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/Makefile.am b/gps/utils/platform_lib_abstractions/loc_pla/Makefile.am
deleted file mode 100644
index 8996763..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-# Makefile.am for gps loc-pla
-#
-
-ACLOCAL_AMFLAGS = -I m4
-
-SUBDIRS = src
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = loc-pla.pc
-EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
deleted file mode 100644
index 340c3c5..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (c) 2014, 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 __PLATFORM_LIB_GETTID_H__
-#define __PLATFORM_LIB_GETTID_H__
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef USE_GLIB
-const char* getprogname();
-#endif /* USE_GLIB */
-
-pid_t platform_lib_abstraction_gettid();
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* __PLATFORM_LIB_GETTID_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
deleted file mode 100644
index ebb7119..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (c) 2014, 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 __PLATFORM_LIB_INCLUDES_H__
-#define __PLATFORM_LIB_INCLUDES_H__
-
-#include "platform_lib_gettid.h"
-#include "platform_lib_log_util.h"
-#include "platform_lib_macros.h"
-#include "platform_lib_property_service.h"
-#include "platform_lib_sched_policy.h"
-#include "platform_lib_time.h"
-
-#endif /* __PLATFORM_LIB_INCLUDES_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
deleted file mode 100644
index 26d3c29..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (c) 2011-2014 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 __PLATFORM_LIB_LOG_UTIL_H__
-#define __PLATFORM_LIB_LOG_UTIL_H__
-
-#include "platform_lib_macros.h"
-
-#ifndef USE_GLIB
-#include <log_util.h>
-#else
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#ifndef LOG_TAG
-#define LOG_TAG "GPS_UTILS"
-#endif /* LOG_TAG */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/*=============================================================================
- *
- * LOC LOGGER TYPE DECLARATION
- *
- *============================================================================*/
-/* LOC LOGGER */
-typedef struct loc_logger_s
-{
- unsigned long DEBUG_LEVEL;
- unsigned long TIMESTAMP;
-} loc_logger_s_type;
-
-/*=============================================================================
- *
- * EXTERNAL DATA
- *
- *============================================================================*/
-extern loc_logger_s_type loc_logger;
-
-// Logging Improvements
-extern const char *loc_logger_boolStr[];
-
-extern const char *boolStr[];
-extern const char VOID_RET[];
-extern const char FROM_AFW[];
-extern const char TO_MODEM[];
-extern const char FROM_MODEM[];
-extern const char TO_AFW[];
-extern const char EXIT_TAG[];
-extern const char ENTRY_TAG[];
-extern const char EXIT_ERROR_TAG[];
-
-/*=============================================================================
- *
- * MODULE EXPORTED FUNCTIONS
- *
- *============================================================================*/
-void loc_logger_init(unsigned long debug, unsigned long timestamp);
-char* get_timestamp(char* str, unsigned long buf_size);
-
-#ifndef DEBUG_DMN_LOC_API
-
-/* LOGGING MACROS */
-/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
- if that value remains unchanged, it means gps.conf did not
- provide a value and we default to the initial value to use
- Android's logging levels*/
-#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
-#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
-#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
-#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
-#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
-
-#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); }
-#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); }
-#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); }
-#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); }
-#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); }
-
-#else /* DEBUG_DMN_LOC_API */
-
-#define LOC_LOGE(...) ALOGE(__VA_ARGS__)
-#define LOC_LOGW(...) ALOGW(__VA_ARGS__)
-#define LOC_LOGI(...) ALOGI(__VA_ARGS__)
-#define LOC_LOGD(...) ALOGD(__VA_ARGS__)
-#define LOC_LOGV(...) ALOGV(__VA_ARGS__)
-
-#endif /* DEBUG_DMN_LOC_API */
-
-/*=============================================================================
- *
- * LOGGING IMPROVEMENT MACROS
- *
- *============================================================================*/
-#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \
- do { \
- if (loc_logger.TIMESTAMP) { \
- char ts[32]; \
- LOC_LOG("[%s] %s %s line %d " #SPEC, \
- get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \
- } else { \
- LOC_LOG("%s %s line %d " #SPEC, \
- ID, WHAT, __LINE__, VAL); \
- } \
- } while(0)
-
-#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt
-#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
-
-#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
-#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
-#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)
-
-#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "")
-#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL)
-#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \
- if (VAL != 0) { \
- LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \
- } else { \
- LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \
- }
-
-
-// Used for logging callflow from Android Framework
-#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "")
-// Used for logging callflow to Modem
-#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL)
-// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "")
-#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL)
-// Used for logging callflow to Android Framework
-#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* USE_GLIB */
-
-#endif /* __PLATFORM_LIB_LOG_UTIL_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
deleted file mode 100644
index d0795eb..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (c) 2014, 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 __PLATFORM_LIB_MACROS_H__
-#define __PLATFORM_LIB_MACROS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef USE_GLIB
-#include <sys/time.h>
-#include <string.h>
-#include <stdlib.h>
-#ifndef OFF_TARGET
-#include <glib.h>
-#define strlcat g_strlcat
-#define strlcpy g_strlcpy
-#else
-#define strlcat strncat
-#define strlcpy strncpy
-#endif
-
-#define TS_PRINTF(format, x...) \
-{ \
- struct timeval tv; \
- struct timezone tz; \
- int hh, mm, ss; \
- gettimeofday(&tv, &tz); \
- hh = tv.tv_sec/3600%24; \
- mm = (tv.tv_sec%3600)/60; \
- ss = tv.tv_sec%60; \
- fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \
-}
-
-#define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x)
-#define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x)
-#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x)
-#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x)
-#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x)
-
-#endif /* USE_GLIB */
-
-
-// Below are the location conf file paths
-extern const char LOC_PATH_GPS_CONF[];
-extern const char LOC_PATH_IZAT_CONF[];
-extern const char LOC_PATH_FLP_CONF[];
-extern const char LOC_PATH_LOWI_CONF[];
-extern const char LOC_PATH_SAP_CONF[];
-extern const char LOC_PATH_APDR_CONF[];
-extern const char LOC_PATH_XTWIFI_CONF[];
-extern const char LOC_PATH_QUIPC_CONF[];
-
-
-#ifdef __cplusplus
-}
-#endif /*__cplusplus */
-
-#endif /* __PLATFORM_LIB_MACROS_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
deleted file mode 100644
index d10f151..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (c) 2014, 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 __PLATFORM_LIB_SCHED_POLICY_H__
-#define __PLATFORM_LIB_SCHED_POLICY_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef enum {
- PLA_SP_BACKGROUND = 0,
- PLA_SP_FOREGROUND = 1,
-} PLASchedPolicy;
-
-int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __PLATFORM_LIB_SCHED_POLICY_H__ */
-
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
deleted file mode 100644
index ae25ae6..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (c) 2014, 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 __PLATFORM_LIB_TIME_H__
-#define __PLATFORM_LIB_TIME_H__
-
-#include <stdint.h>
-int64_t platform_lib_abstraction_elapsed_millis_since_boot();
-int64_t platform_lib_abstraction_elapsed_micros_since_boot();
-
-#endif /* __PLATFORM_LIB_TIME_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in b/gps/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
deleted file mode 100644
index 1aad2f4..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: loc-pla
-Description: QTI GPS Location Platform Library Abstractions
-Version: @VERSION@
-Libs: -L${libdir} -lloc_pla
-Cflags: -I${includedir}/loc-pla
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/Android.mk b/gps/utils/platform_lib_abstractions/loc_pla/src/Android.mk
deleted file mode 100644
index 25d9439..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/src/Android.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-GNSS_CFLAGS := \
- -Werror \
- -Wno-error=unused-parameter \
- -Wno-error=format \
- -Wno-error=macro-redefined \
- -Wno-error=reorder \
- -Wno-error=missing-braces \
- -Wno-error=self-assign \
- -Wno-error=enum-conversion \
- -Wno-error=logical-op-parentheses \
- -Wno-error=null-arithmetic \
- -Wno-error=null-conversion \
- -Wno-error=parentheses-equality \
- -Wno-error=undefined-bool-conversion \
- -Wno-error=tautological-compare \
- -Wno-error=switch \
- -Wno-error=date-time
-
-ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
-ifneq ($(BUILD_TINY_ANDROID),true)
-#Compile this library only for builds with the latest modem image
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-## Libs
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libcutils \
- liblog \
- libloc_stub
-
-LOCAL_SRC_FILES += \
- platform_lib_gettid.cpp \
- platform_lib_log_util.cpp \
- platform_lib_property_service.cpp \
- platform_lib_sched_policy.cpp \
- platform_lib_time.cpp
-
-LOCAL_CFLAGS += \
- -fno-short-enums \
- -D_ANDROID_ \
- -std=c++11
-
-## Includes
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include
-LOCAL_HEADER_LIBRARIES := \
- libgps.utils_headers \
- libloc_stub_headers
-
-LOCAL_MODULE := libloc_pla
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRELINK_MODULE := false
-LOCAL_CFLAGS += $(GNSS_CFLAGS)
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libloc_pla_headers
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include
-include $(BUILD_HEADER_LIBRARY)
-
-endif # not BUILD_TINY_ANDROID
-endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/Makefile.am b/gps/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
deleted file mode 100644
index 30c4b4c..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-AM_CFLAGS = \
- $(LOCSTUB_CFLAGS) \
- -I../include \
- -D__func__=__PRETTY_FUNCTION__ \
- -fno-short-enums
-
-h_sources = \
- ../include/platform_lib_gettid.h \
- ../include/platform_lib_includes.h \
- ../include/platform_lib_log_util.h \
- ../include/platform_lib_macros.h \
- ../include/platform_lib_property_service.h \
- ../include/platform_lib_sched_policy.h \
- ../include/platform_lib_time.h
-
-library_includedir = $(pkgincludedir)
-library_include_HEADERS = $(h_sources)
-
-libloc_pla_la_SOURCES = \
- platform_lib_gettid.cpp \
- platform_lib_log_util.cpp \
- platform_lib_property_service.cpp \
- platform_lib_sched_policy.cpp \
- platform_lib_time.cpp
-
-if USE_GLIB
-libloc_pla_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
-libloc_pla_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
-libloc_pla_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
-else
-libloc_pla_la_CFLAGS = $(AM_CFLAGS)
-libloc_pla_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
-libloc_pla_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
-endif
-
-libloc_pla_la_LIBADD = -lstdc++ -ldl -llog $(LOCSTUB_LIBS)
-
-#Create and Install libraries
-lib_LTLIBRARIES = libloc_pla.la
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
deleted file mode 100644
index 1b7aa32..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-
-#include "platform_lib_gettid.h"
-
-#ifdef USE_GLIB
-#include <loc_stub_gettid.h>
-
-#include <errno.h>
-const char* getprogname() {
- return program_invocation_short_name;
-}
-
-#else
-#include <unistd.h>
-#endif /* USE_GLIB */
-
-pid_t platform_lib_abstraction_gettid()
-{
- return gettid();
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
deleted file mode 100644
index 90bf26d..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-#include <cstdio>
-#include <sys/time.h>
-
-#include "platform_lib_log_util.h"
-#include "platform_lib_macros.h"
-
-char * get_timestamp(char *str, unsigned long buf_size)
-{
- struct timeval tv;
- struct timezone tz;
- int hh, mm, ss;
- gettimeofday(&tv, &tz);
- hh = tv.tv_sec/3600%24;
- mm = (tv.tv_sec%3600)/60;
- ss = tv.tv_sec%60;
- snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec);
- return str;
-}
-
-// Below are the location conf file paths
-#ifdef __ANDROID__
-
-#define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf"
-#define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf"
-#define LOC_PATH_FLP_CONF_STR "/vendor/etc/flp.conf"
-#define LOC_PATH_LOWI_CONF_STR "/vendor/etc/lowi.conf"
-#define LOC_PATH_SAP_CONF_STR "/vendor/etc/sap.conf"
-#define LOC_PATH_APDR_CONF_STR "/vendor/etc/apdr.conf"
-#define LOC_PATH_XTWIFI_CONF_STR "/vendor/etc/xtwifi.conf"
-#define LOC_PATH_QUIPC_CONF_STR "/vendor/etc/quipc.conf"
-
-#else
-
-#define LOC_PATH_GPS_CONF_STR "/etc/gps.conf"
-#define LOC_PATH_IZAT_CONF_STR "/etc/izat.conf"
-#define LOC_PATH_FLP_CONF_STR "/etc/flp.conf"
-#define LOC_PATH_LOWI_CONF_STR "/etc/lowi.conf"
-#define LOC_PATH_SAP_CONF_STR "/etc/sap.conf"
-#define LOC_PATH_APDR_CONF_STR "/etc/apdr.conf"
-#define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf"
-#define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf"
-
-#endif // __ANDROID__
-
-// Reference below arrays wherever needed to avoid duplicating
-// same conf path string over and again in location code.
-const char LOC_PATH_GPS_CONF[] = LOC_PATH_GPS_CONF_STR;
-const char LOC_PATH_IZAT_CONF[] = LOC_PATH_IZAT_CONF_STR;
-const char LOC_PATH_FLP_CONF[] = LOC_PATH_FLP_CONF_STR;
-const char LOC_PATH_LOWI_CONF[] = LOC_PATH_LOWI_CONF_STR;
-const char LOC_PATH_SAP_CONF[] = LOC_PATH_SAP_CONF_STR;
-const char LOC_PATH_APDR_CONF[] = LOC_PATH_APDR_CONF_STR;
-const char LOC_PATH_XTWIFI_CONF[] = LOC_PATH_XTWIFI_CONF_STR;
-const char LOC_PATH_QUIPC_CONF[] = LOC_PATH_QUIPC_CONF_STR;
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
deleted file mode 100644
index dccdebc..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-#ifdef USE_GLIB
-#include <loc_stub_property_service.h>
-#else
-#include <cutils/properties.h>
-#endif /* USE_GLIB */
-
-#include "platform_lib_property_service.h"
-
-int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value)
-{
- return property_get(key, value, default_value);
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
deleted file mode 100644
index ba6b350..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-
-#include "platform_lib_sched_policy.h"
-
-#ifdef USE_GLIB
-#include <loc_stub_sched_policy.h>
-#else
-#include <cutils/sched_policy.h>
-#endif /* USE_GLIB */
-
-int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy)
-{
- return set_sched_policy(tid, (SchedPolicy)policy);
-}
-
diff --git a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp b/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
deleted file mode 100644
index 3dcd4d3..0000000
--- a/gps/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-#include "platform_lib_time.h"
-
-#ifdef USE_GLIB
-#include <loc_stub_time.h>
-#else
-#include <utils/SystemClock.h>
-#include <utils/Timers.h>
-
-#endif /* USE_GLIB */
-
-int64_t platform_lib_abstraction_elapsed_millis_since_boot()
-{
-#ifdef USE_GLIB
-
- return elapsedMillisSinceBoot();
-
-#else
-
- //return android::nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME))/1000;
- return nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME))/1000;
-#endif
-}
-int64_t platform_lib_abstraction_elapsed_micros_since_boot()
-{
-#ifdef USE_GLIB
- return elapsedMicrosSinceBoot();
-
-#else
- //return android::nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME));
- return nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME));
-#endif
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/Android.mk b/gps/utils/platform_lib_abstractions/loc_stub/Android.mk
deleted file mode 100644
index b923a4c..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/Android.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-ifneq ($(BUILD_TINY_ANDROID),true)
-
-include $(call all-subdir-makefiles)
-
-endif
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/Makefile.am b/gps/utils/platform_lib_abstractions/loc_stub/Makefile.am
deleted file mode 100644
index d81e363..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-# Makefile.am for gps loc-stub
-
-ACLOCAL_AMFLAGS = -I m4
-
-SUBDIRS = src
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = loc-stub.pc
-EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h b/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
deleted file mode 100644
index c8764ee..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (c) 2014, 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 __LOC_STUB_ANDROID_RUNTIME_H__
-#define __LOC_STUB_ANDROID_RUNTIME_H__
-
-#include <pthread.h>
-
-namespace android {
-
-class AndroidRuntime
-{
-public:
- /** create a new thread that is visible from Java */
- static pthread_t createJavaThread(const char* name, void (*start)(void *),
- void* arg);
-};
-
-}
-#endif /* __LOC_STUB_ANDROID_RUNTIME_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h b/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
deleted file mode 100644
index 3677cdf..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (c) 2014, 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 __LOC_STUB_PROPERTY_SERVICE_H__
-#define __LOC_STUB_PROPERTY_SERVICE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int property_get(const char *key, char *value, const char *default_value);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __LOC_STUB_PROPERTY_SERVICE_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h b/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
deleted file mode 100644
index f00a49b..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (c) 2014, 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 __LOC_STUB_TIME_H__
-#define __LOC_STUB_TIME_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int64_t systemTime(int clock);
-int64_t elapsedMillisSinceBoot();
-int64_t elapsedMicrosSinceBoot();
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __LOC_STUB_TIME_H__ */
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in b/gps/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
deleted file mode 100644
index c2ae764..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: loc-stub
-Description: QTI GPS Location Stub
-Version: @VERSION
-Libs: -L${libdir} -lloc_stub
-Cflags: -I${includedir}/loc-stub
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/Android.mk b/gps/utils/platform_lib_abstractions/loc_stub/src/Android.mk
deleted file mode 100644
index f4cec2b..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/src/Android.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
-ifneq ($(BUILD_TINY_ANDROID),true)
-#Compile this library only for builds with the latest modem image
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-## Libs
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libcutils \
- liblog
-
-LOCAL_SRC_FILES += \
- loc_stub_android_runtime.cpp \
- loc_stub_gettid.cpp \
- loc_stub_property_service.cpp \
- loc_stub_sched_policy.cpp \
- loc_stub_time.cpp
-
-LOCAL_CFLAGS += \
- -fno-short-enums \
- -D_ANDROID_ \
- -std=c++11
-
-
-LOCAL_LDFLAGS += -Wl,--export-dynamic
-
-## Includes
-LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/../include \
-
-LOCAL_MODULE := libloc_stub
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_PRELINK_MODULE := false
-LOCAL_CFLAGS += $(GNSS_CFLAGS)
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libloc_stub_headers
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include
-include $(BUILD_HEADER_LIBRARY)
-
-endif # not BUILD_TINY_ANDROID
-endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/Makefile.am b/gps/utils/platform_lib_abstractions/loc_stub/src/Makefile.am
deleted file mode 100644
index ba823a2..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/src/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-AM_CFLAGS = \
- -I../include \
- -D__func__=__PRETTY_FUNCTION__ \
- -fno-short-enums
-
-libloc_stub_la_extra_h = \
- ../include/utils/Log.h
-
-libloc_stub_la_c_sources = \
- loc_stub_android_runtime.cpp \
- loc_stub_gettid.cpp \
- loc_stub_property_service.cpp \
- loc_stub_sched_policy.cpp \
- loc_stub_time.cpp
-
-libloc_stub_la_SOURCES = $(libloc_stub_la_c_sources) $(libloc_stub_la_extra_h)
-
-library_include_HEADERS = \
- ../include/loc_stub_android_runtime.h \
- ../include/loc_stub_gettid.h \
- ../include/loc_stub_property_service.h \
- ../include/loc_stub_sched_policy.h \
- ../include/loc_stub_time.h
-
-library_includedir = $(pkgincludedir)
-
-if USE_GLIB
-libloc_stub_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
-libloc_stub_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
-libloc_stub_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
-else
-libloc_stub_la_CFLAGS = $(AM_CFLAGS)
-libloc_stub_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
-libloc_stub_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
-endif
-
-libloc_stub_la_LIBADD = -lstdc++ -ldl -llog
-
-#Create and Install libraries
-lib_LTLIBRARIES = libloc_stub.la
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp
deleted file mode 100644
index 068df4e..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-
-#include "loc_stub_android_runtime.h"
-
-namespace android {
-
-pthread_t AndroidRuntime::createJavaThread(const char* /*name*/,
- void (*start)(void *), void* arg)
-{
- pthread_t threadId = 0;
- pthread_create(&threadId, NULL, (void *(*)(void*))start, arg);
- return threadId;
-}
-
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
deleted file mode 100644
index 55ef48a..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-
-#include "loc_stub_gettid.h"
-#include <sys/syscall.h>
-#include <unistd.h>
-
-// Required for off-target environment to compile properly
-pid_t gettid(void)
-{
- return syscall(SYS_gettid);
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp
deleted file mode 100644
index 907ab02..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-
-#include "loc_stub_property_service.h"
-#include <stdio.h>
-#include <string.h>
-
-int property_get(const char *key, char * value, const char */*default_value*/)
-{
- /* This will disable gps interface
- value[0] = '1';
- */
- if (strcmp(key, "ro.baseband") == 0) {
- memcpy(value, "msm", 4);
- }
- return 0;
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp
deleted file mode 100644
index 5e26245..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-
-#include "loc_stub_sched_policy.h"
-
-/*===========================================================================
-FUNCTION set_sched_policy
-
-DESCRIPTION
- Local copy of this function which bypasses android set_sched_policy
-
-DEPENDENCIES
- None
-
-RETURN VALUE
- 0
-
-SIDE EFFECTS
- N/A
-
-===========================================================================*/
-int set_sched_policy(int /*tid*/, SchedPolicy /*policy*/)
-{
- return 0;
-}
diff --git a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp b/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp
deleted file mode 100644
index 48149a6..0000000
--- a/gps/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (c) 2014, 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.
- */
-
-#include "loc_stub_time.h"
-#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-
-int64_t systemTime(int /*clock*/)
-{
- struct timeval t;
- t.tv_sec = t.tv_usec = 0;
- gettimeofday(&t, NULL);
- return t.tv_sec*1000000LL + t.tv_usec;
-}
-
-int64_t elapsedMicrosSinceBoot()
-{
- struct timespec ts;
- int64_t time_ms = 0;
- clock_gettime(CLOCK_BOOTTIME, &ts);
- time_ms += (ts.tv_sec * 1000000000LL); /* Seconds to nanoseconds */
- time_ms += ts.tv_nsec; /* Add Nanoseconds */
- return time_ms;
-}
-
-int64_t elapsedMillisSinceBoot()
-{
- return (int64_t) (elapsedMicrosSinceBoot() /1000000LL);
-}
diff --git a/wayne.mk b/wayne.mk
index 07235d3..975b6d0 100644
--- a/wayne.mk
+++ b/wayne.mk
@@ -222,9 +222,10 @@ PRODUCT_PACKAGES += \
# GPS / Location
PRODUCT_PACKAGES += \
- android.hardware.gnss@1.0-impl-qti \
- android.hardware.gnss@1.0-service-qti \
+ android.hardware.gnss@1.1-impl-qti \
+ android.hardware.gnss@1.1-service-qti \
libgnss \
+ libgnsspps \
libgps.utils \
liblocation_api \
libloc_core \