diff --git a/configs/privapp-permissions-oem.xml b/configs/privapp-permissions-oem.xml
index 7f0634b..568f376 100644
--- a/configs/privapp-permissions-oem.xml
+++ b/configs/privapp-permissions-oem.xml
@@ -6,6 +6,8 @@
+
+
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 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 AGnss::setCallback(const sp& callback) {
}
// Save the interface
- sAGnssCbIface = callback;
+ mAGnssCbIface = callback;
AgpsCbInfo cbInfo = {};
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
@@ -182,7 +197,7 @@ Return 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 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 sAGnssCbIface;
+ sp 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 bd4bb37..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
*/
/*
@@ -29,12 +29,14 @@
#include
#include "Gnss.h"
#include "AGnssRil.h"
+#include
+
typedef void* (getLocationInterface)();
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
@@ -51,13 +53,41 @@ Return AGnssRil::updateNetworkState(bool connected, NetworkType type, bool
// for XTRA
if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
- mGnss->getGnssInterface()->updateConnectionStatus(connected, (uint8_t)type);
+ int8_t typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
+ switch(type)
+ {
+ case IAGnssRil::NetworkType::MOBILE:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_MOBILE;
+ break;
+ case IAGnssRil::NetworkType::WIFI:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIFI;
+ break;
+ case IAGnssRil::NetworkType::MMS:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_MMS;
+ break;
+ case IAGnssRil::NetworkType::SUPL:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_SUPL;
+ break;
+ case IAGnssRil::NetworkType::DUN:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_DUN;
+ break;
+ case IAGnssRil::NetworkType::HIPRI:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_HIPRI;
+ break;
+ case IAGnssRil::NetworkType::WIMAX:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_WIMAX;
+ break;
+ default:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
+ break;
+ }
+ mGnss->getGnssInterface()->updateConnectionStatus(connected, typeout);
}
return true;
}
} // 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 5f17415..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_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+LOCAL_MODULE := android.hardware.gnss@1.1-impl-qti
+LOCAL_VENDOR_MODULE := true
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_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
-LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.gnss@1.1-service-qti
LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_OWNER := qti
-LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc
+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
#include
#include
+#include
#include "Gnss.h"
+#include
+
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& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast(cookie), &who);
@@ -107,7 +151,7 @@ GnssInterface* Gnss::getGnssInterface() {
return mGnssInterface;
}
-Return Gnss::setCallback(const sp& callback) {
+Return Gnss::setCallback(const sp& callback) {
ENTRY_LOG_CALLFLOW();
if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
@@ -251,7 +295,7 @@ Return Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
}
}
-Return Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
+Return Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
ENTRY_LOG_CALLFLOW();
GnssAPIClient* api = getApi();
if (api) {
@@ -260,8 +304,8 @@ Return Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
return Void();
}
-Return Gnss::setPositionMode(IGnss::GnssPositionMode mode,
- IGnss::GnssPositionRecurrence recurrence,
+Return 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 Gnss::setPositionMode(IGnss::GnssPositionMode mode,
return retVal;
}
-Return> Gnss::getExtensionAGnss() {
+Return> Gnss::getExtensionAGnss() {
ENTRY_LOG_CALLFLOW();
mAGnssIface = new AGnss(this);
return mAGnssIface;
}
-Return> Gnss::getExtensionGnssNi() {
+Return> Gnss::getExtensionGnssNi() {
ENTRY_LOG_CALLFLOW();
mGnssNi = new GnssNi(this);
return mGnssNi;
}
-Return> Gnss::getExtensionGnssMeasurement() {
+Return> Gnss::getExtensionGnssMeasurement() {
ENTRY_LOG_CALLFLOW();
- mGnssMeasurement = new GnssMeasurement();
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement;
}
-Return> Gnss::getExtensionGnssConfiguration() {
+Return> Gnss::getExtensionGnssConfiguration() {
ENTRY_LOG_CALLFLOW();
mGnssConfig = new GnssConfiguration(this);
return mGnssConfig;
}
-Return> Gnss::getExtensionGnssGeofencing() {
+Return> Gnss::getExtensionGnssGeofencing() {
ENTRY_LOG_CALLFLOW();
mGnssGeofencingIface = new GnssGeofencing();
return mGnssGeofencingIface;
}
-Return> Gnss::getExtensionGnssBatching() {
+Return> Gnss::getExtensionGnssBatching() {
mGnssBatching = new GnssBatching();
return mGnssBatching;
}
-Return> Gnss::getExtensionGnssDebug() {
+Return> Gnss::getExtensionGnssDebug() {
ENTRY_LOG_CALLFLOW();
mGnssDebug = new GnssDebug(this);
return mGnssDebug;
}
-Return> Gnss::getExtensionAGnssRil() {
+Return> Gnss::getExtensionAGnssRil() {
mGnssRil = new AGnssRil(this);
return mGnssRil;
}
+// Methods from ::android::hardware::gnss::V1_1::IGnss follow.
+Return Gnss::setCallback_1_1(const sp& 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 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> Gnss::getExtensionGnssMeasurement_1_1() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+}
+
+Return> Gnss::getExtensionGnssConfiguration_1_1() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssConfig == nullptr)
+ mGnssConfig = new GnssConfiguration(this);
+ return mGnssConfig;
+}
+
+Return 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
#include
-#include
+#include
+#include
#include
#include
@@ -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 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 setCallback(const sp& callback) override;
+ Return setCallback(const sp& callback) override;
Return start() override;
Return stop() override;
Return cleanup() override;
@@ -79,30 +70,40 @@ struct Gnss : public IGnss {
Return injectTime(int64_t timeMs,
int64_t timeReferenceMs,
int32_t uncertaintyMs) override;
- Return deleteAidingData(IGnss::GnssAidingData aidingDataFlags) override;
- Return setPositionMode(IGnss::GnssPositionMode mode,
- IGnss::GnssPositionRecurrence recurrence,
+ Return deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
+ Return setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) override;
- Return> getExtensionAGnss() override;
- Return> getExtensionGnssNi() override;
- Return> getExtensionGnssMeasurement() override;
- Return> getExtensionGnssConfiguration() override;
- Return> getExtensionGnssGeofencing() override;
- Return> getExtensionGnssBatching() override;
+ Return> getExtensionAGnss() override;
+ Return> getExtensionGnssNi() override;
+ Return> getExtensionGnssMeasurement() override;
+ Return> getExtensionGnssConfiguration() override;
+ Return> getExtensionGnssGeofencing() override;
+ Return> getExtensionGnssBatching() override;
- Return> getExtensionAGnssRil() override;
+ Return> getExtensionAGnssRil() override;
- inline Return> getExtensionGnssNavigationMessage() override {
+ inline Return> getExtensionGnssNavigationMessage() override {
return nullptr;
}
- inline Return> getExtensionXtra() override {
+ inline Return> getExtensionXtra() override {
return nullptr;
}
- Return> getExtensionGnssDebug() override;
+ Return> getExtensionGnssDebug() override;
+
+ // Methods from ::android::hardware::gnss::V1_1::IGnss follow.
+ Return setCallback_1_1(const sp& callback) override;
+ Return 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> getExtensionGnssMeasurement_1_1() override;
+ Return> getExtensionGnssConfiguration_1_1() override;
+ Return 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 updateConfiguration(GnssConfig& gnssConfig);
GnssInterface* getGnssInterface();
+ // Callback for ODCPI request
+ void odcpiRequestCb(const OdcpiRequestInfo& request);
+
private:
struct GnssDeathRecipient : hidl_death_recipient {
GnssDeathRecipient(sp gnss) : mGnss(gnss) {
@@ -132,8 +136,9 @@ struct Gnss : public IGnss {
sp mGnssRil = nullptr;
GnssAPIClient* mApi = nullptr;
- sp mGnssCbIface = nullptr;
- sp mGnssNiCbIface = nullptr;
+ sp mGnssCbIface = nullptr;
+ sp mGnssCbIface_1_1 = nullptr;
+ sp 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 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 GnssConfiguration::setEmergencySuplPdn(bool enabled) {
return mGnss->updateConfiguration(config);
}
+// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+Return GnssConfiguration::setBlacklist(
+ const hidl_vec& /*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
+#include
#include
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 setEmergencySuplPdn(bool enable) override;
Return setGpsLock(uint8_t lock) override;
+ // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
+ Return setBlacklist(
+ const hidl_vec& 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 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 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 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 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 GnssMeasurement::setCallback(
- const sp& callback) {
+ const sp& callback) {
Return ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
@@ -72,9 +73,10 @@ Return GnssMeasurement::setCallback(
}
mGnssMeasurementCbIface = callback;
- mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/);
+ mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
return mApi->measurementSetCallback(callback);
+
}
Return GnssMeasurement::close() {
@@ -87,13 +89,43 @@ Return 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::setCallback_1_1(
+ const sp& callback, bool /*enableFullTracking*/) {
+
+ Return 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
+#include
+#include
#include
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 setCallback(
- const sp& callback) override;
+ Return setCallback(
+ const sp& callback) override;
Return close() override;
+ // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
+ Return setCallback_1_1(
+ const sp& callback,
+ bool enableFullTracking) override;
+
private:
struct GnssMeasurementDeathRecipient : hidl_death_recipient {
GnssMeasurementDeathRecipient(sp gnssMeasurement) :
@@ -63,12 +69,13 @@ struct GnssMeasurement : public IGnssMeasurement {
private:
sp mGnssMeasurementDeathRecipient = nullptr;
- sp mGnssMeasurementCbIface = nullptr;
+ sp mGnssMeasurementCbIface = nullptr;
+ sp 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& who) {
@@ -79,7 +79,7 @@ Return 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.0-service-qti.rc
deleted file mode 100644
index d4d40fa..0000000
--- a/gps/android/android.hardware.gnss@1.0-service-qti.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti
- class main
- user gps
- group system gps radio
diff --git a/gps/android/android.hardware.gnss@1.1-service-qti.rc b/gps/android/android.hardware.gnss@1.1-service-qti.rc
new file mode 100644
index 0000000..41b105b
--- /dev/null
+++ b/gps/android/android.hardware.gnss@1.1-service-qti.rc
@@ -0,0 +1,4 @@
+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& callback);
+ BatchingAPIClient(const sp& 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 mGnssBatchingCbIface;
+ sp 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& callback) :
LocationAPIClientBase(),
@@ -158,7 +160,7 @@ void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBr
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
geofenceBreachNotification.ids[i], gnssLocation, transition,
- static_cast(geofenceBreachNotification.timestamp));
+ static_cast(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& callback);
+ GeofenceAPIClient(const sp& 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 mGnssGeofencingCbIface;
+ sp 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 2745f56..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& gpsCb,
@@ -81,8 +86,10 @@ void GnssAPIClient::gnssUpdateCallbacks(const sp& gpsCb,
{
LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+ mMutex.lock();
mGnssCbIface = gpsCb;
mGnssNiCbIface = niCb;
+ mMutex.unlock();
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
@@ -158,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::max();
+ }
if (mode == IGnss::GnssPositionMode::STANDALONE)
mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
else if (mode == IGnss::GnssPositionMode::MS_BASED)
@@ -278,7 +289,10 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
mLocationCapabilitiesCached = true;
- sp gnssCbIface = mGnssCbIface;
+
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
if (gnssCbIface != nullptr) {
uint32_t data = 0;
@@ -322,7 +336,9 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
void GnssAPIClient::onTrackingCb(Location location)
{
LOC_LOGD("%s]: (flags: %02x)", __FUNCTION__, location.flags);
- sp gnssCbIface = mGnssCbIface;
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
if (gnssCbIface != nullptr) {
GnssLocation gnssLocation;
@@ -338,7 +354,9 @@ void GnssAPIClient::onTrackingCb(Location location)
void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification)
{
LOC_LOGD("%s]: (id: %d)", __FUNCTION__, id);
- sp gnssNiCbIface = mGnssNiCbIface;
+ mMutex.lock();
+ auto gnssNiCbIface(mGnssNiCbIface);
+ mMutex.unlock();
if (gnssNiCbIface == nullptr) {
LOC_LOGE("%s]: mGnssNiCbIface is nullptr", __FUNCTION__);
@@ -411,7 +429,9 @@ void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotificatio
void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
{
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssSvNotification.count);
- sp gnssCbIface = mGnssCbIface;
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
if (gnssCbIface != nullptr) {
IGnssCallback::GnssSvStatus svStatus;
@@ -426,13 +446,15 @@ void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
{
- sp gnssCbIface = mGnssCbIface;
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
if (gnssCbIface != nullptr) {
android::hardware::hidl_string nmeaString;
nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
auto r = gnssCbIface->gnssNmeaCb(
- static_cast(gnssNmeaNotification.timestamp), nmeaString);
+ static_cast(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());
@@ -443,7 +465,9 @@ void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
void GnssAPIClient::onStartTrackingCb(LocationError error)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
- sp gnssCbIface = mGnssCbIface;
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
@@ -462,7 +486,9 @@ void GnssAPIClient::onStartTrackingCb(LocationError error)
void GnssAPIClient::onStopTrackingCb(LocationError error)
{
LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
- sp gnssCbIface = mGnssCbIface;
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
@@ -482,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(GnssMax::SVS_COUNT)) {
- LOC_LOGW("%s]: Too many satellites %zd. Clamps to %d.",
- __FUNCTION__, out.numSvs, GnssMax::SVS_COUNT);
- out.numSvs = static_cast(GnssMax::SVS_COUNT);
+ if (out.numSvs > static_cast(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(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.numSvs; i++) {
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
@@ -505,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 295a9e9..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
@@ -31,15 +31,16 @@
#define GNSS_API_CLINET_H
-#include
-#include
+#include
+#include
+#include
#include
#include
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& gpsCb,
- const sp& niCb);
+ GnssAPIClient(const sp& gpsCb,
+ const sp& niCb);
virtual ~GnssAPIClient();
GnssAPIClient(const GnssAPIClient&) = delete;
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
// for GpsInterface
- void gnssUpdateCallbacks(const sp& gpsCb,
- const sp& niCb);
+ void gnssUpdateCallbacks(const sp& gpsCb,
+ const sp& 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,9 +90,9 @@ public:
void onStopTrackingCb(LocationError error) final;
private:
- sp mGnssCbIface;
- sp mGnssNiCbIface;
-
+ sp mGnssCbIface;
+ sp mGnssNiCbIface;
+ std::mutex mMutex;
LocationAPIControlClient* mControlClient;
LocationCapabilitiesMask mLocationCapabilitiesMask;
bool mLocationCapabilitiesCached;
@@ -100,7 +101,7 @@ private:
};
} // 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(in.timestamp);
+ out.timestamp = static_cast(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(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 dd7ceac..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,12 +68,32 @@ MeasurementAPIClient::~MeasurementAPIClient()
// for GpsInterface
Return
-MeasurementAPIClient::measurementSetCallback(const sp& callback)
+MeasurementAPIClient::measurementSetCallback(const sp& callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+ mMutex.lock();
mGnssMeasurementCbIface = callback;
+ mMutex.unlock();
+ return startTracking();
+}
+
+Return
+MeasurementAPIClient::measurementSetCallback_1_1(const sp& callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface_1_1 = callback;
+ mMutex.unlock();
+
+ return startTracking();
+}
+
+Return
+MeasurementAPIClient::startTracking()
+{
LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks);
@@ -82,7 +108,7 @@ MeasurementAPIClient::measurementSetCallback(const sp&
locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr;
- if (mGnssMeasurementCbIface != nullptr) {
+ if (mGnssMeasurementCbIface_1_1 != nullptr || mGnssMeasurementCbIface != nullptr) {
locationCallbacks.gnssMeasurementsCb =
[this](GnssMeasurementsNotification gnssMeasurementsNotification) {
onGnssMeasurementsCb(gnssMeasurementsNotification);
@@ -113,13 +139,31 @@ 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) {
- if (mGnssMeasurementCbIface != nullptr) {
+ mMutex.lock();
+ sp gnssMeasurementCbIface = nullptr;
+ sp 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_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 = mGnssMeasurementCbIface->GnssMeasurementCb(gnssData);
+ auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
if (!r.isOk()) {
LOC_LOGE("%s] Error from GnssMeasurementCb description=%s",
__func__, r.description().c_str());
@@ -129,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)
@@ -236,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(GnssMax::SVS_COUNT)) {
- LOC_LOGW("%s]: Too many measurement %zd. Clamps to %d.",
- __FUNCTION__, out.measurementCount, GnssMax::SVS_COUNT);
- out.measurementCount = static_cast(GnssMax::SVS_COUNT);
+ if (out.measurementCount > static_cast(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(V1_0::GnssMax::SVS_COUNT);
}
for (size_t i = 0; i < out.measurementCount; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i]);
@@ -250,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 422564d..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
@@ -30,19 +30,18 @@
#ifndef MEASUREMENT_API_CLINET_H
#define MEASUREMENT_API_CLINET_H
-
-#include
-#include
+#include
+#include
+#include
#include
#include
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 measurementSetCallback(
+ Return measurementSetCallback(
+ const sp& callback);
+ Return measurementSetCallback_1_1(
const sp& callback);
void measurementClose();
+ Return startTracking();
// callbacks we are interested in
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
private:
- sp mGnssMeasurementCbIface;
+ std::mutex mMutex;
+ sp mGnssMeasurementCbIface;
+ sp 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
+#include
#include
-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 dba0b0a..1a4f51a 100644
--- a/gps/core/Android.mk
+++ b/gps/core/Android.mk
@@ -6,8 +6,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libloc_core
-LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+LOCAL_VENDOR_MODULE := true
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
#include
#include
-#include
+#include
#include
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
#include
-#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
#include
#include
-#include
+#include
#include
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
#include
#include
-#include
+#include
#include
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",
@@ -440,6 +442,10 @@ enum loc_api_adapter_err LocApiBase::
injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
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
#include
#include
-#include
+#include
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:
@@ -153,6 +154,8 @@ public:
setAPN(char* apn, int len);
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
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