axolotl: Import GPS HAL from LA.UM.8.3.c25-05600-sdm845.0
Change-Id: I5e4c19337e30c7fb23d4ff5bf65acd3520238c8a
diff --git a/gps/Android.mk b/gps/Android.mk
new file mode 100644
index 0000000..f1088a4
--- /dev/null
+++ b/gps/Android.mk
@@ -0,0 +1,5 @@
+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/CleanSpec.mk b/gps/CleanSpec.mk
new file mode 100644
index 0000000..dd1849d
--- /dev/null
+++ b/gps/CleanSpec.mk
@@ -0,0 +1,50 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list. These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list. E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libloc_api*)
diff --git a/gps/Makefile.am b/gps/Makefile.am
new file mode 100644
index 0000000..cd4a731
--- /dev/null
+++ b/gps/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am - Automake script for gps loc_api
+#
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = gnss
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-hal.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/android/1.0/AGnss.cpp b/gps/android/1.0/AGnss.cpp
new file mode 100644
index 0000000..79f665c
--- /dev/null
+++ b/gps/android/1.0/AGnss.cpp
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_AGnssInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "AGnss.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+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) {
+ case LOC_AGPS_TYPE_SUPL:
+ st.type = IAGnssCallback::AGnssType::TYPE_SUPL;
+ break;
+ case LOC_AGPS_TYPE_C2K:
+ st.type = IAGnssCallback::AGnssType::TYPE_C2K;
+ break;
+ default:
+ LOC_LOGE("invalid type: %d", status.type);
+ return;
+ }
+
+ switch (status.status) {
+ case LOC_GPS_REQUEST_AGPS_DATA_CONN:
+ st.status = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
+ break;
+ case LOC_GPS_RELEASE_AGPS_DATA_CONN:
+ st.status = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
+ break;
+ case LOC_GPS_AGPS_DATA_CONNECTED:
+ st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
+ break;
+ case LOC_GPS_AGPS_DATA_CONN_DONE:
+ st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
+ break;
+ case LOC_GPS_AGPS_DATA_CONN_FAILED:
+ st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
+ break;
+ default:
+ LOC_LOGE("invalid status: %d", status.status);
+ return;
+ }
+ st.ipV4Addr = status.ipV4Addr;
+
+ 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");
+ }
+}
+
+Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return Void();
+ }
+
+ // Save the interface
+ mAGnssCbIface = callback;
+
+ AgpsCbInfo cbInfo = {};
+ cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
+ cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
+
+ mGnss->getGnssInterface()->agpsInit(cbInfo);
+ return Void();
+}
+
+Return<bool> AGnss::dataConnClosed() {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnClosed(LOC_AGPS_TYPE_SUPL);
+ return true;
+}
+
+Return<bool> AGnss::dataConnFailed() {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnFailed(LOC_AGPS_TYPE_SUPL);
+ return true;
+}
+
+Return<bool> AGnss::dataConnOpen(const hidl_string& apn,
+ IAGnss::ApnIpType apnIpType) {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ /* Validate */
+ if(apn.empty()){
+ LOC_LOGE("Invalid APN");
+ return false;
+ }
+
+ LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
+
+ AGpsBearerType bearerType;
+ switch (apnIpType) {
+ case IAGnss::ApnIpType::IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case IAGnss::ApnIpType::IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case IAGnss::ApnIpType::IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnOpen(
+ LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
+ return true;
+}
+
+Return<bool> AGnss::setServer(IAGnssCallback::AGnssType type,
+ const hidl_string& hostname,
+ int32_t port) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
+ config.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
+ if (type == IAGnssCallback::AGnssType::TYPE_SUPL) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL;
+ } else if (type == IAGnssCallback::AGnssType::TYPE_C2K) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_C2K;
+ } else {
+ LOC_LOGE("%s]: invalid AGnssType: %d", __FUNCTION__, static_cast<int>(type));
+ return false;
+ }
+ config.assistanceServer.hostName = strdup(hostname.c_str());
+ config.assistanceServer.port = port;
+ return mGnss->updateConfiguration(config);
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/AGnss.h b/gps/android/1.0/AGnss.h
new file mode 100644
index 0000000..cdd5931
--- /dev/null
+++ b/gps/android/1.0/AGnss.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
+#define ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
+
+#include <android/hardware/gnss/1.0/IAGnss.h>
+#include <hidl/Status.h>
+#include <gps_extended_c.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IAGnss;
+using ::android::hardware::gnss::V1_0::IAGnssCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+struct AGnss : public IAGnss {
+
+ AGnss(Gnss* gnss);
+ ~AGnss();
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IAGnss interface follow.
+ * These declarations were generated from IAGnss.hal.
+ */
+ Return<void> setCallback(const sp<IAGnssCallback>& callback) override;
+
+ Return<bool> dataConnClosed() override;
+
+ Return<bool> dataConnFailed() override;
+
+ Return<bool> dataConnOpen(const hidl_string& apn,
+ IAGnss::ApnIpType apnIpType) override;
+
+ 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;
+ sp<IAGnssCallback> mAGnssCbIface = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSS_H
diff --git a/gps/android/1.0/AGnssRil.cpp b/gps/android/1.0/AGnssRil.cpp
new file mode 100644
index 0000000..0437cf1
--- /dev/null
+++ b/gps/android/1.0/AGnssRil.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc__AGnssRilInterface"
+
+#include <log_util.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sstream>
+#include <string>
+#include "Gnss.h"
+#include "AGnssRil.h"
+#include <DataItemConcreteTypesBase.h>
+
+typedef void* (getLocationInterface)();
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+
+AGnssRil::AGnssRil(Gnss* gnss) : mGnss(gnss) {
+ ENTRY_LOG_CALLFLOW();
+}
+
+AGnssRil::~AGnssRil() {
+ ENTRY_LOG_CALLFLOW();
+}
+
+Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool /*roaming*/) {
+ ENTRY_LOG_CALLFLOW();
+ // Extra NetworkTypes not available in IAgnssRil enums
+ const int NetworkType_BLUETOOTH = 7;
+ const int NetworkType_ETHERNET = 9;
+ const int NetworkType_PROXY = 16;
+
+ // for XTRA
+ if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
+ 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:
+ {
+ int networkType = (int) type;
+ // Handling network types not available in IAgnssRil
+ switch(networkType)
+ {
+ case NetworkType_BLUETOOTH:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_BLUETOOTH;
+ break;
+ case NetworkType_ETHERNET:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_ETHERNET;
+ break;
+ case NetworkType_PROXY:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_PROXY;
+ break;
+ default:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
+ }
+ }
+ break;
+ }
+ mGnss->getGnssInterface()->updateConnectionStatus(connected, false, typeout, 0);
+ }
+ return true;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/AGnssRil.h b/gps/android/1.0/AGnssRil.h
new file mode 100644
index 0000000..7f18c57
--- /dev/null
+++ b/gps/android/1.0/AGnssRil.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
+#define ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
+
+#include <android/hardware/gnss/1.0/IAGnssRil.h>
+#include <hidl/Status.h>
+#include <location_interface.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IAGnssRil;
+using ::android::hardware::gnss::V1_0::IAGnssRilCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+/*
+ * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface Layer interface
+ * allows the GNSS chipset to request radio interface layer information from Android platform.
+ * Examples of such information are reference location, unique subscriber ID, phone number string
+ * and network availability changes. Also contains wrapper methods to allow methods from
+ * IAGnssiRilCallback interface to be passed into the conventional implementation of the GNSS HAL.
+ */
+struct AGnssRil : public IAGnssRil {
+ AGnssRil(Gnss* gnss);
+ ~AGnssRil();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IAGnssRil follow.
+ * These declarations were generated from IAGnssRil.hal.
+ */
+ Return<void> setCallback(const sp<IAGnssRilCallback>& /*callback*/) override {
+ return Void();
+ }
+ Return<void> setRefLocation(const IAGnssRil::AGnssRefLocation& /*agnssReflocation*/) override {
+ return Void();
+ }
+ Return<bool> setSetId(IAGnssRil::SetIDType /*type*/, const hidl_string& /*setid*/) override {
+ return false;
+ }
+ Return<bool> updateNetworkAvailability(bool /*available*/,
+ const hidl_string& /*apn*/) override {
+ return false;
+ }
+ Return<bool> updateNetworkState(bool connected, NetworkType type, bool roaming) override;
+
+ private:
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
diff --git a/gps/android/1.0/Android.mk b/gps/android/1.0/Android.mk
new file mode 100644
index 0000000..112ae8b
--- /dev/null
+++ b/gps/android/1.0/Android.mk
@@ -0,0 +1,103 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ AGnss.cpp \
+ Gnss.cpp \
+ GnssBatching.cpp \
+ GnssGeofencing.cpp \
+ GnssMeasurement.cpp \
+ GnssNi.cpp \
+ GnssConfiguration.cpp \
+ GnssDebug.cpp \
+ AGnssRil.cpp
+
+LOCAL_SRC_FILES += \
+ location_api/LocationUtil.cpp \
+ location_api/GnssAPIClient.cpp \
+ location_api/GeofenceAPIClient.cpp \
+ location_api/BatchingAPIClient.cpp \
+ location_api/MeasurementAPIClient.cpp \
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/location_api
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers \
+ liblocbatterylistener_headers
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libcutils \
+ libutils \
+ android.hardware.gnss@1.0 \
+ android.hardware.health@1.0 \
+ android.hardware.health@2.0 \
+ android.hardware.power@1.2 \
+ libbase
+
+LOCAL_SHARED_LIBRARIES += \
+ libloc_core \
+ libgps.utils \
+ libdl \
+ liblocation_api \
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+LOCAL_STATIC_LIBRARIES := liblocbatterylistener
+LOCAL_STATIC_LIBRARIES += libhealthhalutils
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@1.0-service-qti.xml
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc
+LOCAL_SRC_FILES := \
+ service.cpp \
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/location_api
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libdl \
+ libbase \
+ libutils \
+ libgps.utils \
+ libqti_vndfwk_detect \
+
+LOCAL_SHARED_LIBRARIES += \
+ libhwbinder \
+ libhidlbase \
+ libhidltransport \
+ android.hardware.gnss@1.0 \
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+
+ifneq ($(LOC_HIDL_VERSION),)
+LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
+endif
+
+include $(BUILD_EXECUTABLE)
diff --git a/gps/android/1.0/Gnss.cpp b/gps/android/1.0/Gnss.cpp
new file mode 100644
index 0000000..06a94d4
--- /dev/null
+++ b/gps/android/1.0/Gnss.cpp
@@ -0,0 +1,350 @@
+/*
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssInterface"
+#define LOG_NDEBUG 0
+
+#include <fstream>
+#include <log_util.h>
+#include <dlfcn.h>
+#include <cutils/properties.h>
+#include "Gnss.h"
+#include <LocationUtil.h>
+#include "battery_listener.h"
+#include "loc_misc_utils.h"
+
+typedef const GnssInterface* (getLocationInterface)();
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+static sp<Gnss> sGnss;
+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);
+ if (mGnss != nullptr) {
+ mGnss->stop();
+ mGnss->cleanup();
+ }
+}
+
+void location_on_battery_status_changed(bool charging) {
+ LOC_LOGd("battery status changed to %s charging", charging ? "" : "not ");
+ if (sGnss != nullptr) {
+ sGnss->getGnssInterface()->updateBatteryStatus(charging);
+ }
+}
+Gnss::Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ sGnss = this;
+ // initilize gnss interface at first in case needing notify battery status
+ sGnss->getGnssInterface()->initialize();
+ // register health client to listen on battery change
+ loc_extn_battery_properties_listener_init(location_on_battery_status_changed);
+ // clear pending GnssConfig
+ memset(&mPendingConfig, 0, sizeof(GnssConfig));
+
+ mGnssDeathRecipient = new GnssDeathRecipient(this);
+}
+
+Gnss::~Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+ sGnss = nullptr;
+}
+
+GnssAPIClient* Gnss::getApi() {
+ if (mApi == nullptr && (mGnssCbIface != nullptr || mGnssNiCbIface != nullptr)) {
+ mApi = new GnssAPIClient(mGnssCbIface, mGnssNiCbIface);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s] faild to create GnssAPIClient", __FUNCTION__);
+ return mApi;
+ }
+
+ if (mPendingConfig.size == sizeof(GnssConfig)) {
+ // we have pending GnssConfig
+ mApi->gnssConfigurationUpdate(mPendingConfig);
+ // clear size to invalid mPendingConfig
+ mPendingConfig.size = 0;
+ if (mPendingConfig.assistanceServer.hostName != nullptr) {
+ free((void*)mPendingConfig.assistanceServer.hostName);
+ }
+ }
+ }
+ if (mApi == nullptr) {
+ LOC_LOGW("%s] GnssAPIClient is not ready", __FUNCTION__);
+ }
+ return mApi;
+}
+
+const GnssInterface* Gnss::getGnssInterface() {
+ static bool getGnssInterfaceFailed = false;
+ if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
+ void * libHandle = nullptr;
+ getLocationInterface* getter = (getLocationInterface*)
+ dlGetSymFromLib(libHandle, "libgnss.so", "getGnssInterface");
+
+ if (nullptr == getter) {
+ getGnssInterfaceFailed = true;
+ } else {
+ mGnssInterface = (GnssInterface*)(*getter)();
+ }
+ }
+ return mGnssInterface;
+}
+
+Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
+ }
+ mGnssCbIface = callback;
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
+ }
+
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
+ api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
+ api->requestCapabilities();
+ }
+ return true;
+}
+
+Return<bool> Gnss::setGnssNiCb(const sp<IGnssNiCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+ mGnssNiCbIface = callback;
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
+ }
+ return true;
+}
+
+Return<bool> Gnss::updateConfiguration(GnssConfig& gnssConfig) {
+ ENTRY_LOG_CALLFLOW();
+ GnssAPIClient* api = getApi();
+ if (api) {
+ api->gnssConfigurationUpdate(gnssConfig);
+ } else if (gnssConfig.flags != 0) {
+ // api is not ready yet, update mPendingConfig with gnssConfig
+ mPendingConfig.size = sizeof(GnssConfig);
+
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
+ mPendingConfig.gpsLock = gnssConfig.gpsLock;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
+ mPendingConfig.suplVersion = gnssConfig.suplVersion;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
+ mPendingConfig.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
+ mPendingConfig.assistanceServer.type = gnssConfig.assistanceServer.type;
+ if (mPendingConfig.assistanceServer.hostName != nullptr) {
+ free((void*)mPendingConfig.assistanceServer.hostName);
+ mPendingConfig.assistanceServer.hostName =
+ strdup(gnssConfig.assistanceServer.hostName);
+ }
+ mPendingConfig.assistanceServer.port = gnssConfig.assistanceServer.port;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
+ mPendingConfig.lppProfile = gnssConfig.lppProfile;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
+ mPendingConfig.lppeControlPlaneMask = gnssConfig.lppeControlPlaneMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT;
+ mPendingConfig.lppeUserPlaneMask = gnssConfig.lppeUserPlaneMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
+ mPendingConfig.aGlonassPositionProtocolMask = gnssConfig.aGlonassPositionProtocolMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
+ mPendingConfig.emergencyPdnForEmergencySupl = gnssConfig.emergencyPdnForEmergencySupl;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
+ mPendingConfig.suplEmergencyServices = gnssConfig.suplEmergencyServices;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
+ mPendingConfig.suplModeMask = gnssConfig.suplModeMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
+ mPendingConfig.blacklistedSvIds = gnssConfig.blacklistedSvIds;
+ }
+ }
+ return true;
+}
+
+Return<bool> Gnss::start() {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssStart();
+ }
+ return retVal;
+}
+
+Return<bool> Gnss::stop() {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssStop();
+ }
+ return retVal;
+}
+
+Return<void> Gnss::cleanup() {
+ ENTRY_LOG_CALLFLOW();
+
+ if (mApi != nullptr) {
+ mApi->gnssDisable();
+ }
+
+ return Void();
+}
+
+Return<bool> Gnss::injectLocation(double latitudeDegrees,
+ double longitudeDegrees,
+ float accuracyMeters) {
+ ENTRY_LOG_CALLFLOW();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ gnssInterface->injectLocation(latitudeDegrees, longitudeDegrees, accuracyMeters);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
+ int32_t uncertaintyMs) {
+ ENTRY_LOG_CALLFLOW();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if ((nullptr != gnssInterface) && (gnssInterface->isSS5HWEnabled())) {
+ gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
+ }
+ return true;
+}
+
+Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
+ ENTRY_LOG_CALLFLOW();
+ GnssAPIClient* api = getApi();
+ if (api) {
+ api->gnssDeleteAidingData(aidingDataFlags);
+ }
+ return Void();
+}
+
+Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs) {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
+ preferredAccuracyMeters, preferredTimeMs);
+ }
+ return retVal;
+}
+
+Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
+ ENTRY_LOG_CALLFLOW();
+ mAGnssIface = new AGnss(this);
+ return mAGnssIface;
+}
+
+Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssNi = new GnssNi(this);
+ return mGnssNi;
+}
+
+Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+}
+
+Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssConfig = new GnssConfiguration(this);
+ return mGnssConfig;
+}
+
+Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssGeofencingIface = new GnssGeofencing();
+ return mGnssGeofencingIface;
+}
+
+Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ mGnssBatching = new GnssBatching();
+ return mGnssBatching;
+}
+
+Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssDebug = new GnssDebug(this);
+ return mGnssDebug;
+}
+
+Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
+ mGnssRil = new AGnssRil(this);
+ return mGnssRil;
+}
+
+IGnss* HIDL_FETCH_IGnss(const char* hal) {
+ ENTRY_LOG_CALLFLOW();
+ IGnss* iface = nullptr;
+ iface = new Gnss();
+ if (iface == nullptr) {
+ LOC_LOGE("%s]: failed to get %s", __FUNCTION__, hal);
+ }
+ return iface;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/Gnss.h b/gps/android/1.0/Gnss.h
new file mode 100644
index 0000000..900a510
--- /dev/null
+++ b/gps/android/1.0/Gnss.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
+
+#include <AGnss.h>
+#include <AGnssRil.h>
+#include <GnssBatching.h>
+#include <GnssConfiguration.h>
+#include <GnssGeofencing.h>
+#include <GnssMeasurement.h>
+#include <GnssNi.h>
+#include <GnssDebug.h>
+
+#include <android/hardware/gnss/1.0/IGnss.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <GnssAPIClient.h>
+#include <location_interface.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+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::sp;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+
+struct Gnss : public IGnss {
+ Gnss();
+ ~Gnss();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnss follow.
+ * These declarations were generated from Gnss.hal.
+ */
+ Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
+ Return<bool> start() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+ Return<bool> injectLocation(double latitudeDegrees,
+ double longitudeDegrees,
+ float accuracyMeters) override;
+ Return<bool> injectTime(int64_t timeMs,
+ int64_t timeReferenceMs,
+ int32_t uncertaintyMs) override;
+ 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<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<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
+
+ inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
+ return nullptr;
+ }
+
+ inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
+ return nullptr;
+ }
+
+ Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
+
+ // These methods are not part of the IGnss base class.
+ GnssAPIClient* getApi();
+ Return<bool> setGnssNiCb(const sp<IGnssNiCallback>& niCb);
+ Return<bool> updateConfiguration(GnssConfig& gnssConfig);
+ const GnssInterface* getGnssInterface();
+
+ // Callback for ODCPI request
+ void odcpiRequestCb(const OdcpiRequestInfo& request);
+
+ private:
+ struct GnssDeathRecipient : hidl_death_recipient {
+ GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
+ }
+ ~GnssDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<Gnss> mGnss;
+ };
+
+ private:
+ sp<GnssDeathRecipient> mGnssDeathRecipient = nullptr;
+
+ sp<AGnss> mAGnssIface = nullptr;
+ sp<GnssNi> mGnssNi = nullptr;
+ sp<GnssMeasurement> mGnssMeasurement = nullptr;
+ sp<GnssConfiguration> mGnssConfig = nullptr;
+ sp<GnssGeofencing> mGnssGeofencingIface = nullptr;
+ sp<GnssBatching> mGnssBatching = nullptr;
+ sp<IGnssDebug> mGnssDebug = nullptr;
+ sp<AGnssRil> mGnssRil = nullptr;
+
+ GnssAPIClient* mApi = nullptr;
+ sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
+ GnssConfig mPendingConfig;
+ const GnssInterface* mGnssInterface = nullptr;
+};
+
+extern "C" IGnss* HIDL_FETCH_IGnss(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSS_H
diff --git a/gps/android/1.0/GnssBatching.cpp b/gps/android/1.0/GnssBatching.cpp
new file mode 100644
index 0000000..f92697f
--- /dev/null
+++ b/gps/android/1.0/GnssBatching.cpp
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssBatchingInterface"
+
+#include <log_util.h>
+#include <BatchingAPIClient.h>
+#include "GnssBatching.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+void GnssBatching::GnssBatchingDeathRecipient::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);
+ if (mGnssBatching != nullptr) {
+ mGnssBatching->stop();
+ mGnssBatching->cleanup();
+ }
+}
+
+GnssBatching::GnssBatching() : mApi(nullptr) {
+ mGnssBatchingDeathRecipient = new GnssBatchingDeathRecipient(this);
+}
+
+GnssBatching::~GnssBatching() {
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
+ if (mApi != nullptr) {
+ LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
+ mApi->destroy();
+ mApi = nullptr;
+ }
+
+ mApi = new BatchingAPIClient(callback);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
+ return false;
+ }
+
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
+ }
+ mGnssBatchingCbIface = callback;
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->linkToDeath(mGnssBatchingDeathRecipient, 0 /*cookie*/);
+ }
+
+ return true;
+}
+
+Return<uint16_t> GnssBatching::getBatchSize() {
+ uint16_t ret = 0;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->getBatchSize();
+ }
+ return ret;
+}
+
+Return<bool> GnssBatching::start(const IGnssBatching::Options& options) {
+ bool ret = false;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->startSession(options);
+ }
+ return ret;
+}
+
+Return<void> GnssBatching::flush() {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->flushBatchedLocations();
+ }
+ return Void();
+}
+
+Return<bool> GnssBatching::stop() {
+ bool ret = false;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->stopSession();
+ }
+ return ret;
+}
+
+Return<void> GnssBatching::cleanup() {
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/GnssBatching.h b/gps/android/1.0/GnssBatching.h
new file mode 100644
index 0000000..8fab857
--- /dev/null
+++ b/gps/android/1.0/GnssBatching.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
+
+#include <android/hardware/gnss/1.0/IGnssBatching.h>
+#include <hidl/Status.h>
+
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssBatching;
+using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
+using ::android::hidl::base::V1_0::IBase;
+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::sp;
+
+class BatchingAPIClient;
+struct GnssBatching : public IGnssBatching {
+ GnssBatching();
+ ~GnssBatching();
+
+ // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+ Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
+ Return<uint16_t> getBatchSize() override;
+ Return<bool> start(const IGnssBatching::Options& options ) override;
+ Return<void> flush() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+
+ private:
+ struct GnssBatchingDeathRecipient : hidl_death_recipient {
+ GnssBatchingDeathRecipient(sp<GnssBatching> gnssBatching) :
+ mGnssBatching(gnssBatching) {
+ }
+ ~GnssBatchingDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssBatching> mGnssBatching;
+ };
+
+ private:
+ sp<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
+ sp<IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
+ BatchingAPIClient* mApi = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
diff --git a/gps/android/1.0/GnssConfiguration.cpp b/gps/android/1.0/GnssConfiguration.cpp
new file mode 100644
index 0000000..73c9d5c
--- /dev/null
+++ b/gps/android/1.0/GnssConfiguration.cpp
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssConfigurationInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssConfiguration.h"
+#include <android/hardware/gnss/1.0/types.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::GnssConstellationType;
+
+GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
+}
+
+// Methods from ::android::hardware::gps::V1_0::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setSuplEs(bool enabled) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
+ config.suplEmergencyServices = (enabled ?
+ GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES :
+ GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO);
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setSuplVersion(uint32_t version) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
+ switch (version) {
+ case 0x00020004:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_4;
+ break;
+ case 0x00020002:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_2;
+ break;
+ case 0x00020000:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_0;
+ break;
+ case 0x00010000:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_1_0_0;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid version: 0x%x.", __FUNCTION__, version);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setSuplMode(uint8_t mode) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
+ switch (mode) {
+ case 0:
+ config.suplModeMask = 0; // STANDALONE ONLY
+ break;
+ case 1:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT;
+ break;
+ case 2:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSA_BIT;
+ break;
+ case 3:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT | GNSS_CONFIG_SUPL_MODE_MSA_BIT;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid mode: %d.", __FUNCTION__, mode);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
+ switch (lppProfile) {
+ case 0:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
+ break;
+ case 1:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE;
+ break;
+ case 2:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE;
+ break;
+ case 3:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid lppProfile: %d.", __FUNCTION__, lppProfile);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+
+ config.flags = GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
+ if (protocol & (1<<0)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRC_CONTROL_PLANE_BIT;
+ }
+ if (protocol & (1<<1)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRLP_USER_PLANE_BIT;
+ }
+ if (protocol & (1<<2)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_USER_PLANE_BIT;
+ }
+ if (protocol & (1<<3)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_CONTROL_PLANE_BIT;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
+ switch (lock) {
+ case 0:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
+ break;
+ case 1:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO;
+ break;
+ case 2:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI;
+ break;
+ case 3:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
+ config.emergencyPdnForEmergencySupl = (enabled ?
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES :
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO);
+
+ return mGnss->updateConfiguration(config);
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/GnssConfiguration.h b/gps/android/1.0/GnssConfiguration.h
new file mode 100644
index 0000000..1629e06
--- /dev/null
+++ b/gps/android/1.0/GnssConfiguration.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+
+ /* Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
+
+#include <android/hardware/gnss/1.0/IGnssConfiguration.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssConfiguration;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+/*
+ * Interface for passing GNSS configuration info from platform to HAL.
+ */
+struct Gnss;
+struct GnssConfiguration : public IGnssConfiguration {
+ GnssConfiguration(Gnss* gnss);
+ ~GnssConfiguration() = default;
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
+ * These declarations were generated from IGnssConfiguration.hal.
+ */
+ Return<bool> setSuplVersion(uint32_t version) override;
+ Return<bool> setSuplMode(uint8_t mode) override;
+ Return<bool> setSuplEs(bool enabled) override;
+ Return<bool> setLppProfile(uint8_t lppProfile) override;
+ Return<bool> setGlonassPositioningProtocol(uint8_t protocol) override;
+ Return<bool> setEmergencySuplPdn(bool enable) override;
+ Return<bool> setGpsLock(uint8_t lock) override;
+
+ private:
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSCONFIGURATION_H
diff --git a/gps/android/1.0/GnssDebug.cpp b/gps/android/1.0/GnssDebug.cpp
new file mode 100644
index 0000000..ead72e1
--- /dev/null
+++ b/gps/android/1.0/GnssDebug.cpp
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssDebugInterface"
+
+#include <log/log.h>
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssDebug.h"
+#include "LocationUtil.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::hidl_vec;
+
+#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)
+{
+}
+
+/*
+ * This methods requests position, time and satellite ephemeris debug information
+ * from the HAL.
+ *
+ * @return void
+*/
+Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ DebugData data = { };
+
+ if((nullptr == mGnss) || (nullptr == mGnss->getGnssInterface())){
+ LOC_LOGE("GnssDebug - Null GNSS interface");
+ _hidl_cb(data);
+ return Void();
+ }
+
+ // get debug report snapshot via hal interface
+ GnssDebugReport reports = { };
+ mGnss->getGnssInterface()->getDebugReport(reports);
+
+ // location block
+ if (reports.mLocation.mValid) {
+ data.position.valid = true;
+ data.position.latitudeDegrees = reports.mLocation.mLocation.latitude;
+ data.position.longitudeDegrees = reports.mLocation.mLocation.longitude;
+ data.position.altitudeMeters = reports.mLocation.mLocation.altitude;
+
+ data.position.speedMetersPerSec =
+ (double)(reports.mLocation.mLocation.speed);
+ data.position.bearingDegrees =
+ (double)(reports.mLocation.mLocation.bearing);
+ data.position.horizontalAccuracyMeters =
+ (double)(reports.mLocation.mLocation.accuracy);
+ data.position.verticalAccuracyMeters =
+ reports.mLocation.verticalAccuracyMeters;
+ data.position.speedAccuracyMetersPerSecond =
+ reports.mLocation.speedAccuracyMetersPerSecond;
+ data.position.bearingAccuracyDegrees =
+ reports.mLocation.bearingAccuracyDegrees;
+
+ timeval tv_now, tv_report;
+ tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
+ tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
+ gettimeofday(&tv_now, NULL);
+ data.position.ageSeconds =
+ (tv_now.tv_sec - tv_report.tv_sec) +
+ (float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
+ }
+ else {
+ 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;
+ }
+
+ // time block
+ if (reports.mTime.mValid) {
+ data.time.timeEstimate = reports.mTime.timeEstimate;
+ data.time.timeUncertaintyNs = reports.mTime.timeUncertaintyNs;
+ data.time.frequencyUncertaintyNsPerSec =
+ reports.mTime.frequencyUncertaintyNsPerSec;
+ }
+
+ if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
+ data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
+ }
+ 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
+ SatelliteData s = { };
+ std::vector<SatelliteData> s_array = { };
+
+ for (uint32_t i=0; i<reports.mSatelliteInfo.size(); i++) {
+ memset(&s, 0, sizeof(s));
+ s.svid = reports.mSatelliteInfo[i].svid;
+ convertGnssConstellationType(
+ reports.mSatelliteInfo[i].constellation, s.constellation);
+ convertGnssEphemerisType(
+ reports.mSatelliteInfo[i].mEphemerisType, s.ephemerisType);
+ convertGnssEphemerisSource(
+ reports.mSatelliteInfo[i].mEphemerisSource, s.ephemerisSource);
+ convertGnssEphemerisHealth(
+ reports.mSatelliteInfo[i].mEphemerisHealth, s.ephemerisHealth);
+
+ s.ephemerisAgeSeconds =
+ reports.mSatelliteInfo[i].ephemerisAgeSeconds;
+ s.serverPredictionIsAvailable =
+ reports.mSatelliteInfo[i].serverPredictionIsAvailable;
+ s.serverPredictionAgeSeconds =
+ reports.mSatelliteInfo[i].serverPredictionAgeSeconds;
+
+ s_array.push_back(s);
+ }
+ data.satelliteDataArray = s_array;
+
+ // callback HIDL with collected debug data
+ _hidl_cb(data);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/GnssDebug.h b/gps/android/1.0/GnssDebug.h
new file mode 100644
index 0000000..a7116cb
--- /dev/null
+++ b/gps/android/1.0/GnssDebug.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
+
+
+#include <android/hardware/gnss/1.0/IGnssDebug.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssDebug;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+/* Interface for GNSS Debug support. */
+struct Gnss;
+struct GnssDebug : public IGnssDebug {
+ GnssDebug(Gnss* gnss);
+ ~GnssDebug() {};
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
+ * These declarations were generated from IGnssDebug.hal.
+ */
+ Return<void> getDebugData(getDebugData_cb _hidl_cb) override;
+
+private:
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSDEBUG_H
diff --git a/gps/android/1.0/GnssGeofencing.cpp b/gps/android/1.0/GnssGeofencing.cpp
new file mode 100644
index 0000000..4be6d8a
--- /dev/null
+++ b/gps/android/1.0/GnssGeofencing.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssHal_GnssGeofencing"
+
+#include <log_util.h>
+#include <GeofenceAPIClient.h>
+#include "GnssGeofencing.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+void GnssGeofencing::GnssGeofencingDeathRecipient::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);
+ if (mGnssGeofencing != nullptr) {
+ mGnssGeofencing->removeAllGeofences();
+ }
+}
+
+GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
+ mGnssGeofencingDeathRecipient = new GnssGeofencingDeathRecipient(this);
+}
+
+GnssGeofencing::~GnssGeofencing() {
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
+Return<void> GnssGeofencing::setCallback(const sp<IGnssGeofenceCallback>& callback) {
+ if (mApi != nullptr) {
+ LOC_LOGE("%s]: mApi is NOT nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ mApi = new GeofenceAPIClient(callback);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
+ }
+
+ if (mGnssGeofencingCbIface != nullptr) {
+ mGnssGeofencingCbIface->unlinkToDeath(mGnssGeofencingDeathRecipient);
+ }
+ mGnssGeofencingCbIface = callback;
+ if (mGnssGeofencingCbIface != nullptr) {
+ mGnssGeofencingCbIface->linkToDeath(mGnssGeofencingDeathRecipient, 0 /*cookie*/);
+ }
+
+ return Void();
+}
+
+Return<void> GnssGeofencing::addGeofence(
+ int32_t geofenceId,
+ double latitudeDegrees,
+ double longitudeDegrees,
+ double radiusMeters,
+ IGnssGeofenceCallback::GeofenceTransition lastTransition,
+ int32_t monitorTransitions,
+ uint32_t notificationResponsivenessMs,
+ uint32_t unknownTimerMs) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceAdd(
+ geofenceId,
+ latitudeDegrees,
+ longitudeDegrees,
+ radiusMeters,
+ static_cast<int32_t>(lastTransition),
+ monitorTransitions,
+ notificationResponsivenessMs,
+ unknownTimerMs);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::pauseGeofence(int32_t geofenceId) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofencePause(geofenceId);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceResume(geofenceId, monitorTransitions);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::removeGeofence(int32_t geofenceId) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceRemove(geofenceId);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::removeAllGeofences() {
+ if (mApi == nullptr) {
+ LOC_LOGD("%s]: mApi is nullptr, do nothing", __FUNCTION__);
+ } else {
+ mApi->geofenceRemoveAll();
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/GnssGeofencing.h b/gps/android/1.0/GnssGeofencing.h
new file mode 100644
index 0000000..db5f9d2
--- /dev/null
+++ b/gps/android/1.0/GnssGeofencing.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
+
+#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
+using ::android::hardware::gnss::V1_0::IGnssGeofencing;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+class GeofenceAPIClient;
+struct GnssGeofencing : public IGnssGeofencing {
+ GnssGeofencing();
+ ~GnssGeofencing();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
+ * These declarations were generated from IGnssGeofencing.hal.
+ */
+ Return<void> setCallback(const sp<IGnssGeofenceCallback>& callback) override;
+ Return<void> addGeofence(int32_t geofenceId,
+ double latitudeDegrees,
+ double longitudeDegrees,
+ double radiusMeters,
+ IGnssGeofenceCallback::GeofenceTransition lastTransition,
+ int32_t monitorTransitions,
+ uint32_t notificationResponsivenessMs,
+ uint32_t unknownTimerMs) override;
+
+ Return<void> pauseGeofence(int32_t geofenceId) override;
+ Return<void> resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) override;
+ Return<void> removeGeofence(int32_t geofenceId) override;
+
+ private:
+ // This method is not part of the IGnss base class.
+ // It is called by GnssGeofencingDeathRecipient to remove all geofences added so far.
+ Return<void> removeAllGeofences();
+
+ private:
+ struct GnssGeofencingDeathRecipient : hidl_death_recipient {
+ GnssGeofencingDeathRecipient(sp<GnssGeofencing> gnssGeofencing) :
+ mGnssGeofencing(gnssGeofencing) {
+ }
+ ~GnssGeofencingDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssGeofencing> mGnssGeofencing;
+ };
+
+ private:
+ sp<GnssGeofencingDeathRecipient> mGnssGeofencingDeathRecipient = nullptr;
+ sp<IGnssGeofenceCallback> mGnssGeofencingCbIface = nullptr;
+ GeofenceAPIClient* mApi = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSGEOFENCING_H
diff --git a/gps/android/1.0/GnssMeasurement.cpp b/gps/android/1.0/GnssMeasurement.cpp
new file mode 100644
index 0000000..7af9e27
--- /dev/null
+++ b/gps/android/1.0/GnssMeasurement.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssMeasurementInterface"
+
+#include <log_util.h>
+#include <MeasurementAPIClient.h>
+#include "GnssMeasurement.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+void GnssMeasurement::GnssMeasurementDeathRecipient::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);
+ if (mGnssMeasurement != nullptr) {
+ mGnssMeasurement->close();
+ }
+}
+
+GnssMeasurement::GnssMeasurement() {
+ mGnssMeasurementDeathRecipient = new GnssMeasurementDeathRecipient(this);
+ mApi = new MeasurementAPIClient();
+}
+
+GnssMeasurement::~GnssMeasurement() {
+ if (mApi) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+
+Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) {
+
+ Return<IGnssMeasurement::GnssMeasurementStatus> ret =
+ IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
+ if (mGnssMeasurementCbIface != 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 = callback;
+ mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+
+ return mApi->measurementSetCallback(callback);
+
+}
+
+Return<void> GnssMeasurement::close() {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ if (mGnssMeasurementCbIface != nullptr) {
+ mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
+ mGnssMeasurementCbIface = nullptr;
+ }
+ mApi->measurementClose();
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/GnssMeasurement.h b/gps/android/1.0/GnssMeasurement.h
new file mode 100644
index 0000000..4247dbf
--- /dev/null
+++ b/gps/android/1.0/GnssMeasurement.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
+
+#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssMeasurement;
+using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+class MeasurementAPIClient;
+struct GnssMeasurement : public IGnssMeasurement {
+ GnssMeasurement();
+ ~GnssMeasurement();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+ * These declarations were generated from IGnssMeasurement.hal.
+ */
+ Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) override;
+ Return<void> close() override;
+
+ private:
+ struct GnssMeasurementDeathRecipient : hidl_death_recipient {
+ GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
+ mGnssMeasurement(gnssMeasurement) {
+ }
+ ~GnssMeasurementDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssMeasurement> mGnssMeasurement;
+ };
+
+ private:
+ sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
+ MeasurementAPIClient* mApi;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSMEASUREMENT_H
diff --git a/gps/android/1.0/GnssNi.cpp b/gps/android/1.0/GnssNi.cpp
new file mode 100644
index 0000000..d06cc20
--- /dev/null
+++ b/gps/android/1.0/GnssNi.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssNiInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssNi.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+void GnssNi::GnssNiDeathRecipient::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);
+ // we do nothing here
+ // Gnss::GnssDeathRecipient will stop the session
+}
+
+GnssNi::GnssNi(Gnss* gnss) : mGnss(gnss) {
+ mGnssNiDeathRecipient = new GnssNiDeathRecipient(this);
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
+Return<void> GnssNi::setCallback(const sp<IGnssNiCallback>& callback) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ mGnss->setGnssNiCb(callback);
+
+ if (mGnssNiCbIface != nullptr) {
+ mGnssNiCbIface->unlinkToDeath(mGnssNiDeathRecipient);
+ }
+ mGnssNiCbIface = callback;
+ if (mGnssNiCbIface != nullptr) {
+ mGnssNiCbIface->linkToDeath(mGnssNiDeathRecipient, 0 /*cookie*/);
+ }
+
+ return Void();
+}
+
+Return<void> GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ GnssAPIClient* api = mGnss->getApi();
+ if (api == nullptr) {
+ LOC_LOGE("%s]: api is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ api->gnssNiRespond(notifId, userResponse);
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/GnssNi.h b/gps/android/1.0/GnssNi.h
new file mode 100644
index 0000000..90f62d5
--- /dev/null
+++ b/gps/android/1.0/GnssNi.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
+
+#include <android/hardware/gnss/1.0/IGnssNi.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssNi;
+using ::android::hardware::gnss::V1_0::IGnssNiCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+struct GnssNi : public IGnssNi {
+ GnssNi(Gnss* gnss);
+ ~GnssNi() = default;
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
+ * These declarations were generated from IGnssNi.hal.
+ */
+ Return<void> setCallback(const sp<IGnssNiCallback>& callback) override;
+ Return<void> respond(int32_t notifId,
+ IGnssNiCallback::GnssUserResponseType userResponse) override;
+
+ private:
+ struct GnssNiDeathRecipient : hidl_death_recipient {
+ GnssNiDeathRecipient(sp<GnssNi> gnssNi) : mGnssNi(gnssNi) {
+ }
+ ~GnssNiDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssNi> mGnssNi;
+ };
+
+ private:
+ sp<GnssNiDeathRecipient> mGnssNiDeathRecipient = nullptr;
+ sp<IGnssNiCallback> mGnssNiCbIface = nullptr;
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSNI_H
diff --git a/gps/android/1.0/android.hardware.gnss@1.0-service-qti.rc b/gps/android/1.0/android.hardware.gnss@1.0-service-qti.rc
new file mode 100644
index 0000000..1fbd893
--- /dev/null
+++ b/gps/android/1.0/android.hardware.gnss@1.0-service-qti.rc
@@ -0,0 +1,4 @@
+service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti
+ class hal
+ user gps
+ group system gps radio vendor_qti_diag
diff --git a/gps/android/1.0/android.hardware.gnss@1.0-service-qti.xml b/gps/android/1.0/android.hardware.gnss@1.0-service-qti.xml
new file mode 100644
index 0000000..46bcffb
--- /dev/null
+++ b/gps/android/1.0/android.hardware.gnss@1.0-service-qti.xml
@@ -0,0 +1,35 @@
+<!-- Copyright (c) 2019, 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.
+-->
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.gnss</name>
+ <transport>hwbinder</transport>
+ <fqname>@1.0::IGnss/default</fqname>
+ </hal>
+</manifest>
+
diff --git a/gps/android/1.0/location_api/BatchingAPIClient.cpp b/gps/android/1.0/location_api/BatchingAPIClient.cpp
new file mode 100644
index 0000000..264ab83
--- /dev/null
+++ b/gps/android/1.0/location_api/BatchingAPIClient.cpp
@@ -0,0 +1,196 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_BatchingAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "BatchingAPIClient.h"
+
+#include "limits.h"
+
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+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);
+
+BatchingAPIClient::BatchingAPIClient(const sp<IGnssBatchingCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssBatchingCbIface(callback),
+ mDefaultId(UINT_MAX),
+ mLocationCapabilitiesMask(0)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+ if (mGnssBatchingCbIface != nullptr) {
+ locationCallbacks.batchingCb = [this](size_t count, Location* location,
+ BatchingOptions batchOptions) {
+ onBatchingCb(count, location, batchOptions);
+ };
+ }
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+BatchingAPIClient::~BatchingAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+int BatchingAPIClient::getBatchSize()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ return locAPIGetBatchSize();
+}
+
+int BatchingAPIClient::startSession(const IGnssBatching::Options& opts)
+{
+ LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
+ static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
+ int retVal = -1;
+ LocationOptions options;
+ convertBatchOption(opts, options, mLocationCapabilitiesMask);
+ uint32_t mode = 0;
+ if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
+ mode = SESSION_MODE_ON_FULL;
+ }
+ if (locAPIStartSession(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts)
+{
+ LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
+ static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
+ int retVal = -1;
+ LocationOptions options;
+ convertBatchOption(opts, options, mLocationCapabilitiesMask);
+
+ uint32_t mode = 0;
+ if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
+ mode = SESSION_MODE_ON_FULL;
+ }
+ if (locAPIUpdateSessionOptions(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+int BatchingAPIClient::stopSession()
+{
+ LOC_LOGD("%s]: ", __FUNCTION__);
+ int retVal = -1;
+ if (locAPIStopSession(mDefaultId) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+void BatchingAPIClient::getBatchedLocation(int last_n_locations)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations);
+ locAPIGetBatchedLocations(mDefaultId, last_n_locations);
+}
+
+void BatchingAPIClient::flushBatchedLocations()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
+}
+
+void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+}
+
+void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
+ BatchingOptions /*batchOptions*/)
+{
+ LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
+ if (mGnssBatchingCbIface != nullptr && count > 0) {
+ hidl_vec<GnssLocation> locationVec;
+ locationVec.resize(count);
+ for (size_t i = 0; i < count; i++) {
+ convertGnssLocation(location[i], locationVec[i]);
+ }
+ auto r = mGnssBatchingCbIface->gnssLocationBatchCb(locationVec);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationBatchCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
+ LocationCapabilitiesMask mask)
+{
+ memset(&out, 0, sizeof(LocationOptions));
+ out.size = sizeof(LocationOptions);
+ out.minInterval = (uint32_t)(in.periodNanos / 1000000L);
+ out.minDistance = 0;
+ out.mode = GNSS_SUPL_MODE_STANDALONE;
+ if (mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
+ out.mode = GNSS_SUPL_MODE_MSA;
+ if (mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
+ out.mode = GNSS_SUPL_MODE_MSB;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/location_api/BatchingAPIClient.h b/gps/android/1.0/location_api/BatchingAPIClient.h
new file mode 100644
index 0000000..f98726f
--- /dev/null
+++ b/gps/android/1.0/location_api/BatchingAPIClient.h
@@ -0,0 +1,74 @@
+/* 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 BATCHING_API_CLINET_H
+#define BATCHING_API_CLINET_H
+
+#include <android/hardware/gnss/1.0/IGnssBatching.h>
+#include <android/hardware/gnss/1.0/IGnssBatchingCallback.h>
+#include <pthread.h>
+
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+class BatchingAPIClient : public LocationAPIClientBase
+{
+public:
+ BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
+ int getBatchSize();
+ 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();
+
+ inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; }
+
+ // callbacks
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
+
+private:
+ ~BatchingAPIClient();
+ sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
+ uint32_t mDefaultId;
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // BATCHING_API_CLINET_H
diff --git a/gps/android/1.0/location_api/GeofenceAPIClient.cpp b/gps/android/1.0/location_api/GeofenceAPIClient.cpp
new file mode 100644
index 0000000..774a049
--- /dev/null
+++ b/gps/android/1.0/location_api/GeofenceAPIClient.cpp
@@ -0,0 +1,275 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_GeofenceApiClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GeofenceAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+
+GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssGeofencingCbIface(callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+
+ locationCallbacks.geofenceBreachCb = nullptr;
+ if (mGnssGeofencingCbIface != nullptr) {
+ locationCallbacks.geofenceBreachCb =
+ [this](GeofenceBreachNotification geofenceBreachNotification) {
+ onGeofenceBreachCb(geofenceBreachNotification);
+ };
+
+ locationCallbacks.geofenceStatusCb =
+ [this](GeofenceStatusNotification geofenceStatusNotification) {
+ onGeofenceStatusCb(geofenceStatusNotification);
+ };
+ }
+
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+void GeofenceAPIClient::geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int32_t last_transition, int32_t monitor_transitions,
+ uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms)
+{
+ LOC_LOGD("%s]: (%d %f %f %f %d %d %d %d)", __FUNCTION__,
+ geofence_id, latitude, longitude, radius_meters,
+ last_transition, monitor_transitions, notification_responsiveness_ms, unknown_timer_ms);
+
+ GeofenceOption options;
+ memset(&options, 0, sizeof(GeofenceOption));
+ options.size = sizeof(GeofenceOption);
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
+ options.breachTypeMask |= GEOFENCE_BREACH_ENTER_BIT;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
+ options.breachTypeMask |= GEOFENCE_BREACH_EXIT_BIT;
+ options.responsiveness = notification_responsiveness_ms;
+
+ GeofenceInfo data;
+ data.size = sizeof(GeofenceInfo);
+ data.latitude = latitude;
+ data.longitude = longitude;
+ data.radius = radius_meters;
+
+ LocationError err = (LocationError)locAPIAddGeofences(1, &geofence_id, &options, &data);
+ if (LOCATION_ERROR_SUCCESS != err) {
+ onAddGeofencesCb(1, &err, &geofence_id);
+ }
+}
+
+void GeofenceAPIClient::geofencePause(uint32_t geofence_id)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
+ locAPIPauseGeofences(1, &geofence_id);
+}
+
+void GeofenceAPIClient::geofenceResume(uint32_t geofence_id, int32_t monitor_transitions)
+{
+ LOC_LOGD("%s]: (%d %d)", __FUNCTION__, geofence_id, monitor_transitions);
+ GeofenceBreachTypeMask mask = 0;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
+ mask |= GEOFENCE_BREACH_ENTER_BIT;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
+ mask |= GEOFENCE_BREACH_EXIT_BIT;
+ locAPIResumeGeofences(1, &geofence_id, &mask);
+}
+
+void GeofenceAPIClient::geofenceRemove(uint32_t geofence_id)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
+ locAPIRemoveGeofences(1, &geofence_id);
+}
+
+void GeofenceAPIClient::geofenceRemoveAll()
+{
+ LOC_LOGD("%s]", __FUNCTION__);
+ // TODO locAPIRemoveAllGeofences();
+}
+
+// callbacks
+void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, geofenceBreachNotification.count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < geofenceBreachNotification.count; i++) {
+ GnssLocation gnssLocation;
+ convertGnssLocation(geofenceBreachNotification.location, gnssLocation);
+
+ IGnssGeofenceCallback::GeofenceTransition transition;
+ if (geofenceBreachNotification.type == GEOFENCE_BREACH_ENTER)
+ transition = IGnssGeofenceCallback::GeofenceTransition::ENTERED;
+ else if (geofenceBreachNotification.type == GEOFENCE_BREACH_EXIT)
+ transition = IGnssGeofenceCallback::GeofenceTransition::EXITED;
+ else {
+ // continue with other breach if transition is
+ // nether GPS_GEOFENCE_ENTERED nor GPS_GEOFENCE_EXITED
+ continue;
+ }
+
+ auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
+ geofenceBreachNotification.ids[i], gnssLocation, transition,
+ static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofenceStatusNotification.available);
+ if (mGnssGeofencingCbIface != nullptr) {
+ IGnssGeofenceCallback::GeofenceAvailability status =
+ IGnssGeofenceCallback::GeofenceAvailability::UNAVAILABLE;
+ if (geofenceStatusNotification.available == GEOFENCE_STATUS_AVAILABILE_YES) {
+ status = IGnssGeofenceCallback::GeofenceAvailability::AVAILABLE;
+ }
+ GnssLocation gnssLocation;
+ memset(&gnssLocation, 0, sizeof(GnssLocation));
+ auto r = mGnssGeofencingCbIface->gnssGeofenceStatusCb(status, gnssLocation);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceStatusCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GeofenceAPIClient::onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_EXISTS)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_EXISTS;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceAddCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceAddCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceRemoveCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceRemoveCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofencePauseCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofencePauseCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceResumeCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceResumeCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/location_api/GeofenceAPIClient.h b/gps/android/1.0/location_api/GeofenceAPIClient.h
new file mode 100644
index 0000000..94aada7
--- /dev/null
+++ b/gps/android/1.0/location_api/GeofenceAPIClient.h
@@ -0,0 +1,75 @@
+/* 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 GEOFENCE_API_CLINET_H
+#define GEOFENCE_API_CLINET_H
+
+
+#include <android/hardware/gnss/1.0/IGnssGeofenceCallback.h>
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::sp;
+
+class GeofenceAPIClient : public LocationAPIClientBase
+{
+public:
+ GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
+ void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int32_t last_transition, int32_t monitor_transitions,
+ uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
+ void geofencePause(uint32_t geofence_id);
+ void geofenceResume(uint32_t geofence_id, int32_t monitor_transitions);
+ void geofenceRemove(uint32_t geofence_id);
+ void geofenceRemoveAll();
+
+ // callbacks
+ void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification) final;
+ void onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification) final;
+ void onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+
+private:
+ virtual ~GeofenceAPIClient() = default;
+ sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GEOFENCE_API_CLINET_H
diff --git a/gps/android/1.0/location_api/GnssAPIClient.cpp b/gps/android/1.0/location_api/GnssAPIClient.cpp
new file mode 100644
index 0000000..27be0fc
--- /dev/null
+++ b/gps/android/1.0/location_api/GnssAPIClient.cpp
@@ -0,0 +1,566 @@
+/* Copyright (c) 2017-2019, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_GnssAPIClient"
+#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GnssAPIClient.h"
+#include <LocContext.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+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,
+ const sp<IGnssNiCallback>& niCb) :
+ LocationAPIClientBase(),
+ mGnssCbIface(nullptr),
+ mGnssNiCbIface(nullptr),
+ mControlClient(new LocationAPIControlClient()),
+ mLocationCapabilitiesMask(0),
+ mLocationCapabilitiesCached(false)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ // set default LocationOptions.
+ memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
+ mTrackingOptions.size = sizeof(TrackingOptions);
+ mTrackingOptions.minInterval = 1000;
+ mTrackingOptions.minDistance = 0;
+ mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+
+ gnssUpdateCallbacks(gpsCb, niCb);
+}
+
+GnssAPIClient::~GnssAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ if (mControlClient) {
+ delete mControlClient;
+ mControlClient = nullptr;
+ }
+}
+
+// for GpsInterface
+void GnssAPIClient::gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
+ const sp<IGnssNiCallback>& niCb)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ mMutex.lock();
+ mGnssCbIface = gpsCb;
+ mGnssNiCbIface = niCb;
+ mMutex.unlock();
+
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ if (mGnssCbIface != nullptr) {
+ locationCallbacks.trackingCb = [this](Location location) {
+ onTrackingCb(location);
+ };
+ }
+
+ locationCallbacks.batchingCb = nullptr;
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+
+ locationCallbacks.gnssNiCb = nullptr;
+ loc_core::ContextBase* context =
+ loc_core::LocContext::getLocContext(
+ NULL, NULL,
+ loc_core::LocContext::mLocationHalName, false);
+ if (mGnssNiCbIface != nullptr && !context->hasAgpsExtendedCapabilities()) {
+ LOC_LOGD("Registering NI CB");
+ locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotification) {
+ onGnssNiCb(id, gnssNiNotification);
+ };
+ }
+
+ locationCallbacks.gnssSvCb = nullptr;
+ if (mGnssCbIface != nullptr) {
+ locationCallbacks.gnssSvCb = [this](GnssSvNotification gnssSvNotification) {
+ onGnssSvCb(gnssSvNotification);
+ };
+ }
+
+ locationCallbacks.gnssNmeaCb = nullptr;
+ if (mGnssCbIface != nullptr) {
+ locationCallbacks.gnssNmeaCb = [this](GnssNmeaNotification gnssNmeaNotification) {
+ onGnssNmeaCb(gnssNmeaNotification);
+ };
+ }
+
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+bool GnssAPIClient::gnssStart()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ bool retVal = true;
+ locAPIStartTracking(mTrackingOptions);
+ return retVal;
+}
+
+bool GnssAPIClient::gnssStop()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ bool retVal = true;
+ locAPIStopTracking();
+ return retVal;
+}
+
+bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
+ IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs,
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LOC_LOGD("%s]: (%d %d %d %d %d %d %d)", __FUNCTION__,
+ (int)mode, recurrence, minIntervalMs, preferredAccuracyMeters,
+ preferredTimeMs, (int)powerMode, timeBetweenMeasurement);
+ bool retVal = true;
+ memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
+ mTrackingOptions.size = sizeof(TrackingOptions);
+ mTrackingOptions.minInterval = minIntervalMs;
+ if (IGnss::GnssPositionMode::MS_ASSISTED == mode ||
+ IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
+ // We set a very large interval to simulate SINGLE mode. Once we report a fix,
+ // the caller should take the responsibility to stop the session.
+ // For MSA, we always treat it as SINGLE mode.
+ mTrackingOptions.minInterval = SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC;
+ }
+ if (mode == IGnss::GnssPositionMode::STANDALONE)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+ else if (mode == IGnss::GnssPositionMode::MS_BASED)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_MSB;
+ else if (mode == IGnss::GnssPositionMode::MS_ASSISTED)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_MSA;
+ else {
+ LOC_LOGD("%s]: invalid GnssPositionMode: %d", __FUNCTION__, (int)mode);
+ retVal = false;
+ }
+ if (GNSS_POWER_MODE_INVALID != powerMode) {
+ mTrackingOptions.powerMode = powerMode;
+ mTrackingOptions.tbm = timeBetweenMeasurement;
+ }
+ locAPIUpdateTrackingOptions(mTrackingOptions);
+ return retVal;
+}
+
+// for GpsNiInterface
+void GnssAPIClient::gnssNiRespond(int32_t notifId,
+ IGnssNiCallback::GnssUserResponseType userResponse)
+{
+ LOC_LOGD("%s]: (%d %d)", __FUNCTION__, notifId, static_cast<int>(userResponse));
+ GnssNiResponse data;
+ switch (userResponse) {
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT:
+ data = GNSS_NI_RESPONSE_ACCEPT;
+ break;
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY:
+ data = GNSS_NI_RESPONSE_DENY;
+ break;
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP:
+ data = GNSS_NI_RESPONSE_NO_RESPONSE;
+ break;
+ default:
+ data = GNSS_NI_RESPONSE_IGNORE;
+ break;
+ }
+
+ locAPIGnssNiResponse(notifId, data);
+}
+
+// these apis using LocationAPIControlClient
+void GnssAPIClient::gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags)
+{
+ LOC_LOGD("%s]: (%02hx)", __FUNCTION__, aidingDataFlags);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ GnssAidingData data;
+ memset(&data, 0, sizeof (GnssAidingData));
+ data.sv.svTypeMask = GNSS_AIDING_DATA_SV_TYPE_GPS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT;
+ data.posEngineMask = STANDARD_POSITIONING_ENGINE;
+
+ if (aidingDataFlags == IGnss::GnssAidingData::DELETE_ALL)
+ data.deleteAll = true;
+ else {
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_EPHEMERIS)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_ALMANAC)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_ALMANAC_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_POSITION)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_POSITION_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_TIME)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_TIME_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_IONO)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_UTC)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_UTC_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_HEALTH)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_HEALTH_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVDIR)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_DIRECTION_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVSTEER)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_STEER_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SADATA)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_SA_DATA_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_RTI)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_RTI_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_CELLDB_INFO)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_CELLDB_BIT;
+ }
+ mControlClient->locAPIGnssDeleteAidingData(data);
+}
+
+void GnssAPIClient::gnssEnable(LocationTechnologyType techType)
+{
+ LOC_LOGD("%s]: (%0d)", __FUNCTION__, techType);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIEnable(techType);
+}
+
+void GnssAPIClient::gnssDisable()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIDisable();
+}
+
+void GnssAPIClient::gnssConfigurationUpdate(const GnssConfig& gnssConfig)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, gnssConfig.flags);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIGnssUpdateConfig(gnssConfig);
+}
+
+void GnssAPIClient::requestCapabilities() {
+ // only send capablities if it's already cached, otherwise the first time LocationAPI
+ // is initialized, capabilities will be sent by LocationAPI
+ if (mLocationCapabilitiesCached) {
+ onCapabilitiesCb(mLocationCapabilitiesMask);
+ }
+}
+
+// callbacks
+void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+ mLocationCapabilitiesCached = true;
+
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ uint32_t data = 0;
+ if ((capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT))
+ data |= IGnssCallback::Capabilities::SCHEDULING;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GEOFENCE_BIT)
+ data |= IGnssCallback::Capabilities::GEOFENCING;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT)
+ data |= IGnssCallback::Capabilities::MEASUREMENTS;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
+ data |= IGnssCallback::Capabilities::MSB;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
+ data |= IGnssCallback::Capabilities::MSA;
+ auto r = gnssCbIface->gnssSetCapabilitesCb(data);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ if (gnssCbIface != nullptr) {
+ IGnssCallback::GnssSystemInfo gnssInfo = { .yearOfHw = 2015 };
+
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
+ gnssInfo.yearOfHw++; // 2016
+ if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
+ gnssInfo.yearOfHw++; // 2017
+ if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
+ capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
+ gnssInfo.yearOfHw++; // 2018
+ }
+ }
+ }
+ LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
+ auto r = gnssCbIface->gnssSetSystemInfoCb(gnssInfo);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onTrackingCb(Location location)
+{
+ LOC_LOGD("%s]: (flags: %02x)", __FUNCTION__, location.flags);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ GnssLocation gnssLocation;
+ convertGnssLocation(location, gnssLocation);
+ auto r = gnssCbIface->gnssLocationCb(gnssLocation);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification)
+{
+ LOC_LOGD("%s]: (id: %d)", __FUNCTION__, id);
+ mMutex.lock();
+ auto gnssNiCbIface(mGnssNiCbIface);
+ mMutex.unlock();
+
+ if (gnssNiCbIface == nullptr) {
+ LOC_LOGE("%s]: mGnssNiCbIface is nullptr", __FUNCTION__);
+ return;
+ }
+
+ IGnssNiCallback::GnssNiNotification notificationGnss = {};
+
+ notificationGnss.notificationId = id;
+
+ if (gnssNiNotification.type == GNSS_NI_TYPE_VOICE)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::VOICE;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_SUPL)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_SUPL;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_CONTROL_PLANE)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_CTRL_PLANE;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_EMERGENCY_SUPL)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::EMERGENCY_SUPL;
+
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_NOTIFICATION_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_NOTIFY;
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_VERIFICATION_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_VERIFY;
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::PRIVACY_OVERRIDE;
+
+ notificationGnss.timeoutSec = gnssNiNotification.timeout;
+
+ if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_ACCEPT)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT;
+ else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_DENY)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY;
+ else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_NO_RESPONSE ||
+ gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_IGNORE)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP;
+
+ notificationGnss.requestorId = gnssNiNotification.requestor;
+
+ notificationGnss.notificationMessage = gnssNiNotification.message;
+
+ if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_NONE)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
+
+ if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_NONE)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
+
+ gnssNiCbIface->niNotifyCb(notificationGnss);
+}
+
+void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
+{
+ LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssSvNotification.count);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ IGnssCallback::GnssSvStatus svStatus;
+ convertGnssSvStatus(gnssSvNotification, svStatus);
+ auto r = gnssCbIface->gnssSvStatusCb(svStatus);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSvStatusCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
+{
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ const std::string s(gnssNmeaNotification.nmea);
+ std::stringstream ss(s);
+ std::string each;
+ while(std::getline(ss, each, '\n')) {
+ each += '\n';
+ android::hardware::hidl_string nmeaString;
+ nmeaString.setToExternal(each.c_str(), each.length());
+ auto r = gnssCbIface->gnssNmeaCb(
+ 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());
+ }
+ }
+ }
+}
+
+void GnssAPIClient::onStartTrackingCb(LocationError error)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb ENGINE_ON description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb SESSION_BEGIN description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onStopTrackingCb(LocationError error)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb SESSION_END description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb ENGINE_OFF description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out)
+{
+ memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
+ out.numSvs = in.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];
+ convertGnssSvid(in.gnssSvs[i], info.svid);
+ convertGnssConstellationType(in.gnssSvs[i].type, info.constellation);
+ info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
+ info.elevationDegrees = in.gnssSvs[i].elevation;
+ info.azimuthDegrees = in.gnssSvs[i].azimuth;
+ info.carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
+ info.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/location_api/GnssAPIClient.h b/gps/android/1.0/location_api/GnssAPIClient.h
new file mode 100644
index 0000000..427b0db
--- /dev/null
+++ b/gps/android/1.0/location_api/GnssAPIClient.h
@@ -0,0 +1,110 @@
+/* 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 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.0/IGnssNiCallback.h>
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::sp;
+
+class GnssAPIClient : public LocationAPIClientBase
+{
+public:
+ GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
+ GnssAPIClient(const GnssAPIClient&) = delete;
+ GnssAPIClient& operator=(const GnssAPIClient&) = delete;
+
+ // for GpsInterface
+ void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
+ bool gnssStart();
+ bool gnssStop();
+ bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs,
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = 0);
+
+ // for GpsNiInterface
+ void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
+
+ // these apis using LocationAPIControlClient
+ void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
+ void gnssEnable(LocationTechnologyType techType);
+ void gnssDisable();
+ void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
+
+ inline LocationCapabilitiesMask gnssGetCapabilities() const {
+ return mLocationCapabilitiesMask;
+ }
+ void requestCapabilities();
+
+ // callbacks we are interested in
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onTrackingCb(Location location) final;
+ void onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification) final;
+ void onGnssSvCb(GnssSvNotification gnssSvNotification) final;
+ void onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification) final;
+
+ void onStartTrackingCb(LocationError error) final;
+ void onStopTrackingCb(LocationError error) final;
+
+private:
+ virtual ~GnssAPIClient();
+
+ sp<V1_0::IGnssCallback> mGnssCbIface;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
+ std::mutex mMutex;
+ LocationAPIControlClient* mControlClient;
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+ bool mLocationCapabilitiesCached;
+ TrackingOptions mTrackingOptions;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GNSS_API_CLINET_H
diff --git a/gps/android/1.0/location_api/LocationUtil.cpp b/gps/android/1.0/location_api/LocationUtil.cpp
new file mode 100644
index 0000000..d14cdac
--- /dev/null
+++ b/gps/android/1.0/location_api/LocationUtil.cpp
@@ -0,0 +1,264 @@
+/* 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 <LocationUtil.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+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));
+ if (in.flags & LOCATION_HAS_LAT_LONG_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG;
+ out.latitudeDegrees = in.latitude;
+ out.longitudeDegrees = in.longitude;
+ }
+ if (in.flags & LOCATION_HAS_ALTITUDE_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_ALTITUDE;
+ out.altitudeMeters = in.altitude;
+ }
+ if (in.flags & LOCATION_HAS_SPEED_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED;
+ out.speedMetersPerSec = in.speed;
+ }
+ if (in.flags & LOCATION_HAS_BEARING_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING;
+ out.bearingDegrees = in.bearing;
+ }
+ if (in.flags & LOCATION_HAS_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_HORIZONTAL_ACCURACY;
+ out.horizontalAccuracyMeters = in.accuracy;
+ }
+ if (in.flags & LOCATION_HAS_VERTICAL_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_VERTICAL_ACCURACY;
+ out.verticalAccuracyMeters = in.verticalAccuracy;
+ }
+ if (in.flags & LOCATION_HAS_SPEED_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED_ACCURACY;
+ out.speedAccuracyMetersPerSecond = in.speedAccuracy;
+ }
+ if (in.flags & LOCATION_HAS_BEARING_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING_ACCURACY;
+ out.bearingAccuracyDegrees = in.bearingAccuracy;
+ }
+
+ 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;
+ out.latitude = in.latitudeDegrees;
+ out.longitude = in.longitudeDegrees;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE) {
+ out.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ out.altitude = in.altitudeMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED) {
+ out.flags |= LOCATION_HAS_SPEED_BIT;
+ out.speed = in.speedMetersPerSec;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
+ out.flags |= LOCATION_HAS_BEARING_BIT;
+ out.bearing = in.bearingDegrees;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY) {
+ out.flags |= LOCATION_HAS_ACCURACY_BIT;
+ out.accuracy = in.horizontalAccuracyMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
+ out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ out.verticalAccuracy = in.verticalAccuracyMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
+ out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ out.speedAccuracy = in.speedAccuracyMetersPerSecond;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
+ out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ out.bearingAccuracy = in.bearingAccuracyDegrees;
+ }
+
+ out.timestamp = static_cast<uint64_t>(in.timestamp);
+}
+
+void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
+{
+ switch(in) {
+ case GNSS_SV_TYPE_GPS:
+ out = GnssConstellationType::GPS;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = GnssConstellationType::SBAS;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ out = GnssConstellationType::GLONASS;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = GnssConstellationType::QZSS;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = GnssConstellationType::BEIDOU;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = GnssConstellationType::GALILEO;
+ break;
+ case GNSS_SV_TYPE_UNKNOWN:
+ default:
+ out = GnssConstellationType::UNKNOWN;
+ break;
+ }
+}
+
+void convertGnssSvid(GnssSv& in, int16_t& out)
+{
+ switch(in.type){
+ case GNSS_SV_TYPE_GPS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ out = in.svId - GLO_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = in.svId - BDS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = in.svId - GAL_SV_PRN_MIN + 1;
+ break;
+ default:
+ out = in.svId;
+ break;
+ }
+}
+
+void convertGnssSvid(GnssMeasurementsData& in, int16_t& out)
+{
+ switch (in.svType) {
+ case GNSS_SV_TYPE_GPS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ if (in.svId != 255) { // OSN is known
+ out = in.svId - GLO_SV_PRN_MIN + 1;
+ } else { // OSN is not known, report FCN
+ out = in.gloFrequency + 92;
+ }
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = in.svId - BDS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = in.svId - GAL_SV_PRN_MIN + 1;
+ break;
+ default:
+ out = in.svId;
+ break;
+ }
+}
+
+void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
+{
+ switch(in) {
+ case GNSS_EPH_TYPE_EPHEMERIS:
+ out = GnssDebug::SatelliteEphemerisType::EPHEMERIS;
+ break;
+ case GNSS_EPH_TYPE_ALMANAC:
+ out = GnssDebug::SatelliteEphemerisType::ALMANAC_ONLY;
+ break;
+ case GNSS_EPH_TYPE_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisType::NOT_AVAILABLE;
+ break;
+ }
+}
+
+void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out)
+{
+ switch(in) {
+ case GNSS_EPH_SOURCE_DEMODULATED:
+ out = GnssDebug::SatelliteEphemerisSource::DEMODULATED;
+ break;
+ case GNSS_EPH_SOURCE_SUPL_PROVIDED:
+ out = GnssDebug::SatelliteEphemerisSource::SUPL_PROVIDED;
+ break;
+ case GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED:
+ out = GnssDebug::SatelliteEphemerisSource::OTHER_SERVER_PROVIDED;
+ break;
+ case GNSS_EPH_SOURCE_LOCAL:
+ case GNSS_EPH_SOURCE_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisSource::OTHER;
+ break;
+ }
+}
+
+void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out)
+{
+ switch(in) {
+ case GNSS_EPH_HEALTH_GOOD:
+ out = GnssDebug::SatelliteEphemerisHealth::GOOD;
+ break;
+ case GNSS_EPH_HEALTH_BAD:
+ out = GnssDebug::SatelliteEphemerisHealth::BAD;
+ break;
+ case GNSS_EPH_HEALTH_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisHealth::UNKNOWN;
+ break;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/location_api/LocationUtil.h b/gps/android/1.0/location_api/LocationUtil.h
new file mode 100644
index 0000000..f6760e5
--- /dev/null
+++ b/gps/android/1.0/location_api/LocationUtil.h
@@ -0,0 +1,57 @@
+/* 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 LOCATION_UTIL_H
+#define LOCATION_UTIL_H
+
+#include <android/hardware/gnss/1.0/types.h>
+#include <LocationAPI.h>
+#include <GnssDebug.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+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 convertGnssSvid(GnssSv& in, int16_t& out);
+void convertGnssSvid(GnssMeasurementsData& in, int16_t& 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 gnss
+} // namespace hardware
+} // namespace android
+#endif // LOCATION_UTIL_H
diff --git a/gps/android/1.0/location_api/MeasurementAPIClient.cpp b/gps/android/1.0/location_api/MeasurementAPIClient.cpp
new file mode 100644
index 0000000..9b23308
--- /dev/null
+++ b/gps/android/1.0/location_api/MeasurementAPIClient.cpp
@@ -0,0 +1,276 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_MeasurementAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "MeasurementAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssMeasurement;
+using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback;
+
+static void convertGnssData(GnssMeasurementsNotification& in,
+ V1_0::IGnssMeasurementCallback::GnssData& out);
+static void convertGnssMeasurement(GnssMeasurementsData& in,
+ V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
+static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
+
+MeasurementAPIClient::MeasurementAPIClient() :
+ mGnssMeasurementCbIface(nullptr),
+ mTracking(false)
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+MeasurementAPIClient::~MeasurementAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+// for GpsInterface
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface = callback;
+ mMutex.unlock();
+
+ return startTracking();
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::startTracking()
+{
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+ if (mGnssMeasurementCbIface != nullptr) {
+ locationCallbacks.gnssMeasurementsCb =
+ [this](GnssMeasurementsNotification gnssMeasurementsNotification) {
+ onGnssMeasurementsCb(gnssMeasurementsNotification);
+ };
+ }
+
+ locAPISetCallbacks(locationCallbacks);
+
+ TrackingOptions options = {};
+ memset(&options, 0, sizeof(TrackingOptions));
+ options.size = sizeof(TrackingOptions);
+ options.minInterval = 1000;
+ options.mode = GNSS_SUPL_MODE_STANDALONE;
+
+ mTracking = true;
+ LOC_LOGD("%s]: start tracking session", __FUNCTION__);
+ locAPIStartTracking(options);
+ return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
+}
+
+// for GpsMeasurementInterface
+void MeasurementAPIClient::measurementClose() {
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ mTracking = false;
+ locAPIStopTracking();
+}
+
+// callbacks
+void MeasurementAPIClient::onGnssMeasurementsCb(
+ GnssMeasurementsNotification gnssMeasurementsNotification)
+{
+ LOC_LOGD("%s]: (count: %zu active: %d)",
+ __FUNCTION__, gnssMeasurementsNotification.count, mTracking);
+ if (mTracking) {
+ mMutex.lock();
+ sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
+ if (mGnssMeasurementCbIface != nullptr) {
+ gnssMeasurementCbIface = mGnssMeasurementCbIface;
+ }
+ mMutex.unlock();
+
+ if (gnssMeasurementCbIface != nullptr) {
+ V1_0::IGnssMeasurementCallback::GnssData gnssData;
+ convertGnssData(gnssMeasurementsNotification, gnssData);
+ auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from GnssMeasurementCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+static void convertGnssMeasurement(GnssMeasurementsData& in,
+ V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
+{
+ memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
+ if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SNR;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_FREQUENCY;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_CYCLES;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
+ convertGnssSvid(in, out.svid);
+ convertGnssConstellationType(in.svType, out.constellation);
+ out.timeOffsetNs = in.timeOffsetNs;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BIT_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SUBFRAME_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_MSEC_AMBIGUOUS;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SYMBOL_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_STRING_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_BIT_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_SUBFRAME_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1BC_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1C_2ND_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1B_PAGE_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SBAS_SYNC;
+ out.receivedSvTimeInNs = in.receivedSvTimeNs;
+ out.receivedSvTimeUncertaintyInNs = in.receivedSvTimeUncertaintyNs;
+ out.cN0DbHz = in.carrierToNoiseDbHz;
+ out.pseudorangeRateMps = in.pseudorangeRateMps;
+ out.pseudorangeRateUncertaintyMps = in.pseudorangeRateUncertaintyMps;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
+ out.accumulatedDeltaRangeM = in.adrMeters;
+ out.accumulatedDeltaRangeUncertaintyM = in.adrUncertaintyMeters;
+ out.carrierFrequencyHz = in.carrierFrequencyHz;
+ out.carrierCycles = in.carrierCycles;
+ out.carrierPhase = in.carrierPhase;
+ out.carrierPhaseUncertainty = in.carrierPhaseUncertainty;
+ uint8_t indicator =
+ static_cast<uint8_t>(IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_UNKNOWN);
+ if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT)
+ indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_PRESENT;
+ if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT)
+ indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATIOR_NOT_PRESENT;
+ out.multipathIndicator =
+ static_cast<IGnssMeasurementCallback::GnssMultipathIndicator>(indicator);
+ out.snrDb = in.signalToNoiseRatioDb;
+ out.agcLevelDb = in.agcLevelDb;
+}
+
+static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out)
+{
+ memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssClock));
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_LEAP_SECOND;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_TIME_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_FULL_BIAS;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT_UNCERTAINTY;
+ out.leapSecond = in.leapSecond;
+ out.timeNs = in.timeNs;
+ out.timeUncertaintyNs = in.timeUncertaintyNs;
+ out.fullBiasNs = in.fullBiasNs;
+ out.biasNs = in.biasNs;
+ out.biasUncertaintyNs = in.biasUncertaintyNs;
+ out.driftNsps = in.driftNsps;
+ out.driftUncertaintyNsps = in.driftUncertaintyNsps;
+ out.hwClockDiscontinuityCount = in.hwClockDiscontinuityCount;
+}
+
+static void convertGnssData(GnssMeasurementsNotification& in,
+ V1_0::IGnssMeasurementCallback::GnssData& out)
+{
+ out.measurementCount = in.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]);
+ }
+ convertGnssClock(in.clock, out.clock);
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.0/location_api/MeasurementAPIClient.h b/gps/android/1.0/location_api/MeasurementAPIClient.h
new file mode 100644
index 0000000..1b32251
--- /dev/null
+++ b/gps/android/1.0/location_api/MeasurementAPIClient.h
@@ -0,0 +1,77 @@
+/* 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 MEASUREMENT_API_CLINET_H
+#define MEASUREMENT_API_CLINET_H
+
+#include <mutex>
+#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
+#include <android/hardware/gnss/1.0/IGnssMeasurementCallback.h>
+#include <LocationAPIClientBase.h>
+#include <hidl/Status.h>
+#include <gps_extended_c.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::sp;
+
+class MeasurementAPIClient : public LocationAPIClientBase
+{
+public:
+ MeasurementAPIClient();
+ MeasurementAPIClient(const MeasurementAPIClient&) = delete;
+ MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
+
+ // for GpsMeasurementInterface
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback);
+ void measurementClose();
+ Return<IGnssMeasurement::GnssMeasurementStatus> startTracking();
+
+ // callbacks we are interested in
+ void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
+
+private:
+ virtual ~MeasurementAPIClient();
+ std::mutex mMutex;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
+
+ bool mTracking;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // MEASUREMENT_API_CLINET_H
diff --git a/gps/android/1.0/service.cpp b/gps/android/1.0/service.cpp
new file mode 100644
index 0000000..2a6f60f
--- /dev/null
+++ b/gps/android/1.0/service.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.gnss@1.0-service-qti"
+
+#include <android/hardware/gnss/1.0/IGnss.h>
+#include <hidl/LegacySupport.h>
+#include "loc_cfg.h"
+#include "loc_misc_utils.h"
+
+extern "C" {
+#include "vndfwk-detect.h"
+}
+
+#ifdef ARCH_ARM_32
+#define DEFAULT_HW_BINDER_MEM_SIZE 65536
+#endif
+
+using android::hardware::gnss::V1_0::IGnss;
+
+using android::hardware::configureRpcThreadpool;
+using android::hardware::registerPassthroughServiceImplementation;
+using android::hardware::joinRpcThreadpool;
+
+using android::status_t;
+using android::OK;
+
+typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []);
+
+int main() {
+
+ ALOGI("%s", __FUNCTION__);
+
+ int vendorInfo = getVendorEnhancedInfo();
+ bool vendorEnhanced = ( 1 == vendorInfo || 3 == vendorInfo );
+ setVendorEnhanced(vendorEnhanced);
+
+#ifdef ARCH_ARM_32
+ android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
+#endif
+ configureRpcThreadpool(1, true);
+ status_t status;
+
+ status = registerPassthroughServiceImplementation<IGnss>();
+ if (status == OK) {
+ if (vendorEnhanced) {
+ #ifdef LOC_HIDL_VERSION
+ #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so"
+
+ void* libHandle = NULL;
+ vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*)
+ dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main");
+ if (NULL != vendorEnhancedMainMethod) {
+ (*vendorEnhancedMainMethod)(0, NULL);
+ }
+ #else
+ ALOGE("LOC_HIDL_VERSION not defined.");
+ #endif
+ }
+
+ joinRpcThreadpool();
+
+ } else {
+ ALOGE("Error while registering IGnss 1.0 service: %d", status);
+ }
+
+ return 0;
+}
diff --git a/gps/android/1.1/AGnss.cpp b/gps/android/1.1/AGnss.cpp
new file mode 100644
index 0000000..d8f9706
--- /dev/null
+++ b/gps/android/1.1/AGnss.cpp
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_AGnssInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "AGnss.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+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) {
+ case LOC_AGPS_TYPE_SUPL:
+ st.type = IAGnssCallback::AGnssType::TYPE_SUPL;
+ break;
+ case LOC_AGPS_TYPE_C2K:
+ st.type = IAGnssCallback::AGnssType::TYPE_C2K;
+ break;
+ default:
+ LOC_LOGE("invalid type: %d", status.type);
+ return;
+ }
+
+ switch (status.status) {
+ case LOC_GPS_REQUEST_AGPS_DATA_CONN:
+ st.status = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
+ break;
+ case LOC_GPS_RELEASE_AGPS_DATA_CONN:
+ st.status = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
+ break;
+ case LOC_GPS_AGPS_DATA_CONNECTED:
+ st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
+ break;
+ case LOC_GPS_AGPS_DATA_CONN_DONE:
+ st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
+ break;
+ case LOC_GPS_AGPS_DATA_CONN_FAILED:
+ st.status = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
+ break;
+ default:
+ LOC_LOGE("invalid status: %d", status.status);
+ return;
+ }
+ st.ipV4Addr = status.ipV4Addr;
+
+ 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");
+ }
+}
+
+Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return Void();
+ }
+
+ // Save the interface
+ mAGnssCbIface = callback;
+
+ AgpsCbInfo cbInfo = {};
+ cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
+ cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
+
+ mGnss->getGnssInterface()->agpsInit(cbInfo);
+ return Void();
+}
+
+Return<bool> AGnss::dataConnClosed() {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnClosed(LOC_AGPS_TYPE_SUPL);
+ return true;
+}
+
+Return<bool> AGnss::dataConnFailed() {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnFailed(LOC_AGPS_TYPE_SUPL);
+ return true;
+}
+
+Return<bool> AGnss::dataConnOpen(const hidl_string& apn,
+ IAGnss::ApnIpType apnIpType) {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ /* Validate */
+ if(apn.empty()){
+ LOC_LOGE("Invalid APN");
+ return false;
+ }
+
+ LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
+
+ AGpsBearerType bearerType;
+ switch (apnIpType) {
+ case IAGnss::ApnIpType::IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case IAGnss::ApnIpType::IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case IAGnss::ApnIpType::IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnOpen(
+ LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
+ return true;
+}
+
+Return<bool> AGnss::setServer(IAGnssCallback::AGnssType type,
+ const hidl_string& hostname,
+ int32_t port) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
+ config.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
+ if (type == IAGnssCallback::AGnssType::TYPE_SUPL) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL;
+ } else if (type == IAGnssCallback::AGnssType::TYPE_C2K) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_C2K;
+ } else {
+ LOC_LOGE("%s]: invalid AGnssType: %d", __FUNCTION__, static_cast<int>(type));
+ return false;
+ }
+ config.assistanceServer.hostName = strdup(hostname.c_str());
+ config.assistanceServer.port = port;
+ return mGnss->updateConfiguration(config);
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/AGnss.h b/gps/android/1.1/AGnss.h
new file mode 100644
index 0000000..4b599b9
--- /dev/null
+++ b/gps/android/1.1/AGnss.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
+#define ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
+
+#include <android/hardware/gnss/1.0/IAGnss.h>
+#include <hidl/Status.h>
+#include <gps_extended_c.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IAGnss;
+using ::android::hardware::gnss::V1_0::IAGnssCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+struct AGnss : public IAGnss {
+
+ AGnss(Gnss* gnss);
+ ~AGnss();
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IAGnss interface follow.
+ * These declarations were generated from IAGnss.hal.
+ */
+ Return<void> setCallback(const sp<IAGnssCallback>& callback) override;
+
+ Return<bool> dataConnClosed() override;
+
+ Return<bool> dataConnFailed() override;
+
+ Return<bool> dataConnOpen(const hidl_string& apn,
+ IAGnss::ApnIpType apnIpType) override;
+
+ 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;
+ sp<IAGnssCallback> mAGnssCbIface = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
diff --git a/gps/android/1.1/AGnssRil.cpp b/gps/android/1.1/AGnssRil.cpp
new file mode 100644
index 0000000..1e774f1
--- /dev/null
+++ b/gps/android/1.1/AGnssRil.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc__AGnssRilInterface"
+
+#include <log_util.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sstream>
+#include <string>
+#include "Gnss.h"
+#include "AGnssRil.h"
+#include <DataItemConcreteTypesBase.h>
+
+typedef void* (getLocationInterface)();
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+
+AGnssRil::AGnssRil(Gnss* gnss) : mGnss(gnss) {
+ ENTRY_LOG_CALLFLOW();
+}
+
+AGnssRil::~AGnssRil() {
+ ENTRY_LOG_CALLFLOW();
+}
+
+Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool /*roaming*/) {
+ ENTRY_LOG_CALLFLOW();
+ // Extra NetworkTypes not available in IAgnssRil enums
+ const int NetworkType_BLUETOOTH = 7;
+ const int NetworkType_ETHERNET = 9;
+ const int NetworkType_PROXY = 16;
+
+ // for XTRA
+ if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
+ 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:
+ {
+ int networkType = (int) type;
+ // Handling network types not available in IAgnssRil
+ switch(networkType)
+ {
+ case NetworkType_BLUETOOTH:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_BLUETOOTH;
+ break;
+ case NetworkType_ETHERNET:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_ETHERNET;
+ break;
+ case NetworkType_PROXY:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_PROXY;
+ break;
+ default:
+ typeout = loc_core::NetworkInfoDataItemBase::TYPE_UNKNOWN;
+ }
+ }
+ break;
+ }
+ mGnss->getGnssInterface()->updateConnectionStatus(connected, false, typeout, 0);
+ }
+ return true;
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/AGnssRil.h b/gps/android/1.1/AGnssRil.h
new file mode 100644
index 0000000..5c9298a
--- /dev/null
+++ b/gps/android/1.1/AGnssRil.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
+#define ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
+
+#include <android/hardware/gnss/1.0/IAGnssRil.h>
+#include <hidl/Status.h>
+#include <location_interface.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IAGnssRil;
+using ::android::hardware::gnss::V1_0::IAGnssRilCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+/*
+ * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface Layer interface
+ * allows the GNSS chipset to request radio interface layer information from Android platform.
+ * Examples of such information are reference location, unique subscriber ID, phone number string
+ * and network availability changes. Also contains wrapper methods to allow methods from
+ * IAGnssiRilCallback interface to be passed into the conventional implementation of the GNSS HAL.
+ */
+struct AGnssRil : public IAGnssRil {
+ AGnssRil(Gnss* gnss);
+ ~AGnssRil();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IAGnssRil follow.
+ * These declarations were generated from IAGnssRil.hal.
+ */
+ Return<void> setCallback(const sp<IAGnssRilCallback>& /*callback*/) override {
+ return Void();
+ }
+ Return<void> setRefLocation(const IAGnssRil::AGnssRefLocation& /*agnssReflocation*/) override {
+ return Void();
+ }
+ Return<bool> setSetId(IAGnssRil::SetIDType /*type*/, const hidl_string& /*setid*/) override {
+ return false;
+ }
+ Return<bool> updateNetworkAvailability(bool /*available*/,
+ const hidl_string& /*apn*/) override {
+ return false;
+ }
+ Return<bool> updateNetworkState(bool connected, NetworkType type, bool roaming) override;
+
+ private:
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_AGNSSRIL_H_
diff --git a/gps/android/1.1/Android.mk b/gps/android/1.1/Android.mk
new file mode 100644
index 0000000..132c1e1
--- /dev/null
+++ b/gps/android/1.1/Android.mk
@@ -0,0 +1,105 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@1.1-impl-qti
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ AGnss.cpp \
+ Gnss.cpp \
+ GnssBatching.cpp \
+ GnssGeofencing.cpp \
+ GnssMeasurement.cpp \
+ GnssNi.cpp \
+ GnssConfiguration.cpp \
+ GnssDebug.cpp \
+ AGnssRil.cpp
+
+LOCAL_SRC_FILES += \
+ location_api/LocationUtil.cpp \
+ location_api/GnssAPIClient.cpp \
+ location_api/GeofenceAPIClient.cpp \
+ location_api/BatchingAPIClient.cpp \
+ location_api/MeasurementAPIClient.cpp \
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/location_api
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers \
+ liblocbatterylistener_headers
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libcutils \
+ libutils \
+ android.hardware.gnss@1.0 \
+ android.hardware.gnss@1.1 \
+ android.hardware.health@1.0 \
+ android.hardware.health@2.0 \
+ android.hardware.power@1.2 \
+ libbase
+
+LOCAL_SHARED_LIBRARIES += \
+ libloc_core \
+ libgps.utils \
+ libdl \
+ liblocation_api \
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+LOCAL_STATIC_LIBRARIES := liblocbatterylistener
+LOCAL_STATIC_LIBRARIES += libhealthhalutils
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@1.1-service-qti
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@1.1-service-qti.xml
+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 \
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/location_api
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libdl \
+ libbase \
+ libutils \
+ libgps.utils \
+ libqti_vndfwk_detect \
+
+LOCAL_SHARED_LIBRARIES += \
+ libhwbinder \
+ libhidlbase \
+ libhidltransport \
+ android.hardware.gnss@1.0 \
+ android.hardware.gnss@1.1 \
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+
+ifneq ($(LOC_HIDL_VERSION),)
+LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
+endif
+
+include $(BUILD_EXECUTABLE)
diff --git a/gps/android/1.1/Gnss.cpp b/gps/android/1.1/Gnss.cpp
new file mode 100644
index 0000000..0babbc4
--- /dev/null
+++ b/gps/android/1.1/Gnss.cpp
@@ -0,0 +1,470 @@
+/*
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssInterface"
+#define LOG_NDEBUG 0
+
+#include <fstream>
+#include <log_util.h>
+#include <dlfcn.h>
+#include <cutils/properties.h>
+#include "Gnss.h"
+#include <LocationUtil.h>
+
+#include "battery_listener.h"
+#include "loc_misc_utils.h"
+
+typedef const GnssInterface* (getLocationInterface)();
+
+#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
+#define DELIMITER ";"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+static sp<Gnss> sGnss;
+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);
+ if (mGnss != nullptr) {
+ mGnss->stop();
+ mGnss->cleanup();
+ }
+}
+
+void location_on_battery_status_changed(bool charging) {
+ LOC_LOGd("battery status changed to %s charging", charging ? "" : "not");
+ if (sGnss != nullptr) {
+ sGnss->getGnssInterface()->updateBatteryStatus(charging);
+ }
+}
+Gnss::Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ sGnss = this;
+ // initilize gnss interface at first in case needing notify battery status
+ sGnss->getGnssInterface()->initialize();
+ // register health client to listen on battery change
+ loc_extn_battery_properties_listener_init(location_on_battery_status_changed);
+ // clear pending GnssConfig
+ memset(&mPendingConfig, 0, sizeof(GnssConfig));
+
+ mGnssDeathRecipient = new GnssDeathRecipient(this);
+}
+
+Gnss::~Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+ sGnss = nullptr;
+}
+
+GnssAPIClient* Gnss::getApi() {
+ if (mApi == nullptr && (mGnssCbIface != nullptr || mGnssNiCbIface != nullptr)) {
+ mApi = new GnssAPIClient(mGnssCbIface, mGnssNiCbIface);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s] faild to create GnssAPIClient", __FUNCTION__);
+ return mApi;
+ }
+
+ if (mPendingConfig.size == sizeof(GnssConfig)) {
+ // we have pending GnssConfig
+ mApi->gnssConfigurationUpdate(mPendingConfig);
+ // clear size to invalid mPendingConfig
+ mPendingConfig.size = 0;
+ if (mPendingConfig.assistanceServer.hostName != nullptr) {
+ free((void*)mPendingConfig.assistanceServer.hostName);
+ }
+ }
+ }
+ if (mApi == nullptr) {
+ LOC_LOGW("%s] GnssAPIClient is not ready", __FUNCTION__);
+ }
+ return mApi;
+}
+
+const GnssInterface* Gnss::getGnssInterface() {
+ static bool getGnssInterfaceFailed = false;
+ if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
+ void * libHandle = nullptr;
+ getLocationInterface* getter = (getLocationInterface*)
+ dlGetSymFromLib(libHandle, "libgnss.so", "getGnssInterface");
+
+ if (nullptr == getter) {
+ getGnssInterfaceFailed = true;
+ } else {
+ mGnssInterface = (GnssInterface*)(*getter)();
+ }
+ }
+ return mGnssInterface;
+}
+
+Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
+ }
+ mGnssCbIface = callback;
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
+ }
+
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
+ api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
+ api->requestCapabilities();
+ }
+ return true;
+}
+
+Return<bool> Gnss::setGnssNiCb(const sp<IGnssNiCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+ mGnssNiCbIface = callback;
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
+ }
+ return true;
+}
+
+Return<bool> Gnss::updateConfiguration(GnssConfig& gnssConfig) {
+ ENTRY_LOG_CALLFLOW();
+ GnssAPIClient* api = getApi();
+ if (api) {
+ api->gnssConfigurationUpdate(gnssConfig);
+ } else if (gnssConfig.flags != 0) {
+ // api is not ready yet, update mPendingConfig with gnssConfig
+ mPendingConfig.size = sizeof(GnssConfig);
+
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
+ mPendingConfig.gpsLock = gnssConfig.gpsLock;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
+ mPendingConfig.suplVersion = gnssConfig.suplVersion;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
+ mPendingConfig.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
+ mPendingConfig.assistanceServer.type = gnssConfig.assistanceServer.type;
+ if (mPendingConfig.assistanceServer.hostName != nullptr) {
+ free((void*)mPendingConfig.assistanceServer.hostName);
+ mPendingConfig.assistanceServer.hostName =
+ strdup(gnssConfig.assistanceServer.hostName);
+ }
+ mPendingConfig.assistanceServer.port = gnssConfig.assistanceServer.port;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
+ mPendingConfig.lppProfile = gnssConfig.lppProfile;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
+ mPendingConfig.lppeControlPlaneMask = gnssConfig.lppeControlPlaneMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT;
+ mPendingConfig.lppeUserPlaneMask = gnssConfig.lppeUserPlaneMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
+ mPendingConfig.aGlonassPositionProtocolMask = gnssConfig.aGlonassPositionProtocolMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
+ mPendingConfig.emergencyPdnForEmergencySupl = gnssConfig.emergencyPdnForEmergencySupl;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
+ mPendingConfig.suplEmergencyServices = gnssConfig.suplEmergencyServices;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
+ mPendingConfig.suplModeMask = gnssConfig.suplModeMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
+ mPendingConfig.blacklistedSvIds = gnssConfig.blacklistedSvIds;
+ }
+ }
+ return true;
+}
+
+Return<bool> Gnss::start() {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssStart();
+ }
+ return retVal;
+}
+
+Return<bool> Gnss::stop() {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssStop();
+ }
+ return retVal;
+}
+
+Return<void> Gnss::cleanup() {
+ ENTRY_LOG_CALLFLOW();
+
+ if (mApi != nullptr) {
+ mApi->gnssDisable();
+ }
+
+ return Void();
+}
+
+Return<bool> Gnss::injectLocation(double latitudeDegrees,
+ double longitudeDegrees,
+ float accuracyMeters) {
+ ENTRY_LOG_CALLFLOW();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ gnssInterface->injectLocation(latitudeDegrees, longitudeDegrees, accuracyMeters);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
+ int32_t uncertaintyMs) {
+ ENTRY_LOG_CALLFLOW();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if ((nullptr != gnssInterface) && (gnssInterface->isSS5HWEnabled())) {
+ gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
+ }
+ return true;
+}
+
+Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
+ ENTRY_LOG_CALLFLOW();
+ GnssAPIClient* api = getApi();
+ if (api) {
+ api->gnssDeleteAidingData(aidingDataFlags);
+ }
+ return Void();
+}
+
+Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs) {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
+ preferredAccuracyMeters, preferredTimeMs);
+ }
+ return retVal;
+}
+
+Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
+ ENTRY_LOG_CALLFLOW();
+ mAGnssIface = new AGnss(this);
+ return mAGnssIface;
+}
+
+Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssNi = new GnssNi(this);
+ return mGnssNi;
+}
+
+Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+}
+
+Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssConfig = new GnssConfiguration(this);
+ return mGnssConfig;
+}
+
+Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssGeofencingIface = new GnssGeofencing();
+ return mGnssGeofencingIface;
+}
+
+Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ mGnssBatching = new GnssBatching();
+ return mGnssBatching;
+}
+
+Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssDebug = new GnssDebug(this);
+ return mGnssDebug;
+}
+
+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;
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
+ odcpiRequestCb(odcpiRequest);
+ };
+ gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
+ }
+ 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();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ GnssPowerMode powerMode = lowPowerMode?
+ GNSS_POWER_MODE_M4 : GNSS_POWER_MODE_M2;
+ retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
+ preferredAccuracyMeters, preferredTimeMs, powerMode, minIntervalMs);
+ }
+ return retVal;
+}
+
+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();
+ const 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 (ODCPI_REQUEST_TYPE_STOP == request.type) {
+ return;
+ }
+ 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.");
+ }
+}
+
+V1_0::IGnss* HIDL_FETCH_IGnss(const char* hal) {
+ ENTRY_LOG_CALLFLOW();
+ V1_0::IGnss* iface = nullptr;
+ iface = new Gnss();
+ if (iface == nullptr) {
+ LOC_LOGE("%s]: failed to get %s", __FUNCTION__, hal);
+ }
+ return iface;
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/Gnss.h b/gps/android/1.1/Gnss.h
new file mode 100644
index 0000000..15645eb
--- /dev/null
+++ b/gps/android/1.1/Gnss.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2017-2018-2018-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
+
+#include <AGnss.h>
+#include <AGnssRil.h>
+#include <GnssBatching.h>
+#include <GnssConfiguration.h>
+#include <GnssGeofencing.h>
+#include <GnssMeasurement.h>
+#include <GnssNi.h>
+#include <GnssDebug.h>
+
+#include <android/hardware/gnss/1.1/IGnss.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <GnssAPIClient.h>
+#include <location_interface.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+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::sp;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+
+struct Gnss : public IGnss {
+ Gnss();
+ ~Gnss();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnss follow.
+ * These declarations were generated from Gnss.hal.
+ */
+ Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
+ Return<bool> start() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+ Return<bool> injectLocation(double latitudeDegrees,
+ double longitudeDegrees,
+ float accuracyMeters) override;
+ Return<bool> injectTime(int64_t timeMs,
+ int64_t timeReferenceMs,
+ int32_t uncertaintyMs) override;
+ 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<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<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
+
+ inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
+ return nullptr;
+ }
+
+ inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
+ return nullptr;
+ }
+
+ 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();
+ Return<bool> setGnssNiCb(const sp<IGnssNiCallback>& niCb);
+ Return<bool> updateConfiguration(GnssConfig& gnssConfig);
+ const GnssInterface* getGnssInterface();
+
+ // Callback for ODCPI request
+ void odcpiRequestCb(const OdcpiRequestInfo& request);
+
+ private:
+ struct GnssDeathRecipient : hidl_death_recipient {
+ GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
+ }
+ ~GnssDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<Gnss> mGnss;
+ };
+
+ private:
+ sp<GnssDeathRecipient> mGnssDeathRecipient = nullptr;
+
+ sp<AGnss> mAGnssIface = nullptr;
+ sp<GnssNi> mGnssNi = nullptr;
+ sp<GnssMeasurement> mGnssMeasurement = nullptr;
+ sp<GnssConfiguration> mGnssConfig = nullptr;
+ sp<GnssGeofencing> mGnssGeofencingIface = nullptr;
+ sp<GnssBatching> mGnssBatching = nullptr;
+ sp<IGnssDebug> mGnssDebug = nullptr;
+ sp<AGnssRil> mGnssRil = nullptr;
+
+ GnssAPIClient* mApi = nullptr;
+ sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
+ sp<V1_1::IGnssCallback> mGnssCbIface_1_1 = nullptr;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
+ GnssConfig mPendingConfig;
+ const GnssInterface* mGnssInterface = nullptr;
+};
+
+extern "C" V1_0::IGnss* HIDL_FETCH_IGnss(const char* name);
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSS_H
diff --git a/gps/android/1.1/GnssBatching.cpp b/gps/android/1.1/GnssBatching.cpp
new file mode 100644
index 0000000..8ab264d
--- /dev/null
+++ b/gps/android/1.1/GnssBatching.cpp
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssBatchingInterface"
+
+#include <log_util.h>
+#include <BatchingAPIClient.h>
+#include "GnssBatching.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+void GnssBatching::GnssBatchingDeathRecipient::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);
+ if (mGnssBatching != nullptr) {
+ mGnssBatching->stop();
+ mGnssBatching->cleanup();
+ }
+}
+
+GnssBatching::GnssBatching() : mApi(nullptr) {
+ mGnssBatchingDeathRecipient = new GnssBatchingDeathRecipient(this);
+}
+
+GnssBatching::~GnssBatching() {
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
+ if (mApi != nullptr) {
+ LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
+ mApi->destroy();
+ mApi = nullptr;
+ }
+
+ mApi = new BatchingAPIClient(callback);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
+ return false;
+ }
+
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
+ }
+ mGnssBatchingCbIface = callback;
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->linkToDeath(mGnssBatchingDeathRecipient, 0 /*cookie*/);
+ }
+
+ return true;
+}
+
+Return<uint16_t> GnssBatching::getBatchSize() {
+ uint16_t ret = 0;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->getBatchSize();
+ }
+ return ret;
+}
+
+Return<bool> GnssBatching::start(const IGnssBatching::Options& options) {
+ bool ret = false;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->startSession(options);
+ }
+ return ret;
+}
+
+Return<void> GnssBatching::flush() {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->flushBatchedLocations();
+ }
+ return Void();
+}
+
+Return<bool> GnssBatching::stop() {
+ bool ret = false;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->stopSession();
+ }
+ return ret;
+}
+
+Return<void> GnssBatching::cleanup() {
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/GnssBatching.h b/gps/android/1.1/GnssBatching.h
new file mode 100644
index 0000000..8e235d8
--- /dev/null
+++ b/gps/android/1.1/GnssBatching.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
+
+#include <android/hardware/gnss/1.0/IGnssBatching.h>
+#include <hidl/Status.h>
+
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssBatching;
+using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
+using ::android::hidl::base::V1_0::IBase;
+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::sp;
+
+class BatchingAPIClient;
+struct GnssBatching : public IGnssBatching {
+ GnssBatching();
+ ~GnssBatching();
+
+ // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+ Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
+ Return<uint16_t> getBatchSize() override;
+ Return<bool> start(const IGnssBatching::Options& options ) override;
+ Return<void> flush() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+
+ private:
+ struct GnssBatchingDeathRecipient : hidl_death_recipient {
+ GnssBatchingDeathRecipient(sp<GnssBatching> gnssBatching) :
+ mGnssBatching(gnssBatching) {
+ }
+ ~GnssBatchingDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssBatching> mGnssBatching;
+ };
+
+ private:
+ sp<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
+ sp<IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
+ BatchingAPIClient* mApi = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
diff --git a/gps/android/1.1/GnssConfiguration.cpp b/gps/android/1.1/GnssConfiguration.cpp
new file mode 100644
index 0000000..708e2c1
--- /dev/null
+++ b/gps/android/1.1/GnssConfiguration.cpp
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssConfigurationInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssConfiguration.h"
+#include <android/hardware/gnss/1.0/types.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::GnssConstellationType;
+
+GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
+}
+
+// Methods from ::android::hardware::gps::V1_0::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setSuplEs(bool enabled) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
+ config.suplEmergencyServices = (enabled ?
+ GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES :
+ GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO);
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setSuplVersion(uint32_t version) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
+ switch (version) {
+ case 0x00020004:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_4;
+ break;
+ case 0x00020002:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_2;
+ break;
+ case 0x00020000:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_0;
+ break;
+ case 0x00010000:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_1_0_0;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid version: 0x%x.", __FUNCTION__, version);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setSuplMode(uint8_t mode) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
+ switch (mode) {
+ case 0:
+ config.suplModeMask = 0; // STANDALONE ONLY
+ break;
+ case 1:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT;
+ break;
+ case 2:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSA_BIT;
+ break;
+ case 3:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT | GNSS_CONFIG_SUPL_MODE_MSA_BIT;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid mode: %d.", __FUNCTION__, mode);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
+ switch (lppProfile) {
+ case 0:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
+ break;
+ case 1:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE;
+ break;
+ case 2:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE;
+ break;
+ case 3:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid lppProfile: %d.", __FUNCTION__, lppProfile);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+
+ config.flags = GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
+ if (protocol & (1<<0)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRC_CONTROL_PLANE_BIT;
+ }
+ if (protocol & (1<<1)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRLP_USER_PLANE_BIT;
+ }
+ if (protocol & (1<<2)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_USER_PLANE_BIT;
+ }
+ if (protocol & (1<<3)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_CONTROL_PLANE_BIT;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
+ switch (lock) {
+ case 0:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
+ break;
+ case 1:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO;
+ break;
+ case 2:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI;
+ break;
+ case 3:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
+ config.emergencyPdnForEmergencySupl = (enabled ?
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES :
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO);
+
+ 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();
+ if (nullptr == mGnss) {
+ LOC_LOGe("mGnss is null");
+ return false;
+ }
+
+ // blValid is true if blacklist is empty, i.e. clearing the BL;
+ // if blacklist is not empty, blValid is initialied to false, and later
+ // updated in the for loop to become true only if there is at least
+ // one {constellation, svid} in the list that is valid.
+ bool blValid = (0 == blacklist.size());
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
+ config.blacklistedSvIds.clear();
+
+ GnssSvIdSource source = {};
+ for (int idx = 0; idx < (int)blacklist.size(); idx++) {
+ // Set blValid true if any one source is valid
+ blValid = setBlacklistedSource(source, blacklist[idx]) || blValid;
+ config.blacklistedSvIds.push_back(source);
+ }
+
+ // Update configuration only if blValid is true
+ // i.e. only if atleast one source is valid for blacklisting
+ return (blValid && mGnss->updateConfiguration(config));
+}
+
+bool GnssConfiguration::setBlacklistedSource(
+ GnssSvIdSource& copyToSource,
+ const GnssConfiguration::BlacklistedSource& copyFromSource) {
+
+ bool retVal = true;
+ uint16_t svIdOffset = 0;
+ copyToSource.size = sizeof(GnssSvIdSource);
+ copyToSource.svId = copyFromSource.svid;
+
+ switch(copyFromSource.constellation) {
+ case GnssConstellationType::GPS:
+ copyToSource.constellation = GNSS_SV_TYPE_GPS;
+ LOC_LOGe("GPS SVs can't be blacklisted.");
+ retVal = false;
+ break;
+ case GnssConstellationType::SBAS:
+ copyToSource.constellation = GNSS_SV_TYPE_SBAS;
+ LOC_LOGe("SBAS SVs can't be blacklisted.");
+ retVal = false;
+ break;
+ case GnssConstellationType::GLONASS:
+ copyToSource.constellation = GNSS_SV_TYPE_GLONASS;
+ svIdOffset = GNSS_SV_CONFIG_GLO_INITIAL_SV_ID - 1;
+ break;
+ case GnssConstellationType::QZSS:
+ copyToSource.constellation = GNSS_SV_TYPE_QZSS;
+ svIdOffset = 0;
+ break;
+ case GnssConstellationType::BEIDOU:
+ copyToSource.constellation = GNSS_SV_TYPE_BEIDOU;
+ svIdOffset = GNSS_SV_CONFIG_BDS_INITIAL_SV_ID - 1;
+ break;
+ case GnssConstellationType::GALILEO:
+ copyToSource.constellation = GNSS_SV_TYPE_GALILEO;
+ svIdOffset = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID - 1;
+ break;
+ default:
+ copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
+ LOC_LOGe("Invalid constellation %d", copyFromSource.constellation);
+ retVal = false;
+ break;
+ }
+
+ if (copyToSource.svId > 0 && svIdOffset > 0) {
+ copyToSource.svId += svIdOffset;
+ }
+
+ return retVal;
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/GnssConfiguration.h b/gps/android/1.1/GnssConfiguration.h
new file mode 100644
index 0000000..96681b6
--- /dev/null
+++ b/gps/android/1.1/GnssConfiguration.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+
+ /* Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
+
+#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_1::IGnssConfiguration;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+/*
+ * Interface for passing GNSS configuration info from platform to HAL.
+ */
+struct Gnss;
+struct GnssConfiguration : public IGnssConfiguration {
+ GnssConfiguration(Gnss* gnss);
+ ~GnssConfiguration() = default;
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
+ * These declarations were generated from IGnssConfiguration.hal.
+ */
+ Return<bool> setSuplVersion(uint32_t version) override;
+ Return<bool> setSuplMode(uint8_t mode) override;
+ Return<bool> setSuplEs(bool enabled) override;
+ Return<bool> setLppProfile(uint8_t lppProfile) override;
+ Return<bool> setGlonassPositioningProtocol(uint8_t protocol) override;
+ 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;
+ bool setBlacklistedSource(
+ GnssSvIdSource& copyToSource,
+ const GnssConfiguration::BlacklistedSource& copyFromSource);
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
diff --git a/gps/android/1.1/GnssDebug.cpp b/gps/android/1.1/GnssDebug.cpp
new file mode 100644
index 0000000..f164c54
--- /dev/null
+++ b/gps/android/1.1/GnssDebug.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssDebugInterface"
+
+#include <log/log.h>
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssDebug.h"
+#include "LocationUtil.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::hidl_vec;
+
+#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_MIN (999) // 999 ns
+#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX (1.57783680E17) // 5 years in ns
+#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm
+
+GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
+{
+}
+
+/*
+ * This methods requests position, time and satellite ephemeris debug information
+ * from the HAL.
+ *
+ * @return void
+*/
+Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ DebugData data = { };
+
+ if((nullptr == mGnss) || (nullptr == mGnss->getGnssInterface())){
+ LOC_LOGE("GnssDebug - Null GNSS interface");
+ _hidl_cb(data);
+ return Void();
+ }
+
+ // get debug report snapshot via hal interface
+ GnssDebugReport reports = { };
+ mGnss->getGnssInterface()->getDebugReport(reports);
+
+ // location block
+ if (reports.mLocation.mValid) {
+ data.position.valid = true;
+ data.position.latitudeDegrees = reports.mLocation.mLocation.latitude;
+ data.position.longitudeDegrees = reports.mLocation.mLocation.longitude;
+ data.position.altitudeMeters = reports.mLocation.mLocation.altitude;
+
+ data.position.speedMetersPerSec =
+ (double)(reports.mLocation.mLocation.speed);
+ data.position.bearingDegrees =
+ (double)(reports.mLocation.mLocation.bearing);
+ data.position.horizontalAccuracyMeters =
+ (double)(reports.mLocation.mLocation.accuracy);
+ data.position.verticalAccuracyMeters =
+ reports.mLocation.verticalAccuracyMeters;
+ data.position.speedAccuracyMetersPerSecond =
+ reports.mLocation.speedAccuracyMetersPerSecond;
+ data.position.bearingAccuracyDegrees =
+ reports.mLocation.bearingAccuracyDegrees;
+
+ timeval tv_now, tv_report;
+ tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
+ tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
+ gettimeofday(&tv_now, NULL);
+ data.position.ageSeconds =
+ (tv_now.tv_sec - tv_report.tv_sec) +
+ (float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
+ }
+ else {
+ 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;
+ }
+
+ // time block
+ if (reports.mTime.mValid) {
+ data.time.timeEstimate = reports.mTime.timeEstimate;
+ data.time.timeUncertaintyNs = reports.mTime.timeUncertaintyNs;
+ data.time.frequencyUncertaintyNsPerSec =
+ reports.mTime.frequencyUncertaintyNsPerSec;
+ }
+
+ if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
+ data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
+ }
+ if (data.time.timeUncertaintyNs <= 0) {
+ data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MIN;
+ } else if (data.time.timeUncertaintyNs > GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX) {
+ data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX;
+ }
+ 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
+ SatelliteData s = { };
+ std::vector<SatelliteData> s_array = { };
+
+ for (uint32_t i=0; i<reports.mSatelliteInfo.size(); i++) {
+ memset(&s, 0, sizeof(s));
+ s.svid = reports.mSatelliteInfo[i].svid;
+ convertGnssConstellationType(
+ reports.mSatelliteInfo[i].constellation, s.constellation);
+ convertGnssEphemerisType(
+ reports.mSatelliteInfo[i].mEphemerisType, s.ephemerisType);
+ convertGnssEphemerisSource(
+ reports.mSatelliteInfo[i].mEphemerisSource, s.ephemerisSource);
+ convertGnssEphemerisHealth(
+ reports.mSatelliteInfo[i].mEphemerisHealth, s.ephemerisHealth);
+
+ s.ephemerisAgeSeconds =
+ reports.mSatelliteInfo[i].ephemerisAgeSeconds;
+ s.serverPredictionIsAvailable =
+ reports.mSatelliteInfo[i].serverPredictionIsAvailable;
+ s.serverPredictionAgeSeconds =
+ reports.mSatelliteInfo[i].serverPredictionAgeSeconds;
+
+ s_array.push_back(s);
+ }
+ data.satelliteDataArray = s_array;
+
+ // callback HIDL with collected debug data
+ _hidl_cb(data);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/GnssDebug.h b/gps/android/1.1/GnssDebug.h
new file mode 100644
index 0000000..cb818ac
--- /dev/null
+++ b/gps/android/1.1/GnssDebug.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
+
+
+#include <android/hardware/gnss/1.0/IGnssDebug.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssDebug;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+/* Interface for GNSS Debug support. */
+struct Gnss;
+struct GnssDebug : public IGnssDebug {
+ GnssDebug(Gnss* gnss);
+ ~GnssDebug() {};
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
+ * These declarations were generated from IGnssDebug.hal.
+ */
+ Return<void> getDebugData(getDebugData_cb _hidl_cb) override;
+
+private:
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSDEBUG_H
diff --git a/gps/android/1.1/GnssGeofencing.cpp b/gps/android/1.1/GnssGeofencing.cpp
new file mode 100644
index 0000000..a4aaf88
--- /dev/null
+++ b/gps/android/1.1/GnssGeofencing.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssHal_GnssGeofencing"
+
+#include <log_util.h>
+#include <GeofenceAPIClient.h>
+#include "GnssGeofencing.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+void GnssGeofencing::GnssGeofencingDeathRecipient::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);
+ if (mGnssGeofencing != nullptr) {
+ mGnssGeofencing->removeAllGeofences();
+ }
+}
+
+GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
+ mGnssGeofencingDeathRecipient = new GnssGeofencingDeathRecipient(this);
+}
+
+GnssGeofencing::~GnssGeofencing() {
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
+Return<void> GnssGeofencing::setCallback(const sp<IGnssGeofenceCallback>& callback) {
+ if (mApi != nullptr) {
+ LOC_LOGd("mApi is NOT nullptr");
+ return Void();
+ }
+
+ mApi = new GeofenceAPIClient(callback);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
+ }
+
+ if (mGnssGeofencingCbIface != nullptr) {
+ mGnssGeofencingCbIface->unlinkToDeath(mGnssGeofencingDeathRecipient);
+ }
+ mGnssGeofencingCbIface = callback;
+ if (mGnssGeofencingCbIface != nullptr) {
+ mGnssGeofencingCbIface->linkToDeath(mGnssGeofencingDeathRecipient, 0 /*cookie*/);
+ }
+
+ return Void();
+}
+
+Return<void> GnssGeofencing::addGeofence(
+ int32_t geofenceId,
+ double latitudeDegrees,
+ double longitudeDegrees,
+ double radiusMeters,
+ IGnssGeofenceCallback::GeofenceTransition lastTransition,
+ int32_t monitorTransitions,
+ uint32_t notificationResponsivenessMs,
+ uint32_t unknownTimerMs) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceAdd(
+ geofenceId,
+ latitudeDegrees,
+ longitudeDegrees,
+ radiusMeters,
+ static_cast<int32_t>(lastTransition),
+ monitorTransitions,
+ notificationResponsivenessMs,
+ unknownTimerMs);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::pauseGeofence(int32_t geofenceId) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofencePause(geofenceId);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceResume(geofenceId, monitorTransitions);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::removeGeofence(int32_t geofenceId) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceRemove(geofenceId);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::removeAllGeofences() {
+ if (mApi == nullptr) {
+ LOC_LOGD("%s]: mApi is nullptr, do nothing", __FUNCTION__);
+ } else {
+ mApi->geofenceRemoveAll();
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/GnssGeofencing.h b/gps/android/1.1/GnssGeofencing.h
new file mode 100644
index 0000000..94a73de
--- /dev/null
+++ b/gps/android/1.1/GnssGeofencing.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
+
+#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
+using ::android::hardware::gnss::V1_0::IGnssGeofencing;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+class GeofenceAPIClient;
+struct GnssGeofencing : public IGnssGeofencing {
+ GnssGeofencing();
+ ~GnssGeofencing();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
+ * These declarations were generated from IGnssGeofencing.hal.
+ */
+ Return<void> setCallback(const sp<IGnssGeofenceCallback>& callback) override;
+ Return<void> addGeofence(int32_t geofenceId,
+ double latitudeDegrees,
+ double longitudeDegrees,
+ double radiusMeters,
+ IGnssGeofenceCallback::GeofenceTransition lastTransition,
+ int32_t monitorTransitions,
+ uint32_t notificationResponsivenessMs,
+ uint32_t unknownTimerMs) override;
+
+ Return<void> pauseGeofence(int32_t geofenceId) override;
+ Return<void> resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) override;
+ Return<void> removeGeofence(int32_t geofenceId) override;
+
+ private:
+ // This method is not part of the IGnss base class.
+ // It is called by GnssGeofencingDeathRecipient to remove all geofences added so far.
+ Return<void> removeAllGeofences();
+
+ private:
+ struct GnssGeofencingDeathRecipient : hidl_death_recipient {
+ GnssGeofencingDeathRecipient(sp<GnssGeofencing> gnssGeofencing) :
+ mGnssGeofencing(gnssGeofencing) {
+ }
+ ~GnssGeofencingDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssGeofencing> mGnssGeofencing;
+ };
+
+ private:
+ sp<GnssGeofencingDeathRecipient> mGnssGeofencingDeathRecipient = nullptr;
+ sp<IGnssGeofenceCallback> mGnssGeofencingCbIface = nullptr;
+ GeofenceAPIClient* mApi = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSGEOFENCING_H
diff --git a/gps/android/1.1/GnssMeasurement.cpp b/gps/android/1.1/GnssMeasurement.cpp
new file mode 100644
index 0000000..6f8c14d
--- /dev/null
+++ b/gps/android/1.1/GnssMeasurement.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssMeasurementInterface"
+
+#include <log_util.h>
+#include <MeasurementAPIClient.h>
+#include "GnssMeasurement.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+void GnssMeasurement::GnssMeasurementDeathRecipient::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);
+ if (mGnssMeasurement != nullptr) {
+ mGnssMeasurement->close();
+ }
+}
+
+GnssMeasurement::GnssMeasurement() {
+ mGnssMeasurementDeathRecipient = new GnssMeasurementDeathRecipient(this);
+ mApi = new MeasurementAPIClient();
+}
+
+GnssMeasurement::~GnssMeasurement() {
+ if (mApi) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+
+Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) {
+
+ Return<IGnssMeasurement::GnssMeasurementStatus> ret =
+ IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
+ if (mGnssMeasurementCbIface != 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 = callback;
+ mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+
+ return mApi->measurementSetCallback(callback);
+
+}
+
+Return<void> GnssMeasurement::close() {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ if (mGnssMeasurementCbIface != nullptr) {
+ 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 (nullptr == mApi) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ return ret;
+ }
+
+ mGnssMeasurementCbIface_1_1 = callback;
+ mGnssMeasurementCbIface_1_1->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+
+ GnssPowerMode powerMode = enableFullTracking?
+ GNSS_POWER_MODE_M1 : GNSS_POWER_MODE_M2;
+
+ return mApi->measurementSetCallback_1_1(callback, powerMode);
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/GnssMeasurement.h b/gps/android/1.1/GnssMeasurement.h
new file mode 100644
index 0000000..373f0d0
--- /dev/null
+++ b/gps/android/1.1/GnssMeasurement.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_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_1 {
+namespace implementation {
+
+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;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+class MeasurementAPIClient;
+struct GnssMeasurement : public IGnssMeasurement {
+ GnssMeasurement();
+ ~GnssMeasurement();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+ * These declarations were generated from IGnssMeasurement.hal.
+ */
+ 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) :
+ mGnssMeasurement(gnssMeasurement) {
+ }
+ ~GnssMeasurementDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssMeasurement> mGnssMeasurement;
+ };
+
+ private:
+ sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
+ sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
+ MeasurementAPIClient* mApi;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
diff --git a/gps/android/1.1/GnssNi.cpp b/gps/android/1.1/GnssNi.cpp
new file mode 100644
index 0000000..5ce9569
--- /dev/null
+++ b/gps/android/1.1/GnssNi.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssNiInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssNi.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+void GnssNi::GnssNiDeathRecipient::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);
+ // we do nothing here
+ // Gnss::GnssDeathRecipient will stop the session
+}
+
+GnssNi::GnssNi(Gnss* gnss) : mGnss(gnss) {
+ mGnssNiDeathRecipient = new GnssNiDeathRecipient(this);
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
+Return<void> GnssNi::setCallback(const sp<IGnssNiCallback>& callback) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ mGnss->setGnssNiCb(callback);
+
+ if (mGnssNiCbIface != nullptr) {
+ mGnssNiCbIface->unlinkToDeath(mGnssNiDeathRecipient);
+ }
+ mGnssNiCbIface = callback;
+ if (mGnssNiCbIface != nullptr) {
+ mGnssNiCbIface->linkToDeath(mGnssNiDeathRecipient, 0 /*cookie*/);
+ }
+
+ return Void();
+}
+
+Return<void> GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ GnssAPIClient* api = mGnss->getApi();
+ if (api == nullptr) {
+ LOC_LOGE("%s]: api is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ api->gnssNiRespond(notifId, userResponse);
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/GnssNi.h b/gps/android/1.1/GnssNi.h
new file mode 100644
index 0000000..6733e5b
--- /dev/null
+++ b/gps/android/1.1/GnssNi.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
+#define ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
+
+#include <android/hardware/gnss/1.0/IGnssNi.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssNi;
+using ::android::hardware::gnss::V1_0::IGnssNiCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+struct GnssNi : public IGnssNi {
+ GnssNi(Gnss* gnss);
+ ~GnssNi() = default;
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
+ * These declarations were generated from IGnssNi.hal.
+ */
+ Return<void> setCallback(const sp<IGnssNiCallback>& callback) override;
+ Return<void> respond(int32_t notifId,
+ IGnssNiCallback::GnssUserResponseType userResponse) override;
+
+ private:
+ struct GnssNiDeathRecipient : hidl_death_recipient {
+ GnssNiDeathRecipient(sp<GnssNi> gnssNi) : mGnssNi(gnssNi) {
+ }
+ ~GnssNiDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssNi> mGnssNi;
+ };
+
+ private:
+ sp<GnssNiDeathRecipient> mGnssNiDeathRecipient = nullptr;
+ sp<IGnssNiCallback> mGnssNiCbIface = nullptr;
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H
diff --git a/gps/android/1.1/android.hardware.gnss@1.1-service-qti.rc b/gps/android/1.1/android.hardware.gnss@1.1-service-qti.rc
new file mode 100644
index 0000000..bd65584
--- /dev/null
+++ b/gps/android/1.1/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 vendor_qti_diag
diff --git a/gps/android/1.1/android.hardware.gnss@1.1-service-qti.xml b/gps/android/1.1/android.hardware.gnss@1.1-service-qti.xml
new file mode 100644
index 0000000..c9c83fb
--- /dev/null
+++ b/gps/android/1.1/android.hardware.gnss@1.1-service-qti.xml
@@ -0,0 +1,35 @@
+<!-- Copyright (c) 2019, 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.
+-->
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.gnss</name>
+ <transport>hwbinder</transport>
+ <fqname>@1.1::IGnss/default</fqname>
+ </hal>
+</manifest>
+
diff --git a/gps/android/1.1/location_api/BatchingAPIClient.cpp b/gps/android/1.1/location_api/BatchingAPIClient.cpp
new file mode 100644
index 0000000..82a803f
--- /dev/null
+++ b/gps/android/1.1/location_api/BatchingAPIClient.cpp
@@ -0,0 +1,196 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_BatchingAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "BatchingAPIClient.h"
+
+#include "limits.h"
+
+
+namespace android {
+namespace hardware {
+namespace gnss {
+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);
+
+BatchingAPIClient::BatchingAPIClient(const sp<IGnssBatchingCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssBatchingCbIface(callback),
+ mDefaultId(UINT_MAX),
+ mLocationCapabilitiesMask(0)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+ if (mGnssBatchingCbIface != nullptr) {
+ locationCallbacks.batchingCb = [this](size_t count, Location* location,
+ BatchingOptions batchOptions) {
+ onBatchingCb(count, location, batchOptions);
+ };
+ }
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+BatchingAPIClient::~BatchingAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+int BatchingAPIClient::getBatchSize()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ return locAPIGetBatchSize();
+}
+
+int BatchingAPIClient::startSession(const IGnssBatching::Options& opts)
+{
+ LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
+ static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
+ int retVal = -1;
+ LocationOptions options;
+ convertBatchOption(opts, options, mLocationCapabilitiesMask);
+ uint32_t mode = 0;
+ if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
+ mode = SESSION_MODE_ON_FULL;
+ }
+ if (locAPIStartSession(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts)
+{
+ LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
+ static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
+ int retVal = -1;
+ LocationOptions options;
+ convertBatchOption(opts, options, mLocationCapabilitiesMask);
+
+ uint32_t mode = 0;
+ if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
+ mode = SESSION_MODE_ON_FULL;
+ }
+ if (locAPIUpdateSessionOptions(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+int BatchingAPIClient::stopSession()
+{
+ LOC_LOGD("%s]: ", __FUNCTION__);
+ int retVal = -1;
+ if (locAPIStopSession(mDefaultId) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+void BatchingAPIClient::getBatchedLocation(int last_n_locations)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations);
+ locAPIGetBatchedLocations(mDefaultId, last_n_locations);
+}
+
+void BatchingAPIClient::flushBatchedLocations()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
+}
+
+void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+}
+
+void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
+ BatchingOptions /*batchOptions*/)
+{
+ LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
+ if (mGnssBatchingCbIface != nullptr && count > 0) {
+ hidl_vec<GnssLocation> locationVec;
+ locationVec.resize(count);
+ for (size_t i = 0; i < count; i++) {
+ convertGnssLocation(location[i], locationVec[i]);
+ }
+ auto r = mGnssBatchingCbIface->gnssLocationBatchCb(locationVec);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationBatchCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
+ LocationCapabilitiesMask mask)
+{
+ memset(&out, 0, sizeof(LocationOptions));
+ out.size = sizeof(LocationOptions);
+ out.minInterval = (uint32_t)(in.periodNanos / 1000000L);
+ out.minDistance = 0;
+ out.mode = GNSS_SUPL_MODE_STANDALONE;
+ if (mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
+ out.mode = GNSS_SUPL_MODE_MSA;
+ if (mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
+ out.mode = GNSS_SUPL_MODE_MSB;
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/location_api/BatchingAPIClient.h b/gps/android/1.1/location_api/BatchingAPIClient.h
new file mode 100644
index 0000000..4c90626
--- /dev/null
+++ b/gps/android/1.1/location_api/BatchingAPIClient.h
@@ -0,0 +1,75 @@
+/* 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 BATCHING_API_CLINET_H
+#define BATCHING_API_CLINET_H
+
+#include <android/hardware/gnss/1.0/IGnssBatching.h>
+#include <android/hardware/gnss/1.0/IGnssBatchingCallback.h>
+#include <pthread.h>
+
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+class BatchingAPIClient : public LocationAPIClientBase
+{
+public:
+ BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
+ int getBatchSize();
+ 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();
+
+ inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; }
+
+ // callbacks
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
+
+private:
+ ~BatchingAPIClient();
+
+ sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
+ uint32_t mDefaultId;
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // BATCHING_API_CLINET_H
diff --git a/gps/android/1.1/location_api/GeofenceAPIClient.cpp b/gps/android/1.1/location_api/GeofenceAPIClient.cpp
new file mode 100644
index 0000000..93d175e
--- /dev/null
+++ b/gps/android/1.1/location_api/GeofenceAPIClient.cpp
@@ -0,0 +1,275 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_GeofenceApiClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GeofenceAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+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(),
+ mGnssGeofencingCbIface(callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+
+ locationCallbacks.geofenceBreachCb = nullptr;
+ if (mGnssGeofencingCbIface != nullptr) {
+ locationCallbacks.geofenceBreachCb =
+ [this](GeofenceBreachNotification geofenceBreachNotification) {
+ onGeofenceBreachCb(geofenceBreachNotification);
+ };
+
+ locationCallbacks.geofenceStatusCb =
+ [this](GeofenceStatusNotification geofenceStatusNotification) {
+ onGeofenceStatusCb(geofenceStatusNotification);
+ };
+ }
+
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+void GeofenceAPIClient::geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int32_t last_transition, int32_t monitor_transitions,
+ uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms)
+{
+ LOC_LOGD("%s]: (%d %f %f %f %d %d %d %d)", __FUNCTION__,
+ geofence_id, latitude, longitude, radius_meters,
+ last_transition, monitor_transitions, notification_responsiveness_ms, unknown_timer_ms);
+
+ GeofenceOption options;
+ memset(&options, 0, sizeof(GeofenceOption));
+ options.size = sizeof(GeofenceOption);
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
+ options.breachTypeMask |= GEOFENCE_BREACH_ENTER_BIT;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
+ options.breachTypeMask |= GEOFENCE_BREACH_EXIT_BIT;
+ options.responsiveness = notification_responsiveness_ms;
+
+ GeofenceInfo data;
+ data.size = sizeof(GeofenceInfo);
+ data.latitude = latitude;
+ data.longitude = longitude;
+ data.radius = radius_meters;
+
+ LocationError err = (LocationError)locAPIAddGeofences(1, &geofence_id, &options, &data);
+ if (LOCATION_ERROR_SUCCESS != err) {
+ onAddGeofencesCb(1, &err, &geofence_id);
+ }
+}
+
+void GeofenceAPIClient::geofencePause(uint32_t geofence_id)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
+ locAPIPauseGeofences(1, &geofence_id);
+}
+
+void GeofenceAPIClient::geofenceResume(uint32_t geofence_id, int32_t monitor_transitions)
+{
+ LOC_LOGD("%s]: (%d %d)", __FUNCTION__, geofence_id, monitor_transitions);
+ GeofenceBreachTypeMask mask = 0;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
+ mask |= GEOFENCE_BREACH_ENTER_BIT;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
+ mask |= GEOFENCE_BREACH_EXIT_BIT;
+ locAPIResumeGeofences(1, &geofence_id, &mask);
+}
+
+void GeofenceAPIClient::geofenceRemove(uint32_t geofence_id)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
+ locAPIRemoveGeofences(1, &geofence_id);
+}
+
+void GeofenceAPIClient::geofenceRemoveAll()
+{
+ LOC_LOGD("%s]", __FUNCTION__);
+ // TODO locAPIRemoveAllGeofences();
+}
+
+// callbacks
+void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, geofenceBreachNotification.count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < geofenceBreachNotification.count; i++) {
+ GnssLocation gnssLocation;
+ convertGnssLocation(geofenceBreachNotification.location, gnssLocation);
+
+ IGnssGeofenceCallback::GeofenceTransition transition;
+ if (geofenceBreachNotification.type == GEOFENCE_BREACH_ENTER)
+ transition = IGnssGeofenceCallback::GeofenceTransition::ENTERED;
+ else if (geofenceBreachNotification.type == GEOFENCE_BREACH_EXIT)
+ transition = IGnssGeofenceCallback::GeofenceTransition::EXITED;
+ else {
+ // continue with other breach if transition is
+ // nether GPS_GEOFENCE_ENTERED nor GPS_GEOFENCE_EXITED
+ continue;
+ }
+
+ auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
+ geofenceBreachNotification.ids[i], gnssLocation, transition,
+ static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofenceStatusNotification.available);
+ if (mGnssGeofencingCbIface != nullptr) {
+ IGnssGeofenceCallback::GeofenceAvailability status =
+ IGnssGeofenceCallback::GeofenceAvailability::UNAVAILABLE;
+ if (geofenceStatusNotification.available == GEOFENCE_STATUS_AVAILABILE_YES) {
+ status = IGnssGeofenceCallback::GeofenceAvailability::AVAILABLE;
+ }
+ GnssLocation gnssLocation;
+ memset(&gnssLocation, 0, sizeof(GnssLocation));
+ auto r = mGnssGeofencingCbIface->gnssGeofenceStatusCb(status, gnssLocation);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceStatusCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GeofenceAPIClient::onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_EXISTS)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_EXISTS;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceAddCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceAddCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceRemoveCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceRemoveCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofencePauseCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofencePauseCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceResumeCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceResumeCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/location_api/GeofenceAPIClient.h b/gps/android/1.1/location_api/GeofenceAPIClient.h
new file mode 100644
index 0000000..3df50bb
--- /dev/null
+++ b/gps/android/1.1/location_api/GeofenceAPIClient.h
@@ -0,0 +1,76 @@
+/* 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 GEOFENCE_API_CLINET_H
+#define GEOFENCE_API_CLINET_H
+
+
+#include <android/hardware/gnss/1.0/IGnssGeofenceCallback.h>
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::sp;
+
+class GeofenceAPIClient : public LocationAPIClientBase
+{
+public:
+ GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
+ void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int32_t last_transition, int32_t monitor_transitions,
+ uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
+ void geofencePause(uint32_t geofence_id);
+ void geofenceResume(uint32_t geofence_id, int32_t monitor_transitions);
+ void geofenceRemove(uint32_t geofence_id);
+ void geofenceRemoveAll();
+
+ // callbacks
+ void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification) final;
+ void onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification) final;
+ void onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+
+private:
+ virtual ~GeofenceAPIClient() = default;
+
+ sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GEOFENCE_API_CLINET_H
diff --git a/gps/android/1.1/location_api/GnssAPIClient.cpp b/gps/android/1.1/location_api/GnssAPIClient.cpp
new file mode 100644
index 0000000..7aa573b
--- /dev/null
+++ b/gps/android/1.1/location_api/GnssAPIClient.cpp
@@ -0,0 +1,566 @@
+/* Copyright (c) 2017-2019, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_GnssAPIClient"
+#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GnssAPIClient.h"
+#include <LocContext.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+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,
+ const sp<IGnssNiCallback>& niCb) :
+ LocationAPIClientBase(),
+ mGnssCbIface(nullptr),
+ mGnssNiCbIface(nullptr),
+ mControlClient(new LocationAPIControlClient()),
+ mLocationCapabilitiesMask(0),
+ mLocationCapabilitiesCached(false)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ // set default LocationOptions.
+ memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
+ mTrackingOptions.size = sizeof(TrackingOptions);
+ mTrackingOptions.minInterval = 1000;
+ mTrackingOptions.minDistance = 0;
+ mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+
+ gnssUpdateCallbacks(gpsCb, niCb);
+}
+
+GnssAPIClient::~GnssAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ if (mControlClient) {
+ delete mControlClient;
+ mControlClient = nullptr;
+ }
+}
+
+// for GpsInterface
+void GnssAPIClient::gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
+ const sp<IGnssNiCallback>& niCb)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ mMutex.lock();
+ mGnssCbIface = gpsCb;
+ mGnssNiCbIface = niCb;
+ mMutex.unlock();
+
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ if (mGnssCbIface != nullptr) {
+ locationCallbacks.trackingCb = [this](Location location) {
+ onTrackingCb(location);
+ };
+ }
+
+ locationCallbacks.batchingCb = nullptr;
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+
+ locationCallbacks.gnssNiCb = nullptr;
+ loc_core::ContextBase* context =
+ loc_core::LocContext::getLocContext(
+ NULL, NULL,
+ loc_core::LocContext::mLocationHalName, false);
+ if (mGnssNiCbIface != nullptr && !context->hasAgpsExtendedCapabilities()) {
+ LOC_LOGD("Registering NI CB");
+ locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotification) {
+ onGnssNiCb(id, gnssNiNotification);
+ };
+ }
+
+ locationCallbacks.gnssSvCb = nullptr;
+ if (mGnssCbIface != nullptr) {
+ locationCallbacks.gnssSvCb = [this](GnssSvNotification gnssSvNotification) {
+ onGnssSvCb(gnssSvNotification);
+ };
+ }
+
+ locationCallbacks.gnssNmeaCb = nullptr;
+ if (mGnssCbIface != nullptr) {
+ locationCallbacks.gnssNmeaCb = [this](GnssNmeaNotification gnssNmeaNotification) {
+ onGnssNmeaCb(gnssNmeaNotification);
+ };
+ }
+
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+bool GnssAPIClient::gnssStart()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ bool retVal = true;
+ locAPIStartTracking(mTrackingOptions);
+ return retVal;
+}
+
+bool GnssAPIClient::gnssStop()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ bool retVal = true;
+ locAPIStopTracking();
+ return retVal;
+}
+
+bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
+ IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs,
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LOC_LOGD("%s]: (%d %d %d %d %d %d %d)", __FUNCTION__,
+ (int)mode, recurrence, minIntervalMs, preferredAccuracyMeters,
+ preferredTimeMs, (int)powerMode, timeBetweenMeasurement);
+ bool retVal = true;
+ memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
+ mTrackingOptions.size = sizeof(TrackingOptions);
+ mTrackingOptions.minInterval = minIntervalMs;
+ if (IGnss::GnssPositionMode::MS_ASSISTED == mode ||
+ IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
+ // We set a very large interval to simulate SINGLE mode. Once we report a fix,
+ // the caller should take the responsibility to stop the session.
+ // For MSA, we always treat it as SINGLE mode.
+ mTrackingOptions.minInterval = SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC;
+ }
+ if (mode == IGnss::GnssPositionMode::STANDALONE)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+ else if (mode == IGnss::GnssPositionMode::MS_BASED)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_MSB;
+ else if (mode == IGnss::GnssPositionMode::MS_ASSISTED)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_MSA;
+ else {
+ LOC_LOGD("%s]: invalid GnssPositionMode: %d", __FUNCTION__, (int)mode);
+ retVal = false;
+ }
+ if (GNSS_POWER_MODE_INVALID != powerMode) {
+ mTrackingOptions.powerMode = powerMode;
+ mTrackingOptions.tbm = timeBetweenMeasurement;
+ }
+ locAPIUpdateTrackingOptions(mTrackingOptions);
+ return retVal;
+}
+
+// for GpsNiInterface
+void GnssAPIClient::gnssNiRespond(int32_t notifId,
+ IGnssNiCallback::GnssUserResponseType userResponse)
+{
+ LOC_LOGD("%s]: (%d %d)", __FUNCTION__, notifId, static_cast<int>(userResponse));
+ GnssNiResponse data;
+ switch (userResponse) {
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT:
+ data = GNSS_NI_RESPONSE_ACCEPT;
+ break;
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY:
+ data = GNSS_NI_RESPONSE_DENY;
+ break;
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP:
+ data = GNSS_NI_RESPONSE_NO_RESPONSE;
+ break;
+ default:
+ data = GNSS_NI_RESPONSE_IGNORE;
+ break;
+ }
+
+ locAPIGnssNiResponse(notifId, data);
+}
+
+// these apis using LocationAPIControlClient
+void GnssAPIClient::gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags)
+{
+ LOC_LOGD("%s]: (%02hx)", __FUNCTION__, aidingDataFlags);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ GnssAidingData data;
+ memset(&data, 0, sizeof (GnssAidingData));
+ data.sv.svTypeMask = GNSS_AIDING_DATA_SV_TYPE_GPS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT;
+ data.posEngineMask = STANDARD_POSITIONING_ENGINE;
+
+ if (aidingDataFlags == IGnss::GnssAidingData::DELETE_ALL)
+ data.deleteAll = true;
+ else {
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_EPHEMERIS)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_ALMANAC)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_ALMANAC_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_POSITION)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_POSITION_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_TIME)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_TIME_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_IONO)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_UTC)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_UTC_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_HEALTH)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_HEALTH_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVDIR)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_DIRECTION_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVSTEER)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_STEER_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SADATA)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_SA_DATA_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_RTI)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_RTI_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_CELLDB_INFO)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_CELLDB_BIT;
+ }
+ mControlClient->locAPIGnssDeleteAidingData(data);
+}
+
+void GnssAPIClient::gnssEnable(LocationTechnologyType techType)
+{
+ LOC_LOGD("%s]: (%0d)", __FUNCTION__, techType);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIEnable(techType);
+}
+
+void GnssAPIClient::gnssDisable()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIDisable();
+}
+
+void GnssAPIClient::gnssConfigurationUpdate(const GnssConfig& gnssConfig)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, gnssConfig.flags);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIGnssUpdateConfig(gnssConfig);
+}
+
+void GnssAPIClient::requestCapabilities() {
+ // only send capablities if it's already cached, otherwise the first time LocationAPI
+ // is initialized, capabilities will be sent by LocationAPI
+ if (mLocationCapabilitiesCached) {
+ onCapabilitiesCb(mLocationCapabilitiesMask);
+ }
+}
+
+// callbacks
+void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+ mLocationCapabilitiesCached = true;
+
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ uint32_t data = 0;
+ if ((capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT))
+ data |= IGnssCallback::Capabilities::SCHEDULING;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GEOFENCE_BIT)
+ data |= IGnssCallback::Capabilities::GEOFENCING;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT)
+ data |= IGnssCallback::Capabilities::MEASUREMENTS;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
+ data |= IGnssCallback::Capabilities::MSB;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
+ data |= IGnssCallback::Capabilities::MSA;
+ auto r = gnssCbIface->gnssSetCapabilitesCb(data);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ if (gnssCbIface != nullptr) {
+ IGnssCallback::GnssSystemInfo gnssInfo = { .yearOfHw = 2015 };
+
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
+ gnssInfo.yearOfHw++; // 2016
+ if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
+ gnssInfo.yearOfHw++; // 2017
+ if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
+ capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
+ gnssInfo.yearOfHw++; // 2018
+ }
+ }
+ }
+ LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
+ auto r = gnssCbIface->gnssSetSystemInfoCb(gnssInfo);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onTrackingCb(Location location)
+{
+ LOC_LOGD("%s]: (flags: %02x)", __FUNCTION__, location.flags);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ GnssLocation gnssLocation;
+ convertGnssLocation(location, gnssLocation);
+ auto r = gnssCbIface->gnssLocationCb(gnssLocation);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification)
+{
+ LOC_LOGD("%s]: (id: %d)", __FUNCTION__, id);
+ mMutex.lock();
+ auto gnssNiCbIface(mGnssNiCbIface);
+ mMutex.unlock();
+
+ if (gnssNiCbIface == nullptr) {
+ LOC_LOGE("%s]: mGnssNiCbIface is nullptr", __FUNCTION__);
+ return;
+ }
+
+ IGnssNiCallback::GnssNiNotification notificationGnss = {};
+
+ notificationGnss.notificationId = id;
+
+ if (gnssNiNotification.type == GNSS_NI_TYPE_VOICE)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::VOICE;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_SUPL)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_SUPL;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_CONTROL_PLANE)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_CTRL_PLANE;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_EMERGENCY_SUPL)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::EMERGENCY_SUPL;
+
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_NOTIFICATION_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_NOTIFY;
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_VERIFICATION_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_VERIFY;
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::PRIVACY_OVERRIDE;
+
+ notificationGnss.timeoutSec = gnssNiNotification.timeout;
+
+ if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_ACCEPT)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT;
+ else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_DENY)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY;
+ else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_NO_RESPONSE ||
+ gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_IGNORE)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP;
+
+ notificationGnss.requestorId = gnssNiNotification.requestor;
+
+ notificationGnss.notificationMessage = gnssNiNotification.message;
+
+ if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_NONE)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
+
+ if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_NONE)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
+
+ gnssNiCbIface->niNotifyCb(notificationGnss);
+}
+
+void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
+{
+ LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssSvNotification.count);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ IGnssCallback::GnssSvStatus svStatus;
+ convertGnssSvStatus(gnssSvNotification, svStatus);
+ auto r = gnssCbIface->gnssSvStatusCb(svStatus);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSvStatusCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
+{
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr) {
+ const std::string s(gnssNmeaNotification.nmea);
+ std::stringstream ss(s);
+ std::string each;
+ while(std::getline(ss, each, '\n')) {
+ each += '\n';
+ android::hardware::hidl_string nmeaString;
+ nmeaString.setToExternal(each.c_str(), each.length());
+ auto r = gnssCbIface->gnssNmeaCb(
+ 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());
+ }
+ }
+ }
+}
+
+void GnssAPIClient::onStartTrackingCb(LocationError error)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb ENGINE_ON description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb SESSION_BEGIN description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onStopTrackingCb(LocationError error)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ mMutex.unlock();
+
+ if (error == LOCATION_ERROR_SUCCESS && gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb SESSION_END description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb ENGINE_OFF description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out)
+{
+ memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
+ out.numSvs = in.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];
+ convertGnssSvid(in.gnssSvs[i], info.svid);
+ convertGnssConstellationType(in.gnssSvs[i].type, info.constellation);
+ info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
+ info.elevationDegrees = in.gnssSvs[i].elevation;
+ info.azimuthDegrees = in.gnssSvs[i].azimuth;
+ info.carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
+ info.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
+ info.svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/location_api/GnssAPIClient.h b/gps/android/1.1/location_api/GnssAPIClient.h
new file mode 100644
index 0000000..1c8737f
--- /dev/null
+++ b/gps/android/1.1/location_api/GnssAPIClient.h
@@ -0,0 +1,109 @@
+/* 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 GNSS_API_CLINET_H
+#define GNSS_API_CLINET_H
+
+
+#include <mutex>
+#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_1 {
+namespace implementation {
+
+using ::android::sp;
+
+class GnssAPIClient : public LocationAPIClientBase
+{
+public:
+ GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
+ GnssAPIClient(const GnssAPIClient&) = delete;
+ GnssAPIClient& operator=(const GnssAPIClient&) = delete;
+
+ // for GpsInterface
+ void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
+ bool gnssStart();
+ bool gnssStop();
+ bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs,
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = 0);
+
+ // for GpsNiInterface
+ void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
+
+ // these apis using LocationAPIControlClient
+ void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
+ void gnssEnable(LocationTechnologyType techType);
+ void gnssDisable();
+ void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
+
+ inline LocationCapabilitiesMask gnssGetCapabilities() const {
+ return mLocationCapabilitiesMask;
+ }
+ void requestCapabilities();
+
+ // callbacks we are interested in
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onTrackingCb(Location location) final;
+ void onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification) final;
+ void onGnssSvCb(GnssSvNotification gnssSvNotification) final;
+ void onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification) final;
+
+ void onStartTrackingCb(LocationError error) final;
+ void onStopTrackingCb(LocationError error) final;
+
+private:
+ virtual ~GnssAPIClient();
+ sp<V1_0::IGnssCallback> mGnssCbIface;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
+ std::mutex mMutex;
+ LocationAPIControlClient* mControlClient;
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+ bool mLocationCapabilitiesCached;
+ TrackingOptions mTrackingOptions;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GNSS_API_CLINET_H
diff --git a/gps/android/1.1/location_api/LocationUtil.cpp b/gps/android/1.1/location_api/LocationUtil.cpp
new file mode 100644
index 0000000..459150f
--- /dev/null
+++ b/gps/android/1.1/location_api/LocationUtil.cpp
@@ -0,0 +1,264 @@
+/* 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 <LocationUtil.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+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));
+ if (in.flags & LOCATION_HAS_LAT_LONG_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG;
+ out.latitudeDegrees = in.latitude;
+ out.longitudeDegrees = in.longitude;
+ }
+ if (in.flags & LOCATION_HAS_ALTITUDE_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_ALTITUDE;
+ out.altitudeMeters = in.altitude;
+ }
+ if (in.flags & LOCATION_HAS_SPEED_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED;
+ out.speedMetersPerSec = in.speed;
+ }
+ if (in.flags & LOCATION_HAS_BEARING_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING;
+ out.bearingDegrees = in.bearing;
+ }
+ if (in.flags & LOCATION_HAS_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_HORIZONTAL_ACCURACY;
+ out.horizontalAccuracyMeters = in.accuracy;
+ }
+ if (in.flags & LOCATION_HAS_VERTICAL_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_VERTICAL_ACCURACY;
+ out.verticalAccuracyMeters = in.verticalAccuracy;
+ }
+ if (in.flags & LOCATION_HAS_SPEED_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED_ACCURACY;
+ out.speedAccuracyMetersPerSecond = in.speedAccuracy;
+ }
+ if (in.flags & LOCATION_HAS_BEARING_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING_ACCURACY;
+ out.bearingAccuracyDegrees = in.bearingAccuracy;
+ }
+
+ 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;
+ out.latitude = in.latitudeDegrees;
+ out.longitude = in.longitudeDegrees;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE) {
+ out.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ out.altitude = in.altitudeMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED) {
+ out.flags |= LOCATION_HAS_SPEED_BIT;
+ out.speed = in.speedMetersPerSec;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
+ out.flags |= LOCATION_HAS_BEARING_BIT;
+ out.bearing = in.bearingDegrees;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY) {
+ out.flags |= LOCATION_HAS_ACCURACY_BIT;
+ out.accuracy = in.horizontalAccuracyMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
+ out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ out.verticalAccuracy = in.verticalAccuracyMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
+ out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ out.speedAccuracy = in.speedAccuracyMetersPerSecond;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
+ out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ out.bearingAccuracy = in.bearingAccuracyDegrees;
+ }
+
+ out.timestamp = static_cast<uint64_t>(in.timestamp);
+}
+
+void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
+{
+ switch(in) {
+ case GNSS_SV_TYPE_GPS:
+ out = GnssConstellationType::GPS;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = GnssConstellationType::SBAS;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ out = GnssConstellationType::GLONASS;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = GnssConstellationType::QZSS;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = GnssConstellationType::BEIDOU;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = GnssConstellationType::GALILEO;
+ break;
+ case GNSS_SV_TYPE_UNKNOWN:
+ default:
+ out = GnssConstellationType::UNKNOWN;
+ break;
+ }
+}
+
+void convertGnssSvid(GnssSv& in, int16_t& out)
+{
+ switch(in.type){
+ case GNSS_SV_TYPE_GPS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ out = in.svId - GLO_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = in.svId - BDS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = in.svId - GAL_SV_PRN_MIN + 1;
+ break;
+ default:
+ out = in.svId;
+ break;
+ }
+}
+
+void convertGnssSvid(GnssMeasurementsData& in, int16_t& out)
+{
+ switch (in.svType) {
+ case GNSS_SV_TYPE_GPS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ if (in.svId != 255) { // OSN is known
+ out = in.svId - GLO_SV_PRN_MIN + 1;
+ } else { // OSN is not known, report FCN
+ out = in.gloFrequency + 92;
+ }
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = in.svId - BDS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = in.svId - GAL_SV_PRN_MIN + 1;
+ break;
+ default:
+ out = in.svId;
+ break;
+ }
+}
+
+void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
+{
+ switch(in) {
+ case GNSS_EPH_TYPE_EPHEMERIS:
+ out = GnssDebug::SatelliteEphemerisType::EPHEMERIS;
+ break;
+ case GNSS_EPH_TYPE_ALMANAC:
+ out = GnssDebug::SatelliteEphemerisType::ALMANAC_ONLY;
+ break;
+ case GNSS_EPH_TYPE_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisType::NOT_AVAILABLE;
+ break;
+ }
+}
+
+void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out)
+{
+ switch(in) {
+ case GNSS_EPH_SOURCE_DEMODULATED:
+ out = GnssDebug::SatelliteEphemerisSource::DEMODULATED;
+ break;
+ case GNSS_EPH_SOURCE_SUPL_PROVIDED:
+ out = GnssDebug::SatelliteEphemerisSource::SUPL_PROVIDED;
+ break;
+ case GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED:
+ out = GnssDebug::SatelliteEphemerisSource::OTHER_SERVER_PROVIDED;
+ break;
+ case GNSS_EPH_SOURCE_LOCAL:
+ case GNSS_EPH_SOURCE_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisSource::OTHER;
+ break;
+ }
+}
+
+void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out)
+{
+ switch(in) {
+ case GNSS_EPH_HEALTH_GOOD:
+ out = GnssDebug::SatelliteEphemerisHealth::GOOD;
+ break;
+ case GNSS_EPH_HEALTH_BAD:
+ out = GnssDebug::SatelliteEphemerisHealth::BAD;
+ break;
+ case GNSS_EPH_HEALTH_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisHealth::UNKNOWN;
+ break;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/location_api/LocationUtil.h b/gps/android/1.1/location_api/LocationUtil.h
new file mode 100644
index 0000000..af3c93f
--- /dev/null
+++ b/gps/android/1.1/location_api/LocationUtil.h
@@ -0,0 +1,57 @@
+/* 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 LOCATION_UTIL_H
+#define LOCATION_UTIL_H
+
+#include <android/hardware/gnss/1.0/types.h>
+#include <LocationAPI.h>
+#include <GnssDebug.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+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 convertGnssSvid(GnssSv& in, int16_t& out);
+void convertGnssSvid(GnssMeasurementsData& in, int16_t& 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_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // LOCATION_UTIL_H
diff --git a/gps/android/1.1/location_api/MeasurementAPIClient.cpp b/gps/android/1.1/location_api/MeasurementAPIClient.cpp
new file mode 100644
index 0000000..a87ae6d
--- /dev/null
+++ b/gps/android/1.1/location_api/MeasurementAPIClient.cpp
@@ -0,0 +1,332 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_MeasurementAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "MeasurementAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+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,
+ 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__);
+}
+
+MeasurementAPIClient::~MeasurementAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+// for GpsInterface
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface = callback;
+ mMutex.unlock();
+
+ return startTracking();
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::measurementSetCallback_1_1(
+ const sp<IGnssMeasurementCallback>& callback,
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LOC_LOGD("%s]: (%p) (powermode: %d) (tbm: %d)",
+ __FUNCTION__, &callback, (int)powerMode, timeBetweenMeasurement);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface_1_1 = callback;
+ mMutex.unlock();
+
+ return startTracking(powerMode, timeBetweenMeasurement);
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::startTracking(
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+ if (mGnssMeasurementCbIface_1_1 != nullptr || mGnssMeasurementCbIface != nullptr) {
+ locationCallbacks.gnssMeasurementsCb =
+ [this](GnssMeasurementsNotification gnssMeasurementsNotification) {
+ onGnssMeasurementsCb(gnssMeasurementsNotification);
+ };
+ }
+
+ locAPISetCallbacks(locationCallbacks);
+
+ TrackingOptions options = {};
+ memset(&options, 0, sizeof(TrackingOptions));
+ options.size = sizeof(TrackingOptions);
+ options.minInterval = 1000;
+ options.mode = GNSS_SUPL_MODE_STANDALONE;
+ if (GNSS_POWER_MODE_INVALID != powerMode) {
+ options.powerMode = powerMode;
+ options.tbm = timeBetweenMeasurement;
+ }
+
+ mTracking = true;
+ LOC_LOGD("%s]: start tracking session", __FUNCTION__);
+ locAPIStartTracking(options);
+ return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
+}
+
+// for GpsMeasurementInterface
+void MeasurementAPIClient::measurementClose() {
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ mTracking = false;
+ locAPIStopTracking();
+}
+
+// callbacks
+void MeasurementAPIClient::onGnssMeasurementsCb(
+ GnssMeasurementsNotification gnssMeasurementsNotification)
+{
+ LOC_LOGD("%s]: (count: %zu active: %d)",
+ __FUNCTION__, gnssMeasurementsNotification.count, mTracking);
+ if (mTracking) {
+ mMutex.lock();
+ 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_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()) {
+ LOC_LOGE("%s] Error from GnssMeasurementCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+static void convertGnssMeasurement(GnssMeasurementsData& in,
+ V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
+{
+ memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
+ if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SNR;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_FREQUENCY;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_CYCLES;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
+ convertGnssSvid(in, out.svid);
+ convertGnssConstellationType(in.svType, out.constellation);
+ out.timeOffsetNs = in.timeOffsetNs;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BIT_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SUBFRAME_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_MSEC_AMBIGUOUS;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SYMBOL_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_STRING_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_BIT_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_SUBFRAME_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1BC_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1C_2ND_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1B_PAGE_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SBAS_SYNC;
+ out.receivedSvTimeInNs = in.receivedSvTimeNs;
+ out.receivedSvTimeUncertaintyInNs = in.receivedSvTimeUncertaintyNs;
+ out.cN0DbHz = in.carrierToNoiseDbHz;
+ out.pseudorangeRateMps = in.pseudorangeRateMps;
+ out.pseudorangeRateUncertaintyMps = in.pseudorangeRateUncertaintyMps;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
+ out.accumulatedDeltaRangeM = in.adrMeters;
+ out.accumulatedDeltaRangeUncertaintyM = in.adrUncertaintyMeters;
+ out.carrierFrequencyHz = in.carrierFrequencyHz;
+ out.carrierCycles = in.carrierCycles;
+ out.carrierPhase = in.carrierPhase;
+ out.carrierPhaseUncertainty = in.carrierPhaseUncertainty;
+ uint8_t indicator =
+ static_cast<uint8_t>(IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_UNKNOWN);
+ if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT)
+ indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_PRESENT;
+ if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT)
+ indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATIOR_NOT_PRESENT;
+ out.multipathIndicator =
+ static_cast<IGnssMeasurementCallback::GnssMultipathIndicator>(indicator);
+ out.snrDb = in.signalToNoiseRatioDb;
+ out.agcLevelDb = in.agcLevelDb;
+}
+
+static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out)
+{
+ memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssClock));
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_LEAP_SECOND;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_TIME_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_FULL_BIAS;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT_UNCERTAINTY;
+ out.leapSecond = in.leapSecond;
+ out.timeNs = in.timeNs;
+ out.timeUncertaintyNs = in.timeUncertaintyNs;
+ out.fullBiasNs = in.fullBiasNs;
+ out.biasNs = in.biasNs;
+ out.biasUncertaintyNs = in.biasUncertaintyNs;
+ out.driftNsps = in.driftNsps;
+ out.driftUncertaintyNsps = in.driftUncertaintyNsps;
+ out.hwClockDiscontinuityCount = in.hwClockDiscontinuityCount;
+}
+
+static void convertGnssData(GnssMeasurementsNotification& in,
+ V1_0::IGnssMeasurementCallback::GnssData& out)
+{
+ out.measurementCount = in.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]);
+ }
+ 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);
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_HALF_CYCLE_RESOLVED;
+ }
+ convertGnssClock(in.clock, out.clock);
+}
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/1.1/location_api/MeasurementAPIClient.h b/gps/android/1.1/location_api/MeasurementAPIClient.h
new file mode 100644
index 0000000..5fb307c
--- /dev/null
+++ b/gps/android/1.1/location_api/MeasurementAPIClient.h
@@ -0,0 +1,85 @@
+/* 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 MEASUREMENT_API_CLINET_H
+#define MEASUREMENT_API_CLINET_H
+
+#include <mutex>
+#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
+#include <android/hardware/gnss/1.1/IGnssMeasurementCallback.h>
+#include <LocationAPIClientBase.h>
+#include <hidl/Status.h>
+#include <gps_extended_c.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_1 {
+namespace implementation {
+
+using ::android::sp;
+
+class MeasurementAPIClient : public LocationAPIClientBase
+{
+public:
+ MeasurementAPIClient();
+ MeasurementAPIClient(const MeasurementAPIClient&) = delete;
+ MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
+
+ // for GpsMeasurementInterface
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback);
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_1_1(
+ const sp<IGnssMeasurementCallback>& callback,
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
+ void measurementClose();
+ Return<IGnssMeasurement::GnssMeasurementStatus> startTracking(
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
+
+ // callbacks we are interested in
+ void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
+
+private:
+ virtual ~MeasurementAPIClient();
+
+ std::mutex mMutex;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
+ sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
+
+ bool mTracking;
+};
+
+} // namespace implementation
+} // namespace V1_1
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // MEASUREMENT_API_CLINET_H
diff --git a/gps/android/1.1/service.cpp b/gps/android/1.1/service.cpp
new file mode 100644
index 0000000..0cb91f7
--- /dev/null
+++ b/gps/android/1.1/service.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.gnss@1.1-service-qti"
+
+#include <android/hardware/gnss/1.1/IGnss.h>
+#include <hidl/LegacySupport.h>
+#include "loc_cfg.h"
+#include "loc_misc_utils.h"
+
+extern "C" {
+#include "vndfwk-detect.h"
+}
+
+#ifdef ARCH_ARM_32
+#define DEFAULT_HW_BINDER_MEM_SIZE 65536
+#endif
+
+using android::hardware::gnss::V1_1::IGnss;
+
+using android::hardware::configureRpcThreadpool;
+using android::hardware::registerPassthroughServiceImplementation;
+using android::hardware::joinRpcThreadpool;
+
+using android::status_t;
+using android::OK;
+
+typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []);
+
+int main() {
+
+ ALOGI("%s", __FUNCTION__);
+
+ int vendorInfo = getVendorEnhancedInfo();
+ bool vendorEnhanced = ( 1 == vendorInfo || 3 == vendorInfo );
+ setVendorEnhanced(vendorEnhanced);
+
+#ifdef ARCH_ARM_32
+ android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
+#endif
+ configureRpcThreadpool(1, true);
+ status_t status;
+
+ status = registerPassthroughServiceImplementation<IGnss>();
+ if (status == OK) {
+ if (vendorEnhanced) {
+ #ifdef LOC_HIDL_VERSION
+ #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so"
+
+ void* libHandle = NULL;
+ vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*)
+ dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main");
+ if (NULL != vendorEnhancedMainMethod) {
+ (*vendorEnhancedMainMethod)(0, NULL);
+ }
+ #else
+ ALOGE("LOC_HIDL_VERSION not defined.");
+ #endif
+ }
+
+ joinRpcThreadpool();
+
+ } else {
+ ALOGE("Error while registering IGnss 1.1 service: %d", status);
+ }
+
+ return 0;
+}
diff --git a/gps/android/2.0/AGnss.cpp b/gps/android/2.0/AGnss.cpp
new file mode 100644
index 0000000..a48f1a0
--- /dev/null
+++ b/gps/android/2.0/AGnss.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_AGnssInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "AGnss.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+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->statusCb(status.type, status.status);
+ }
+}
+
+void AGnss::statusCb(AGpsExtType type, LocAGpsStatusValue status) {
+
+ V2_0::IAGnssCallback::AGnssType aType;
+ IAGnssCallback::AGnssStatusValue aStatus;
+
+ switch (type) {
+ case LOC_AGPS_TYPE_SUPL:
+ aType = IAGnssCallback::AGnssType::SUPL;
+ break;
+ case LOC_AGPS_TYPE_SUPL_ES:
+ aType = IAGnssCallback::AGnssType::SUPL_EIMS;
+ break;
+ default:
+ LOC_LOGE("invalid type: %d", type);
+ return;
+ }
+
+ switch (status) {
+ case LOC_GPS_REQUEST_AGPS_DATA_CONN:
+ aStatus = IAGnssCallback::AGnssStatusValue::REQUEST_AGNSS_DATA_CONN;
+ break;
+ case LOC_GPS_RELEASE_AGPS_DATA_CONN:
+ aStatus = IAGnssCallback::AGnssStatusValue::RELEASE_AGNSS_DATA_CONN;
+ break;
+ case LOC_GPS_AGPS_DATA_CONNECTED:
+ aStatus = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONNECTED;
+ break;
+ case LOC_GPS_AGPS_DATA_CONN_DONE:
+ aStatus = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_DONE;
+ break;
+ case LOC_GPS_AGPS_DATA_CONN_FAILED:
+ aStatus = IAGnssCallback::AGnssStatusValue::AGNSS_DATA_CONN_FAILED;
+ break;
+ default:
+ LOC_LOGE("invalid status: %d", status);
+ return;
+ }
+
+ if (mAGnssCbIface != nullptr) {
+ auto r = mAGnssCbIface->agnssStatusCb(aType, aStatus);
+ if (!r.isOk()) {
+ LOC_LOGw("Error invoking AGNSS status cb %s", r.description().c_str());
+ }
+ }
+ else {
+ LOC_LOGw("setCallback has not been called yet");
+ }
+}
+
+Return<void> AGnss::setCallback(const sp<V2_0::IAGnssCallback>& callback) {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return Void();
+ }
+
+ // Save the interface
+ mAGnssCbIface = callback;
+
+ AgpsCbInfo cbInfo = {};
+ cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
+ cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
+
+ mGnss->getGnssInterface()->agpsInit(cbInfo);
+ return Void();
+}
+
+Return<bool> AGnss::dataConnClosed() {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnClosed(LOC_AGPS_TYPE_SUPL);
+ return true;
+}
+
+Return<bool> AGnss::dataConnFailed() {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnFailed(LOC_AGPS_TYPE_SUPL);
+ return true;
+}
+
+Return<bool> AGnss::dataConnOpen(uint64_t /*networkHandle*/, const hidl_string& apn,
+ V2_0::IAGnss::ApnIpType apnIpType) {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return false;
+ }
+
+ /* Validate */
+ if(apn.empty()){
+ LOC_LOGE("Invalid APN");
+ return false;
+ }
+
+ LOC_LOGD("dataConnOpen APN name = [%s]", apn.c_str());
+
+ AGpsBearerType bearerType;
+ switch (apnIpType) {
+ case IAGnss::ApnIpType::IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case IAGnss::ApnIpType::IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case IAGnss::ApnIpType::IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ mGnss->getGnssInterface()->agpsDataConnOpen(
+ LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)bearerType);
+ return true;
+}
+
+Return<bool> AGnss::setServer(V2_0::IAGnssCallback::AGnssType type,
+ const hidl_string& hostname,
+ int32_t port) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
+ config.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
+ if (type == IAGnssCallback::AGnssType::SUPL) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL;
+ } else if (type == IAGnssCallback::AGnssType::C2K) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_C2K;
+ } else if (type == IAGnssCallback::AGnssType::SUPL_EIMS) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL_EIMS;
+ } else if (type == IAGnssCallback::AGnssType::SUPL_IMS) {
+ config.assistanceServer.type = GNSS_ASSISTANCE_TYPE_SUPL_IMS;
+ } else {
+ LOC_LOGE("%s]: invalid AGnssType: %d", __FUNCTION__, static_cast<uint8_t>(type));
+ return false;
+ }
+ config.assistanceServer.hostName = strdup(hostname.c_str());
+ config.assistanceServer.port = port;
+ return mGnss->updateConfiguration(config);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/AGnss.h b/gps/android/2.0/AGnss.h
new file mode 100644
index 0000000..c442327
--- /dev/null
+++ b/gps/android/2.0/AGnss.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
+#define ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
+
+#include <android/hardware/gnss/2.0/IAGnss.h>
+#include <hidl/Status.h>
+#include <gps_extended_c.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+struct AGnss : public V2_0::IAGnss {
+
+ AGnss(Gnss* gnss);
+ ~AGnss();
+ /*
+ * Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow.
+ * These declarations were generated from IAGnss.hal.
+ */
+ Return<void> setCallback(const sp<V2_0::IAGnssCallback>& callback) override;
+
+ Return<bool> dataConnClosed() override;
+
+ Return<bool> dataConnFailed() override;
+
+ Return<bool> dataConnOpen(uint64_t networkHandle, const hidl_string& apn,
+ V2_0::IAGnss::ApnIpType apnIpType) override;
+
+ Return<bool> setServer(V2_0::IAGnssCallback::AGnssType type,
+ const hidl_string& hostname, int32_t port) override;
+
+ void statusCb(AGpsExtType type, LocAGpsStatusValue status);
+
+ /* Data call setup callback passed down to GNSS HAL implementation */
+ static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
+
+ private:
+ Gnss* mGnss = nullptr;
+ sp<IAGnssCallback> mAGnssCbIface = nullptr;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
diff --git a/gps/android/2.0/AGnssRil.cpp b/gps/android/2.0/AGnssRil.cpp
new file mode 100644
index 0000000..a477fc2
--- /dev/null
+++ b/gps/android/2.0/AGnssRil.cpp
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc__AGnssRilInterface"
+
+#include <log_util.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sstream>
+#include <string>
+#include "Gnss.h"
+#include "AGnssRil.h"
+#include <DataItemConcreteTypesBase.h>
+
+typedef void* (getLocationInterface)();
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+
+AGnssRil::AGnssRil(Gnss* gnss) : mGnss(gnss) {
+ ENTRY_LOG_CALLFLOW();
+}
+
+AGnssRil::~AGnssRil() {
+ ENTRY_LOG_CALLFLOW();
+}
+
+Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool /*roaming*/) {
+ ENTRY_LOG_CALLFLOW();
+ // Extra NetworkTypes not available in IAgnssRil enums
+ const int NetworkType_BLUETOOTH = 7;
+ const int NetworkType_ETHERNET = 9;
+ const int NetworkType_PROXY = 16;
+
+ // for XTRA
+ if (nullptr != mGnss && ( nullptr != mGnss->getGnssInterface() )) {
+ int8_t typeout = loc_core::TYPE_UNKNOWN;
+ switch(type)
+ {
+ case IAGnssRil::NetworkType::MOBILE:
+ typeout = loc_core::TYPE_MOBILE;
+ break;
+ case IAGnssRil::NetworkType::WIFI:
+ typeout = loc_core::TYPE_WIFI;
+ break;
+ case IAGnssRil::NetworkType::MMS:
+ typeout = loc_core::TYPE_MMS;
+ break;
+ case IAGnssRil::NetworkType::SUPL:
+ typeout = loc_core::TYPE_SUPL;
+ break;
+ case IAGnssRil::NetworkType::DUN:
+ typeout = loc_core::TYPE_DUN;
+ break;
+ case IAGnssRil::NetworkType::HIPRI:
+ typeout = loc_core::TYPE_HIPRI;
+ break;
+ case IAGnssRil::NetworkType::WIMAX:
+ typeout = loc_core::TYPE_WIMAX;
+ break;
+ default:
+ {
+ int networkType = (int) type;
+ // Handling network types not available in IAgnssRil
+ switch(networkType)
+ {
+ case NetworkType_BLUETOOTH:
+ typeout = loc_core::TYPE_BLUETOOTH;
+ break;
+ case NetworkType_ETHERNET:
+ typeout = loc_core::TYPE_ETHERNET;
+ break;
+ case NetworkType_PROXY:
+ typeout = loc_core::TYPE_PROXY;
+ break;
+ default:
+ typeout = loc_core::TYPE_UNKNOWN;
+ }
+ }
+ break;
+ }
+ mGnss->getGnssInterface()->updateConnectionStatus(connected, false, typeout, 0);
+ }
+ return true;
+}
+Return<bool> AGnssRil::updateNetworkState_2_0(const V2_0::IAGnssRil::NetworkAttributes& attributes) {
+ ENTRY_LOG_CALLFLOW();
+
+ if (nullptr != mGnss && (nullptr != mGnss->getGnssInterface())) {
+ int8_t typeout = loc_core::TYPE_UNKNOWN;
+ bool roaming = false;
+ if (attributes.capabilities & IAGnssRil::NetworkCapability::NOT_METERED) {
+ typeout = loc_core::TYPE_WIFI;
+ } else {
+ typeout = loc_core::TYPE_MOBILE;
+ }
+ if (attributes.capabilities & IAGnssRil::NetworkCapability::NOT_ROAMING) {
+ roaming = false;
+ }
+ mGnss->getGnssInterface()->updateConnectionStatus(attributes.isConnected,
+ typeout, roaming, (NetworkHandle) attributes.networkHandle);
+ }
+ return true;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/AGnssRil.h b/gps/android/2.0/AGnssRil.h
new file mode 100644
index 0000000..a04d8aa
--- /dev/null
+++ b/gps/android/2.0/AGnssRil.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_
+#define ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_
+
+#include <android/hardware/gnss/2.0/IAGnssRil.h>
+#include <hidl/Status.h>
+#include <location_interface.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+/*
+ * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface Layer interface
+ * allows the GNSS chipset to request radio interface layer information from Android platform.
+ * Examples of such information are reference location, unique subscriber ID, phone number string
+ * and network availability changes. Also contains wrapper methods to allow methods from
+ * IAGnssiRilCallback interface to be passed into the conventional implementation of the GNSS HAL.
+ */
+struct AGnssRil : public V2_0::IAGnssRil {
+ AGnssRil(Gnss* gnss);
+ ~AGnssRil();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IAGnssRil follow.
+ * These declarations were generated from IAGnssRil.hal.
+ */
+ Return<void> setCallback(const sp<V1_0::IAGnssRilCallback>& /*callback*/) override {
+ return Void();
+ }
+ Return<void> setRefLocation(const V1_0::IAGnssRil::AGnssRefLocation& /*agnssReflocation*/) override {
+ return Void();
+ }
+ Return<bool> setSetId(V1_0::IAGnssRil::SetIDType /*type*/, const hidl_string& /*setid*/) override {
+ return false;
+ }
+ Return<bool> updateNetworkAvailability(bool /*available*/,
+ const hidl_string& /*apn*/) override {
+ return false;
+ }
+ Return<bool> updateNetworkState(bool connected, V1_0::IAGnssRil::NetworkType type, bool roaming) override;
+
+ // Methods from ::android::hardware::gnss::V2_0::IAGnssRil follow
+ Return<bool> updateNetworkState_2_0(const V2_0::IAGnssRil::NetworkAttributes& attributes) override;
+
+ private:
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSSRIL_H_
diff --git a/gps/android/2.0/Android.mk b/gps/android/2.0/Android.mk
new file mode 100644
index 0000000..d9ac77c
--- /dev/null
+++ b/gps/android/2.0/Android.mk
@@ -0,0 +1,116 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@2.0-impl-qti
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ AGnss.cpp \
+ Gnss.cpp \
+ AGnssRil.cpp \
+ GnssMeasurement.cpp \
+ GnssConfiguration.cpp \
+ GnssBatching.cpp \
+ GnssGeofencing.cpp \
+ GnssNi.cpp \
+ GnssDebug.cpp \
+ ../measurement_corrections/1.0/MeasurementCorrections.cpp \
+ ../visibility_control/1.0/GnssVisibilityControl.cpp
+
+LOCAL_SRC_FILES += \
+ location_api/GnssAPIClient.cpp \
+ location_api/MeasurementAPIClient.cpp \
+ location_api/GeofenceAPIClient.cpp \
+ location_api/BatchingAPIClient.cpp \
+ location_api/LocationUtil.cpp \
+
+ifeq ($(GNSS_HIDL_LEGACY_MEASURMENTS),true)
+LOCAL_CFLAGS += \
+ -DGNSS_HIDL_LEGACY_MEASURMENTS
+endif
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/location_api \
+ $(LOCAL_PATH)/../measurement_corrections/1.0 \
+ $(LOCAL_PATH)/../visibility_control/1.0
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers \
+ liblocbatterylistener_headers
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libcutils \
+ libutils \
+ android.hardware.gnss@1.0 \
+ android.hardware.gnss@1.1 \
+ android.hardware.gnss@2.0 \
+ android.hardware.gnss.measurement_corrections@1.0 \
+ android.hardware.gnss.visibility_control@1.0 \
+ android.hardware.health@1.0 \
+ android.hardware.health@2.0 \
+ android.hardware.power@1.2 \
+ libbase
+
+LOCAL_SHARED_LIBRARIES += \
+ libloc_core \
+ libgps.utils \
+ libdl \
+ liblocation_api \
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+LOCAL_STATIC_LIBRARIES := liblocbatterylistener
+LOCAL_STATIC_LIBRARIES += libhealthhalutils
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@2.0-service-qti
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VINTF_FRAGMENTS := android.hardware.gnss@2.0-service-qti.xml
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_INIT_RC := android.hardware.gnss@2.0-service-qti.rc
+LOCAL_SRC_FILES := \
+ service.cpp \
+
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libdl \
+ libbase \
+ libutils \
+ libgps.utils \
+ libqti_vndfwk_detect \
+
+LOCAL_SHARED_LIBRARIES += \
+ libhwbinder \
+ libhidlbase \
+ libhidltransport \
+ android.hardware.gnss@1.0 \
+ android.hardware.gnss@1.1 \
+ android.hardware.gnss@2.0 \
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+
+ifneq ($(LOC_HIDL_VERSION),)
+LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
+endif
+
+include $(BUILD_EXECUTABLE)
diff --git a/gps/android/2.0/Gnss.cpp b/gps/android/2.0/Gnss.cpp
new file mode 100644
index 0000000..7a1c593
--- /dev/null
+++ b/gps/android/2.0/Gnss.cpp
@@ -0,0 +1,736 @@
+/*
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssInterface"
+#define LOG_NDEBUG 0
+
+#include <fstream>
+#include <log_util.h>
+#include <dlfcn.h>
+#include <cutils/properties.h>
+#include "Gnss.h"
+#include "LocationUtil.h"
+#include "battery_listener.h"
+#include "loc_misc_utils.h"
+
+typedef const GnssInterface* (getLocationInterface)();
+
+#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
+#define DELIMITER ";"
+#define MAX_GNSS_ACCURACY_ALLOWED 10000
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::visibility_control::V1_0::implementation::GnssVisibilityControl;
+static sp<Gnss> sGnss;
+static gnssStatusCb sGnssStatusCbRef = nullptr;
+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);
+ if (mGnss != nullptr) {
+ mGnss->cleanup();
+ }
+}
+
+void location_on_battery_status_changed(bool charging) {
+ LOC_LOGd("battery status changed to %s charging", charging ? "" : "not");
+ if (sGnss != nullptr) {
+ sGnss->getGnssInterface()->updateBatteryStatus(charging);
+ }
+}
+Gnss::Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ if (sGnss == nullptr) {
+ sGnss = this;
+ }
+ // initilize gnss interface at first in case needing notify battery status
+ sGnss->getGnssInterface()->initialize();
+ // register health client to listen on battery change
+ loc_extn_battery_properties_listener_init(location_on_battery_status_changed);
+ // clear pending GnssConfig
+ memset(&mPendingConfig, 0, sizeof(GnssConfig));
+ mGnssDeathRecipient = new GnssDeathRecipient(this);
+}
+
+Gnss::~Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+ sGnss = nullptr;
+ sGnssStatusCbRef = nullptr;
+}
+
+GnssAPIClient* Gnss::getApi() {
+ if (mApi != nullptr) {
+ return mApi;
+ }
+
+ if (mGnssCbIface_2_0 != nullptr) {
+ mApi = new GnssAPIClient(mGnssCbIface_2_0);
+ } else if (mGnssCbIface_1_1 != nullptr) {
+ mApi = new GnssAPIClient(mGnssCbIface_1_1, mGnssNiCbIface);
+ } else if (mGnssCbIface != nullptr) {
+ mApi = new GnssAPIClient(mGnssCbIface, mGnssNiCbIface);
+ } else {
+ LOC_LOGW("%s] GnssAPIClient is not ready", __FUNCTION__);
+ return mApi;
+ }
+
+ if (mPendingConfig.size == sizeof(GnssConfig)) {
+ // we have pending GnssConfig
+ mApi->gnssConfigurationUpdate(mPendingConfig);
+ // clear size to invalid mPendingConfig
+ mPendingConfig.size = 0;
+ if (mPendingConfig.assistanceServer.hostName != nullptr) {
+ free((void*)mPendingConfig.assistanceServer.hostName);
+ }
+ }
+
+ return mApi;
+}
+
+const GnssInterface* Gnss::getGnssInterface() {
+ static bool getGnssInterfaceFailed = false;
+
+ if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
+ void * libHandle = nullptr;
+ getLocationInterface* getter = (getLocationInterface*)
+ dlGetSymFromLib(libHandle, "libgnss.so", "getGnssInterface");
+
+ if (nullptr == getter) {
+ getGnssInterfaceFailed = true;
+ } else {
+ mGnssInterface = (GnssInterface*)(*getter)();
+ }
+ }
+ return mGnssInterface;
+}
+
+Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+
+ // In case where previous call to setCallback_1_1 or setCallback_2_0, then
+ // we need to cleanup these interfaces/callbacks here since we no longer
+ // do so in cleanup() function to keep callbacks around after cleanup()
+ if (mApi != nullptr) {
+ mApi->gnssUpdateCallbacks_2_0(nullptr);
+ }
+ if (mGnssCbIface_1_1 != nullptr) {
+ mGnssCbIface_1_1->unlinkToDeath(mGnssDeathRecipient);
+ mGnssCbIface_1_1 = nullptr;
+ }
+ if (mGnssCbIface_2_0 != nullptr) {
+ mGnssCbIface_2_0->unlinkToDeath(mGnssDeathRecipient);
+ mGnssCbIface_2_0 = nullptr;
+ }
+
+
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
+ }
+ mGnssCbIface = callback;
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
+ }
+ //Send the gps enable signal
+ notifyGnssStatus();
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
+ api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
+ api->requestCapabilities();
+ }
+ return true;
+}
+
+Return<bool> Gnss::setGnssNiCb(const sp<IGnssNiCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+ mGnssNiCbIface = callback;
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
+ }
+ return true;
+}
+
+Return<bool> Gnss::updateConfiguration(GnssConfig& gnssConfig) {
+ ENTRY_LOG_CALLFLOW();
+ GnssAPIClient* api = getApi();
+ if (api) {
+ api->gnssConfigurationUpdate(gnssConfig);
+ } else if (gnssConfig.flags != 0) {
+ // api is not ready yet, update mPendingConfig with gnssConfig
+ mPendingConfig.size = sizeof(GnssConfig);
+
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
+ mPendingConfig.gpsLock = gnssConfig.gpsLock;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
+ mPendingConfig.suplVersion = gnssConfig.suplVersion;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT;
+ mPendingConfig.assistanceServer.size = sizeof(GnssConfigSetAssistanceServer);
+ mPendingConfig.assistanceServer.type = gnssConfig.assistanceServer.type;
+ if (mPendingConfig.assistanceServer.hostName != nullptr) {
+ free((void*)mPendingConfig.assistanceServer.hostName);
+ mPendingConfig.assistanceServer.hostName =
+ strdup(gnssConfig.assistanceServer.hostName);
+ }
+ mPendingConfig.assistanceServer.port = gnssConfig.assistanceServer.port;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
+ mPendingConfig.lppProfile = gnssConfig.lppProfile;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
+ mPendingConfig.lppeControlPlaneMask = gnssConfig.lppeControlPlaneMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT;
+ mPendingConfig.lppeUserPlaneMask = gnssConfig.lppeUserPlaneMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
+ mPendingConfig.aGlonassPositionProtocolMask = gnssConfig.aGlonassPositionProtocolMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
+ mPendingConfig.emergencyPdnForEmergencySupl = gnssConfig.emergencyPdnForEmergencySupl;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT;
+ mPendingConfig.suplEmergencyServices = gnssConfig.suplEmergencyServices;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
+ mPendingConfig.suplModeMask = gnssConfig.suplModeMask;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
+ mPendingConfig.blacklistedSvIds = gnssConfig.blacklistedSvIds;
+ }
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT) {
+ mPendingConfig.flags |= GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT;
+ mPendingConfig.emergencyExtensionSeconds = gnssConfig.emergencyExtensionSeconds;
+ }
+ }
+ return true;
+}
+
+Return<bool> Gnss::start() {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssStart();
+ }
+ return retVal;
+}
+
+Return<bool> Gnss::stop() {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ retVal = api->gnssStop();
+ }
+ return retVal;
+}
+
+Return<void> Gnss::cleanup() {
+ ENTRY_LOG_CALLFLOW();
+
+ if (mApi != nullptr) {
+ mApi->gnssStop();
+ mApi->gnssDisable();
+ // sGnssStatusCbRef will be NULL in case of Android OS,
+ // we need to retain mGnssCbIface* for Andorid, for SUPL ES.
+ // When location is disabled, GPS locked,
+ // we need a way to callback to AFW to request for DBH.
+
+ // sGnssStatusCbRef will be NOT be NULL in case of non-Android OS,
+ // in such case we don't want to retain the mGnssCbIface*, as DBH is
+ // handled internally, hence making below references as nullptr.
+ if (nullptr != sGnssStatusCbRef) {
+ mGnssCbIface = mGnssCbIface_1_1 = mGnssCbIface_2_0 = nullptr;
+ //Send gnss disable signal
+ notifyGnssStatus();
+ }
+ }
+ return Void();
+}
+
+Return<bool> Gnss::injectLocation(double latitudeDegrees,
+ double longitudeDegrees,
+ float accuracyMeters) {
+ ENTRY_LOG_CALLFLOW();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ gnssInterface->injectLocation(latitudeDegrees, longitudeDegrees, accuracyMeters);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
+ int32_t uncertaintyMs) {
+ ENTRY_LOG_CALLFLOW();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if ((nullptr != gnssInterface) && (gnssInterface->isSS5HWEnabled())) {
+ gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
+ }
+ return true;
+}
+
+Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
+ ENTRY_LOG_CALLFLOW();
+ GnssAPIClient* api = getApi();
+ if (api) {
+ api->gnssDeleteAidingData(aidingDataFlags);
+ }
+ return Void();
+}
+
+void Gnss::updateCallbacksIfGnssStatusCbReg(GnssAPIClient* api) {
+ if (nullptr != sGnssStatusCbRef) {
+ // Swith to timebased FLP client, if gnssStatusCb is registered.
+ LOC_LOGd("Swith to timebased FlpClient as StatusCb is registerd(m):");
+ api->gnssUpdateFlpCallbacks();
+ } else {
+ if (mGnssCbIface_2_0 != nullptr) {
+ api->gnssUpdateCallbacks_2_0(mGnssCbIface_2_0);
+ } else if (mGnssCbIface_1_1 != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface_1_1, mGnssNiCbIface);
+ } else if (mGnssCbIface != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
+ } else {
+ LOC_LOGe("All client callbacks are null...");
+ }
+ }
+}
+
+Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs) {
+ ENTRY_LOG_CALLFLOW();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ updateCallbacksIfGnssStatusCbReg(api);
+ retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
+ preferredAccuracyMeters, preferredTimeMs);
+ }
+ return retVal;
+}
+
+Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
+ ENTRY_LOG_CALLFLOW();
+ // deprecated function. Must return nullptr to pass VTS
+ return nullptr;
+}
+
+Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
+ ENTRY_LOG_CALLFLOW();
+ // deprecated function. Must return nullptr to pass VTS
+ return nullptr;
+}
+
+Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+}
+
+Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssConfig == nullptr) {
+ mGnssConfig = new GnssConfiguration(this);
+ }
+ return mGnssConfig;
+}
+
+Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssGeofencingIface == nullptr) {
+ mGnssGeofencingIface = new GnssGeofencing();
+ }
+ return mGnssGeofencingIface;
+}
+
+Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssBatching == nullptr) {
+ mGnssBatching = new GnssBatching();
+ }
+ return mGnssBatching;
+}
+
+Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssDebug == nullptr) {
+ mGnssDebug = new GnssDebug(this);
+ }
+ return mGnssDebug;
+}
+
+Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssRil == nullptr) {
+ 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();
+ auto r = callback->gnssNameCb(getVersionString());
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssNameCb description=%s",
+ __func__, r.description().c_str());
+ }
+
+ // In case where previous call to setCallback or setCallback_2_1, then
+ // we need to cleanup these interfaces/callbacks here since we no longer
+ // do so in cleanup() function to keep callbacks around after cleanup()
+ if (mApi != nullptr) {
+ mApi->gnssUpdateCallbacks_2_0(nullptr);
+ }
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
+ mGnssCbIface = nullptr;
+ }
+ if (mGnssCbIface_2_0 != nullptr) {
+ mGnssCbIface_2_0->unlinkToDeath(mGnssDeathRecipient);
+ mGnssCbIface_2_0 = nullptr;
+ }
+
+
+ if (mGnssCbIface_1_1 != nullptr) {
+ mGnssCbIface_1_1->unlinkToDeath(mGnssDeathRecipient);
+ }
+ mGnssCbIface_1_1 = callback;
+ if (mGnssCbIface_1_1 != nullptr) {
+ mGnssCbIface_1_1->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
+ }
+ notifyGnssStatus();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
+ odcpiRequestCb(odcpiRequest);
+ };
+ gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
+ }
+
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks(mGnssCbIface_1_1, mGnssNiCbIface);
+ api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
+ api->requestCapabilities();
+ }
+
+ return true;
+}
+
+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();
+ bool retVal = false;
+ GnssAPIClient* api = getApi();
+ if (api) {
+ updateCallbacksIfGnssStatusCbReg(api);
+ GnssPowerMode powerMode = lowPowerMode?
+ GNSS_POWER_MODE_M4 : GNSS_POWER_MODE_M2;
+ retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
+ preferredAccuracyMeters, preferredTimeMs, powerMode, minIntervalMs);
+ }
+ return retVal;
+}
+
+Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() {
+ ENTRY_LOG_CALLFLOW();
+#ifdef GNSS_HIDL_LEGACY_MEASURMENTS
+ return nullptr;
+#else
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+#endif
+}
+
+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();
+ const 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 (ODCPI_REQUEST_TYPE_STOP == request.type) {
+ return;
+ }
+ if (mGnssCbIface_2_0 != nullptr) {
+ // For emergency mode, request DBH (Device based hybrid) location
+ // Mark Independent from GNSS flag to false.
+ if (ODCPI_REQUEST_TYPE_START == request.type) {
+ LOC_LOGd("gnssRequestLocationCb_2_0 isUserEmergency = %d", request.isEmergencyMode);
+ auto r = mGnssCbIface_2_0->gnssRequestLocationCb_2_0(!request.isEmergencyMode,
+ request.isEmergencyMode);
+ if (!r.isOk()) {
+ LOC_LOGe("Error invoking gnssRequestLocationCb_2_0 %s", r.description().c_str());
+ }
+ } else {
+ LOC_LOGv("Unsupported ODCPI request type: %d", request.type);
+ }
+ } else 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.");
+ }
+}
+
+// Methods from ::android::hardware::gnss::V2_0::IGnss follow.
+Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) {
+ ENTRY_LOG_CALLFLOW();
+ auto r = callback->gnssNameCb(getVersionString());
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssNameCb description=%s",
+ __func__, r.description().c_str());
+ }
+
+ // In case where previous call to setCallback or setCallback_1_1, then
+ // we need to cleanup these interfaces/callbacks here since we no longer
+ // do so in cleanup() function to keep callbacks around after cleanup()
+ if (mApi != nullptr) {
+ mApi->gnssUpdateCallbacks(nullptr, nullptr);
+ }
+ mGnssNiCbIface = nullptr;
+ if (mGnssCbIface != nullptr) {
+ mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
+ mGnssCbIface = nullptr;
+ }
+ if (mGnssCbIface_1_1 != nullptr) {
+ mGnssCbIface_1_1->unlinkToDeath(mGnssDeathRecipient);
+ mGnssCbIface_1_1 = nullptr;
+ }
+
+ if (mGnssCbIface_2_0 != nullptr) {
+ mGnssCbIface_2_0->unlinkToDeath(mGnssDeathRecipient);
+ }
+ mGnssCbIface_2_0 = callback;
+ if (mGnssCbIface_2_0 != nullptr) {
+ mGnssCbIface_2_0->linkToDeath(mGnssDeathRecipient, 0 /*cookie*/);
+ }
+ notifyGnssStatus();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
+ odcpiRequestCb(odcpiRequest);
+ };
+ gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
+ }
+
+ GnssAPIClient* api = getApi();
+ if (api != nullptr) {
+ api->gnssUpdateCallbacks_2_0(mGnssCbIface_2_0);
+ api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
+ api->requestCapabilities();
+ }
+
+ return true;
+}
+
+Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() {
+ ENTRY_LOG_CALLFLOW();
+ if (mAGnssIface_2_0 == nullptr) {
+ mAGnssIface_2_0 = new AGnss(this);
+ }
+ return mAGnssIface_2_0;
+}
+Return<sp<V2_0::IAGnssRil>> Gnss::getExtensionAGnssRil_2_0() {
+ if (mGnssRil == nullptr) {
+ mGnssRil = new AGnssRil(this);
+ }
+ return mGnssRil;
+}
+
+Return<sp<V2_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_0() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssConfig == nullptr) {
+ mGnssConfig = new GnssConfiguration(this);
+ }
+ return mGnssConfig;
+}
+Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
+ ENTRY_LOG_CALLFLOW();
+#ifdef GNSS_HIDL_LEGACY_MEASURMENTS
+ return nullptr;
+#else
+ if (mGnssMeasurement == nullptr)
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+#endif
+}
+Return<sp<::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections>>
+ Gnss::getExtensionMeasurementCorrections() {
+ // We do not support, so return nullptr to pass VTS
+ return nullptr;
+}
+Return<sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl>>
+ Gnss::getExtensionVisibilityControl() {
+ ENTRY_LOG_CALLFLOW();
+ if (mVisibCtrl == nullptr) {
+ mVisibCtrl = new GnssVisibilityControl(this);
+ }
+ return mVisibCtrl;
+}
+
+Return<bool> Gnss::injectBestLocation_2_0(const V2_0::GnssLocation& gnssLocation) {
+ ENTRY_LOG_CALLFLOW();
+ const GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ Location location = {};
+ convertGnssLocation(gnssLocation, location);
+ gnssInterface->odcpiInject(location);
+ }
+ return true;
+}
+
+Return<sp<V2_0::IGnssDebug>> Gnss::getExtensionGnssDebug_2_0() {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnssDebug == nullptr) {
+ mGnssDebug = new GnssDebug(this);
+ }
+ return mGnssDebug;
+}
+
+Return<sp<V2_0::IGnssBatching>> Gnss::getExtensionGnssBatching_2_0() {
+ return nullptr;
+}
+
+void Gnss::notifyGnssStatus() {
+ if (nullptr != sGnssStatusCbRef) {
+ sGnssStatusCbRef(mGnssCbIface != nullptr || mGnssCbIface_1_1 != nullptr
+ || mGnssCbIface_2_0 != nullptr);
+ }
+}
+
+// Method that will register gnssStatusCallback,
+// only if the host FW is non-AFW and native NLP library
+// is available.
+void registerGnssStatusCallback(gnssStatusCb in) {
+ sGnssStatusCbRef = in;
+ if(nullptr != sGnssStatusCbRef && sGnss != nullptr) {
+ sGnss->notifyGnssStatus();
+ } else {
+ LOC_LOGe("Failed to register!!!");
+ }
+}
+
+V1_0::IGnss* HIDL_FETCH_IGnss(const char* hal) {
+ ENTRY_LOG_CALLFLOW();
+ V1_0::IGnss* iface = nullptr;
+ iface = new Gnss();
+ if (iface == nullptr) {
+ LOC_LOGE("%s]: failed to get %s", __FUNCTION__, hal);
+ }
+ return iface;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/Gnss.h b/gps/android/2.0/Gnss.h
new file mode 100644
index 0000000..3defbde
--- /dev/null
+++ b/gps/android/2.0/Gnss.h
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
+
+#include <AGnss.h>
+#include <AGnssRil.h>
+#include <GnssConfiguration.h>
+#include <GnssMeasurement.h>
+#include <GnssBatching.h>
+#include <GnssGeofencing.h>
+#include <GnssNi.h>
+#include <GnssDebug.h>
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+#include <MeasurementCorrections.h>
+#include <GnssVisibilityControl.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include "GnssAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+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::sp;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+using ::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections;
+using ::android::hardware::gnss::measurement_corrections::V1_0::implementation::MeasurementCorrections;
+using ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
+
+struct Gnss : public IGnss {
+ Gnss();
+ ~Gnss();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnss follow.
+ * These declarations were generated from Gnss.hal.
+ */
+ Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
+ Return<bool> start() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+ Return<bool> injectLocation(double latitudeDegrees,
+ double longitudeDegrees,
+ float accuracyMeters) override;
+ Return<bool> injectTime(int64_t timeMs,
+ int64_t timeReferenceMs,
+ int32_t uncertaintyMs) override;
+ 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<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<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
+
+ inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
+ return nullptr;
+ }
+
+ inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
+ return nullptr;
+ }
+
+ 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;
+
+ // Methods from ::android::hardware::gnss::V2_0::IGnss follow.
+ Return<bool> setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) override;
+ Return<sp<V2_0::IAGnss>> getExtensionAGnss_2_0() override;
+ Return<sp<V2_0::IAGnssRil>> getExtensionAGnssRil_2_0() override;
+
+ Return<sp<V2_0::IGnssConfiguration>> getExtensionGnssConfiguration_2_0() override;
+ Return<sp<::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections>>
+ getExtensionMeasurementCorrections() override;
+ Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
+
+ Return<bool> injectBestLocation_2_0(const ::android::hardware::gnss::V2_0::GnssLocation& location) override;
+
+ Return<sp<V2_0::IGnssBatching>> getExtensionGnssBatching_2_0() override;
+ Return<sp<V2_0::IGnssDebug>> getExtensionGnssDebug_2_0() override;
+
+
+ /**
+ * This method returns the IGnssVisibilityControl interface.
+ *
+ * @return visibilityControlIface Handle to the IGnssVisibilityControl interface.
+ */
+ Return<sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl>>
+ getExtensionVisibilityControl() override;
+
+
+ // These methods are not part of the IGnss base class.
+ GnssAPIClient* getApi();
+ Return<bool> setGnssNiCb(const sp<IGnssNiCallback>& niCb);
+ Return<bool> updateConfiguration(GnssConfig& gnssConfig);
+ const GnssInterface* getGnssInterface();
+
+ // Callback for ODCPI request
+ void odcpiRequestCb(const OdcpiRequestInfo& request);
+ void updateCallbacksIfGnssStatusCbReg(GnssAPIClient* api);
+ void notifyGnssStatus();
+ private:
+ struct GnssDeathRecipient : hidl_death_recipient {
+ GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
+ }
+ ~GnssDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<Gnss> mGnss;
+ };
+
+ private:
+ sp<GnssDeathRecipient> mGnssDeathRecipient = nullptr;
+
+ sp<V1_0::IGnssNi> mGnssNi = nullptr;
+ sp<V1_0::IGnssGeofencing> mGnssGeofencingIface = nullptr;
+ sp<V1_0::IAGnss> mAGnssIface = nullptr;
+ sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
+ sp<V1_1::IGnssCallback> mGnssCbIface_1_1 = nullptr;
+ sp<V2_0::IAGnss> mAGnssIface_2_0 = nullptr;
+ sp<V2_0::IAGnssRil> mGnssRil = nullptr;
+ sp<V2_0::IGnssMeasurement> mGnssMeasurement = nullptr;
+ sp<V2_0::IGnssConfiguration> mGnssConfig = nullptr;
+ sp<V2_0::IGnssBatching> mGnssBatching = nullptr;
+ sp<V2_0::IGnssDebug> mGnssDebug = nullptr;
+ sp<V2_0::IGnssCallback> mGnssCbIface_2_0 = nullptr;
+ sp<IMeasurementCorrections> mGnssMeasCorr = nullptr;
+ sp<IGnssVisibilityControl> mVisibCtrl = nullptr;
+ GnssAPIClient* mApi = nullptr;
+ GnssConfig mPendingConfig;
+ const GnssInterface* mGnssInterface = nullptr;
+};
+
+typedef std::function<void(bool)> gnssStatusCb;
+extern "C" V1_0::IGnss* HIDL_FETCH_IGnss(const char* name);
+extern "C" void registerGnssStatusCallback(gnssStatusCb in);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
diff --git a/gps/android/2.0/GnssBatching.cpp b/gps/android/2.0/GnssBatching.cpp
new file mode 100644
index 0000000..6a2a09e
--- /dev/null
+++ b/gps/android/2.0/GnssBatching.cpp
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssBatchingInterface"
+
+#include <log_util.h>
+#include <BatchingAPIClient.h>
+#include "GnssBatching.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+void GnssBatching::GnssBatchingDeathRecipient::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);
+ if (mGnssBatching != nullptr) {
+ mGnssBatching->stop();
+ mGnssBatching->cleanup();
+ }
+}
+
+GnssBatching::GnssBatching() : mApi(nullptr) {
+ mGnssBatchingDeathRecipient = new GnssBatchingDeathRecipient(this);
+}
+
+GnssBatching::~GnssBatching() {
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+Return<bool> GnssBatching::init(const sp<V1_0::IGnssBatchingCallback>& callback) {
+ if (mApi != nullptr) {
+ LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
+ mApi->destroy();
+ mApi = nullptr;
+ }
+
+ mApi = new BatchingAPIClient(callback);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
+ return false;
+ }
+
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
+ }
+ mGnssBatchingCbIface = callback;
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->linkToDeath(mGnssBatchingDeathRecipient, 0 /*cookie*/);
+ }
+
+ return true;
+}
+
+Return<uint16_t> GnssBatching::getBatchSize() {
+ uint16_t ret = 0;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->getBatchSize();
+ }
+ return ret;
+}
+
+Return<bool> GnssBatching::start(const IGnssBatching::Options& options) {
+ bool ret = false;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->startSession(options);
+ }
+ return ret;
+}
+
+Return<void> GnssBatching::flush() {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->flushBatchedLocations();
+ }
+ return Void();
+}
+
+Return<bool> GnssBatching::stop() {
+ bool ret = false;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->stopSession();
+ }
+ return ret;
+}
+
+Return<void> GnssBatching::cleanup() {
+ if (mApi != nullptr) {
+ mApi->stopSession();
+ }
+ if (mGnssBatchingCbIface != nullptr) {
+ mGnssBatchingCbIface->unlinkToDeath(mGnssBatchingDeathRecipient);
+ mGnssBatchingCbIface = nullptr;
+ }
+ if (mGnssBatchingCbIface_2_0 != nullptr) {
+ mGnssBatchingCbIface_2_0->unlinkToDeath(mGnssBatchingDeathRecipient);
+ mGnssBatchingCbIface_2_0 = nullptr;
+ }
+ return Void();
+}
+
+// Methods from ::android::hardware::gnss::V2_0::IGnssBatching follow.
+Return<bool> GnssBatching::init_2_0(const sp<V2_0::IGnssBatchingCallback>& callback) {
+ if (mApi != nullptr) {
+ LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
+ mApi->destroy();
+ mApi = nullptr;
+ }
+
+ mApi = new BatchingAPIClient(callback);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
+ return false;
+ }
+
+ if (mGnssBatchingCbIface_2_0 != nullptr) {
+ mGnssBatchingCbIface_2_0->unlinkToDeath(mGnssBatchingDeathRecipient);
+ }
+ mGnssBatchingCbIface_2_0 = callback;
+ if (mGnssBatchingCbIface_2_0 != nullptr) {
+ mGnssBatchingCbIface_2_0->linkToDeath(mGnssBatchingDeathRecipient, 0 /*cookie*/);
+ }
+
+ return true;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/GnssBatching.h b/gps/android/2.0/GnssBatching.h
new file mode 100644
index 0000000..4c8d1db
--- /dev/null
+++ b/gps/android/2.0/GnssBatching.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H
+
+#include <android/hardware/gnss/2.0/IGnssBatching.h>
+#include <hidl/Status.h>
+
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V2_0::IGnssBatching;
+using ::android::hardware::gnss::V2_0::IGnssBatchingCallback;
+using ::android::hidl::base::V1_0::IBase;
+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::sp;
+
+class BatchingAPIClient;
+struct GnssBatching : public IGnssBatching {
+ GnssBatching();
+ ~GnssBatching();
+
+ // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+ Return<bool> init(const sp<V1_0::IGnssBatchingCallback>& callback) override;
+ Return<uint16_t> getBatchSize() override;
+ Return<bool> start(const IGnssBatching::Options& options ) override;
+ Return<void> flush() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+
+ // Methods from ::android::hardware::gnss::V2_0::IGnssBatching follow.
+ Return<bool> init_2_0(const sp<V2_0::IGnssBatchingCallback>& callback) override;
+
+ private:
+ struct GnssBatchingDeathRecipient : hidl_death_recipient {
+ GnssBatchingDeathRecipient(sp<GnssBatching> gnssBatching) :
+ mGnssBatching(gnssBatching) {
+ }
+ ~GnssBatchingDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssBatching> mGnssBatching;
+ };
+
+ private:
+ sp<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
+ sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
+ BatchingAPIClient* mApi = nullptr;
+ sp<V2_0::IGnssBatchingCallback> mGnssBatchingCbIface_2_0 = nullptr;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSBATCHING_H
diff --git a/gps/android/2.0/GnssConfiguration.cpp b/gps/android/2.0/GnssConfiguration.cpp
new file mode 100644
index 0000000..069c036
--- /dev/null
+++ b/gps/android/2.0/GnssConfiguration.cpp
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssConfigurationInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssConfiguration.h"
+#include "ContextBase.h"
+#include <android/hardware/gnss/1.0/types.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::GnssConstellationType;
+using namespace loc_core;
+
+GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
+}
+
+// Methods from ::android::hardware::gps::V1_0::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setSuplEs(bool enabled) {
+ // deprecated function. Must return false to pass VTS
+ return false;
+}
+
+Return<bool> GnssConfiguration::setSuplVersion(uint32_t version) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT;
+ switch (version) {
+ case 0x00020004:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_4;
+ break;
+ case 0x00020002:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_2;
+ break;
+ case 0x00020000:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_2_0_0;
+ break;
+ case 0x00010000:
+ config.suplVersion = GNSS_CONFIG_SUPL_VERSION_1_0_0;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid version: 0x%x.", __FUNCTION__, version);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setSuplMode(uint8_t mode) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_SUPL_MODE_BIT;
+ switch (mode) {
+ case 0:
+ config.suplModeMask = 0; // STANDALONE ONLY
+ break;
+ case 1:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT;
+ break;
+ case 2:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSA_BIT;
+ break;
+ case 3:
+ config.suplModeMask = GNSS_CONFIG_SUPL_MODE_MSB_BIT | GNSS_CONFIG_SUPL_MODE_MSA_BIT;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid mode: %d.", __FUNCTION__, mode);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config = {};
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
+ switch (lppProfile) {
+ case 0:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
+ break;
+ case 1:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE;
+ break;
+ case 2:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE;
+ break;
+ case 3:
+ config.lppProfile = GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid lppProfile: %d.", __FUNCTION__, lppProfile);
+ return false;
+ break;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+
+ config.flags = GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
+ if (protocol & (1<<0)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRC_CONTROL_PLANE_BIT;
+ }
+ if (protocol & (1<<1)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_RRLP_USER_PLANE_BIT;
+ }
+ if (protocol & (1<<2)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_USER_PLANE_BIT;
+ }
+ if (protocol & (1<<3)) {
+ config.aGlonassPositionProtocolMask |= GNSS_CONFIG_LLP_CONTROL_PLANE_BIT;
+ }
+
+ return mGnss->updateConfiguration(config);
+}
+
+Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) {
+
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config = {};
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT;
+ switch (lock) {
+ case 0:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
+ break;
+ case 1:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO;
+ break;
+ case 2:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI;
+ break;
+ case 3:
+ config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
+ break;
+ default:
+ LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock);
+ return false;
+ break;
+ }
+
+ mGnss->updateConfiguration(config);
+ // Must return false to pass VTS
+ return false;
+}
+
+Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT;
+ config.emergencyPdnForEmergencySupl = (enabled ?
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES :
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO);
+
+ 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();
+ if (nullptr == mGnss) {
+ LOC_LOGe("mGnss is null");
+ return false;
+ }
+
+ // blValid is true if blacklist is empty, i.e. clearing the BL;
+ // if blacklist is not empty, blValid is initialied to false, and later
+ // updated in the for loop to become true only if there is at least
+ // one {constellation, svid} in the list that is valid.
+ bool blValid = (0 == blacklist.size());
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
+ config.blacklistedSvIds.clear();
+
+ GnssSvIdSource source = {};
+ for (int idx = 0; idx < (int)blacklist.size(); idx++) {
+ // Set blValid true if any one source is valid
+ blValid = setBlacklistedSource(source, blacklist[idx]) || blValid;
+ config.blacklistedSvIds.push_back(source);
+ }
+
+ // Update configuration only if blValid is true
+ // i.e. only if atleast one source is valid for blacklisting
+ return (blValid && mGnss->updateConfiguration(config));
+}
+
+bool GnssConfiguration::setBlacklistedSource(
+ GnssSvIdSource& copyToSource,
+ const GnssConfiguration::BlacklistedSource& copyFromSource) {
+
+ bool retVal = true;
+ uint16_t svIdOffset = 0;
+ copyToSource.size = sizeof(GnssSvIdSource);
+ copyToSource.svId = copyFromSource.svid;
+
+ switch(copyFromSource.constellation) {
+ case GnssConstellationType::GPS:
+ copyToSource.constellation = GNSS_SV_TYPE_GPS;
+ LOC_LOGe("GPS SVs can't be blacklisted.");
+ retVal = false;
+ break;
+ case GnssConstellationType::SBAS:
+ copyToSource.constellation = GNSS_SV_TYPE_SBAS;
+ LOC_LOGe("SBAS SVs can't be blacklisted.");
+ retVal = false;
+ break;
+ case GnssConstellationType::GLONASS:
+ copyToSource.constellation = GNSS_SV_TYPE_GLONASS;
+ svIdOffset = GNSS_SV_CONFIG_GLO_INITIAL_SV_ID - 1;
+ break;
+ case GnssConstellationType::QZSS:
+ copyToSource.constellation = GNSS_SV_TYPE_QZSS;
+ svIdOffset = 0;
+ break;
+ case GnssConstellationType::BEIDOU:
+ copyToSource.constellation = GNSS_SV_TYPE_BEIDOU;
+ svIdOffset = GNSS_SV_CONFIG_BDS_INITIAL_SV_ID - 1;
+ break;
+ case GnssConstellationType::GALILEO:
+ copyToSource.constellation = GNSS_SV_TYPE_GALILEO;
+ svIdOffset = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID - 1;
+ break;
+ default:
+ copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
+ LOC_LOGe("Invalid constellation %hhu", copyFromSource.constellation);
+ retVal = false;
+ break;
+ }
+
+ if (copyToSource.svId > 0 && svIdOffset > 0) {
+ copyToSource.svId += svIdOffset;
+ }
+
+ return retVal;
+}
+
+// Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow.
+Return<bool> GnssConfiguration::setEsExtensionSec(uint32_t emergencyExtensionSeconds) {
+ ENTRY_LOG_CALLFLOW();
+ if (mGnss == nullptr) {
+ LOC_LOGe("mGnss is nullptr");
+ return false;
+ }
+
+ GnssConfig config;
+ memset(&config, 0, sizeof(GnssConfig));
+ config.size = sizeof(GnssConfig);
+ config.flags = GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT;
+ config.emergencyExtensionSeconds = emergencyExtensionSeconds;
+
+ return mGnss->updateConfiguration(config);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/GnssConfiguration.h b/gps/android/2.0/GnssConfiguration.h
new file mode 100644
index 0000000..202a9fd
--- /dev/null
+++ b/gps/android/2.0/GnssConfiguration.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+
+ /* Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H
+
+#include <android/hardware/gnss/2.0/IGnssConfiguration.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+/*
+ * Interface for passing GNSS configuration info from platform to HAL.
+ */
+struct Gnss;
+struct GnssConfiguration : public V2_0::IGnssConfiguration {
+ GnssConfiguration(Gnss* gnss);
+ ~GnssConfiguration() = default;
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
+ * These declarations were generated from IGnssConfiguration.hal.
+ */
+ Return<bool> setSuplVersion(uint32_t version) override;
+ Return<bool> setSuplMode(uint8_t mode) override;
+ Return<bool> setSuplEs(bool enabled) override;
+ Return<bool> setLppProfile(uint8_t lppProfile) override;
+ Return<bool> setGlonassPositioningProtocol(uint8_t protocol) override;
+ 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;
+
+ // Methods from ::android::hardware::gnss::V2_0::IGnssConfiguration follow.
+ Return<bool> setEsExtensionSec(uint32_t emergencyExtensionSeconds) override;
+
+ private:
+ Gnss* mGnss = nullptr;
+ bool setBlacklistedSource(
+ GnssSvIdSource& copyToSource,
+ const GnssConfiguration::BlacklistedSource& copyFromSource);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSCONFIGURATION_H
diff --git a/gps/android/2.0/GnssDebug.cpp b/gps/android/2.0/GnssDebug.cpp
new file mode 100644
index 0000000..dc0d9f4
--- /dev/null
+++ b/gps/android/2.0/GnssDebug.cpp
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssDebugInterface"
+
+#include <log/log.h>
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssDebug.h"
+#include "LocationUtil.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::hidl_vec;
+using ::android::hardware::gnss::V2_0::IGnssDebug;
+
+#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_MIN (999) // 999 ns
+#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX (1.57783680E17) // 5 years in ns
+#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm
+
+GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
+{
+}
+
+/*
+ * This methods requests position, time and satellite ephemeris debug information
+ * from the HAL.
+ *
+ * @return void
+*/
+Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ V1_0::IGnssDebug::DebugData data = { };
+
+ if((nullptr == mGnss) || (nullptr == mGnss->getGnssInterface())){
+ LOC_LOGE("GnssDebug - Null GNSS interface");
+ _hidl_cb(data);
+ return Void();
+ }
+
+ // get debug report snapshot via hal interface
+ GnssDebugReport reports = { };
+ mGnss->getGnssInterface()->getDebugReport(reports);
+
+ // location block
+ if (reports.mLocation.mValid) {
+ data.position.valid = true;
+ data.position.latitudeDegrees = reports.mLocation.mLocation.latitude;
+ data.position.longitudeDegrees = reports.mLocation.mLocation.longitude;
+ data.position.altitudeMeters = reports.mLocation.mLocation.altitude;
+
+ data.position.speedMetersPerSec =
+ (double)(reports.mLocation.mLocation.speed);
+ data.position.bearingDegrees =
+ (double)(reports.mLocation.mLocation.bearing);
+ data.position.horizontalAccuracyMeters =
+ (double)(reports.mLocation.mLocation.accuracy);
+ data.position.verticalAccuracyMeters =
+ reports.mLocation.verticalAccuracyMeters;
+ data.position.speedAccuracyMetersPerSecond =
+ reports.mLocation.speedAccuracyMetersPerSecond;
+ data.position.bearingAccuracyDegrees =
+ reports.mLocation.bearingAccuracyDegrees;
+
+ timeval tv_now, tv_report;
+ tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
+ tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
+ gettimeofday(&tv_now, NULL);
+ data.position.ageSeconds =
+ (tv_now.tv_sec - tv_report.tv_sec) +
+ (float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
+ }
+ else {
+ 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;
+ }
+
+ // time block
+ if (reports.mTime.mValid) {
+ data.time.timeEstimate = reports.mTime.timeEstimate;
+ data.time.timeUncertaintyNs = reports.mTime.timeUncertaintyNs;
+ data.time.frequencyUncertaintyNsPerSec =
+ reports.mTime.frequencyUncertaintyNsPerSec;
+ }
+
+ if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
+ data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
+ }
+ if (data.time.timeUncertaintyNs <= 0) {
+ data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MIN;
+ } else if (data.time.timeUncertaintyNs > GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX) {
+ data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX;
+ }
+ 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
+ V1_0::IGnssDebug::SatelliteData s = { };
+ std::vector<V1_0::IGnssDebug::SatelliteData> s_array;
+
+ for (uint32_t i=0; i<reports.mSatelliteInfo.size(); i++) {
+ memset(&s, 0, sizeof(s));
+ s.svid = reports.mSatelliteInfo[i].svid;
+ convertGnssConstellationType(
+ reports.mSatelliteInfo[i].constellation, s.constellation);
+ convertGnssEphemerisType(
+ reports.mSatelliteInfo[i].mEphemerisType, s.ephemerisType);
+ convertGnssEphemerisSource(
+ reports.mSatelliteInfo[i].mEphemerisSource, s.ephemerisSource);
+ convertGnssEphemerisHealth(
+ reports.mSatelliteInfo[i].mEphemerisHealth, s.ephemerisHealth);
+
+ s.ephemerisAgeSeconds =
+ reports.mSatelliteInfo[i].ephemerisAgeSeconds;
+ s.serverPredictionIsAvailable =
+ reports.mSatelliteInfo[i].serverPredictionIsAvailable;
+ s.serverPredictionAgeSeconds =
+ reports.mSatelliteInfo[i].serverPredictionAgeSeconds;
+
+ s_array.push_back(s);
+ }
+ data.satelliteDataArray = s_array;
+
+ // callback HIDL with collected debug data
+ _hidl_cb(data);
+ return Void();
+}
+
+Return<void> GnssDebug::getDebugData_2_0(getDebugData_2_0_cb _hidl_cb)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ V2_0::IGnssDebug::DebugData data = { };
+
+ if((nullptr == mGnss) || (nullptr == mGnss->getGnssInterface())){
+ LOC_LOGE("GnssDebug - Null GNSS interface");
+ _hidl_cb(data);
+ return Void();
+ }
+
+ // get debug report snapshot via hal interface
+ GnssDebugReport reports = { };
+ mGnss->getGnssInterface()->getDebugReport(reports);
+
+ // location block
+ if (reports.mLocation.mValid) {
+ data.position.valid = true;
+ data.position.latitudeDegrees = reports.mLocation.mLocation.latitude;
+ data.position.longitudeDegrees = reports.mLocation.mLocation.longitude;
+ data.position.altitudeMeters = reports.mLocation.mLocation.altitude;
+
+ data.position.speedMetersPerSec =
+ (double)(reports.mLocation.mLocation.speed);
+ data.position.bearingDegrees =
+ (double)(reports.mLocation.mLocation.bearing);
+ data.position.horizontalAccuracyMeters =
+ (double)(reports.mLocation.mLocation.accuracy);
+ data.position.verticalAccuracyMeters =
+ reports.mLocation.verticalAccuracyMeters;
+ data.position.speedAccuracyMetersPerSecond =
+ reports.mLocation.speedAccuracyMetersPerSecond;
+ data.position.bearingAccuracyDegrees =
+ reports.mLocation.bearingAccuracyDegrees;
+
+ timeval tv_now, tv_report;
+ tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
+ tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
+ gettimeofday(&tv_now, NULL);
+ data.position.ageSeconds =
+ (tv_now.tv_sec - tv_report.tv_sec) +
+ (float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
+ }
+ else {
+ 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;
+ }
+
+ // time block
+ if (reports.mTime.mValid) {
+ data.time.timeEstimate = reports.mTime.timeEstimate;
+ data.time.timeUncertaintyNs = reports.mTime.timeUncertaintyNs;
+ data.time.frequencyUncertaintyNsPerSec =
+ reports.mTime.frequencyUncertaintyNsPerSec;
+ }
+
+ if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) {
+ data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
+ }
+ if (data.time.timeUncertaintyNs <= 0) {
+ data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MIN;
+ }
+ else if (data.time.timeUncertaintyNs > GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX) {
+ data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC_MAX;
+ }
+ 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
+ V2_0::IGnssDebug::SatelliteData s = { };
+ std::vector<V2_0::IGnssDebug::SatelliteData> s_array;
+
+ for (uint32_t i=0; i<reports.mSatelliteInfo.size(); i++) {
+ memset(&s, 0, sizeof(s));
+ s.v1_0.svid = reports.mSatelliteInfo[i].svid;
+ convertGnssConstellationType(
+ reports.mSatelliteInfo[i].constellation, s.constellation);
+ convertGnssEphemerisType(
+ reports.mSatelliteInfo[i].mEphemerisType, s.v1_0.ephemerisType);
+ convertGnssEphemerisSource(
+ reports.mSatelliteInfo[i].mEphemerisSource, s.v1_0.ephemerisSource);
+ convertGnssEphemerisHealth(
+ reports.mSatelliteInfo[i].mEphemerisHealth, s.v1_0.ephemerisHealth);
+
+ s.v1_0.ephemerisAgeSeconds =
+ reports.mSatelliteInfo[i].ephemerisAgeSeconds;
+ s.v1_0.serverPredictionIsAvailable =
+ reports.mSatelliteInfo[i].serverPredictionIsAvailable;
+ s.v1_0.serverPredictionAgeSeconds =
+ reports.mSatelliteInfo[i].serverPredictionAgeSeconds;
+
+ s_array.push_back(s);
+ }
+ data.satelliteDataArray = s_array;
+
+ // callback HIDL with collected debug data
+ _hidl_cb(data);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/GnssDebug.h b/gps/android/2.0/GnssDebug.h
new file mode 100644
index 0000000..8d75bea
--- /dev/null
+++ b/gps/android/2.0/GnssDebug.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H
+
+
+#include <android/hardware/gnss/2.0/IGnssDebug.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V2_0::IGnssDebug;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+/* Interface for GNSS Debug support. */
+struct Gnss;
+struct GnssDebug : public IGnssDebug {
+ GnssDebug(Gnss* gnss);
+ ~GnssDebug() {};
+
+ // Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow
+ Return<void> getDebugData(getDebugData_cb _hidl_cb) override;
+ // Methods from ::android::hardware::gnss::V2_0::IGnssDebug follow.
+ Return<void> getDebugData_2_0(getDebugData_2_0_cb _hidl_cb) override;
+
+private:
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSDEBUG_H
diff --git a/gps/android/2.0/GnssGeofencing.cpp b/gps/android/2.0/GnssGeofencing.cpp
new file mode 100644
index 0000000..b6fc94b
--- /dev/null
+++ b/gps/android/2.0/GnssGeofencing.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssHal_GnssGeofencing"
+
+#include <log_util.h>
+#include <GeofenceAPIClient.h>
+#include "GnssGeofencing.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+void GnssGeofencing::GnssGeofencingDeathRecipient::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);
+ if (mGnssGeofencing != nullptr) {
+ mGnssGeofencing->removeAllGeofences();
+ }
+}
+
+GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
+ mGnssGeofencingDeathRecipient = new GnssGeofencingDeathRecipient(this);
+}
+
+GnssGeofencing::~GnssGeofencing() {
+ if (mApi != nullptr) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
+Return<void> GnssGeofencing::setCallback(const sp<IGnssGeofenceCallback>& callback) {
+ if (mApi != nullptr) {
+ LOC_LOGd("mApi is NOT nullptr");
+ return Void();
+ }
+
+ mApi = new GeofenceAPIClient(callback);
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: failed to create mApi", __FUNCTION__);
+ }
+
+ if (mGnssGeofencingCbIface != nullptr) {
+ mGnssGeofencingCbIface->unlinkToDeath(mGnssGeofencingDeathRecipient);
+ }
+ mGnssGeofencingCbIface = callback;
+ if (mGnssGeofencingCbIface != nullptr) {
+ mGnssGeofencingCbIface->linkToDeath(mGnssGeofencingDeathRecipient, 0 /*cookie*/);
+ }
+
+ return Void();
+}
+
+Return<void> GnssGeofencing::addGeofence(
+ int32_t geofenceId,
+ double latitudeDegrees,
+ double longitudeDegrees,
+ double radiusMeters,
+ IGnssGeofenceCallback::GeofenceTransition lastTransition,
+ int32_t monitorTransitions,
+ uint32_t notificationResponsivenessMs,
+ uint32_t unknownTimerMs) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceAdd(
+ geofenceId,
+ latitudeDegrees,
+ longitudeDegrees,
+ radiusMeters,
+ static_cast<int32_t>(lastTransition),
+ monitorTransitions,
+ notificationResponsivenessMs,
+ unknownTimerMs);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::pauseGeofence(int32_t geofenceId) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofencePause(geofenceId);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceResume(geofenceId, monitorTransitions);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::removeGeofence(int32_t geofenceId) {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->geofenceRemove(geofenceId);
+ }
+ return Void();
+}
+
+Return<void> GnssGeofencing::removeAllGeofences() {
+ if (mApi == nullptr) {
+ LOC_LOGD("%s]: mApi is nullptr, do nothing", __FUNCTION__);
+ } else {
+ mApi->geofenceRemoveAll();
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/GnssGeofencing.h b/gps/android/2.0/GnssGeofencing.h
new file mode 100644
index 0000000..caa56d0
--- /dev/null
+++ b/gps/android/2.0/GnssGeofencing.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H
+
+#include <android/hardware/gnss/1.0/IGnssGeofencing.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
+using ::android::hardware::gnss::V1_0::IGnssGeofencing;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+class GeofenceAPIClient;
+struct GnssGeofencing : public IGnssGeofencing {
+ GnssGeofencing();
+ ~GnssGeofencing();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssGeofencing follow.
+ * These declarations were generated from IGnssGeofencing.hal.
+ */
+ Return<void> setCallback(const sp<IGnssGeofenceCallback>& callback) override;
+ Return<void> addGeofence(int32_t geofenceId,
+ double latitudeDegrees,
+ double longitudeDegrees,
+ double radiusMeters,
+ IGnssGeofenceCallback::GeofenceTransition lastTransition,
+ int32_t monitorTransitions,
+ uint32_t notificationResponsivenessMs,
+ uint32_t unknownTimerMs) override;
+
+ Return<void> pauseGeofence(int32_t geofenceId) override;
+ Return<void> resumeGeofence(int32_t geofenceId, int32_t monitorTransitions) override;
+ Return<void> removeGeofence(int32_t geofenceId) override;
+
+ private:
+ // This method is not part of the IGnss base class.
+ // It is called by GnssGeofencingDeathRecipient to remove all geofences added so far.
+ Return<void> removeAllGeofences();
+
+ private:
+ struct GnssGeofencingDeathRecipient : hidl_death_recipient {
+ GnssGeofencingDeathRecipient(sp<GnssGeofencing> gnssGeofencing) :
+ mGnssGeofencing(gnssGeofencing) {
+ }
+ ~GnssGeofencingDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssGeofencing> mGnssGeofencing;
+ };
+
+ private:
+ sp<GnssGeofencingDeathRecipient> mGnssGeofencingDeathRecipient = nullptr;
+ sp<IGnssGeofenceCallback> mGnssGeofencingCbIface = nullptr;
+ GeofenceAPIClient* mApi = nullptr;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSGEOFENCING_H
diff --git a/gps/android/2.0/GnssMeasurement.cpp b/gps/android/2.0/GnssMeasurement.cpp
new file mode 100644
index 0000000..b21b004
--- /dev/null
+++ b/gps/android/2.0/GnssMeasurement.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssMeasurementInterface"
+
+#include <log_util.h>
+#include "GnssMeasurement.h"
+#include "MeasurementAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+void GnssMeasurement::GnssMeasurementDeathRecipient::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);
+ if (mGnssMeasurement != nullptr) {
+ mGnssMeasurement->close();
+ }
+}
+
+GnssMeasurement::GnssMeasurement() {
+ mGnssMeasurementDeathRecipient = new GnssMeasurementDeathRecipient(this);
+ mApi = new MeasurementAPIClient();
+}
+
+GnssMeasurement::~GnssMeasurement() {
+ if (mApi) {
+ mApi->destroy();
+ mApi = nullptr;
+ }
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) {
+
+ Return<GnssMeasurement::GnssMeasurementStatus> ret =
+ IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
+ if (mGnssMeasurementCbIface != 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 = callback;
+ mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+
+ return mApi->measurementSetCallback(callback);
+}
+
+Return<void> GnssMeasurement::close() {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ if (mGnssMeasurementCbIface != nullptr) {
+ mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
+ mGnssMeasurementCbIface = nullptr;
+ }
+ if (mGnssMeasurementCbIface_1_1 != nullptr) {
+ mGnssMeasurementCbIface_1_1->unlinkToDeath(mGnssMeasurementDeathRecipient);
+ mGnssMeasurementCbIface_1_1 = nullptr;
+ }
+ if (mGnssMeasurementCbIface_2_0 != nullptr) {
+ mGnssMeasurementCbIface_2_0->unlinkToDeath(mGnssMeasurementDeathRecipient);
+ mGnssMeasurementCbIface_2_0 = nullptr;
+ }
+ mApi->measurementClose();
+
+ return Void();
+}
+
+// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
+Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>& callback, bool enableFullTracking) {
+
+ Return<GnssMeasurement::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 (nullptr == mApi) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ return ret;
+ }
+
+ mGnssMeasurementCbIface_1_1 = callback;
+ mGnssMeasurementCbIface_1_1->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+
+ GnssPowerMode powerMode = enableFullTracking?
+ GNSS_POWER_MODE_M1 : GNSS_POWER_MODE_M2;
+
+ return mApi->measurementSetCallback_1_1(callback, powerMode);
+}
+// Methods from ::android::hardware::gnss::V2_0::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>& callback,
+ bool enableFullTracking) {
+
+ Return<GnssMeasurement::GnssMeasurementStatus> ret =
+ IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
+ if (mGnssMeasurementCbIface_2_0 != 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 (nullptr == mApi) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ return ret;
+ }
+
+ mGnssMeasurementCbIface_2_0 = callback;
+ mGnssMeasurementCbIface_2_0->linkToDeath(mGnssMeasurementDeathRecipient, 0);
+
+ GnssPowerMode powerMode = enableFullTracking ?
+ GNSS_POWER_MODE_M1 : GNSS_POWER_MODE_M2;
+
+ return mApi->measurementSetCallback_2_0(callback, powerMode);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/GnssMeasurement.h b/gps/android/2.0/GnssMeasurement.h
new file mode 100644
index 0000000..000b00f
--- /dev/null
+++ b/gps/android/2.0/GnssMeasurement.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
+
+#include <android/hardware/gnss/2.0/IGnssMeasurement.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+class MeasurementAPIClient;
+struct GnssMeasurement : public V2_0::IGnssMeasurement {
+ GnssMeasurement();
+ ~GnssMeasurement();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+ * These declarations were generated from IGnssMeasurement.hal.
+ */
+ 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<V1_1::IGnssMeasurementCallback>& callback,
+ bool enableFullTracking) override;
+
+ // Methods from ::android::hardware::gnss::V2_0::IGnssMeasurement follow.
+ Return<GnssMeasurement::GnssMeasurementStatus> setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>& callback,
+ bool enableFullTracking) override;
+ private:
+ struct GnssMeasurementDeathRecipient : hidl_death_recipient {
+ GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
+ mGnssMeasurement(gnssMeasurement) {
+ }
+ ~GnssMeasurementDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssMeasurement> mGnssMeasurement;
+ };
+
+ private:
+ sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
+ sp<V1_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
+ sp<V2_0::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_0 = nullptr;
+ MeasurementAPIClient* mApi;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
diff --git a/gps/android/2.0/GnssNi.cpp b/gps/android/2.0/GnssNi.cpp
new file mode 100644
index 0000000..d65a488
--- /dev/null
+++ b/gps/android/2.0/GnssNi.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "LocSvc_GnssNiInterface"
+
+#include <log_util.h>
+#include "Gnss.h"
+#include "GnssNi.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+void GnssNi::GnssNiDeathRecipient::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);
+ // we do nothing here
+ // Gnss::GnssDeathRecipient will stop the session
+}
+
+GnssNi::GnssNi(Gnss* gnss) : mGnss(gnss) {
+ mGnssNiDeathRecipient = new GnssNiDeathRecipient(this);
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
+Return<void> GnssNi::setCallback(const sp<IGnssNiCallback>& callback) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ mGnss->setGnssNiCb(callback);
+
+ if (mGnssNiCbIface != nullptr) {
+ mGnssNiCbIface->unlinkToDeath(mGnssNiDeathRecipient);
+ }
+ mGnssNiCbIface = callback;
+ if (mGnssNiCbIface != nullptr) {
+ mGnssNiCbIface->linkToDeath(mGnssNiDeathRecipient, 0 /*cookie*/);
+ }
+
+ return Void();
+}
+
+Return<void> GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse) {
+ if (mGnss == nullptr) {
+ LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ GnssAPIClient* api = mGnss->getApi();
+ if (api == nullptr) {
+ LOC_LOGE("%s]: api is nullptr", __FUNCTION__);
+ return Void();
+ }
+
+ api->gnssNiRespond(notifId, userResponse);
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/GnssNi.h b/gps/android/2.0/GnssNi.h
new file mode 100644
index 0000000..26e281f
--- /dev/null
+++ b/gps/android/2.0/GnssNi.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H
+
+#include <android/hardware/gnss/1.0/IGnssNi.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssNi;
+using ::android::hardware::gnss::V1_0::IGnssNiCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Gnss;
+struct GnssNi : public IGnssNi {
+ GnssNi(Gnss* gnss);
+ ~GnssNi() = default;
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
+ * These declarations were generated from IGnssNi.hal.
+ */
+ Return<void> setCallback(const sp<IGnssNiCallback>& callback) override;
+ Return<void> respond(int32_t notifId,
+ IGnssNiCallback::GnssUserResponseType userResponse) override;
+
+ private:
+ struct GnssNiDeathRecipient : hidl_death_recipient {
+ GnssNiDeathRecipient(sp<GnssNi> gnssNi) : mGnssNi(gnssNi) {
+ }
+ ~GnssNiDeathRecipient() = default;
+ virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
+ sp<GnssNi> mGnssNi;
+ };
+
+ private:
+ sp<GnssNiDeathRecipient> mGnssNiDeathRecipient = nullptr;
+ sp<IGnssNiCallback> mGnssNiCbIface = nullptr;
+ Gnss* mGnss = nullptr;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSNI_H
diff --git a/gps/android/2.0/android.hardware.gnss@2.0-service-qti.rc b/gps/android/2.0/android.hardware.gnss@2.0-service-qti.rc
new file mode 100644
index 0000000..ad46d5d
--- /dev/null
+++ b/gps/android/2.0/android.hardware.gnss@2.0-service-qti.rc
@@ -0,0 +1,4 @@
+service gnss_service /vendor/bin/hw/android.hardware.gnss@2.0-service-qti
+ class hal
+ user gps
+ group system gps radio vendor_qti_diag
diff --git a/gps/android/2.0/android.hardware.gnss@2.0-service-qti.xml b/gps/android/2.0/android.hardware.gnss@2.0-service-qti.xml
new file mode 100644
index 0000000..de82c60
--- /dev/null
+++ b/gps/android/2.0/android.hardware.gnss@2.0-service-qti.xml
@@ -0,0 +1,37 @@
+<!-- Copyright (c) 2019, 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.
+-->
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.gnss</name>
+ <transport>hwbinder</transport>
+ <fqname>@1.0::IGnss/gnss_vendor</fqname>
+ <fqname>@1.1::IGnss/default</fqname>
+ <fqname>@2.0::IGnss/default</fqname>
+ </hal>
+</manifest>
+
diff --git a/gps/android/2.0/location_api/BatchingAPIClient.cpp b/gps/android/2.0/location_api/BatchingAPIClient.cpp
new file mode 100644
index 0000000..49cd18a
--- /dev/null
+++ b/gps/android/2.0/location_api/BatchingAPIClient.cpp
@@ -0,0 +1,250 @@
+/* Copyright (c) 2017-2019, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_BatchingAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "BatchingAPIClient.h"
+
+#include "limits.h"
+
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V2_0::IGnssBatching;
+using ::android::hardware::gnss::V2_0::IGnssBatchingCallback;
+using ::android::hardware::gnss::V2_0::GnssLocation;
+
+static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
+ LocationCapabilitiesMask mask);
+
+BatchingAPIClient::BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssBatchingCbIface(nullptr),
+ mDefaultId(UINT_MAX),
+ mLocationCapabilitiesMask(0),
+ mGnssBatchingCbIface_2_0(nullptr)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ gnssUpdateCallbacks(callback);
+}
+
+BatchingAPIClient::BatchingAPIClient(const sp<V2_0::IGnssBatchingCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssBatchingCbIface(nullptr),
+ mDefaultId(UINT_MAX),
+ mLocationCapabilitiesMask(0),
+ mGnssBatchingCbIface_2_0(nullptr)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ gnssUpdateCallbacks_2_0(callback);
+}
+
+BatchingAPIClient::~BatchingAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+int BatchingAPIClient::getBatchSize()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ return locAPIGetBatchSize();
+}
+
+void BatchingAPIClient::setCallbacks()
+{
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+ locationCallbacks.batchingCb = [this](size_t count, Location* location,
+ BatchingOptions batchOptions) {
+ onBatchingCb(count, location, batchOptions);
+ };
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+void BatchingAPIClient::gnssUpdateCallbacks(const sp<V1_0::IGnssBatchingCallback>& callback)
+{
+ mMutex.lock();
+ mGnssBatchingCbIface = callback;
+ mMutex.unlock();
+
+ if (mGnssBatchingCbIface != nullptr) {
+ setCallbacks();
+ }
+}
+
+void BatchingAPIClient::gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssBatchingCallback>& callback)
+{
+ mMutex.lock();
+ mGnssBatchingCbIface_2_0 = callback;
+ mMutex.unlock();
+
+ if (mGnssBatchingCbIface_2_0 != nullptr) {
+ setCallbacks();
+ }
+}
+
+int BatchingAPIClient::startSession(const IGnssBatching::Options& opts)
+{
+ LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
+ static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
+ int retVal = -1;
+ LocationOptions options;
+ convertBatchOption(opts, options, mLocationCapabilitiesMask);
+ uint32_t mode = 0;
+ if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
+ mode = SESSION_MODE_ON_FULL;
+ }
+ if (locAPIStartSession(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+int BatchingAPIClient::updateSessionOptions(const IGnssBatching::Options& opts)
+{
+ LOC_LOGD("%s]: (%lld %d)", __FUNCTION__,
+ static_cast<long long>(opts.periodNanos), static_cast<uint8_t>(opts.flags));
+ int retVal = -1;
+ LocationOptions options;
+ convertBatchOption(opts, options, mLocationCapabilitiesMask);
+
+ uint32_t mode = 0;
+ if (opts.flags == static_cast<uint8_t>(IGnssBatching::Flag::WAKEUP_ON_FIFO_FULL)) {
+ mode = SESSION_MODE_ON_FULL;
+ }
+ if (locAPIUpdateSessionOptions(mDefaultId, mode, options) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+int BatchingAPIClient::stopSession()
+{
+ LOC_LOGD("%s]: ", __FUNCTION__);
+ int retVal = -1;
+ if (locAPIStopSession(mDefaultId) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+void BatchingAPIClient::getBatchedLocation(int last_n_locations)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations);
+ locAPIGetBatchedLocations(mDefaultId, last_n_locations);
+}
+
+void BatchingAPIClient::flushBatchedLocations()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ locAPIGetBatchedLocations(mDefaultId, SIZE_MAX);
+}
+
+void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+}
+
+void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
+ BatchingOptions /*batchOptions*/)
+{
+ mMutex.lock();
+ auto gnssBatchingCbIface(mGnssBatchingCbIface);
+ auto gnssBatchingCbIface_2_0(mGnssBatchingCbIface_2_0);
+ mMutex.unlock();
+
+ LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
+ if (gnssBatchingCbIface_2_0 != nullptr && count > 0) {
+ hidl_vec<V2_0::GnssLocation> locationVec;
+ locationVec.resize(count);
+ for (size_t i = 0; i < count; i++) {
+ convertGnssLocation(location[i], locationVec[i]);
+ }
+ auto r = gnssBatchingCbIface_2_0->gnssLocationBatchCb(locationVec);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationBatchCb 2.0 description=%s",
+ __func__, r.description().c_str());
+ }
+ } else if (gnssBatchingCbIface != nullptr && count > 0) {
+ hidl_vec<V1_0::GnssLocation> locationVec;
+ locationVec.resize(count);
+ for (size_t i = 0; i < count; i++) {
+ convertGnssLocation(location[i], locationVec[i]);
+ }
+ auto r = gnssBatchingCbIface->gnssLocationBatchCb(locationVec);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationBatchCb 1.0 description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
+ LocationCapabilitiesMask mask)
+{
+ memset(&out, 0, sizeof(LocationOptions));
+ out.size = sizeof(LocationOptions);
+ out.minInterval = (uint32_t)(in.periodNanos / 1000000L);
+ out.minDistance = 0;
+ out.mode = GNSS_SUPL_MODE_STANDALONE;
+ if (mask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
+ out.mode = GNSS_SUPL_MODE_MSA;
+ if (mask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
+ out.mode = GNSS_SUPL_MODE_MSB;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/location_api/BatchingAPIClient.h b/gps/android/2.0/location_api/BatchingAPIClient.h
new file mode 100644
index 0000000..a249b58
--- /dev/null
+++ b/gps/android/2.0/location_api/BatchingAPIClient.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2017-2019, 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 BATCHING_API_CLINET_H
+#define BATCHING_API_CLINET_H
+
+#include <mutex>
+#include <android/hardware/gnss/2.0/IGnssBatching.h>
+#include <android/hardware/gnss/2.0/IGnssBatchingCallback.h>
+#include <pthread.h>
+
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+class BatchingAPIClient : public LocationAPIClientBase
+{
+public:
+ BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
+ BatchingAPIClient(const sp<V2_0::IGnssBatchingCallback>& callback);
+ void gnssUpdateCallbacks(const sp<V1_0::IGnssBatchingCallback>& callback);
+ void gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssBatchingCallback>& callback);
+ int getBatchSize();
+ 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();
+
+ inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; }
+
+ // callbacks
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
+
+private:
+ void setCallbacks();
+ ~BatchingAPIClient();
+ std::mutex mMutex;
+ sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
+ uint32_t mDefaultId;
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+ sp<V2_0::IGnssBatchingCallback> mGnssBatchingCbIface_2_0;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // BATCHING_API_CLINET_H
diff --git a/gps/android/2.0/location_api/GeofenceAPIClient.cpp b/gps/android/2.0/location_api/GeofenceAPIClient.cpp
new file mode 100644
index 0000000..a93c988
--- /dev/null
+++ b/gps/android/2.0/location_api/GeofenceAPIClient.cpp
@@ -0,0 +1,275 @@
+/* Copyright (c) 2017-2019, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_GeofenceApiClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GeofenceAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+
+GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssGeofencingCbIface(callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+
+ locationCallbacks.geofenceBreachCb = nullptr;
+ if (mGnssGeofencingCbIface != nullptr) {
+ locationCallbacks.geofenceBreachCb =
+ [this](GeofenceBreachNotification geofenceBreachNotification) {
+ onGeofenceBreachCb(geofenceBreachNotification);
+ };
+
+ locationCallbacks.geofenceStatusCb =
+ [this](GeofenceStatusNotification geofenceStatusNotification) {
+ onGeofenceStatusCb(geofenceStatusNotification);
+ };
+ }
+
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+void GeofenceAPIClient::geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int32_t last_transition, int32_t monitor_transitions,
+ uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms)
+{
+ LOC_LOGD("%s]: (%d %f %f %f %d %d %d %d)", __FUNCTION__,
+ geofence_id, latitude, longitude, radius_meters,
+ last_transition, monitor_transitions, notification_responsiveness_ms, unknown_timer_ms);
+
+ GeofenceOption options;
+ memset(&options, 0, sizeof(GeofenceOption));
+ options.size = sizeof(GeofenceOption);
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
+ options.breachTypeMask |= GEOFENCE_BREACH_ENTER_BIT;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
+ options.breachTypeMask |= GEOFENCE_BREACH_EXIT_BIT;
+ options.responsiveness = notification_responsiveness_ms;
+
+ GeofenceInfo data;
+ data.size = sizeof(GeofenceInfo);
+ data.latitude = latitude;
+ data.longitude = longitude;
+ data.radius = radius_meters;
+
+ LocationError err = (LocationError)locAPIAddGeofences(1, &geofence_id, &options, &data);
+ if (LOCATION_ERROR_SUCCESS != err) {
+ onAddGeofencesCb(1, &err, &geofence_id);
+ }
+}
+
+void GeofenceAPIClient::geofencePause(uint32_t geofence_id)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
+ locAPIPauseGeofences(1, &geofence_id);
+}
+
+void GeofenceAPIClient::geofenceResume(uint32_t geofence_id, int32_t monitor_transitions)
+{
+ LOC_LOGD("%s]: (%d %d)", __FUNCTION__, geofence_id, monitor_transitions);
+ GeofenceBreachTypeMask mask = 0;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::ENTERED)
+ mask |= GEOFENCE_BREACH_ENTER_BIT;
+ if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
+ mask |= GEOFENCE_BREACH_EXIT_BIT;
+ locAPIResumeGeofences(1, &geofence_id, &mask);
+}
+
+void GeofenceAPIClient::geofenceRemove(uint32_t geofence_id)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofence_id);
+ locAPIRemoveGeofences(1, &geofence_id);
+}
+
+void GeofenceAPIClient::geofenceRemoveAll()
+{
+ LOC_LOGD("%s]", __FUNCTION__);
+ // TODO locAPIRemoveAllGeofences();
+}
+
+// callbacks
+void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofenceBreachNotification.count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < geofenceBreachNotification.count; i++) {
+ GnssLocation gnssLocation;
+ convertGnssLocation(geofenceBreachNotification.location, gnssLocation);
+
+ IGnssGeofenceCallback::GeofenceTransition transition;
+ if (geofenceBreachNotification.type == GEOFENCE_BREACH_ENTER)
+ transition = IGnssGeofenceCallback::GeofenceTransition::ENTERED;
+ else if (geofenceBreachNotification.type == GEOFENCE_BREACH_EXIT)
+ transition = IGnssGeofenceCallback::GeofenceTransition::EXITED;
+ else {
+ // continue with other breach if transition is
+ // nether GPS_GEOFENCE_ENTERED nor GPS_GEOFENCE_EXITED
+ continue;
+ }
+
+ auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
+ geofenceBreachNotification.ids[i], gnssLocation, transition,
+ static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, geofenceStatusNotification.available);
+ if (mGnssGeofencingCbIface != nullptr) {
+ IGnssGeofenceCallback::GeofenceAvailability status =
+ IGnssGeofenceCallback::GeofenceAvailability::UNAVAILABLE;
+ if (geofenceStatusNotification.available == GEOFENCE_STATUS_AVAILABILE_YES) {
+ status = IGnssGeofenceCallback::GeofenceAvailability::AVAILABLE;
+ }
+ GnssLocation gnssLocation;
+ memset(&gnssLocation, 0, sizeof(GnssLocation));
+ auto r = mGnssGeofencingCbIface->gnssGeofenceStatusCb(status, gnssLocation);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceStatusCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GeofenceAPIClient::onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_EXISTS)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_EXISTS;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceAddCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceAddCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceRemoveCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceRemoveCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofencePauseCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofencePauseCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids)
+{
+ LOC_LOGD("%s]: (%zu)", __FUNCTION__, count);
+ if (mGnssGeofencingCbIface != nullptr) {
+ for (size_t i = 0; i < count; i++) {
+ IGnssGeofenceCallback::GeofenceStatus status =
+ IGnssGeofenceCallback::GeofenceStatus::ERROR_GENERIC;
+ if (errors[i] == LOCATION_ERROR_SUCCESS)
+ status = IGnssGeofenceCallback::GeofenceStatus::OPERATION_SUCCESS;
+ else if (errors[i] == LOCATION_ERROR_ID_UNKNOWN)
+ status = IGnssGeofenceCallback::GeofenceStatus::ERROR_ID_UNKNOWN;
+ auto r = mGnssGeofencingCbIface->gnssGeofenceResumeCb(ids[i], status);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssGeofenceResumeCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/location_api/GeofenceAPIClient.h b/gps/android/2.0/location_api/GeofenceAPIClient.h
new file mode 100644
index 0000000..83025a9
--- /dev/null
+++ b/gps/android/2.0/location_api/GeofenceAPIClient.h
@@ -0,0 +1,76 @@
+/* Copyright (c) 2017-2019, 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 GEOFENCE_API_CLINET_H
+#define GEOFENCE_API_CLINET_H
+
+
+#include <android/hardware/gnss/1.0/IGnssGeofenceCallback.h>
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+
+class GeofenceAPIClient : public LocationAPIClientBase
+{
+public:
+ GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
+ void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int32_t last_transition, int32_t monitor_transitions,
+ uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
+ void geofencePause(uint32_t geofence_id);
+ void geofenceResume(uint32_t geofence_id, int32_t monitor_transitions);
+ void geofenceRemove(uint32_t geofence_id);
+ void geofenceRemoveAll();
+
+ // callbacks
+ void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification) final;
+ void onGeofenceStatusCb(GeofenceStatusNotification geofenceStatusNotification) final;
+ void onAddGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onRemoveGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onPauseGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+ void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
+
+private:
+ virtual ~GeofenceAPIClient() = default;
+
+ sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GEOFENCE_API_CLINET_H
diff --git a/gps/android/2.0/location_api/GnssAPIClient.cpp b/gps/android/2.0/location_api/GnssAPIClient.cpp
new file mode 100644
index 0000000..74fe036
--- /dev/null
+++ b/gps/android/2.0/location_api/GnssAPIClient.cpp
@@ -0,0 +1,744 @@
+/* Copyright (c) 2017-2019, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_GnssAPIClient"
+#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GnssAPIClient.h"
+#include <LocContext.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V2_0::IGnss;
+using ::android::hardware::gnss::V2_0::IGnssCallback;
+using ::android::hardware::gnss::V1_0::IGnssNiCallback;
+using ::android::hardware::gnss::V2_0::GnssLocation;
+
+static void convertGnssSvStatus(GnssSvNotification& in, V1_0::IGnssCallback::GnssSvStatus& out);
+static void convertGnssSvStatus(GnssSvNotification& in,
+ hidl_vec<V2_0::IGnssCallback::GnssSvInfo>& out);
+
+GnssAPIClient::GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb) :
+ LocationAPIClientBase(),
+ mGnssCbIface(nullptr),
+ mGnssNiCbIface(nullptr),
+ mControlClient(new LocationAPIControlClient()),
+ mLocationCapabilitiesMask(0),
+ mLocationCapabilitiesCached(false),
+ mTracking(false),
+ mGnssCbIface_2_0(nullptr)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ initLocationOptions();
+ gnssUpdateCallbacks(gpsCb, niCb);
+}
+
+GnssAPIClient::GnssAPIClient(const sp<V2_0::IGnssCallback>& gpsCb) :
+ LocationAPIClientBase(),
+ mGnssCbIface(nullptr),
+ mGnssNiCbIface(nullptr),
+ mControlClient(new LocationAPIControlClient()),
+ mLocationCapabilitiesMask(0),
+ mLocationCapabilitiesCached(false),
+ mTracking(false),
+ mGnssCbIface_2_0(nullptr)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &gpsCb);
+
+ initLocationOptions();
+ gnssUpdateCallbacks_2_0(gpsCb);
+}
+
+GnssAPIClient::~GnssAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ if (mControlClient) {
+ delete mControlClient;
+ mControlClient = nullptr;
+ }
+}
+
+void GnssAPIClient::initLocationOptions()
+{
+ // set default LocationOptions.
+ memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
+ mTrackingOptions.size = sizeof(TrackingOptions);
+ mTrackingOptions.minInterval = 1000;
+ mTrackingOptions.minDistance = 0;
+ mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+}
+
+void GnssAPIClient::setFlpCallbacks() {
+ LOC_LOGd("Going to set Flp Callbacks...");
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = [this](Location location) {
+ onTrackingCb(location);
+ };
+ locAPISetCallbacks(locationCallbacks);
+}
+
+void GnssAPIClient::setCallbacks()
+{
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = [this](Location location) {
+ onTrackingCb(location);
+ };
+
+ locationCallbacks.batchingCb = nullptr;
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ if (mGnssNiCbIface != nullptr) {
+ loc_core::ContextBase* context =
+ loc_core::LocContext::getLocContext(
+ NULL, NULL,
+ loc_core::LocContext::mLocationHalName, false);
+ if (!context->hasAgpsExtendedCapabilities()) {
+ LOC_LOGD("Registering NI CB");
+ locationCallbacks.gnssNiCb = [this](uint32_t id, GnssNiNotification gnssNiNotify) {
+ onGnssNiCb(id, gnssNiNotify);
+ };
+ }
+ }
+
+ locationCallbacks.gnssSvCb = [this](GnssSvNotification gnssSvNotification) {
+ onGnssSvCb(gnssSvNotification);
+ };
+
+ locationCallbacks.gnssNmeaCb = [this](GnssNmeaNotification gnssNmeaNotification) {
+ onGnssNmeaCb(gnssNmeaNotification);
+ };
+
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+// for GpsInterface
+void GnssAPIClient::gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<IGnssNiCallback>& niCb)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ mMutex.lock();
+ mGnssCbIface = gpsCb;
+ mGnssNiCbIface = niCb;
+ mMutex.unlock();
+
+ if (mGnssCbIface != nullptr || mGnssNiCbIface != nullptr) {
+ setCallbacks();
+ }
+}
+
+void GnssAPIClient::gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssCallback>& gpsCb)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &gpsCb);
+
+ mMutex.lock();
+ mGnssCbIface_2_0 = gpsCb;
+ mMutex.unlock();
+
+ if (mGnssCbIface_2_0 != nullptr) {
+ setCallbacks();
+ }
+}
+
+void GnssAPIClient::gnssUpdateFlpCallbacks() {
+ if (mGnssCbIface_2_0 != nullptr || mGnssCbIface != nullptr) {
+ setFlpCallbacks();
+ }
+}
+
+bool GnssAPIClient::gnssStart()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+
+ mMutex.lock();
+ mTracking = true;
+ mMutex.unlock();
+
+ bool retVal = true;
+ locAPIStartTracking(mTrackingOptions);
+ return retVal;
+}
+
+bool GnssAPIClient::gnssStop()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+
+ mMutex.lock();
+ mTracking = false;
+ mMutex.unlock();
+
+ bool retVal = true;
+ locAPIStopTracking();
+ return retVal;
+}
+
+bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
+ IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs,
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LOC_LOGD("%s]: (%d %d %d %d %d %d %d)", __FUNCTION__,
+ (int)mode, recurrence, minIntervalMs, preferredAccuracyMeters,
+ preferredTimeMs, (int)powerMode, timeBetweenMeasurement);
+ bool retVal = true;
+ memset(&mTrackingOptions, 0, sizeof(TrackingOptions));
+ mTrackingOptions.size = sizeof(TrackingOptions);
+ mTrackingOptions.minInterval = minIntervalMs;
+ if (IGnss::GnssPositionMode::MS_ASSISTED == mode ||
+ IGnss::GnssPositionRecurrence::RECURRENCE_SINGLE == recurrence) {
+ // We set a very large interval to simulate SINGLE mode. Once we report a fix,
+ // the caller should take the responsibility to stop the session.
+ // For MSA, we always treat it as SINGLE mode.
+ mTrackingOptions.minInterval = SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC;
+ }
+ if (mode == IGnss::GnssPositionMode::STANDALONE)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+ else if (mode == IGnss::GnssPositionMode::MS_BASED)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_MSB;
+ else if (mode == IGnss::GnssPositionMode::MS_ASSISTED)
+ mTrackingOptions.mode = GNSS_SUPL_MODE_MSA;
+ else {
+ LOC_LOGD("%s]: invalid GnssPositionMode: %d", __FUNCTION__, (int)mode);
+ retVal = false;
+ }
+ if (GNSS_POWER_MODE_INVALID != powerMode) {
+ mTrackingOptions.powerMode = powerMode;
+ mTrackingOptions.tbm = timeBetweenMeasurement;
+ }
+ locAPIUpdateTrackingOptions(mTrackingOptions);
+ return retVal;
+}
+
+// for GpsNiInterface
+void GnssAPIClient::gnssNiRespond(int32_t notifId,
+ IGnssNiCallback::GnssUserResponseType userResponse)
+{
+ LOC_LOGD("%s]: (%d %d)", __FUNCTION__, notifId, static_cast<int>(userResponse));
+ GnssNiResponse data;
+ switch (userResponse) {
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT:
+ data = GNSS_NI_RESPONSE_ACCEPT;
+ break;
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY:
+ data = GNSS_NI_RESPONSE_DENY;
+ break;
+ case IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP:
+ data = GNSS_NI_RESPONSE_NO_RESPONSE;
+ break;
+ default:
+ data = GNSS_NI_RESPONSE_IGNORE;
+ break;
+ }
+
+ locAPIGnssNiResponse(notifId, data);
+}
+
+// these apis using LocationAPIControlClient
+void GnssAPIClient::gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags)
+{
+ LOC_LOGD("%s]: (%02hx)", __FUNCTION__, aidingDataFlags);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ GnssAidingData data;
+ memset(&data, 0, sizeof (GnssAidingData));
+ data.sv.svTypeMask = GNSS_AIDING_DATA_SV_TYPE_GPS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT |
+ GNSS_AIDING_DATA_SV_TYPE_NAVIC_BIT;
+ data.posEngineMask = STANDARD_POSITIONING_ENGINE;
+
+ if (aidingDataFlags == IGnss::GnssAidingData::DELETE_ALL)
+ data.deleteAll = true;
+ else {
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_EPHEMERIS)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_ALMANAC)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_ALMANAC_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_POSITION)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_POSITION_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_TIME)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_TIME_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_IONO)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_UTC)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_UTC_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_HEALTH)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_HEALTH_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVDIR)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_DIRECTION_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SVSTEER)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_STEER_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_SADATA)
+ data.sv.svMask |= GNSS_AIDING_DATA_SV_SA_DATA_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_RTI)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_RTI_BIT;
+ if (aidingDataFlags & IGnss::GnssAidingData::DELETE_CELLDB_INFO)
+ data.common.mask |= GNSS_AIDING_DATA_COMMON_CELLDB_BIT;
+ }
+ mControlClient->locAPIGnssDeleteAidingData(data);
+}
+
+void GnssAPIClient::gnssEnable(LocationTechnologyType techType)
+{
+ LOC_LOGD("%s]: (%0d)", __FUNCTION__, techType);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIEnable(techType);
+}
+
+void GnssAPIClient::gnssDisable()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIDisable();
+}
+
+void GnssAPIClient::gnssConfigurationUpdate(const GnssConfig& gnssConfig)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, gnssConfig.flags);
+ if (mControlClient == nullptr) {
+ return;
+ }
+ mControlClient->locAPIGnssUpdateConfig(gnssConfig);
+}
+
+void GnssAPIClient::requestCapabilities() {
+ // only send capablities if it's already cached, otherwise the first time LocationAPI
+ // is initialized, capabilities will be sent by LocationAPI
+ if (mLocationCapabilitiesCached) {
+ onCapabilitiesCb(mLocationCapabilitiesMask);
+ }
+}
+
+// callbacks
+void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+ mLocationCapabilitiesCached = true;
+
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ auto gnssCbIface_2_0(mGnssCbIface_2_0);
+ mMutex.unlock();
+
+ if (gnssCbIface_2_0 != nullptr || gnssCbIface != nullptr) {
+ uint32_t data = 0;
+ if ((capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT) ||
+ (capabilitiesMask & LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT))
+ data |= IGnssCallback::Capabilities::SCHEDULING;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GEOFENCE_BIT)
+ data |= V1_0::IGnssCallback::Capabilities::GEOFENCING;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT)
+ data |= V1_0::IGnssCallback::Capabilities::MEASUREMENTS;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
+ data |= IGnssCallback::Capabilities::MSB;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSA_BIT)
+ data |= IGnssCallback::Capabilities::MSA;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT)
+ data |= IGnssCallback::Capabilities::LOW_POWER_MODE;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT)
+ data |= IGnssCallback::Capabilities::SATELLITE_BLACKLIST;
+
+ IGnssCallback::GnssSystemInfo gnssInfo = { .yearOfHw = 2015 };
+
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
+ gnssInfo.yearOfHw++; // 2016
+ if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
+ gnssInfo.yearOfHw++; // 2017
+ if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
+ capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
+ gnssInfo.yearOfHw++; // 2018
+ if (capabilitiesMask & LOCATION_CAPABILITIES_PRIVACY_BIT) {
+ gnssInfo.yearOfHw++; // 2019
+ }
+ }
+ }
+ }
+ LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
+
+ if (gnssCbIface_2_0 != nullptr) {
+ auto r = gnssCbIface_2_0->gnssSetCapabilitiesCb_2_0(data);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetCapabilitiesCb_2_0 description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface_2_0->gnssSetSystemInfoCb(gnssInfo);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
+ __func__, r.description().c_str());
+ }
+ } else if (gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssSetCapabilitesCb(data);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface->gnssSetSystemInfoCb(gnssInfo);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetSystemInfoCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+
+ }
+
+}
+
+void GnssAPIClient::onTrackingCb(Location location)
+{
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ auto gnssCbIface_2_0(mGnssCbIface_2_0);
+ bool isTracking = mTracking;
+ mMutex.unlock();
+
+ LOC_LOGD("%s]: (flags: %02x isTracking: %d)", __FUNCTION__, location.flags, isTracking);
+
+ if (!isTracking) {
+ return;
+ }
+
+ if (gnssCbIface_2_0 != nullptr) {
+ V2_0::GnssLocation gnssLocation;
+ convertGnssLocation(location, gnssLocation);
+ auto r = gnssCbIface_2_0->gnssLocationCb_2_0(gnssLocation);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationCb_2_0 description=%s",
+ __func__, r.description().c_str());
+ }
+ } else if (gnssCbIface != nullptr) {
+ V1_0::GnssLocation gnssLocation;
+ convertGnssLocation(location, gnssLocation);
+ auto r = gnssCbIface->gnssLocationCb(gnssLocation);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssLocationCb description=%s",
+ __func__, r.description().c_str());
+ }
+ } else {
+ LOC_LOGW("%s] No GNSS Interface ready for gnssLocationCb ", __FUNCTION__);
+ }
+
+}
+
+void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification)
+{
+ LOC_LOGD("%s]: (id: %d)", __FUNCTION__, id);
+ mMutex.lock();
+ auto gnssNiCbIface(mGnssNiCbIface);
+ mMutex.unlock();
+
+ if (gnssNiCbIface == nullptr) {
+ LOC_LOGE("%s]: mGnssNiCbIface is nullptr", __FUNCTION__);
+ return;
+ }
+
+ IGnssNiCallback::GnssNiNotification notificationGnss = {};
+
+ notificationGnss.notificationId = id;
+
+ if (gnssNiNotification.type == GNSS_NI_TYPE_VOICE)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::VOICE;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_SUPL)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_SUPL;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_CONTROL_PLANE)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::UMTS_CTRL_PLANE;
+ else if (gnssNiNotification.type == GNSS_NI_TYPE_EMERGENCY_SUPL)
+ notificationGnss.niType = IGnssNiCallback::GnssNiType::EMERGENCY_SUPL;
+
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_NOTIFICATION_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_NOTIFY;
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_VERIFICATION_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::NEED_VERIFY;
+ if (gnssNiNotification.options & GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT)
+ notificationGnss.notifyFlags |= IGnssNiCallback::GnssNiNotifyFlags::PRIVACY_OVERRIDE;
+
+ notificationGnss.timeoutSec = gnssNiNotification.timeout;
+
+ if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_ACCEPT)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT;
+ else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_DENY)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY;
+ else if (gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_NO_RESPONSE ||
+ gnssNiNotification.timeoutResponse == GNSS_NI_RESPONSE_IGNORE)
+ notificationGnss.defaultResponse = IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP;
+
+ notificationGnss.requestorId = gnssNiNotification.requestor;
+
+ notificationGnss.notificationMessage = gnssNiNotification.message;
+
+ if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_NONE)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
+ else if (gnssNiNotification.requestorEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
+ notificationGnss.requestorIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
+
+ if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_NONE)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_NONE;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_GSM_DEFAULT)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_GSM_DEFAULT;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UTF8)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UTF8;
+ else if (gnssNiNotification.messageEncoding == GNSS_NI_ENCODING_TYPE_UCS2)
+ notificationGnss.notificationIdEncoding =
+ IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
+
+ gnssNiCbIface->niNotifyCb(notificationGnss);
+}
+
+void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
+{
+ LOC_LOGD("%s]: (count: %u)", __FUNCTION__, gnssSvNotification.count);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ auto gnssCbIface_2_0(mGnssCbIface_2_0);
+ mMutex.unlock();
+
+ if (gnssCbIface_2_0 != nullptr) {
+ hidl_vec<V2_0::IGnssCallback::GnssSvInfo> svInfoList;
+ convertGnssSvStatus(gnssSvNotification, svInfoList);
+ auto r = gnssCbIface_2_0->gnssSvStatusCb_2_0(svInfoList);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSvStatusCb_2_0 description=%s",
+ __func__, r.description().c_str());
+ }
+ } else if (gnssCbIface != nullptr) {
+ V1_0::IGnssCallback::GnssSvStatus svStatus;
+ convertGnssSvStatus(gnssSvNotification, svStatus);
+ auto r = gnssCbIface->gnssSvStatusCb(svStatus);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSvStatusCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
+{
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ auto gnssCbIface_2_0(mGnssCbIface_2_0);
+ mMutex.unlock();
+
+ if (gnssCbIface != nullptr || gnssCbIface_2_0 != nullptr) {
+ const std::string s(gnssNmeaNotification.nmea);
+ std::stringstream ss(s);
+ std::string each;
+ while(std::getline(ss, each, '\n')) {
+ each += '\n';
+ android::hardware::hidl_string nmeaString;
+ nmeaString.setToExternal(each.c_str(), each.length());
+ if (gnssCbIface_2_0 != nullptr) {
+ auto r = gnssCbIface_2_0->gnssNmeaCb(
+ static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssCbIface_2_0 nmea=%s length=%u description=%s",
+ __func__, gnssNmeaNotification.nmea, gnssNmeaNotification.length,
+ r.description().c_str());
+ }
+ } else if (gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssNmeaCb(
+ static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%u description=%s",
+ __func__, gnssNmeaNotification.nmea, gnssNmeaNotification.length,
+ r.description().c_str());
+ }
+ }
+ }
+ }
+}
+
+void GnssAPIClient::onStartTrackingCb(LocationError error)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ auto gnssCbIface_2_0(mGnssCbIface_2_0);
+ mMutex.unlock();
+
+ if (error == LOCATION_ERROR_SUCCESS) {
+ if (gnssCbIface_2_0 != nullptr) {
+ auto r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb 2.0 ENGINE_ON description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb 2.0 SESSION_BEGIN description=%s",
+ __func__, r.description().c_str());
+ }
+ } else if (gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb ENGINE_ON description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb SESSION_BEGIN description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+void GnssAPIClient::onStopTrackingCb(LocationError error)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, error);
+ mMutex.lock();
+ auto gnssCbIface(mGnssCbIface);
+ auto gnssCbIface_2_0(mGnssCbIface_2_0);
+ mMutex.unlock();
+
+ if (error == LOCATION_ERROR_SUCCESS) {
+ if (gnssCbIface_2_0 != nullptr) {
+ auto r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb 2.0 SESSION_END description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface_2_0->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb 2.0 ENGINE_OFF description=%s",
+ __func__, r.description().c_str());
+ }
+
+ } else if (gnssCbIface != nullptr) {
+ auto r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb SESSION_END description=%s",
+ __func__, r.description().c_str());
+ }
+ r = gnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_OFF);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb ENGINE_OFF description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+static void convertGnssSvStatus(GnssSvNotification& in, V1_0::IGnssCallback::GnssSvStatus& out)
+{
+ memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
+ out.numSvs = in.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++) {
+ convertGnssSvid(in.gnssSvs[i], out.gnssSvList[i].svid);
+ convertGnssConstellationType(in.gnssSvs[i].type, out.gnssSvList[i].constellation);
+ out.gnssSvList[i].cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
+ out.gnssSvList[i].elevationDegrees = in.gnssSvs[i].elevation;
+ out.gnssSvList[i].azimuthDegrees = in.gnssSvs[i].azimuth;
+ out.gnssSvList[i].carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
+ out.gnssSvList[i].svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
+ out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
+ out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
+ out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
+ out.gnssSvList[i].svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
+ }
+}
+
+static void convertGnssSvStatus(GnssSvNotification& in,
+ hidl_vec<V2_0::IGnssCallback::GnssSvInfo>& out)
+{
+ out.resize(in.count);
+ for (size_t i = 0; i < in.count; i++) {
+ convertGnssSvid(in.gnssSvs[i], out[i].v1_0.svid);
+ out[i].v1_0.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
+ out[i].v1_0.elevationDegrees = in.gnssSvs[i].elevation;
+ out[i].v1_0.azimuthDegrees = in.gnssSvs[i].azimuth;
+ out[i].v1_0.carrierFrequencyHz = in.gnssSvs[i].carrierFrequencyHz;
+ out[i].v1_0.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_EPHEMER_BIT)
+ out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_ALMANAC_BIT)
+ out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_USED_IN_FIX_BIT)
+ out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
+ if (in.gnssSvs[i].gnssSvOptionsMask & GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT)
+ out[i].v1_0.svFlag |= IGnssCallback::GnssSvFlags::HAS_CARRIER_FREQUENCY;
+
+ convertGnssConstellationType(in.gnssSvs[i].type, out[i].constellation);
+ }
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/location_api/GnssAPIClient.h b/gps/android/2.0/location_api/GnssAPIClient.h
new file mode 100644
index 0000000..d6190a9
--- /dev/null
+++ b/gps/android/2.0/location_api/GnssAPIClient.h
@@ -0,0 +1,116 @@
+/* Copyright (c) 2017-2019, 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 GNSS_API_CLINET_H
+#define GNSS_API_CLINET_H
+
+
+#include <mutex>
+#include <android/hardware/gnss/2.0/IGnss.h>
+#include <android/hardware/gnss/2.0/IGnssCallback.h>
+#include <LocationAPIClientBase.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+
+class GnssAPIClient : public LocationAPIClientBase
+{
+public:
+ GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
+ GnssAPIClient(const sp<V2_0::IGnssCallback>& gpsCb);
+ GnssAPIClient(const GnssAPIClient&) = delete;
+ GnssAPIClient& operator=(const GnssAPIClient&) = delete;
+
+ // for GpsInterface
+ void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
+ const sp<V1_0::IGnssNiCallback>& niCb);
+ void gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssCallback>& gpsCb);
+ void gnssUpdateFlpCallbacks();
+ bool gnssStart();
+ bool gnssStop();
+ bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs,
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = 0);
+
+ // for GpsNiInterface
+ void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
+
+ // these apis using LocationAPIControlClient
+ void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
+ void gnssEnable(LocationTechnologyType techType);
+ void gnssDisable();
+ void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
+
+ inline LocationCapabilitiesMask gnssGetCapabilities() const {
+ return mLocationCapabilitiesMask;
+ }
+ void requestCapabilities();
+
+ // callbacks we are interested in
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onTrackingCb(Location location) final;
+ void onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification) final;
+ void onGnssSvCb(GnssSvNotification gnssSvNotification) final;
+ void onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification) final;
+
+ void onStartTrackingCb(LocationError error) final;
+ void onStopTrackingCb(LocationError error) final;
+
+private:
+ virtual ~GnssAPIClient();
+ void setCallbacks();
+ void setFlpCallbacks();
+ void initLocationOptions();
+ sp<V1_0::IGnssCallback> mGnssCbIface;
+ sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
+ std::mutex mMutex;
+ LocationAPIControlClient* mControlClient;
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+ bool mLocationCapabilitiesCached;
+ TrackingOptions mTrackingOptions;
+ bool mTracking;
+ sp<V2_0::IGnssCallback> mGnssCbIface_2_0;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GNSS_API_CLINET_H
diff --git a/gps/android/2.0/location_api/LocationUtil.cpp b/gps/android/2.0/location_api/LocationUtil.cpp
new file mode 100755
index 0000000..5175b5b
--- /dev/null
+++ b/gps/android/2.0/location_api/LocationUtil.cpp
@@ -0,0 +1,386 @@
+/* Copyright (c) 2017-2019, 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 <LocationUtil.h>
+#include <log_util.h>
+#include <inttypes.h>
+#include <gps_extended_c.h>
+#include <loc_misc_utils.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V2_0::GnssLocation;
+using ::android::hardware::gnss::V2_0::GnssConstellationType;
+using ::android::hardware::gnss::V1_0::GnssLocationFlags;
+
+void convertGnssLocation(Location& in, V1_0::GnssLocation& out)
+{
+ memset(&out, 0, sizeof(V1_0::GnssLocation));
+ if (in.flags & LOCATION_HAS_LAT_LONG_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_LAT_LONG;
+ out.latitudeDegrees = in.latitude;
+ out.longitudeDegrees = in.longitude;
+ }
+ if (in.flags & LOCATION_HAS_ALTITUDE_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_ALTITUDE;
+ out.altitudeMeters = in.altitude;
+ }
+ if (in.flags & LOCATION_HAS_SPEED_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED;
+ out.speedMetersPerSec = in.speed;
+ }
+ if (in.flags & LOCATION_HAS_BEARING_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING;
+ out.bearingDegrees = in.bearing;
+ }
+ if (in.flags & LOCATION_HAS_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_HORIZONTAL_ACCURACY;
+ out.horizontalAccuracyMeters = in.accuracy;
+ }
+ if (in.flags & LOCATION_HAS_VERTICAL_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_VERTICAL_ACCURACY;
+ out.verticalAccuracyMeters = in.verticalAccuracy;
+ }
+ if (in.flags & LOCATION_HAS_SPEED_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_SPEED_ACCURACY;
+ out.speedAccuracyMetersPerSecond = in.speedAccuracy;
+ }
+ if (in.flags & LOCATION_HAS_BEARING_ACCURACY_BIT) {
+ out.gnssLocationFlags |= GnssLocationFlags::HAS_BEARING_ACCURACY;
+ out.bearingAccuracyDegrees = in.bearingAccuracy;
+ }
+
+ out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
+}
+
+bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos)
+{
+ struct timespec sinceBootTime;
+ struct timespec sinceBootTimeTest;
+ bool clockGetTimeSuccess = false;
+ const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
+ const uint32_t MAX_GET_TIME_COUNT = 20;
+ /* Attempt to get CLOCK_REALTIME and CLOCK_BOOTIME in succession without an interruption
+ or context switch (for up to MAX_GET_TIME_COUNT times) to avoid errors in the calculation */
+ for (uint32_t i = 0; i < MAX_GET_TIME_COUNT; i++) {
+ if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTime) != 0) {
+ break;
+ };
+ if (clock_gettime(CLOCK_REALTIME, ¤tTime) != 0) {
+ break;
+ }
+ if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTimeTest) != 0) {
+ break;
+ };
+ sinceBootTimeNanos = sinceBootTime.tv_sec * 1000000000 + sinceBootTime.tv_nsec;
+ int64_t sinceBootTimeTestNanos =
+ sinceBootTimeTest.tv_sec * 1000000000 + sinceBootTimeTest.tv_nsec;
+ int64_t sinceBootTimeDeltaNanos = sinceBootTimeTestNanos - sinceBootTimeNanos;
+
+ /* sinceBootTime and sinceBootTimeTest should have a close value if there was no
+ interruption or context switch between clock_gettime for CLOCK_BOOTIME and
+ clock_gettime for CLOCK_REALTIME */
+ if (sinceBootTimeDeltaNanos < MAX_TIME_DELTA_VALUE_NANOS) {
+ clockGetTimeSuccess = true;
+ break;
+ } else {
+ LOC_LOGd("Delta:%" PRIi64 "ns time too large, retry number #%u...",
+ sinceBootTimeDeltaNanos, i + 1);
+ }
+ }
+ return clockGetTimeSuccess;
+}
+
+void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
+{
+ memset(&out, 0, sizeof(V2_0::GnssLocation));
+ convertGnssLocation(in, out.v1_0);
+ if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
+ out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
+ uint64_t qtimerDiff = in.elapsedRealTime - getQTimerTickCount();
+ out.elapsedRealtime.timestampNs = qTimerTicksToNanos(double(qtimerDiff));
+ out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
+ out.elapsedRealtime.timeUncertaintyNs = in.elapsedRealTimeUnc;
+ } else {
+ struct timespec currentTime;
+ int64_t sinceBootTimeNanos;
+
+ if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
+ int64_t currentTimeNanos = currentTime.tv_sec*1000000000 + currentTime.tv_nsec;
+ int64_t locationTimeNanos = in.timestamp*1000000;
+ LOC_LOGD("%s]: sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
+ " locationTimeNanos:%" PRIi64 "",
+ __FUNCTION__, sinceBootTimeNanos, currentTimeNanos, locationTimeNanos);
+ if (currentTimeNanos >= locationTimeNanos) {
+ int64_t ageTimeNanos = currentTimeNanos - locationTimeNanos;
+ LOC_LOGD("%s]: ageTimeNanos:%" PRIi64 ")", __FUNCTION__, ageTimeNanos);
+ // the max trusted propagation time 100ms for ageTimeNanos to avoid user setting
+ //wrong time, it will affect elapsedRealtimeNanos
+ if (ageTimeNanos <= 100000000) {
+ out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
+ out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
+ out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
+ // time uncertainty is the max value between abs(AP_UTC - MP_UTC) and 100ms, to
+ //verify if user change the sys time
+ out.elapsedRealtime.timeUncertaintyNs =
+ std::max(ageTimeNanos, (int64_t)100000000);
+ LOC_LOGD("%s]: timestampNs:%" PRIi64 ")",
+ __FUNCTION__, out.elapsedRealtime.timestampNs);
+ }
+ }
+ } else {
+ LOC_LOGe("Failed to calculate elapsedRealtimeNanos timestamp");
+ }
+ }
+}
+
+void convertGnssLocation(const V1_0::GnssLocation& in, Location& out)
+{
+ memset(&out, 0, sizeof(out));
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG) {
+ out.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ out.latitude = in.latitudeDegrees;
+ out.longitude = in.longitudeDegrees;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE) {
+ out.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ out.altitude = in.altitudeMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED) {
+ out.flags |= LOCATION_HAS_SPEED_BIT;
+ out.speed = in.speedMetersPerSec;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
+ out.flags |= LOCATION_HAS_BEARING_BIT;
+ out.bearing = in.bearingDegrees;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY) {
+ out.flags |= LOCATION_HAS_ACCURACY_BIT;
+ out.accuracy = in.horizontalAccuracyMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
+ out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ out.verticalAccuracy = in.verticalAccuracyMeters;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
+ out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ out.speedAccuracy = in.speedAccuracyMetersPerSecond;
+ }
+ if (in.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
+ out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ out.bearingAccuracy = in.bearingAccuracyDegrees;
+ }
+
+ out.timestamp = static_cast<uint64_t>(in.timestamp);
+}
+
+void convertGnssLocation(const V2_0::GnssLocation& in, Location& out)
+{
+ memset(&out, 0, sizeof(out));
+ convertGnssLocation(in.v1_0, out);
+}
+
+void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out)
+{
+ switch(in) {
+ case GNSS_SV_TYPE_GPS:
+ out = V1_0::GnssConstellationType::GPS;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = V1_0::GnssConstellationType::SBAS;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ out = V1_0::GnssConstellationType::GLONASS;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = V1_0::GnssConstellationType::QZSS;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = V1_0::GnssConstellationType::BEIDOU;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = V1_0::GnssConstellationType::GALILEO;
+ break;
+ case GNSS_SV_TYPE_UNKNOWN:
+ default:
+ out = V1_0::GnssConstellationType::UNKNOWN;
+ break;
+ }
+}
+
+void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out)
+{
+ switch(in) {
+ case GNSS_SV_TYPE_GPS:
+ out = V2_0::GnssConstellationType::GPS;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = V2_0::GnssConstellationType::SBAS;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ out = V2_0::GnssConstellationType::GLONASS;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = V2_0::GnssConstellationType::QZSS;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = V2_0::GnssConstellationType::BEIDOU;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = V2_0::GnssConstellationType::GALILEO;
+ break;
+ case GNSS_SV_TYPE_NAVIC:
+ out = V2_0::GnssConstellationType::IRNSS;
+ break;
+ case GNSS_SV_TYPE_UNKNOWN:
+ default:
+ out = V2_0::GnssConstellationType::UNKNOWN;
+ break;
+ }
+}
+
+void convertGnssSvid(GnssSv& in, int16_t& out)
+{
+ switch (in.type) {
+ case GNSS_SV_TYPE_GPS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ out = in.svId - GLO_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = in.svId - BDS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = in.svId - GAL_SV_PRN_MIN + 1;
+ break;
+ default:
+ out = in.svId;
+ break;
+ }
+}
+
+void convertGnssSvid(GnssMeasurementsData& in, int16_t& out)
+{
+ switch (in.svType) {
+ case GNSS_SV_TYPE_GPS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ if (in.svId != 255) { // OSN is known
+ out = in.svId - GLO_SV_PRN_MIN + 1;
+ } else { // OSN is not known, report FCN
+ out = in.gloFrequency + 92;
+ }
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ out = in.svId;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ out = in.svId - BDS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ out = in.svId - GAL_SV_PRN_MIN + 1;
+ break;
+ default:
+ out = in.svId;
+ break;
+ }
+}
+
+void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
+{
+ switch(in) {
+ case GNSS_EPH_TYPE_EPHEMERIS:
+ out = GnssDebug::SatelliteEphemerisType::EPHEMERIS;
+ break;
+ case GNSS_EPH_TYPE_ALMANAC:
+ out = GnssDebug::SatelliteEphemerisType::ALMANAC_ONLY;
+ break;
+ case GNSS_EPH_TYPE_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisType::NOT_AVAILABLE;
+ break;
+ }
+}
+
+void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out)
+{
+ switch(in) {
+ case GNSS_EPH_SOURCE_DEMODULATED:
+ out = GnssDebug::SatelliteEphemerisSource::DEMODULATED;
+ break;
+ case GNSS_EPH_SOURCE_SUPL_PROVIDED:
+ out = GnssDebug::SatelliteEphemerisSource::SUPL_PROVIDED;
+ break;
+ case GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED:
+ out = GnssDebug::SatelliteEphemerisSource::OTHER_SERVER_PROVIDED;
+ break;
+ case GNSS_EPH_SOURCE_LOCAL:
+ case GNSS_EPH_SOURCE_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisSource::OTHER;
+ break;
+ }
+}
+
+void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out)
+{
+ switch(in) {
+ case GNSS_EPH_HEALTH_GOOD:
+ out = GnssDebug::SatelliteEphemerisHealth::GOOD;
+ break;
+ case GNSS_EPH_HEALTH_BAD:
+ out = GnssDebug::SatelliteEphemerisHealth::BAD;
+ break;
+ case GNSS_EPH_HEALTH_UNKNOWN:
+ default:
+ out = GnssDebug::SatelliteEphemerisHealth::UNKNOWN;
+ break;
+ }
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/location_api/LocationUtil.h b/gps/android/2.0/location_api/LocationUtil.h
new file mode 100644
index 0000000..3c34514
--- /dev/null
+++ b/gps/android/2.0/location_api/LocationUtil.h
@@ -0,0 +1,61 @@
+/* Copyright (c) 2017-2019, 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 LOCATION_UTIL_H
+#define LOCATION_UTIL_H
+
+#include <android/hardware/gnss/2.0/types.h>
+#include <LocationAPI.h>
+#include <GnssDebug.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
+void convertGnssLocation(Location& in, V2_0::GnssLocation& out);
+void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
+void convertGnssLocation(const V2_0::GnssLocation& in, Location& out);
+void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
+void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out);
+void convertGnssSvid(GnssSv& in, int16_t& out);
+void convertGnssSvid(GnssMeasurementsData& in, int16_t& out);
+void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
+void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
+void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
+bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // LOCATION_UTIL_H
diff --git a/gps/android/2.0/location_api/MeasurementAPIClient.cpp b/gps/android/2.0/location_api/MeasurementAPIClient.cpp
new file mode 100644
index 0000000..accf60b
--- /dev/null
+++ b/gps/android/2.0/location_api/MeasurementAPIClient.cpp
@@ -0,0 +1,532 @@
+/* Copyright (c) 2017-2019, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_MeasurementAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+#include <inttypes.h>
+
+#include "LocationUtil.h"
+#include "MeasurementAPIClient.h"
+#include <loc_misc_utils.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssMeasurement;
+using ::android::hardware::gnss::V2_0::IGnssMeasurementCallback;
+
+static void convertGnssData(GnssMeasurementsNotification& in,
+ V1_0::IGnssMeasurementCallback::GnssData& out);
+static void convertGnssData_1_1(GnssMeasurementsNotification& in,
+ V1_1::IGnssMeasurementCallback::GnssData& out);
+static void convertGnssData_2_0(GnssMeasurementsNotification& in,
+ V2_0::IGnssMeasurementCallback::GnssData& out);
+static void convertGnssMeasurement(GnssMeasurementsData& in,
+ V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
+static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
+static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& in,
+ ::android::hardware::hidl_string& out);
+static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
+ ::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtimeNanos);
+
+MeasurementAPIClient::MeasurementAPIClient() :
+ mGnssMeasurementCbIface(nullptr),
+ mGnssMeasurementCbIface_1_1(nullptr),
+ mGnssMeasurementCbIface_2_0(nullptr),
+ mTracking(false)
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+MeasurementAPIClient::~MeasurementAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+// for GpsInterface
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface = callback;
+ mMutex.unlock();
+
+ return startTracking();
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::measurementSetCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>& callback,
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LOC_LOGD("%s]: (%p) (powermode: %d) (tbm: %d)",
+ __FUNCTION__, &callback, (int)powerMode, timeBetweenMeasurement);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface_1_1 = callback;
+ mMutex.unlock();
+
+ return startTracking(powerMode, timeBetweenMeasurement);
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::measurementSetCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>& callback,
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LOC_LOGD("%s]: (%p) (powermode: %d) (tbm: %d)",
+ __FUNCTION__, &callback, (int)powerMode, timeBetweenMeasurement);
+
+ mMutex.lock();
+ mGnssMeasurementCbIface_2_0 = callback;
+ mMutex.unlock();
+
+ return startTracking(powerMode, timeBetweenMeasurement);
+}
+
+Return<IGnssMeasurement::GnssMeasurementStatus>
+MeasurementAPIClient::startTracking(
+ GnssPowerMode powerMode, uint32_t timeBetweenMeasurement)
+{
+ LocationCallbacks locationCallbacks;
+ memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+ if (mGnssMeasurementCbIface_2_0 != nullptr ||
+ mGnssMeasurementCbIface_1_1 != nullptr ||
+ mGnssMeasurementCbIface != nullptr) {
+ locationCallbacks.gnssMeasurementsCb =
+ [this](GnssMeasurementsNotification gnssMeasurementsNotification) {
+ onGnssMeasurementsCb(gnssMeasurementsNotification);
+ };
+ }
+
+ locAPISetCallbacks(locationCallbacks);
+
+ TrackingOptions options = {};
+ memset(&options, 0, sizeof(TrackingOptions));
+ options.size = sizeof(TrackingOptions);
+ options.minInterval = 1000;
+ options.mode = GNSS_SUPL_MODE_STANDALONE;
+ if (GNSS_POWER_MODE_INVALID != powerMode) {
+ options.powerMode = powerMode;
+ options.tbm = timeBetweenMeasurement;
+ }
+
+ mTracking = true;
+ LOC_LOGD("%s]: start tracking session", __FUNCTION__);
+ locAPIStartTracking(options);
+ return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
+}
+
+// for GpsMeasurementInterface
+void MeasurementAPIClient::measurementClose() {
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ mTracking = false;
+ locAPIStopTracking();
+}
+
+// callbacks
+void MeasurementAPIClient::onGnssMeasurementsCb(
+ GnssMeasurementsNotification gnssMeasurementsNotification)
+{
+ LOC_LOGD("%s]: (count: %u active: %d)",
+ __FUNCTION__, gnssMeasurementsNotification.count, mTracking);
+ if (mTracking) {
+ mMutex.lock();
+ sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
+ sp<V1_1::IGnssMeasurementCallback> gnssMeasurementCbIface_1_1 = nullptr;
+ sp<V2_0::IGnssMeasurementCallback> gnssMeasurementCbIface_2_0 = nullptr;
+ if (mGnssMeasurementCbIface_2_0 != nullptr) {
+ gnssMeasurementCbIface_2_0 = mGnssMeasurementCbIface_2_0;
+ } else if (mGnssMeasurementCbIface_1_1 != nullptr) {
+ gnssMeasurementCbIface_1_1 = mGnssMeasurementCbIface_1_1;
+ } else if (mGnssMeasurementCbIface != nullptr) {
+ gnssMeasurementCbIface = mGnssMeasurementCbIface;
+ }
+ mMutex.unlock();
+
+ if (gnssMeasurementCbIface_2_0 != nullptr) {
+ V2_0::IGnssMeasurementCallback::GnssData gnssData;
+ convertGnssData_2_0(gnssMeasurementsNotification, gnssData);
+ auto r = gnssMeasurementCbIface_2_0->gnssMeasurementCb_2_0(gnssData);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssMeasurementCb description=%s",
+ __func__, r.description().c_str());
+ }
+ } else if (gnssMeasurementCbIface_1_1 != nullptr) {
+ V1_1::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()) {
+ LOC_LOGE("%s] Error from GnssMeasurementCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ }
+}
+
+static void convertGnssMeasurement(GnssMeasurementsData& in,
+ V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
+{
+ memset(&out, 0, sizeof(out));
+ if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_SNR;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_FREQUENCY;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_CYCLES;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
+ out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
+ convertGnssSvid(in, out.svid);
+ convertGnssConstellationType(in.svType, out.constellation);
+ out.timeOffsetNs = in.timeOffsetNs;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BIT_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SUBFRAME_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_MSEC_AMBIGUOUS;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SYMBOL_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_STRING_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_BIT_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_SUBFRAME_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1BC_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1C_2ND_CODE_LOCK;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1B_PAGE_SYNC;
+ if (in.stateMask & GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT)
+ out.state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SBAS_SYNC;
+ out.receivedSvTimeInNs = in.receivedSvTimeNs;
+ out.receivedSvTimeUncertaintyInNs = in.receivedSvTimeUncertaintyNs;
+ out.cN0DbHz = in.carrierToNoiseDbHz;
+ out.pseudorangeRateMps = in.pseudorangeRateMps;
+ out.pseudorangeRateUncertaintyMps = in.pseudorangeRateUncertaintyMps;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
+ if (in.adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
+ out.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
+ out.accumulatedDeltaRangeM = in.adrMeters;
+ out.accumulatedDeltaRangeUncertaintyM = in.adrUncertaintyMeters;
+ out.carrierFrequencyHz = in.carrierFrequencyHz;
+ out.carrierCycles = in.carrierCycles;
+ out.carrierPhase = in.carrierPhase;
+ out.carrierPhaseUncertainty = in.carrierPhaseUncertainty;
+ uint8_t indicator =
+ static_cast<uint8_t>(IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_UNKNOWN);
+ if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT)
+ indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATOR_PRESENT;
+ if (in.multipathIndicator & GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT)
+ indicator |= IGnssMeasurementCallback::GnssMultipathIndicator::INDICATIOR_NOT_PRESENT;
+ out.multipathIndicator =
+ static_cast<IGnssMeasurementCallback::GnssMultipathIndicator>(indicator);
+ out.snrDb = in.signalToNoiseRatioDb;
+ out.agcLevelDb = in.agcLevelDb;
+}
+
+static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out)
+{
+ memset(&out, 0, sizeof(out));
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_LEAP_SECOND;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_TIME_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_FULL_BIAS;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_BIAS_UNCERTAINTY;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT;
+ if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT)
+ out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_DRIFT_UNCERTAINTY;
+ out.leapSecond = in.leapSecond;
+ out.timeNs = in.timeNs;
+ out.timeUncertaintyNs = in.timeUncertaintyNs;
+ out.fullBiasNs = in.fullBiasNs;
+ out.biasNs = in.biasNs;
+ out.biasUncertaintyNs = in.biasUncertaintyNs;
+ out.driftNsps = in.driftNsps;
+ out.driftUncertaintyNsps = in.driftUncertaintyNsps;
+ out.hwClockDiscontinuityCount = in.hwClockDiscontinuityCount;
+}
+
+static void convertGnssData(GnssMeasurementsNotification& in,
+ V1_0::IGnssMeasurementCallback::GnssData& out)
+{
+ memset(&out, 0, sizeof(out));
+ out.measurementCount = in.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]);
+ }
+ convertGnssClock(in.clock, out.clock);
+}
+
+static void convertGnssData_1_1(GnssMeasurementsNotification& in,
+ V1_1::IGnssMeasurementCallback::GnssData& out)
+{
+ memset(&out, 0, sizeof(out));
+ out.measurements.resize(in.count);
+ for (size_t i = 0; i < in.count; i++) {
+ convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_0);
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT)
+ out.measurements[i].accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_HALF_CYCLE_RESOLVED;
+ }
+ convertGnssClock(in.clock, out.clock);
+}
+
+static void convertGnssData_2_0(GnssMeasurementsNotification& in,
+ V2_0::IGnssMeasurementCallback::GnssData& out)
+{
+ memset(&out, 0, sizeof(out));
+ out.measurements.resize(in.count);
+ for (size_t i = 0; i < in.count; i++) {
+ convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_1.v1_0);
+ convertGnssConstellationType(in.measurements[i].svType, out.measurements[i].constellation);
+ convertGnssMeasurementsCodeType(in.measurements[i].codeType, out.measurements[i].codeType);
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT)
+ out.measurements[i].v1_1.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_VALID;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT)
+ out.measurements[i].v1_1.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_RESET;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT)
+ out.measurements[i].v1_1.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_CYCLE_SLIP;
+ if (in.measurements[i].adrStateMask & GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT)
+ out.measurements[i].v1_1.accumulatedDeltaRangeState |=
+ IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState::ADR_STATE_HALF_CYCLE_RESOLVED;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_CODE_LOCK;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BIT_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SUBFRAME_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_DECODED;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_MSEC_AMBIGUOUS;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SYMBOL_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_STRING_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_DECODED;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_BIT_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_BDS_D2_SUBFRAME_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1BC_CODE_LOCK;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1C_2ND_CODE_LOCK;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GAL_E1B_PAGE_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_SBAS_SYNC;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_TOW_KNOWN_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_TOW_KNOWN;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_GLO_TOD_KNOWN_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_GLO_TOD_KNOWN;
+ if (in.measurements[i].stateMask & GNSS_MEASUREMENTS_STATE_2ND_CODE_LOCK_BIT)
+ out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_2ND_CODE_LOCK;
+ }
+ convertGnssClock(in.clock, out.clock);
+ convertElapsedRealtimeNanos(in, out.elapsedRealtime);
+}
+
+static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& in,
+ ::android::hardware::hidl_string& out)
+{
+ memset(&out, 0, sizeof(out));
+ switch(in) {
+ case GNSS_MEASUREMENTS_CODE_TYPE_A:
+ out = "A";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_B:
+ out = "B";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_C:
+ out = "C";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_I:
+ out = "I";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_L:
+ out = "L";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_M:
+ out = "M";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_P:
+ out = "P";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_Q:
+ out = "Q";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_S:
+ out = "S";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_W:
+ out = "W";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_X:
+ out = "X";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_Y:
+ out = "Y";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_Z:
+ out = "Z";
+ break;
+ case GNSS_MEASUREMENTS_CODE_TYPE_N:
+ out = "N";
+ break;
+ default:
+ out = "UNKNOWN";
+ }
+
+}
+
+static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
+ ::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtime)
+{
+ if (in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT) {
+ elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
+ uint64_t qtimerDiff = in.clock.elapsedRealTime - getQTimerTickCount();
+ elapsedRealtime.timestampNs = qTimerTicksToNanos(double(qtimerDiff));
+ elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
+ elapsedRealtime.timeUncertaintyNs = in.clock.elapsedRealTimeUnc;
+ } else {
+ const uint32_t UTC_TO_GPS_SECONDS = 315964800;
+ struct timespec currentTime;
+ int64_t sinceBootTimeNanos;
+
+ if (getCurrentTime(currentTime, sinceBootTimeNanos) &&
+ in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT &&
+ in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT &&
+ in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT &&
+ in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT) {
+ int64_t currentTimeNanos = currentTime.tv_sec * 1000000000 + currentTime.tv_nsec;
+ int64_t measTimeNanos = (int64_t)in.clock.timeNs - (int64_t)in.clock.fullBiasNs
+ - (int64_t)in.clock.biasNs - (int64_t)in.clock.leapSecond * 1000000000
+ + (int64_t)UTC_TO_GPS_SECONDS * 1000000000;
+
+ LOC_LOGd("sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
+ " measTimeNanos:%" PRIi64 "",
+ sinceBootTimeNanos, currentTimeNanos, measTimeNanos);
+ if (currentTimeNanos >= measTimeNanos) {
+ int64_t ageTimeNanos = currentTimeNanos - measTimeNanos;
+ LOC_LOGD("%s]: ageTimeNanos:%" PRIi64 ")", __FUNCTION__, ageTimeNanos);
+ if (ageTimeNanos <= 100000000) {
+ elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
+ elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
+ elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
+ // time uncertainty is 1 ms since it is calculated from utc time that is in ms
+ elapsedRealtime.timeUncertaintyNs =
+ std::max(ageTimeNanos, (int64_t)100000000);
+ LOC_LOGd("timestampNs:%" PRIi64 ") timeUncertaintyNs:%" PRIi64 ")",
+ elapsedRealtime.timestampNs,
+ elapsedRealtime.timeUncertaintyNs);
+ }
+ }
+ } else {
+ LOC_LOGe("Failed to calculate elapsedRealtimeNanos timestamp");
+ }
+ }
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/2.0/location_api/MeasurementAPIClient.h b/gps/android/2.0/location_api/MeasurementAPIClient.h
new file mode 100644
index 0000000..67f17ae
--- /dev/null
+++ b/gps/android/2.0/location_api/MeasurementAPIClient.h
@@ -0,0 +1,90 @@
+/* Copyright (c) 2017-2019, 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 MEASUREMENT_API_CLINET_H
+#define MEASUREMENT_API_CLINET_H
+
+#include <mutex>
+#include <android/hardware/gnss/2.0/IGnssMeasurement.h>
+//#include <android/hardware/gnss/1.1/IGnssMeasurementCallback.h>
+#include <LocationAPIClientBase.h>
+#include <hidl/Status.h>
+#include <gps_extended_c.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+
+class MeasurementAPIClient : public LocationAPIClientBase
+{
+public:
+ MeasurementAPIClient();
+ MeasurementAPIClient(const MeasurementAPIClient&) = delete;
+ MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
+
+ // for GpsMeasurementInterface
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback);
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>& callback,
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>& callback,
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
+ void measurementClose();
+ Return<IGnssMeasurement::GnssMeasurementStatus> startTracking(
+ GnssPowerMode powerMode = GNSS_POWER_MODE_INVALID,
+ uint32_t timeBetweenMeasurement = GPS_DEFAULT_FIX_INTERVAL_MS);
+
+ // callbacks we are interested in
+ void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
+
+private:
+ virtual ~MeasurementAPIClient();
+
+ std::mutex mMutex;
+ sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
+ sp<V1_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
+ sp<V2_0::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_0;
+
+ bool mTracking;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // MEASUREMENT_API_CLINET_H
diff --git a/gps/android/2.0/service.cpp b/gps/android/2.0/service.cpp
new file mode 100644
index 0000000..e484a16
--- /dev/null
+++ b/gps/android/2.0/service.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ */
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.gnss@2.0-service-qti"
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+#include <hidl/LegacySupport.h>
+#include "loc_cfg.h"
+#include "loc_misc_utils.h"
+
+extern "C" {
+#include "vndfwk-detect.h"
+}
+
+#ifdef ARCH_ARM_32
+#define DEFAULT_HW_BINDER_MEM_SIZE 65536
+#endif
+
+using android::hardware::gnss::V2_0::IGnss;
+
+using android::hardware::configureRpcThreadpool;
+using android::hardware::registerPassthroughServiceImplementation;
+using android::hardware::joinRpcThreadpool;
+
+using android::status_t;
+using android::OK;
+
+typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []);
+
+int main() {
+
+ ALOGI("%s", __FUNCTION__);
+
+ int vendorInfo = getVendorEnhancedInfo();
+ bool vendorEnhanced = ( 1 == vendorInfo || 3 == vendorInfo );
+ setVendorEnhanced(vendorEnhanced);
+
+#ifdef ARCH_ARM_32
+ android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
+#endif
+ configureRpcThreadpool(1, true);
+ status_t status;
+
+ status = registerPassthroughServiceImplementation<IGnss>();
+ if (status == OK) {
+ if (vendorEnhanced) {
+ #ifdef LOC_HIDL_VERSION
+ #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so"
+
+ void* libHandle = NULL;
+ vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*)
+ dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main");
+ if (NULL != vendorEnhancedMainMethod) {
+ (*vendorEnhancedMainMethod)(0, NULL);
+ }
+ #else
+ ALOGE("LOC_HIDL_VERSION not defined.");
+ #endif
+ } else {
+ status = registerPassthroughServiceImplementation<IGnss>("gnss_vendor");
+ if (status != OK) {
+ ALOGE("Error while registering gnss_vendor service: %d", status);
+ }
+ }
+
+ joinRpcThreadpool();
+
+ } else {
+ ALOGE("Error while registering IGnss 2.0 service: %d", status);
+ }
+
+ return 0;
+}
diff --git a/gps/android/Android.mk b/gps/android/Android.mk
new file mode 100644
index 0000000..3b5c01f
--- /dev/null
+++ b/gps/android/Android.mk
@@ -0,0 +1,15 @@
+LOCAL_PATH := $(call my-dir)
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+include $(CLEAR_VARS)
+DIR_LIST := $(LOCAL_PATH)
+include $(DIR_LIST)/utils/Android.mk
+ifeq ($(GNSS_HIDL_VERSION),2.0)
+include $(DIR_LIST)/2.0/Android.mk
+else
+ifeq ($(GNSS_HIDL_VERSION),1.1)
+include $(DIR_LIST)/1.1/Android.mk
+else
+include $(DIR_LIST)/1.0/Android.mk
+endif #GNSS HIDL 1.1
+endif #GNSS HIDL 2.0
+endif #BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/android/measurement_corrections/1.0/MeasurementCorrections.cpp b/gps/android/measurement_corrections/1.0/MeasurementCorrections.cpp
new file mode 100644
index 0000000..2c93cb3
--- /dev/null
+++ b/gps/android/measurement_corrections/1.0/MeasurementCorrections.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#define LOG_TAG "LocSvc_MeasurementCorrectionsInterface"
+
+#include <log_util.h>
+#include "MeasurementCorrections.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace measurement_corrections {
+namespace V1_0 {
+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::sp;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+
+MeasurementCorrections::MeasurementCorrections() {
+}
+
+MeasurementCorrections::~MeasurementCorrections() {
+}
+
+Return<bool> MeasurementCorrections::setCorrections(const ::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections& /*corrections*/) {
+ return true;
+}
+
+Return<bool> MeasurementCorrections::setCallback(
+ const sp<V1_0::IMeasurementCorrectionsCallback>& /*callback*/) {
+ return true;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace measurement_corrections
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/measurement_corrections/1.0/MeasurementCorrections.h b/gps/android/measurement_corrections/1.0/MeasurementCorrections.h
new file mode 100644
index 0000000..ad534dc
--- /dev/null
+++ b/gps/android/measurement_corrections/1.0/MeasurementCorrections.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2019, 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 ANDROID_HARDWARE_GNSS_V1_0_MeasurementCorrections_H
+#define ANDROID_HARDWARE_GNSS_V1_0_MeasurementCorrections_H
+
+#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrections.h>
+#include <android/hardware/gnss/measurement_corrections/1.0/IMeasurementCorrectionsCallback.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <location_interface.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace measurement_corrections {
+namespace V1_0 {
+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::sp;
+using ::android::hardware::gnss::V1_0::GnssLocation;
+using ::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback;
+
+struct MeasurementCorrections : public IMeasurementCorrections {
+ MeasurementCorrections();
+ ~MeasurementCorrections();
+
+// Methods from ::android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrections follow.
+Return<bool> setCorrections(const ::android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections& corrections) override;
+
+Return<bool> setCallback(const sp<IMeasurementCorrectionsCallback>& callback) override;
+
+};
+
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace measurement_corrections
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_MeasurementCorrections_H
diff --git a/gps/android/utils/Android.mk b/gps/android/utils/Android.mk
new file mode 100644
index 0000000..0e4c953
--- /dev/null
+++ b/gps/android/utils/Android.mk
@@ -0,0 +1,43 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := liblocbatterylistener
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH) \
+
+LOCAL_SRC_FILES:= \
+ battery_listener.cpp
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libcutils \
+ libutils \
+ android.hardware.health@1.0 \
+ android.hardware.health@2.0 \
+ android.hardware.power@1.2 \
+ libbase
+
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+
+LOCAL_STATIC_LIBRARIES := libhealthhalutils
+LOCAL_CFLAGS += -DBATTERY_LISTENER_ENABLED
+
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := liblocbatterylistener_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
+include $(BUILD_HEADER_LIBRARY)
+
+
diff --git a/gps/android/utils/battery_listener.cpp b/gps/android/utils/battery_listener.cpp
new file mode 100644
index 0000000..170159a
--- /dev/null
+++ b/gps/android/utils/battery_listener.cpp
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2019-2020, 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 "battery_listener.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LocSvc_BatteryListener"
+#define LOG_NDEBUG 0
+
+#include <android/hidl/manager/1.0/IServiceManager.h>
+#include <android/hardware/health/2.0/IHealth.h>
+#include <healthhalutils/HealthHalUtils.h>
+#include <hidl/HidlTransportSupport.h>
+#include <thread>
+#include <log_util.h>
+
+using android::hardware::interfacesEqual;
+using android::hardware::Return;
+using android::hardware::Void;
+using android::hardware::health::V1_0::BatteryStatus;
+using android::hardware::health::V1_0::toString;
+using android::hardware::health::V2_0::get_health_service;
+using android::hardware::health::V2_0::HealthInfo;
+using android::hardware::health::V2_0::IHealth;
+using android::hardware::health::V2_0::Result;
+using android::hidl::manager::V1_0::IServiceManager;
+using namespace std::literals::chrono_literals;
+
+static bool sIsBatteryListened = false;
+namespace android {
+
+#define GET_HEALTH_SVC_RETRY_CNT 5
+#define GET_HEALTH_SVC_WAIT_TIME_MS 500
+
+struct BatteryListenerImpl : public hardware::health::V2_0::IHealthInfoCallback,
+ public hardware::hidl_death_recipient {
+ typedef std::function<void(bool)> cb_fn_t;
+ BatteryListenerImpl(cb_fn_t cb);
+ virtual ~BatteryListenerImpl ();
+ virtual hardware::Return<void> healthInfoChanged(
+ const hardware::health::V2_0::HealthInfo& info);
+ virtual void serviceDied(uint64_t cookie,
+ const wp<hidl::base::V1_0::IBase>& who);
+ bool isCharging() {
+ std::lock_guard<std::mutex> _l(mLock);
+ return statusToBool(mStatus);
+ }
+ private:
+ sp<hardware::health::V2_0::IHealth> mHealth;
+ status_t init();
+ BatteryStatus mStatus;
+ cb_fn_t mCb;
+ std::mutex mLock;
+ std::condition_variable mCond;
+ std::unique_ptr<std::thread> mThread;
+ bool mDone;
+ bool statusToBool(const BatteryStatus &s) const {
+ return (s == BatteryStatus::CHARGING) ||
+ (s == BatteryStatus::FULL);
+ }
+};
+
+status_t BatteryListenerImpl::init()
+{
+ int tries = 0;
+
+ if (mHealth != NULL)
+ return INVALID_OPERATION;
+
+ do {
+ mHealth = hardware::health::V2_0::get_health_service();
+ if (mHealth != NULL)
+ break;
+ usleep(GET_HEALTH_SVC_WAIT_TIME_MS * 1000);
+ tries++;
+ } while(tries < GET_HEALTH_SVC_RETRY_CNT);
+
+ if (mHealth == NULL) {
+ LOC_LOGe("no health service found, retries %d", tries);
+ return NO_INIT;
+ } else {
+ LOC_LOGi("Get health service in %d tries", tries);
+ }
+ mStatus = BatteryStatus::UNKNOWN;
+ auto ret = mHealth->getChargeStatus([&](Result r, BatteryStatus status) {
+ if (r != Result::SUCCESS) {
+ LOC_LOGe("batterylistener: cannot get battery status");
+ return;
+ }
+ mStatus = status;
+ });
+ if (!ret.isOk()) {
+ LOC_LOGe("batterylistener: get charge status transaction error");
+ }
+ if (mStatus == BatteryStatus::UNKNOWN) {
+ LOC_LOGw("batterylistener: init: invalid battery status");
+ }
+ mDone = false;
+ mThread = std::make_unique<std::thread>([this]() {
+ std::unique_lock<std::mutex> l(mLock);
+ BatteryStatus local_status = mStatus;
+ while (!mDone) {
+ if (local_status == mStatus) {
+ mCond.wait(l);
+ continue;
+ }
+ local_status = mStatus;
+ switch (local_status) {
+ // NOT_CHARGING is a special event that indicates, a battery is connected,
+ // but not charging. This is seen for approx a second
+ // after charger is plugged in. A charging event is eventually received.
+ // We must try to avoid an unnecessary cb to HAL
+ // only to call it again shortly.
+ // An option to deal with this transient event would be to ignore this.
+ // Or process this event with a slight delay (i.e cancel this event
+ // if a different event comes in within a timeout
+ case BatteryStatus::NOT_CHARGING : {
+ auto mStatusnot_ncharging =
+ [this, local_status]() { return mStatus != local_status; };
+ mCond.wait_for(l, 3s, mStatusnot_ncharging);
+ if (mStatusnot_ncharging()) // i.e event changed
+ break;
+ [[clang::fallthrough]]; //explicit fall-through between switch labels
+ }
+ default:
+ bool c = statusToBool(local_status);
+ LOC_LOGi("healthInfo cb thread: cb %s", c ? "CHARGING" : "NOT CHARGING");
+ l.unlock();
+ mCb(c);
+ l.lock();
+ break;
+ }
+ }
+ });
+ auto reg = mHealth->registerCallback(this);
+ if (!reg.isOk()) {
+ LOC_LOGe("Transaction error in registeringCb to HealthHAL death: %s",
+ reg.description().c_str());
+ }
+
+ auto linked = mHealth->linkToDeath(this, 0 /* cookie */);
+ if (!linked.isOk() || linked == false) {
+ LOC_LOGe("Transaction error in linking to HealthHAL death: %s",
+ linked.description().c_str());
+ }
+ return NO_ERROR;
+}
+
+BatteryListenerImpl::BatteryListenerImpl(cb_fn_t cb) :
+ mCb(cb)
+{
+ init();
+}
+
+BatteryListenerImpl::~BatteryListenerImpl()
+{
+ {
+ std::lock_guard<std::mutex> _l(mLock);
+ if (mHealth != NULL)
+ mHealth->unregisterCallback(this);
+ auto r = mHealth->unlinkToDeath(this);
+ if (!r.isOk() || r == false) {
+ LOC_LOGe("Transaction error in unregister to HealthHAL death: %s",
+ r.description().c_str());
+ }
+ }
+ mDone = true;
+ mThread->join();
+}
+
+void BatteryListenerImpl::serviceDied(uint64_t cookie __unused,
+ const wp<hidl::base::V1_0::IBase>& who)
+{
+ {
+ std::lock_guard<std::mutex> _l(mLock);
+ if (mHealth == NULL || !interfacesEqual(mHealth, who.promote())) {
+ LOC_LOGe("health not initialized or unknown interface died");
+ return;
+ }
+ LOC_LOGi("health service died, reinit");
+ mDone = true;
+ }
+ mHealth = NULL;
+ mCond.notify_one();
+ mThread->join();
+ std::lock_guard<std::mutex> _l(mLock);
+ init();
+}
+
+// this callback seems to be a SYNC callback and so
+// waits for return before next event is issued.
+// therefore we need not have a queue to process
+// NOT_CHARGING and CHARGING concurrencies.
+// Replace single var by a list if this assumption is broken
+Return<void> BatteryListenerImpl::healthInfoChanged(
+ const hardware::health::V2_0::HealthInfo& info) {
+ LOC_LOGv("healthInfoChanged: %d", info.legacy.batteryStatus);
+ std::unique_lock<std::mutex> l(mLock);
+ if (info.legacy.batteryStatus != mStatus) {
+ mStatus = info.legacy.batteryStatus;
+ mCond.notify_one();
+ }
+ return Void();
+}
+
+static sp<BatteryListenerImpl> batteryListener;
+
+bool batteryPropertiesListenerIsCharging() {
+ return batteryListener->isCharging();
+}
+
+status_t batteryPropertiesListenerInit(BatteryListenerImpl::cb_fn_t cb) {
+ batteryListener = new BatteryListenerImpl(cb);
+ bool isCharging = batteryPropertiesListenerIsCharging();
+ LOC_LOGv("charging status: %s charging", isCharging ? "" : "not");;
+ if (isCharging) {
+ cb(isCharging);
+ }
+ return NO_ERROR;
+}
+
+status_t batteryPropertiesListenerDeinit() {
+ batteryListener.clear();
+ return OK;
+}
+
+} // namespace android
+
+void loc_extn_battery_properties_listener_init(battery_status_change_fn_t fn) {
+ if (!sIsBatteryListened) {
+ std::thread t1(android::batteryPropertiesListenerInit,
+ [=](bool charging) { fn(charging); });
+ t1.detach();
+ sIsBatteryListened = true;
+ }
+}
+
+void loc_extn_battery_properties_listener_deinit() {
+ android::batteryPropertiesListenerDeinit();
+}
+
+bool loc_extn_battery_properties_is_charging() {
+ return android::batteryPropertiesListenerIsCharging();
+}
diff --git a/gps/android/utils/battery_listener.h b/gps/android/utils/battery_listener.h
new file mode 100644
index 0000000..bb6b715
--- /dev/null
+++ b/gps/android/utils/battery_listener.h
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2019, 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.
+*/
+typedef void (* battery_status_change_fn_t)(bool);
+void loc_extn_battery_properties_listener_init(battery_status_change_fn_t fn);
+void loc_extn_battery_properties_listener_deinit();
+bool loc_extn_battery_properties_is_charging();
diff --git a/gps/android/visibility_control/1.0/GnssVisibilityControl.cpp b/gps/android/visibility_control/1.0/GnssVisibilityControl.cpp
new file mode 100644
index 0000000..5a8c697
--- /dev/null
+++ b/gps/android/visibility_control/1.0/GnssVisibilityControl.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2019, 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 <android/hardware/gnss/visibility_control/1.0/IGnssVisibilityControl.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include "GnssVisibilityControl.h"
+#include <location_interface.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace visibility_control {
+namespace V1_0 {
+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::sp;
+
+static GnssVisibilityControl* spGnssVisibilityControl = nullptr;
+
+static void convertGnssNfwNotification(GnssNfwNotification& in,
+ IGnssVisibilityControlCallback::NfwNotification& out);
+
+GnssVisibilityControl::GnssVisibilityControl(Gnss* gnss) : mGnss(gnss) {
+ spGnssVisibilityControl = this;
+}
+GnssVisibilityControl::~GnssVisibilityControl() {
+ spGnssVisibilityControl = nullptr;
+}
+
+void GnssVisibilityControl::nfwStatusCb(GnssNfwNotification notification) {
+ if (nullptr != spGnssVisibilityControl) {
+ spGnssVisibilityControl->statusCb(notification);
+ }
+}
+
+bool GnssVisibilityControl::isInEmergencySession() {
+ if (nullptr != spGnssVisibilityControl) {
+ return spGnssVisibilityControl->isE911Session();
+ }
+ return false;
+}
+
+static void convertGnssNfwNotification(GnssNfwNotification& in,
+ IGnssVisibilityControlCallback::NfwNotification& out)
+{
+ memset(&out, 0, sizeof(IGnssVisibilityControlCallback::NfwNotification));
+ out.proxyAppPackageName = in.proxyAppPackageName;
+ out.protocolStack = (IGnssVisibilityControlCallback::NfwProtocolStack)in.protocolStack;
+ out.otherProtocolStackName = in.otherProtocolStackName;
+ out.requestor = (IGnssVisibilityControlCallback::NfwRequestor)in.requestor;
+ out.requestorId = in.requestorId;
+ out.responseType = (IGnssVisibilityControlCallback::NfwResponseType)in.responseType;
+ out.inEmergencyMode = in.inEmergencyMode;
+ out.isCachedLocation = in.isCachedLocation;
+}
+
+void GnssVisibilityControl::statusCb(GnssNfwNotification notification) {
+
+ if (mGnssVisibilityControlCbIface != nullptr) {
+ IGnssVisibilityControlCallback::NfwNotification nfwNotification;
+
+ // Convert from one structure to another
+ convertGnssNfwNotification(notification, nfwNotification);
+
+ auto r = mGnssVisibilityControlCbIface->nfwNotifyCb(nfwNotification);
+ if (!r.isOk()) {
+ LOC_LOGw("Error invoking NFW status cb %s", r.description().c_str());
+ }
+ } else {
+ LOC_LOGw("setCallback has not been called yet");
+ }
+}
+
+bool GnssVisibilityControl::isE911Session() {
+
+ if (mGnssVisibilityControlCbIface != nullptr) {
+ auto r = mGnssVisibilityControlCbIface->isInEmergencySession();
+ if (!r.isOk()) {
+ LOC_LOGw("Error invoking NFW status cb %s", r.description().c_str());
+ return false;
+ } else {
+ return (r);
+ }
+ } else {
+ LOC_LOGw("setCallback has not been called yet");
+ return false;
+ }
+}
+
+// Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow.
+Return<bool> GnssVisibilityControl::enableNfwLocationAccess(const hidl_vec<::android::hardware::hidl_string>& proxyApps) {
+
+ if (nullptr == mGnss || nullptr == mGnss->getGnssInterface()) {
+ LOC_LOGe("Null GNSS interface");
+ return false;
+ }
+
+ /* If the vector is empty we need to disable all NFW clients
+ If there is at least one app in the vector we need to enable
+ all NFW clients */
+ if (0 == proxyApps.size()) {
+ mGnss->getGnssInterface()->enableNfwLocationAccess(false);
+ } else {
+ mGnss->getGnssInterface()->enableNfwLocationAccess(true);
+ }
+
+ return true;
+}
+/**
+ * Registers the callback for HAL implementation to use.
+ *
+ * @param callback Handle to IGnssVisibilityControlCallback interface.
+ */
+Return<bool> GnssVisibilityControl::setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) {
+
+ if (nullptr == mGnss || nullptr == mGnss->getGnssInterface()) {
+ LOC_LOGe("Null GNSS interface");
+ return false;
+ }
+ mGnssVisibilityControlCbIface = callback;
+
+ NfwCbInfo cbInfo = {};
+ cbInfo.visibilityControlCb = (void*)nfwStatusCb;
+ cbInfo.isInEmergencySession = (void*)isInEmergencySession;
+
+ mGnss->getGnssInterface()->nfwInit(cbInfo);
+
+ return true;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace visibility_control
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gps/android/visibility_control/1.0/GnssVisibilityControl.h b/gps/android/visibility_control/1.0/GnssVisibilityControl.h
new file mode 100644
index 0000000..9c26e38
--- /dev/null
+++ b/gps/android/visibility_control/1.0/GnssVisibilityControl.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2019, 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 ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H
+
+#include <android/hardware/gnss/visibility_control/1.0/IGnssVisibilityControl.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#include <gps_extended_c.h>
+#include <location_interface.h>
+#include "Gnss.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace visibility_control {
+namespace V1_0 {
+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::sp;
+using ::android::hardware::gnss::V2_0::implementation::Gnss;
+
+struct GnssVisibilityControl : public IGnssVisibilityControl {
+ GnssVisibilityControl(Gnss* gnss);
+ ~GnssVisibilityControl();
+
+ // Methods from ::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl follow.
+ Return<bool> enableNfwLocationAccess(const hidl_vec<::android::hardware::hidl_string>& proxyApps) override;
+ /**
+ * Registers the callback for HAL implementation to use.
+ *
+ * @param callback Handle to IGnssVisibilityControlCallback interface.
+ */
+ Return<bool> setCallback(const ::android::sp<::android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControlCallback>& callback) override;
+
+ void statusCb(GnssNfwNotification notification);
+ bool isE911Session();
+
+ /* Data call setup callback passed down to GNSS HAL implementation */
+ static void nfwStatusCb(GnssNfwNotification notification);
+ static bool isInEmergencySession();
+
+private:
+ Gnss* mGnss = nullptr;
+ sp<IGnssVisibilityControlCallback> mGnssVisibilityControlCbIface = nullptr;
+};
+
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace visibility_control
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_0_GnssVisibilityControl_H
diff --git a/gps/batching/Android.mk b/gps/batching/Android.mk
new file mode 100644
index 0000000..b4876cd
--- /dev/null
+++ b/gps/batching/Android.mk
@@ -0,0 +1,40 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libbatching
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_core \
+ libgps.utils \
+ libdl \
+ liblbs_core
+
+LOCAL_SRC_FILES += \
+ location_batching.cpp \
+ BatchingAdapter.cpp
+
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/batching/BatchingAdapter.cpp b/gps/batching/BatchingAdapter.cpp
new file mode 100644
index 0000000..135f0ed
--- /dev/null
+++ b/gps/batching/BatchingAdapter.cpp
@@ -0,0 +1,1050 @@
+/* Copyright (c) 2017-2019, 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_BatchingAdapter"
+
+#include <loc_pla.h>
+#include <log_util.h>
+#include <LocContext.h>
+#include <BatchingAdapter.h>
+
+using namespace loc_core;
+
+BatchingAdapter::BatchingAdapter() :
+ LocAdapterBase(0,
+ LocContext::getLocContext(
+ NULL,
+ NULL,
+ LocContext::mLocationHalName,
+ false)),
+ mOngoingTripDistance(0),
+ mOngoingTripTBFInterval(0),
+ mTripWithOngoingTBFDropped(false),
+ mTripWithOngoingTripDistanceDropped(false),
+ mBatchingTimeout(0),
+ mBatchingAccuracy(1),
+ mBatchSize(0),
+ mTripBatchSize(0)
+{
+ LOC_LOGD("%s]: Constructor", __func__);
+ readConfigCommand();
+ setConfigCommand();
+}
+
+void
+BatchingAdapter::readConfigCommand()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgReadConfig : public LocMsg {
+ BatchingAdapter& mAdapter;
+ inline MsgReadConfig(BatchingAdapter& adapter) :
+ LocMsg(),
+ mAdapter(adapter) {}
+ inline virtual void proc() const {
+ uint32_t batchingTimeout = 0;
+ uint32_t batchingAccuracy = 0;
+ uint32_t batchSize = 0;
+ uint32_t tripBatchSize = 0;
+ static const loc_param_s_type flp_conf_param_table[] =
+ {
+ {"BATCH_SIZE", &batchSize, NULL, 'n'},
+ {"OUTDOOR_TRIP_BATCH_SIZE", &tripBatchSize, NULL, 'n'},
+ {"BATCH_SESSION_TIMEOUT", &batchingTimeout, NULL, 'n'},
+ {"ACCURACY", &batchingAccuracy, NULL, 'n'},
+ };
+ UTIL_READ_CONF(LOC_PATH_FLP_CONF, flp_conf_param_table);
+
+ LOC_LOGD("%s]: batchSize %u tripBatchSize %u batchingAccuracy %u batchingTimeout %u ",
+ __func__, batchSize, tripBatchSize, batchingAccuracy, batchingTimeout);
+
+ mAdapter.setBatchSize(batchSize);
+ mAdapter.setTripBatchSize(tripBatchSize);
+ mAdapter.setBatchingTimeout(batchingTimeout);
+ mAdapter.setBatchingAccuracy(batchingAccuracy);
+ }
+ };
+
+ sendMsg(new MsgReadConfig(*this));
+
+}
+
+void
+BatchingAdapter::setConfigCommand()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgSetConfig : public LocMsg {
+ BatchingAdapter& mAdapter;
+ LocApiBase& mApi;
+ inline MsgSetConfig(BatchingAdapter& adapter,
+ LocApiBase& api) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api) {}
+ inline virtual void proc() const {
+ mApi.setBatchSize(mAdapter.getBatchSize());
+ mApi.setTripBatchSize(mAdapter.getTripBatchSize());
+ }
+ };
+
+ sendMsg(new MsgSetConfig(*this, *mLocApi));
+}
+
+void
+BatchingAdapter::stopClientSessions(LocationAPI* client)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+
+ typedef struct pairKeyBatchMode {
+ LocationAPI* client;
+ uint32_t id;
+ BatchingMode batchingMode;
+ inline pairKeyBatchMode(LocationAPI* _client, uint32_t _id, BatchingMode _bMode) :
+ client(_client), id(_id), batchingMode(_bMode) {}
+ } pairKeyBatchMode;
+ std::vector<pairKeyBatchMode> vBatchingClient;
+ for (auto it : mBatchingSessions) {
+ if (client == it.first.client) {
+ vBatchingClient.emplace_back(it.first.client, it.first.id, it.second.batchingMode);
+ }
+ }
+ for (auto keyBatchingMode : vBatchingClient) {
+ if (keyBatchingMode.batchingMode != BATCHING_MODE_TRIP) {
+ stopBatching(keyBatchingMode.client, keyBatchingMode.id);
+ } else {
+ stopTripBatchingMultiplex(keyBatchingMode.client, keyBatchingMode.id);
+ }
+ }
+}
+
+void
+BatchingAdapter::updateClientsEventMask()
+{
+ LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ // we don't register LOC_API_ADAPTER_BIT_BATCH_FULL until we
+ // start batching with ROUTINE or TRIP option
+ if (it->second.batchingCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_BATCH_STATUS;
+ }
+ }
+ if (autoReportBatchingSessionsCount() > 0) {
+ mask |= LOC_API_ADAPTER_BIT_BATCH_FULL;
+ }
+ updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
+}
+
+void
+BatchingAdapter::handleEngineUpEvent()
+{
+ struct MsgSSREvent : public LocMsg {
+ BatchingAdapter& mAdapter;
+ LocApiBase& mApi;
+ inline MsgSSREvent(BatchingAdapter& adapter,
+ LocApiBase& api) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api) {}
+ virtual void proc() const {
+ mAdapter.setEngineCapabilitiesKnown(true);
+ mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
+ mApi.setBatchSize(mAdapter.getBatchSize());
+ mApi.setTripBatchSize(mAdapter.getTripBatchSize());
+ mAdapter.restartSessions();
+ for (auto msg: mAdapter.mPendingMsgs) {
+ mAdapter.sendMsg(msg);
+ }
+ mAdapter.mPendingMsgs.clear();
+ }
+ };
+
+ sendMsg(new MsgSSREvent(*this, *mLocApi));
+}
+
+void
+BatchingAdapter::restartSessions()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ if (autoReportBatchingSessionsCount() > 0) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_ENABLED);
+ }
+ for (auto it = mBatchingSessions.begin();
+ it != mBatchingSessions.end(); ++it) {
+ if (it->second.batchingMode != BATCHING_MODE_TRIP) {
+ mLocApi->startBatching(it->first.id, it->second,
+ getBatchingAccuracy(), getBatchingTimeout(),
+ new LocApiResponse(*getContext(),
+ [] (LocationError /*err*/) {}));
+ }
+ }
+
+ if (mTripSessions.size() > 0) {
+ // restart outdoor trip batching session if any.
+ mOngoingTripDistance = 0;
+ mOngoingTripTBFInterval = 0;
+
+ // record the min trip distance and min tbf interval of all ongoing sessions
+ for (auto tripSession : mTripSessions) {
+
+ TripSessionStatus &tripSessStatus = tripSession.second;
+
+ if ((0 == mOngoingTripDistance) ||
+ (mOngoingTripDistance >
+ (tripSessStatus.tripDistance - tripSessStatus.accumulatedDistanceThisTrip))) {
+ mOngoingTripDistance = tripSessStatus.tripDistance -
+ tripSessStatus.accumulatedDistanceThisTrip;
+ }
+
+ if ((0 == mOngoingTripTBFInterval) ||
+ (mOngoingTripTBFInterval > tripSessStatus.tripTBFInterval)) {
+ mOngoingTripTBFInterval = tripSessStatus.tripTBFInterval;
+ }
+
+ // reset the accumulatedDistanceOngoingBatch for each session
+ tripSessStatus.accumulatedDistanceOngoingBatch = 0;
+
+ }
+
+ mLocApi->startOutdoorTripBatching(mOngoingTripDistance, mOngoingTripTBFInterval,
+ getBatchingTimeout(), new LocApiResponse(*getContext(), [this] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ mOngoingTripDistance = 0;
+ mOngoingTripTBFInterval = 0;
+ }
+ printTripReport();
+ }));
+ }
+}
+
+bool
+BatchingAdapter::hasBatchingCallback(LocationAPI* client)
+{
+ auto it = mClientData.find(client);
+ return (it != mClientData.end() && it->second.batchingCb);
+}
+
+bool
+BatchingAdapter::isBatchingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ return (mBatchingSessions.find(key) != mBatchingSessions.end());
+}
+
+bool
+BatchingAdapter::isTripSession(uint32_t sessionId) {
+ return (mTripSessions.find(sessionId) != mTripSessions.end());
+}
+
+void
+BatchingAdapter::saveBatchingSession(LocationAPI* client, uint32_t sessionId,
+ const BatchingOptions& batchingOptions)
+{
+ LocationSessionKey key(client, sessionId);
+ mBatchingSessions[key] = batchingOptions;
+}
+
+void
+BatchingAdapter::eraseBatchingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ auto it = mBatchingSessions.find(key);
+ if (it != mBatchingSessions.end()) {
+ mBatchingSessions.erase(it);
+ }
+}
+
+void
+BatchingAdapter::reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId)
+{
+ LOC_LOGD("%s]: client %p id %u err %u", __func__, client, sessionId, err);
+
+ auto it = mClientData.find(client);
+ if (it != mClientData.end() &&
+ it->second.responseCb != nullptr) {
+ it->second.responseCb(err, sessionId);
+ } else {
+ LOC_LOGE("%s]: client %p id %u not found in data", __func__, client, sessionId);
+ }
+}
+
+uint32_t
+BatchingAdapter::autoReportBatchingSessionsCount()
+{
+ uint32_t count = 0;
+ for (auto batchingSession: mBatchingSessions) {
+ if (batchingSession.second.batchingMode != BATCHING_MODE_NO_AUTO_REPORT) {
+ count++;
+ }
+ }
+ count += mTripSessions.size();
+ return count;
+}
+
+uint32_t
+BatchingAdapter::startBatchingCommand(
+ LocationAPI* client, BatchingOptions& batchOptions)
+{
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGD("%s]: client %p id %u minInterval %u minDistance %u mode %u Batching Mode %d",
+ __func__, client, sessionId, batchOptions.minInterval, batchOptions.minDistance,
+ batchOptions.mode,batchOptions.batchingMode);
+
+ struct MsgStartBatching : public LocMsg {
+ BatchingAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ BatchingOptions mBatchingOptions;
+ inline MsgStartBatching(BatchingAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId,
+ BatchingOptions batchOptions) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId),
+ mBatchingOptions(batchOptions) {}
+ inline virtual void proc() const {
+ if (!mAdapter.isEngineCapabilitiesKnown()) {
+ mAdapter.mPendingMsgs.push_back(new MsgStartBatching(*this));
+ return;
+ }
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ if (!mAdapter.hasBatchingCallback(mClient)) {
+ err = LOCATION_ERROR_CALLBACK_MISSING;
+ } else if (0 == mBatchingOptions.size) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ } else if (!ContextBase::isMessageSupported(
+ LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING)) {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ if (LOCATION_ERROR_SUCCESS == err) {
+ if (mBatchingOptions.batchingMode == BATCHING_MODE_ROUTINE ||
+ mBatchingOptions.batchingMode == BATCHING_MODE_NO_AUTO_REPORT) {
+ mAdapter.startBatching(mClient, mSessionId, mBatchingOptions);
+ } else if (mBatchingOptions.batchingMode == BATCHING_MODE_TRIP) {
+ mAdapter.startTripBatchingMultiplex(mClient, mSessionId, mBatchingOptions);
+ } else {
+ mAdapter.reportResponse(mClient, LOCATION_ERROR_INVALID_PARAMETER, mSessionId);
+ }
+ }
+ }
+ };
+
+ sendMsg(new MsgStartBatching(*this, *mLocApi, client, sessionId, batchOptions));
+
+ return sessionId;
+}
+
+void
+BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId,
+ const BatchingOptions& batchingOptions)
+{
+ if (batchingOptions.batchingMode != BATCHING_MODE_NO_AUTO_REPORT &&
+ 0 == autoReportBatchingSessionsCount()) {
+ // if there is currenty no batching sessions interested in batch full event, then this
+ // new session will need to register for batch full event
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_ENABLED);
+ }
+
+ // Assume start will be OK, remove session if not
+ saveBatchingSession(client, sessionId, batchingOptions);
+ mLocApi->startBatching(sessionId, batchingOptions, getBatchingAccuracy(), getBatchingTimeout(),
+ new LocApiResponse(*getContext(),
+ [this, client, sessionId, batchingOptions] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ eraseBatchingSession(client, sessionId);
+ }
+
+ if (LOCATION_ERROR_SUCCESS != err &&
+ batchingOptions.batchingMode != BATCHING_MODE_NO_AUTO_REPORT &&
+ 0 == autoReportBatchingSessionsCount()) {
+ // if we fail to start batching and we have already registered batch full event
+ // we need to undo that since no sessions are now interested in batch full event
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_DISABLED);
+ }
+
+ reportResponse(client, err, sessionId);
+ }));
+}
+
+void
+BatchingAdapter::updateBatchingOptionsCommand(LocationAPI* client, uint32_t id,
+ BatchingOptions& batchOptions)
+{
+ LOC_LOGD("%s]: client %p id %u minInterval %u minDistance %u mode %u batchMode %u",
+ __func__, client, id, batchOptions.minInterval,
+ batchOptions.minDistance, batchOptions.mode,
+ batchOptions.batchingMode);
+
+ struct MsgUpdateBatching : public LocMsg {
+ BatchingAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ BatchingOptions mBatchOptions;
+ inline MsgUpdateBatching(BatchingAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId,
+ BatchingOptions batchOptions) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId),
+ mBatchOptions(batchOptions) {}
+ inline virtual void proc() const {
+ if (!mAdapter.isEngineCapabilitiesKnown()) {
+ mAdapter.mPendingMsgs.push_back(new MsgUpdateBatching(*this));
+ return;
+ }
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (!mAdapter.isBatchingSession(mClient, mSessionId)) {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ } else if ((0 == mBatchOptions.size) ||
+ (mBatchOptions.batchingMode > BATCHING_MODE_NO_AUTO_REPORT)) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ }
+ if (LOCATION_ERROR_SUCCESS == err) {
+ if (!mAdapter.isTripSession(mSessionId)) {
+ mAdapter.stopBatching(mClient, mSessionId, true, mBatchOptions);
+ } else {
+ mAdapter.stopTripBatchingMultiplex(mClient, mSessionId, true, mBatchOptions);
+ }
+ }
+ }
+ };
+
+ sendMsg(new MsgUpdateBatching(*this, *mLocApi, client, id, batchOptions));
+}
+
+void
+BatchingAdapter::stopBatchingCommand(LocationAPI* client, uint32_t id)
+{
+ LOC_LOGD("%s]: client %p id %u", __func__, client, id);
+
+ struct MsgStopBatching : public LocMsg {
+ BatchingAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ inline MsgStopBatching(BatchingAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId) {}
+ inline virtual void proc() const {
+ if (!mAdapter.isEngineCapabilitiesKnown()) {
+ mAdapter.mPendingMsgs.push_back(new MsgStopBatching(*this));
+ return;
+ }
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (!mAdapter.isBatchingSession(mClient, mSessionId)) {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ }
+ if (LOCATION_ERROR_SUCCESS == err) {
+ if (mAdapter.isTripSession(mSessionId)) {
+ mAdapter.stopTripBatchingMultiplex(mClient, mSessionId);
+ } else {
+ mAdapter.stopBatching(mClient, mSessionId);
+ }
+ }
+ }
+ };
+
+ sendMsg(new MsgStopBatching(*this, *mLocApi, client, id));
+}
+
+void
+BatchingAdapter::stopBatching(LocationAPI* client, uint32_t sessionId, bool restartNeeded,
+ const BatchingOptions& batchOptions)
+{
+ LocationSessionKey key(client, sessionId);
+ auto it = mBatchingSessions.find(key);
+ if (it != mBatchingSessions.end()) {
+ auto flpOptions = it->second;
+ // Assume stop will be OK, restore session if not
+ eraseBatchingSession(client, sessionId);
+ mLocApi->stopBatching(sessionId,
+ new LocApiResponse(*getContext(),
+ [this, client, sessionId, flpOptions, restartNeeded, batchOptions]
+ (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ saveBatchingSession(client, sessionId, batchOptions);
+ } else {
+ // if stopBatching is success, unregister for batch full event if this was the last
+ // batching session that is interested in batch full event
+ if (0 == autoReportBatchingSessionsCount() &&
+ flpOptions.batchingMode != BATCHING_MODE_NO_AUTO_REPORT) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_DISABLED);
+ }
+
+ if (restartNeeded) {
+ if (batchOptions.batchingMode == BATCHING_MODE_ROUTINE ||
+ batchOptions.batchingMode == BATCHING_MODE_NO_AUTO_REPORT) {
+ startBatching(client, sessionId, batchOptions);
+ } else if (batchOptions.batchingMode == BATCHING_MODE_TRIP) {
+ startTripBatchingMultiplex(client, sessionId, batchOptions);
+ }
+ }
+ }
+ reportResponse(client, err, sessionId);
+ }));
+ }
+}
+
+void
+BatchingAdapter::getBatchedLocationsCommand(LocationAPI* client, uint32_t id, size_t count)
+{
+ LOC_LOGD("%s]: client %p id %u count %zu", __func__, client, id, count);
+
+ struct MsgGetBatchedLocations : public LocMsg {
+ BatchingAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ size_t mCount;
+ inline MsgGetBatchedLocations(BatchingAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId,
+ size_t count) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId),
+ mCount(count) {}
+ inline virtual void proc() const {
+ if (!mAdapter.isEngineCapabilitiesKnown()) {
+ mAdapter.mPendingMsgs.push_back(new MsgGetBatchedLocations(*this));
+ return;
+ }
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (!mAdapter.hasBatchingCallback(mClient)) {
+ err = LOCATION_ERROR_CALLBACK_MISSING;
+ } else if (!mAdapter.isBatchingSession(mClient, mSessionId)) {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ }
+ if (LOCATION_ERROR_SUCCESS == err) {
+ if (mAdapter.isTripSession(mSessionId)) {
+ mApi.getBatchedTripLocations(mCount, 0,
+ new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mSessionId = mSessionId,
+ mClient = mClient] (LocationError err) {
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }));
+ } else {
+ mApi.getBatchedLocations(mCount, new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mSessionId = mSessionId,
+ mClient = mClient] (LocationError err) {
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }));
+ }
+ } else {
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }
+ }
+ };
+
+ sendMsg(new MsgGetBatchedLocations(*this, *mLocApi, client, id, count));
+}
+
+void
+BatchingAdapter::reportLocationsEvent(const Location* locations, size_t count,
+ BatchingMode batchingMode)
+{
+ LOC_LOGD("%s]: count %zu batchMode %d", __func__, count, batchingMode);
+
+ struct MsgReportLocations : public LocMsg {
+ BatchingAdapter& mAdapter;
+ Location* mLocations;
+ size_t mCount;
+ BatchingMode mBatchingMode;
+ inline MsgReportLocations(BatchingAdapter& adapter,
+ const Location* locations,
+ size_t count,
+ BatchingMode batchingMode) :
+ LocMsg(),
+ mAdapter(adapter),
+ mLocations(new Location[count]),
+ mCount(count),
+ mBatchingMode(batchingMode)
+ {
+ if (nullptr == mLocations) {
+ LOC_LOGE("%s]: new failed to allocate mLocations", __func__);
+ return;
+ }
+ for (size_t i=0; i < mCount; ++i) {
+ mLocations[i] = locations[i];
+ }
+ }
+ inline virtual ~MsgReportLocations() {
+ if (nullptr != mLocations)
+ delete[] mLocations;
+ }
+ inline virtual void proc() const {
+ mAdapter.reportLocations(mLocations, mCount, mBatchingMode);
+ }
+ };
+
+ sendMsg(new MsgReportLocations(*this, locations, count, batchingMode));
+}
+
+void
+BatchingAdapter::reportLocations(Location* locations, size_t count, BatchingMode batchingMode)
+{
+ BatchingOptions batchOptions = {sizeof(BatchingOptions), batchingMode};
+
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.batchingCb) {
+ it->second.batchingCb(count, locations, batchOptions);
+ }
+ }
+}
+
+void
+BatchingAdapter::reportCompletedTripsEvent(uint32_t accumulated_distance)
+{
+ struct MsgReportCompletedTrips : public LocMsg {
+ BatchingAdapter& mAdapter;
+ uint32_t mAccumulatedDistance;
+ inline MsgReportCompletedTrips(BatchingAdapter& adapter,
+ uint32_t accumulated_distance) :
+ LocMsg(),
+ mAdapter(adapter),
+ mAccumulatedDistance(accumulated_distance)
+ {
+ }
+ inline virtual ~MsgReportCompletedTrips() {
+ }
+ inline virtual void proc() const {
+
+ // Check if any trips are completed
+ std::list<uint32_t> completedTripsList;
+ completedTripsList.clear();
+
+ for(auto itt = mAdapter.mTripSessions.begin(); itt != mAdapter.mTripSessions.end();)
+ {
+ TripSessionStatus &tripSession = itt->second;
+
+ tripSession.accumulatedDistanceThisTrip =
+ tripSession.accumulatedDistanceOnTripRestart
+ + (mAccumulatedDistance - tripSession.accumulatedDistanceOngoingBatch);
+ if (tripSession.tripDistance <= tripSession.accumulatedDistanceThisTrip) {
+ // trip is completed
+ completedTripsList.push_back(itt->first);
+ itt = mAdapter.mTripSessions.erase(itt);
+
+ if (tripSession.tripTBFInterval == mAdapter.mOngoingTripTBFInterval) {
+ // trip with ongoing TBF interval is completed
+ mAdapter.mTripWithOngoingTBFDropped = true;
+ }
+
+ if (tripSession.tripDistance == mAdapter.mOngoingTripDistance) {
+ // trip with ongoing trip distance is completed
+ mAdapter.mTripWithOngoingTripDistanceDropped = true;
+ }
+ } else {
+ itt++;
+ }
+ }
+
+ if (completedTripsList.size() > 0) {
+ mAdapter.reportBatchStatusChange(BATCHING_STATUS_TRIP_COMPLETED,
+ completedTripsList);
+ mAdapter.restartTripBatching(false, mAccumulatedDistance, 0);
+ } else {
+ mAdapter.printTripReport();
+ }
+ }
+ };
+
+ LOC_LOGD("%s]: Accumulated Distance so far: %u",
+ __func__, accumulated_distance);
+
+ sendMsg(new MsgReportCompletedTrips(*this, accumulated_distance));
+}
+
+void
+BatchingAdapter::reportBatchStatusChange(BatchingStatus batchStatus,
+ std::list<uint32_t> & completedTripsList)
+{
+ BatchingStatusInfo batchStatusInfo =
+ {sizeof(BatchingStatusInfo), batchStatus};
+
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.batchingStatusCb) {
+ it->second.batchingStatusCb(batchStatusInfo, completedTripsList);
+ }
+ }
+}
+
+void
+BatchingAdapter::reportBatchStatusChangeEvent(BatchingStatus batchStatus)
+{
+ struct MsgReportBatchStatus : public LocMsg {
+ BatchingAdapter& mAdapter;
+ BatchingStatus mBatchStatus;
+ inline MsgReportBatchStatus(BatchingAdapter& adapter,
+ BatchingStatus batchStatus) :
+ LocMsg(),
+ mAdapter(adapter),
+ mBatchStatus(batchStatus)
+ {
+ }
+ inline virtual ~MsgReportBatchStatus() {
+ }
+ inline virtual void proc() const {
+ std::list<uint32_t> tempList;
+ tempList.clear();
+ mAdapter.reportBatchStatusChange(mBatchStatus, tempList);
+ }
+ };
+
+ sendMsg(new MsgReportBatchStatus(*this, batchStatus));
+}
+
+void
+BatchingAdapter::startTripBatchingMultiplex(LocationAPI* client, uint32_t sessionId,
+ const BatchingOptions& batchingOptions)
+{
+ if (mTripSessions.size() == 0) {
+ // if there is currenty no batching sessions interested in batch full event, then this
+ // new session will need to register for batch full event
+ if (0 == autoReportBatchingSessionsCount()) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_ENABLED);
+ }
+
+ // Assume start will be OK, remove session if not
+ saveBatchingSession(client, sessionId, batchingOptions);
+
+ mTripSessions[sessionId] = { 0, 0, 0, batchingOptions.minDistance,
+ batchingOptions.minInterval};
+ mLocApi->startOutdoorTripBatching(batchingOptions.minDistance,
+ batchingOptions.minInterval, getBatchingTimeout(), new LocApiResponse(*getContext(),
+ [this, client, sessionId, batchingOptions] (LocationError err) {
+ if (err == LOCATION_ERROR_SUCCESS) {
+ mOngoingTripDistance = batchingOptions.minDistance;
+ mOngoingTripTBFInterval = batchingOptions.minInterval;
+ LOC_LOGD("%s] New Trip started ...", __func__);
+ printTripReport();
+ } else {
+ eraseBatchingSession(client, sessionId);
+ mTripSessions.erase(sessionId);
+ // if we fail to start batching and we have already registered batch full event
+ // we need to undo that since no sessions are now interested in batch full event
+ if (0 == autoReportBatchingSessionsCount()) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_DISABLED);
+ }
+ }
+ reportResponse(client, err, sessionId);
+ }));
+ } else {
+ // query accumulated distance
+ mLocApi->queryAccumulatedTripDistance(
+ new LocApiResponseData<LocApiBatchData>(*getContext(),
+ [this, batchingOptions, sessionId, client]
+ (LocationError err, LocApiBatchData data) {
+ uint32_t accumulatedDistanceOngoingBatch = 0;
+ uint32_t numOfBatchedPositions = 0;
+ uint32_t ongoingTripDistance = mOngoingTripDistance;
+ uint32_t ongoingTripInterval = mOngoingTripTBFInterval;
+ bool needsRestart = false;
+
+ // check if TBF of new session is lesser than ongoing TBF interval
+ if (ongoingTripInterval > batchingOptions.minInterval) {
+ ongoingTripInterval = batchingOptions.minInterval;
+ needsRestart = true;
+ }
+ accumulatedDistanceOngoingBatch = data.accumulatedDistance;
+ numOfBatchedPositions = data.numOfBatchedPositions;
+ TripSessionStatus newTripSession = { accumulatedDistanceOngoingBatch, 0, 0,
+ batchingOptions.minDistance,
+ batchingOptions.minInterval};
+ if (err != LOCATION_ERROR_SUCCESS) {
+ // unable to query accumulated distance, assume remaining distance in
+ // ongoing batch is mongoingTripDistance.
+ if (batchingOptions.minDistance < ongoingTripDistance) {
+ ongoingTripDistance = batchingOptions.minDistance;
+ needsRestart = true;
+ }
+ } else {
+ // compute the remaining distance
+ uint32_t ongoing_trip_remaining_distance = ongoingTripDistance -
+ accumulatedDistanceOngoingBatch;
+
+ // check if new trip distance is lesser than the ongoing batch remaining distance
+ if (batchingOptions.minDistance < ongoing_trip_remaining_distance) {
+ ongoingTripDistance = batchingOptions.minDistance;
+ needsRestart = true;
+ } else if (needsRestart == true) {
+ // needsRestart is anyways true , may be because of lesser TBF of new session.
+ ongoingTripDistance = ongoing_trip_remaining_distance;
+ }
+ mTripSessions[sessionId] = newTripSession;
+ LOC_LOGD("%s] New Trip started ...", __func__);
+ printTripReport();
+ }
+
+ if (needsRestart) {
+ mOngoingTripDistance = ongoingTripDistance;
+ mOngoingTripTBFInterval = ongoingTripInterval;
+
+ // reset the accumulatedDistanceOngoingBatch for each session,
+ // and record the total accumulated distance so far for the session.
+ for (auto itt = mTripSessions.begin(); itt != mTripSessions.end(); itt++) {
+ TripSessionStatus &tripSessStatus = itt->second;
+ tripSessStatus.accumulatedDistanceOngoingBatch = 0;
+ tripSessStatus.accumulatedDistanceOnTripRestart =
+ tripSessStatus.accumulatedDistanceThisTrip;
+ }
+ mLocApi->reStartOutdoorTripBatching(ongoingTripDistance, ongoingTripInterval,
+ getBatchingTimeout(), new LocApiResponse(*getContext(),
+ [this, client, sessionId] (LocationError err) {
+ if (err != LOCATION_ERROR_SUCCESS) {
+ LOC_LOGE("%s] New Trip restart failed!", __func__);
+ }
+ reportResponse(client, err, sessionId);
+ }));
+ } else {
+ reportResponse(client, LOCATION_ERROR_SUCCESS, sessionId);
+ }
+ }));
+ }
+}
+
+void
+BatchingAdapter::stopTripBatchingMultiplex(LocationAPI* client, uint32_t sessionId,
+ bool restartNeeded, const BatchingOptions& batchOptions)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ if (mTripSessions.size() == 1) {
+ mLocApi->stopOutdoorTripBatching(true, new LocApiResponse(*getContext(),
+ [this, restartNeeded, client, sessionId, batchOptions]
+ (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ // if stopOutdoorTripBatching is success, unregister for batch full event if this
+ // was the last batching session that is interested in batch full event
+ if (1 == autoReportBatchingSessionsCount()) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_DISABLED);
+ }
+ }
+ stopTripBatchingMultiplexCommon(err, client, sessionId, restartNeeded, batchOptions);
+ }));
+ return;
+ }
+
+ stopTripBatchingMultiplexCommon(err, client, sessionId, restartNeeded, batchOptions);
+}
+
+void
+BatchingAdapter::stopTripBatchingMultiplexCommon(LocationError err, LocationAPI* client,
+ uint32_t sessionId, bool restartNeeded, const BatchingOptions& batchOptions)
+{
+ auto itt = mTripSessions.find(sessionId);
+ TripSessionStatus tripSess = itt->second;
+ if (tripSess.tripTBFInterval == mOngoingTripTBFInterval) {
+ // trip with ongoing trip interval is stopped
+ mTripWithOngoingTBFDropped = true;
+ }
+
+ if (tripSess.tripDistance == mOngoingTripDistance) {
+ // trip with ongoing trip distance is stopped
+ mTripWithOngoingTripDistanceDropped = true;
+ }
+
+ mTripSessions.erase(sessionId);
+
+ if (mTripSessions.size() == 0) {
+ mOngoingTripDistance = 0;
+ mOngoingTripTBFInterval = 0;
+ } else {
+ restartTripBatching(true);
+ }
+
+ if (restartNeeded) {
+ eraseBatchingSession(client, sessionId);
+ if (batchOptions.batchingMode == BATCHING_MODE_ROUTINE ||
+ batchOptions.batchingMode == BATCHING_MODE_NO_AUTO_REPORT) {
+ startBatching(client, sessionId, batchOptions);
+ } else if (batchOptions.batchingMode == BATCHING_MODE_TRIP) {
+ startTripBatchingMultiplex(client, sessionId, batchOptions);
+ }
+ }
+ reportResponse(client, err, sessionId);
+}
+
+
+void
+BatchingAdapter::restartTripBatching(bool queryAccumulatedDistance, uint32_t accDist,
+ uint32_t numbatchedPos)
+{
+ // does batch need restart with new trip distance / TBF interval
+ uint32_t minRemainingDistance = 0;
+ uint32_t minTBFInterval = 0;
+
+ // if no more trips left, stop the ongoing trip
+ if (mTripSessions.size() == 0) {
+ mLocApi->stopOutdoorTripBatching(true, new LocApiResponse(*getContext(),
+ [] (LocationError /*err*/) {}));
+ mOngoingTripDistance = 0;
+ mOngoingTripTBFInterval = 0;
+ // unregister for batch full event if there are no more
+ // batching session that is interested in batch full event
+ if (0 == autoReportBatchingSessionsCount()) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_BATCH_FULL,
+ LOC_REGISTRATION_MASK_DISABLED);
+ }
+ return;
+ }
+
+ // record the min trip distance and min tbf interval of all ongoing sessions
+ for (auto itt = mTripSessions.begin(); itt != mTripSessions.end(); itt++) {
+
+ TripSessionStatus tripSessStatus = itt->second;
+
+ if ((minRemainingDistance == 0) ||
+ (minRemainingDistance > (tripSessStatus.tripDistance
+ - tripSessStatus.accumulatedDistanceThisTrip))) {
+ minRemainingDistance = tripSessStatus.tripDistance -
+ tripSessStatus.accumulatedDistanceThisTrip;
+ }
+
+ if ((minTBFInterval == 0) ||
+ (minTBFInterval > tripSessStatus.tripTBFInterval)) {
+ minTBFInterval = tripSessStatus.tripTBFInterval;
+ }
+ }
+
+ mLocApi->queryAccumulatedTripDistance(
+ new LocApiResponseData<LocApiBatchData>(*getContext(),
+ [this, queryAccumulatedDistance, minRemainingDistance, minTBFInterval, accDist,
+ numbatchedPos] (LocationError /*err*/, LocApiBatchData data) {
+ bool needsRestart = false;
+
+ uint32_t ongoingTripDistance = mOngoingTripDistance;
+ uint32_t ongoingTripInterval = mOngoingTripTBFInterval;
+ uint32_t accumulatedDistance = accDist;
+ uint32_t numOfBatchedPositions = numbatchedPos;
+
+ if (queryAccumulatedDistance) {
+ accumulatedDistance = data.accumulatedDistance;
+ numOfBatchedPositions = data.numOfBatchedPositions;
+ }
+
+ if ((!mTripWithOngoingTripDistanceDropped) &&
+ (ongoingTripDistance - accumulatedDistance != 0)) {
+ // if ongoing trip is already not completed still,
+ // check the min distance against the remaining distance
+ if (minRemainingDistance <
+ (ongoingTripDistance - accumulatedDistance)) {
+ ongoingTripDistance = minRemainingDistance;
+ needsRestart = true;
+ }
+ } else if (minRemainingDistance != 0) {
+ // else if ongoing trip is already completed / dropped,
+ // use the minRemainingDistance of ongoing sessions
+ ongoingTripDistance = minRemainingDistance;
+ needsRestart = true;
+ }
+
+ if ((minTBFInterval < ongoingTripInterval) ||
+ ((minTBFInterval != ongoingTripInterval) &&
+ (mTripWithOngoingTBFDropped))) {
+ ongoingTripInterval = minTBFInterval;
+ needsRestart = true;
+ }
+
+ if (needsRestart) {
+ mLocApi->reStartOutdoorTripBatching(ongoingTripDistance, ongoingTripInterval,
+ getBatchingTimeout(), new LocApiResponse(*getContext(),
+ [this, accumulatedDistance, ongoingTripDistance, ongoingTripInterval]
+ (LocationError err) {
+
+ if (err == LOCATION_ERROR_SUCCESS) {
+ for(auto itt = mTripSessions.begin(); itt != mTripSessions.end(); itt++) {
+ TripSessionStatus &tripSessStatus = itt->second;
+ tripSessStatus.accumulatedDistanceThisTrip =
+ tripSessStatus.accumulatedDistanceOnTripRestart +
+ (accumulatedDistance -
+ tripSessStatus.accumulatedDistanceOngoingBatch);
+
+ tripSessStatus.accumulatedDistanceOngoingBatch = 0;
+ tripSessStatus.accumulatedDistanceOnTripRestart =
+ tripSessStatus.accumulatedDistanceThisTrip;
+ }
+
+ mOngoingTripDistance = ongoingTripDistance;
+ mOngoingTripTBFInterval = ongoingTripInterval;
+ }
+ }));
+ }
+ }));
+}
+
+void
+BatchingAdapter::printTripReport()
+{
+ IF_LOC_LOGD {
+ LOC_LOGD("Ongoing Trip Distance = %u, Ongoing Trip TBF Interval = %u",
+ mOngoingTripDistance, mOngoingTripTBFInterval);
+
+ for (auto itt = mTripSessions.begin(); itt != mTripSessions.end(); itt++) {
+ TripSessionStatus tripSessStatus = itt->second;
+
+ LOC_LOGD("tripDistance:%u tripTBFInterval:%u"
+ " trip accumulated Distance:%u"
+ " trip accumualted distance ongoing batch:%u"
+ " trip accumulated distance on trip restart %u \r\n",
+ tripSessStatus.tripDistance, tripSessStatus.tripTBFInterval,
+ tripSessStatus.accumulatedDistanceThisTrip,
+ tripSessStatus.accumulatedDistanceOngoingBatch,
+ tripSessStatus.accumulatedDistanceOnTripRestart);
+ }
+ }
+}
diff --git a/gps/batching/BatchingAdapter.h b/gps/batching/BatchingAdapter.h
new file mode 100644
index 0000000..66f7c5f
--- /dev/null
+++ b/gps/batching/BatchingAdapter.h
@@ -0,0 +1,152 @@
+/* Copyright (c) 2017-2019, 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 BATCHING_ADAPTER_H
+#define BATCHING_ADAPTER_H
+
+#include <LocAdapterBase.h>
+#include <LocContext.h>
+#include <LocationAPI.h>
+#include <map>
+
+using namespace loc_core;
+
+class BatchingAdapter : public LocAdapterBase {
+
+ /* ==== BATCHING ======================================================================= */
+ typedef struct {
+ uint32_t accumulatedDistanceOngoingBatch;
+ uint32_t accumulatedDistanceThisTrip;
+ uint32_t accumulatedDistanceOnTripRestart;
+ uint32_t tripDistance;
+ uint32_t tripTBFInterval;
+ } TripSessionStatus;
+ typedef std::map<uint32_t, TripSessionStatus> TripSessionStatusMap;
+ typedef std::map<LocationSessionKey, BatchingOptions> BatchingSessionMap;
+
+ BatchingSessionMap mBatchingSessions;
+ TripSessionStatusMap mTripSessions;
+ uint32_t mOngoingTripDistance;
+ uint32_t mOngoingTripTBFInterval;
+ bool mTripWithOngoingTBFDropped;
+ bool mTripWithOngoingTripDistanceDropped;
+
+ void startTripBatchingMultiplex(LocationAPI* client, uint32_t sessionId,
+ const BatchingOptions& batchingOptions);
+ void stopTripBatchingMultiplex(LocationAPI* client, uint32_t sessionId,
+ bool restartNeeded,
+ const BatchingOptions& batchOptions);
+ inline void stopTripBatchingMultiplex(LocationAPI* client, uint32_t id) {
+ BatchingOptions batchOptions;
+ stopTripBatchingMultiplex(client, id, false, batchOptions);
+ };
+ void stopTripBatchingMultiplexCommon(LocationError err,
+ LocationAPI* client,
+ uint32_t sessionId,
+ bool restartNeeded,
+ const BatchingOptions& batchOptions);
+ void restartTripBatching(bool queryAccumulatedDistance, uint32_t accDist = 0,
+ uint32_t numbatchedPos = 0);
+ void printTripReport();
+
+ /* ==== CONFIGURATION ================================================================== */
+ uint32_t mBatchingTimeout;
+ uint32_t mBatchingAccuracy;
+ size_t mBatchSize;
+ size_t mTripBatchSize;
+
+protected:
+
+ /* ==== CLIENT ========================================================================= */
+ virtual void updateClientsEventMask();
+ virtual void stopClientSessions(LocationAPI* client);
+
+public:
+ BatchingAdapter();
+ virtual ~BatchingAdapter() {}
+
+ /* ==== SSR ============================================================================ */
+ /* ======== EVENTS ====(Called from QMI Thread)========================================= */
+ virtual void handleEngineUpEvent();
+ /* ======== UTILITIES ================================================================== */
+ void restartSessions();
+
+ /* ==== BATCHING ======================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ uint32_t startBatchingCommand(LocationAPI* client, BatchingOptions &batchOptions);
+ void updateBatchingOptionsCommand(
+ LocationAPI* client, uint32_t id, BatchingOptions& batchOptions);
+ void stopBatchingCommand(LocationAPI* client, uint32_t id);
+ void getBatchedLocationsCommand(LocationAPI* client, uint32_t id, size_t count);
+ /* ======== RESPONSES ================================================================== */
+ void reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId);
+ /* ======== UTILITIES ================================================================== */
+ bool hasBatchingCallback(LocationAPI* client);
+ bool isBatchingSession(LocationAPI* client, uint32_t sessionId);
+ bool isTripSession(uint32_t sessionId);
+ void saveBatchingSession(LocationAPI* client, uint32_t sessionId,
+ const BatchingOptions& batchingOptions);
+ void eraseBatchingSession(LocationAPI* client, uint32_t sessionId);
+ uint32_t autoReportBatchingSessionsCount();
+ void startBatching(LocationAPI* client, uint32_t sessionId,
+ const BatchingOptions& batchingOptions);
+ void stopBatching(LocationAPI* client, uint32_t sessionId, bool restartNeeded,
+ const BatchingOptions& batchOptions);
+ void stopBatching(LocationAPI* client, uint32_t sessionId) {
+ BatchingOptions batchOptions;
+ stopBatching(client, sessionId, false, batchOptions);
+ };
+
+ /* ==== REPORTS ======================================================================== */
+ /* ======== EVENTS ====(Called from QMI Thread)========================================= */
+ void reportLocationsEvent(const Location* locations, size_t count,
+ BatchingMode batchingMode);
+ void reportCompletedTripsEvent(uint32_t accumulatedDistance);
+ void reportBatchStatusChangeEvent(BatchingStatus batchStatus);
+ /* ======== UTILITIES ================================================================== */
+ void reportLocations(Location* locations, size_t count, BatchingMode batchingMode);
+ void reportBatchStatusChange(BatchingStatus batchStatus,
+ std::list<uint32_t> & completedTripsList);
+
+ /* ==== CONFIGURATION ================================================================== */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ void readConfigCommand();
+ void setConfigCommand();
+ /* ======== UTILITIES ================================================================== */
+ void setBatchSize(size_t batchSize) { mBatchSize = batchSize; }
+ size_t getBatchSize() { return mBatchSize; }
+ void setTripBatchSize(size_t batchSize) { mTripBatchSize = batchSize; }
+ size_t getTripBatchSize() { return mTripBatchSize; }
+ void setBatchingTimeout(uint32_t batchingTimeout) { mBatchingTimeout = batchingTimeout; }
+ uint32_t getBatchingTimeout() { return mBatchingTimeout; }
+ void setBatchingAccuracy(uint32_t accuracy) { mBatchingAccuracy = accuracy; }
+ uint32_t getBatchingAccuracy() { return mBatchingAccuracy; }
+
+};
+
+#endif /* BATCHING_ADAPTER_H */
diff --git a/gps/batching/Makefile.am b/gps/batching/Makefile.am
new file mode 100644
index 0000000..ef8011e
--- /dev/null
+++ b/gps/batching/Makefile.am
@@ -0,0 +1,45 @@
+AM_CFLAGS = \
+ $(GPSUTILS_CFLAGS) \
+ $(LOCCORE_CFLAGS) \
+ -I./ \
+ -std=c++1y \
+ -D__func__=__PRETTY_FUNCTION__ \
+ -fno-short-enums
+
+ACLOCAL_AMFLAGS = -I m4
+
+requiredlibs = \
+ $(GPSUTILS_LIBS) \
+ $(LOCCORE_LIBS) \
+ -llog
+
+h_sources = \
+ BatchingAdapter.h
+
+libbatching_la_SOURCES = \
+ location_batching.cpp \
+ BatchingAdapter.cpp
+
+if USE_GLIB
+libbatching_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+#libbatching_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread $(requiredlibs) @GLIB_LIBS@ -shared -avoid-version
+libbatching_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread $(requiredlibs) @GLIB_LIBS@ -avoid-version
+libbatching_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libbatching_la_CFLAGS = $(AM_CFLAGS)
+libbatching_la_LDFLAGS = -Wl,-z,defs -lpthread $(requiredlibs) -shared -version-info 1:0:0
+libbatching_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+library_include_HEADERS = $(h_sources)
+
+library_includedir = $(pkgincludedir)
+
+#Create and Install libraries
+lib_LTLIBRARIES = libbatching.la
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-batching.pc
+sysconf_DATA = $(WORKSPACE)/hardware/qcom/gps/etc/flp.conf
+EXTRA_DIST = $(pkgconfig_DATA)
+
diff --git a/gps/batching/configure.ac b/gps/batching/configure.ac
new file mode 100644
index 0000000..e77e497
--- /dev/null
+++ b/gps/batching/configure.ac
@@ -0,0 +1,78 @@
+# configure.ac -- Autoconf script for gps location-batching
+#
+# 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-batching package version 1.0.0
+AC_INIT([location-batching],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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])
+
+PKG_CHECK_MODULES([LOCCORE], [loc-core])
+AC_SUBST([LOCCORE_CFLAGS])
+AC_SUBST([LOCCORE_LIBS])
+
+PKG_CHECK_MODULES([GEOFENCE], [location-geofence])
+AC_SUBST([GEOFENCE_CFLAGS])
+AC_SUBST([GEOFENCE_LIBS])
+
+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],
+ 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-batching.pc
+ ])
+
+AC_OUTPUT
diff --git a/gps/batching/location-batching.pc.in b/gps/batching/location-batching.pc.in
new file mode 100644
index 0000000..da1fbf4
--- /dev/null
+++ b/gps/batching/location-batching.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-batching
+Description: QTI GPS Batching
+Version: @VERSION
+Libs: -L${libdir} -lbatching
+Cflags: -I${includedir}/location-batching
diff --git a/gps/batching/location_batching.cpp b/gps/batching/location_batching.cpp
new file mode 100644
index 0000000..571da72
--- /dev/null
+++ b/gps/batching/location_batching.cpp
@@ -0,0 +1,134 @@
+/* Copyright (c) 2017-2019, 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 "BatchingAdapter.h"
+#include "location_interface.h"
+
+static BatchingAdapter* gBatchingAdapter = NULL;
+
+static void initialize();
+static void deinitialize();
+
+static void addClient(LocationAPI* client, const LocationCallbacks& callbacks);
+static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb);
+static void requestCapabilities(LocationAPI* client);
+
+static uint32_t startBatching(LocationAPI* client, BatchingOptions&);
+static void stopBatching(LocationAPI* client, uint32_t id);
+static void updateBatchingOptions(LocationAPI* client, uint32_t id, BatchingOptions&);
+static void getBatchedLocations(LocationAPI* client, uint32_t id, size_t count);
+
+static const BatchingInterface gBatchingInterface = {
+ sizeof(BatchingInterface),
+ initialize,
+ deinitialize,
+ addClient,
+ removeClient,
+ requestCapabilities,
+ startBatching,
+ stopBatching,
+ updateBatchingOptions,
+ getBatchedLocations
+};
+
+#ifndef DEBUG_X86
+extern "C" const BatchingInterface* getBatchingInterface()
+#else
+const BatchingInterface* getBatchingInterface()
+#endif // DEBUG_X86
+{
+ return &gBatchingInterface;
+}
+
+static void initialize()
+{
+ if (NULL == gBatchingAdapter) {
+ gBatchingAdapter = new BatchingAdapter();
+ }
+}
+
+static void deinitialize()
+{
+ if (NULL != gBatchingAdapter) {
+ delete gBatchingAdapter;
+ gBatchingAdapter = NULL;
+ }
+}
+
+static void addClient(LocationAPI* client, const LocationCallbacks& callbacks)
+{
+ if (NULL != gBatchingAdapter) {
+ gBatchingAdapter->addClientCommand(client, callbacks);
+ }
+}
+
+static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb)
+{
+ if (NULL != gBatchingAdapter) {
+ gBatchingAdapter->removeClientCommand(client, rmClientCb);
+ }
+}
+
+static void requestCapabilities(LocationAPI* client)
+{
+ if (NULL != gBatchingAdapter) {
+ gBatchingAdapter->requestCapabilitiesCommand(client);
+ }
+}
+
+static uint32_t startBatching(LocationAPI* client, BatchingOptions &batchOptions)
+{
+ if (NULL != gBatchingAdapter) {
+ return gBatchingAdapter->startBatchingCommand(client, batchOptions);
+ } else {
+ return 0;
+ }
+}
+
+static void stopBatching(LocationAPI* client, uint32_t id)
+{
+ if (NULL != gBatchingAdapter) {
+ gBatchingAdapter->stopBatchingCommand(client, id);
+ }
+}
+
+static void updateBatchingOptions(
+ LocationAPI* client, uint32_t id, BatchingOptions& batchOptions)
+{
+ if (NULL != gBatchingAdapter) {
+ gBatchingAdapter->updateBatchingOptionsCommand(client, id, batchOptions);
+ }
+}
+
+static void getBatchedLocations(LocationAPI* client, uint32_t id, size_t count)
+{
+ if (NULL != gBatchingAdapter) {
+ gBatchingAdapter->getBatchedLocationsCommand(client, id, count);
+ }
+}
+
diff --git a/gps/build/target_specific_features.mk b/gps/build/target_specific_features.mk
new file mode 100644
index 0000000..5539598
--- /dev/null
+++ b/gps/build/target_specific_features.mk
@@ -0,0 +1,72 @@
+GNSS_CFLAGS := \
+ -Werror \
+ -Wno-error=unused-parameter \
+ -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
+
+# GPS-HIDL
+GNSS_HIDL_1_0_TARGET_LIST := msm8960
+GNSS_HIDL_1_0_TARGET_LIST += msm8974
+GNSS_HIDL_1_0_TARGET_LIST += msm8226
+GNSS_HIDL_1_0_TARGET_LIST += msm8610
+GNSS_HIDL_1_0_TARGET_LIST += apq8084
+GNSS_HIDL_1_0_TARGET_LIST += msm8916
+GNSS_HIDL_1_0_TARGET_LIST += msm8994
+GNSS_HIDL_2_0_TARGET_LIST := msm8909
+GNSS_HIDL_1_0_TARGET_LIST += msm8952
+GNSS_HIDL_1_0_TARGET_LIST += msm8992
+GNSS_HIDL_1_0_TARGET_LIST += msm8996
+GNSS_HIDL_2_0_TARGET_LIST += msm8937
+GNSS_HIDL_2_0_TARGET_LIST += msm8953
+GNSS_HIDL_2_0_TARGET_LIST += msm8998
+GNSS_HIDL_2_0_TARGET_LIST += apq8098_latv
+GNSS_HIDL_2_0_TARGET_LIST += sdm710
+GNSS_HIDL_2_0_TARGET_LIST += qcs605
+GNSS_HIDL_2_0_TARGET_LIST += sdm845
+GNSS_HIDL_2_0_TARGET_LIST += sdm660
+GNSS_HIDL_2_0_TARGET_LIST += msmnile
+GNSS_HIDL_2_0_TARGET_LIST += sdmshrike
+GNSS_HIDL_2_0_TARGET_LIST += $(MSMSTEPPE)
+GNSS_HIDL_2_0_TARGET_LIST += $(TRINKET)
+GNSS_HIDL_2_0_TARGET_LIST += kona
+GNSS_HIDL_2_0_TARGET_LIST += atoll
+GNSS_HIDL_2_0_TARGET_LIST += lito
+GNSS_HIDL_2_0_TARGET_LIST += bengal
+
+ifneq (,$(filter $(GNSS_HIDL_2_0_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
+GNSS_HIDL_VERSION = 2.0
+endif
+ifneq (,$(filter $(GNSS_HIDL_1_0_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
+GNSS_HIDL_VERSION = 1.0
+endif
+ifneq (,$(filter $(GNSS_HIDL_1_1_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
+GNSS_HIDL_VERSION = 1.1
+endif
+
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST := msm8937
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8953
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += msm8998
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += apq8098_latv
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm710
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += qcs605
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm845
+GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST += sdm660
+
+ifneq (,$(filter $(GNSS_HIDL_LEGACY_MEASURMENTS_TARGET_LIST),$(TARGET_BOARD_PLATFORM)))
+GNSS_HIDL_LEGACY_MEASURMENTS = true
+endif
+
+# Activate the following two lines for regression testing
+#GNSS_SANITIZE := address cfi alignment bounds null unreachable integer
+#GNSS_SANITIZE_DIAG := address cfi alignment bounds null unreachable integer
diff --git a/gps/configure.ac b/gps/configure.ac
new file mode 100644
index 0000000..2a44051
--- /dev/null
+++ b/gps/configure.ac
@@ -0,0 +1,87 @@
+# configure.ac -- Autoconf script for gps loc_hal
+#
+# 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-hal package version 1.0.0
+AC_INIT([loc-hal],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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])
+
+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]),
+ [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 \
+ gnss/Makefile \
+ loc-hal.pc \
+ ])
+
+AC_OUTPUT
diff --git a/gps/core/Android.mk b/gps/core/Android.mk
new file mode 100644
index 0000000..ce5d6a8
--- /dev/null
+++ b/gps/core/Android.mk
@@ -0,0 +1,62 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_core
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libutils \
+ libcutils \
+ libgps.utils \
+ libdl \
+ liblog
+
+LOCAL_SRC_FILES += \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocContext.cpp \
+ loc_core_log.cpp \
+ data-items/DataItemsFactoryProxy.cpp \
+ SystemStatusOsObserver.cpp \
+ SystemStatus.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/data-items \
+ $(LOCAL_PATH)/data-items/common \
+ $(LOCAL_PATH)/observer \
+
+LOCAL_HEADER_LIBRARIES := \
+ libutils_headers \
+ libgps.utils_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libloc_core_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/data-items \
+ $(LOCAL_PATH)/data-items/common \
+ $(LOCAL_PATH)/observer
+include $(BUILD_HEADER_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp
new file mode 100644
index 0000000..d12f553
--- /dev/null
+++ b/gps/core/ContextBase.cpp
@@ -0,0 +1,349 @@
+/* Copyright (c) 2011-2014,2016-2017,2020 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <loc_pla.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+#define SLL_LOC_API_LIB_NAME "libsynergy_loc_api.so"
+#define LOC_APIV2_0_LIB_NAME "libloc_api_v02.so"
+#define IS_SS5_HW_ENABLED 1
+
+loc_gps_cfg_s_type ContextBase::mGps_conf {};
+loc_sap_cfg_s_type ContextBase::mSap_conf {};
+bool ContextBase::sIsEngineCapabilitiesKnown = false;
+uint64_t ContextBase::sSupportedMsgMask = 0;
+bool ContextBase::sGnssMeasurementSupported = false;
+uint8_t ContextBase::sFeaturesSupported[MAX_FEATURE_LENGTH];
+
+const loc_param_s_type ContextBase::mGps_conf_table[] =
+{
+ {"GPS_LOCK", &mGps_conf.GPS_LOCK, NULL, 'n'},
+ {"SUPL_VER", &mGps_conf.SUPL_VER, NULL, 'n'},
+ {"LPP_PROFILE", &mGps_conf.LPP_PROFILE, NULL, 'n'},
+ {"A_GLONASS_POS_PROTOCOL_SELECT", &mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
+ {"LPPE_CP_TECHNOLOGY", &mGps_conf.LPPE_CP_TECHNOLOGY, NULL, 'n'},
+ {"LPPE_UP_TECHNOLOGY", &mGps_conf.LPPE_UP_TECHNOLOGY, NULL, 'n'},
+ {"AGPS_CERT_WRITABLE_MASK", &mGps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
+ {"SUPL_MODE", &mGps_conf.SUPL_MODE, NULL, 'n'},
+ {"SUPL_ES", &mGps_conf.SUPL_ES, NULL, 'n'},
+ {"INTERMEDIATE_POS", &mGps_conf.INTERMEDIATE_POS, NULL, 'n'},
+ {"ACCURACY_THRES", &mGps_conf.ACCURACY_THRES, NULL, 'n'},
+ {"NMEA_PROVIDER", &mGps_conf.NMEA_PROVIDER, NULL, 'n'},
+ {"CAPABILITIES", &mGps_conf.CAPABILITIES, NULL, 'n'},
+ {"XTRA_VERSION_CHECK", &mGps_conf.XTRA_VERSION_CHECK, NULL, 'n'},
+ {"XTRA_SERVER_1", &mGps_conf.XTRA_SERVER_1, NULL, 's'},
+ {"XTRA_SERVER_2", &mGps_conf.XTRA_SERVER_2, NULL, 's'},
+ {"XTRA_SERVER_3", &mGps_conf.XTRA_SERVER_3, NULL, 's'},
+ {"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'},
+ {"MODEM_TYPE", &mGps_conf.MODEM_TYPE, NULL, 'n' },
+ {"MO_SUPL_HOST", &mGps_conf.MO_SUPL_HOST, NULL, 's' },
+ {"MO_SUPL_PORT", &mGps_conf.MO_SUPL_PORT, NULL, 'n' },
+ {"CONSTRAINED_TIME_UNCERTAINTY_ENABLED",
+ &mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED, NULL, 'n'},
+ {"CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD",
+ &mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD, NULL, 'f'},
+ {"CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET",
+ &mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET, NULL, 'n'},
+ {"POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED",
+ &mGps_conf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED, NULL, 'n'},
+ {"PROXY_APP_PACKAGE_NAME", &mGps_conf.PROXY_APP_PACKAGE_NAME, NULL, 's' },
+ {"CP_MTLR_ES", &mGps_conf.CP_MTLR_ES, NULL, 'n' },
+ {"GNSS_DEPLOYMENT", &mGps_conf.GNSS_DEPLOYMENT, NULL, 'n'},
+ {"CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED",
+ &mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED, NULL, 'n'},
+ {"NI_SUPL_DENY_ON_NFW_LOCKED", &mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED, NULL, 'n'},
+ {"ENABLE_NMEA_PRINT", &mGps_conf.ENABLE_NMEA_PRINT, NULL, 'n'}
+};
+
+const loc_param_s_type ContextBase::mSap_conf_table[] =
+{
+ {"GYRO_BIAS_RANDOM_WALK", &mSap_conf.GYRO_BIAS_RANDOM_WALK, &mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
+ {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC", &mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC", &mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH", &mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_CONTROL_MODE", &mSap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'}
+};
+
+void ContextBase::readConfig()
+{
+ static bool confReadDone = false;
+ if (!confReadDone) {
+ confReadDone = true;
+ /*Defaults for gps.conf*/
+ mGps_conf.INTERMEDIATE_POS = 0;
+ mGps_conf.ACCURACY_THRES = 0;
+ mGps_conf.NMEA_PROVIDER = 0;
+ mGps_conf.GPS_LOCK = GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
+ mGps_conf.SUPL_VER = 0x10000;
+ mGps_conf.SUPL_MODE = 0x1;
+ mGps_conf.SUPL_ES = 0;
+ mGps_conf.CP_MTLR_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;
+ /*By default no positioning protocol is selected on A-GLONASS system*/
+ mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+ /*XTRA version check is disabled by default*/
+ mGps_conf.XTRA_VERSION_CHECK=0;
+ /*Use emergency PDN by default*/
+ mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
+ /* By default no LPPe CP technology is enabled*/
+ mGps_conf.LPPE_CP_TECHNOLOGY = 0;
+ /* By default no LPPe UP technology is enabled*/
+ mGps_conf.LPPE_UP_TECHNOLOGY = 0;
+ /* By default we use unknown modem type*/
+ mGps_conf.MODEM_TYPE = 2;
+
+ /*Defaults for sap.conf*/
+ mSap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+ mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+ mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+ mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+ mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+ mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+ mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+ mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+ mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+ mSap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+ mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/
+ /* Values MUST be set by OEMs in configuration for sensor-assisted
+ navigation to work. There are NO default values */
+ mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+ mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+
+ /* None of the 10 slots for agps certificates are writable by default */
+ mGps_conf.AGPS_CERT_WRITABLE_MASK = 0;
+
+ /* inject supl config to modem with config values from config.xml or gps.conf, default 1 */
+ mGps_conf.AGPS_CONFIG_INJECT = 1;
+
+ /* default configuration value of constrained time uncertainty mode:
+ feature disabled, time uncertainty threshold defined by modem,
+ and unlimited power budget */
+#ifdef FEATURE_AUTOMOTIVE
+ mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED = 1;
+#else
+ mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED = 0;
+#endif
+ mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD = 0.0;
+ mGps_conf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET = 0;
+
+ /* default configuration value of position assisted clock estimator mode */
+ mGps_conf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED = 0;
+ /* default configuration QTI GNSS H/W */
+ mGps_conf.GNSS_DEPLOYMENT = 0;
+ mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0;
+ /* default configuration for NI_SUPL_DENY_ON_NFW_LOCKED */
+ mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED = 1;
+ /* By default NMEA Printing is disabled */
+ mGps_conf.ENABLE_NMEA_PRINT = 0;
+
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
+ UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
+
+ LOC_LOGI("%s] GNSS Deployment: %s", __FUNCTION__,
+ ((mGps_conf.GNSS_DEPLOYMENT == 1) ? "SS5" :
+ ((mGps_conf.GNSS_DEPLOYMENT == 2) ? "QFUSION" : "QGNSS")));
+
+ switch (getTargetGnssType(loc_get_target())) {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ // For APQ targets, MSA/MSB capabilities should be reset
+ mGps_conf.CAPABILITIES &= ~(LOC_GPS_CAPABILITY_MSA | LOC_GPS_CAPABILITY_MSB);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+uint32_t ContextBase::getCarrierCapabilities() {
+ #define carrierMSA (uint32_t)0x2
+ #define carrierMSB (uint32_t)0x1
+ #define gpsConfMSA (uint32_t)0x4
+ #define gpsConfMSB (uint32_t)0x2
+ uint32_t capabilities = mGps_conf.CAPABILITIES;
+ if ((mGps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
+ capabilities &= ~gpsConfMSA;
+ }
+ if ((mGps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
+ capabilities &= ~gpsConfMSB;
+ }
+
+ LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
+ mGps_conf.CAPABILITIES, mGps_conf.SUPL_MODE, capabilities);
+ return capabilities;
+}
+
+LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
+{
+ LBSProxyBase* proxy = NULL;
+ LOC_LOGD("%s:%d]: getLBSProxy libname: %s\n", __func__, __LINE__, libName);
+ void* lib = dlopen(libName, RTLD_NOW);
+
+ if ((void*)NULL != lib) {
+ getLBSProxy_t* getter = (getLBSProxy_t*)dlsym(lib, "getLBSProxy");
+ if (NULL != getter) {
+ proxy = (*getter)();
+ }
+ }
+ else
+ {
+ LOC_LOGW("%s:%d]: FAILED TO LOAD libname: %s\n", __func__, __LINE__, libName);
+ }
+ if (NULL == proxy) {
+ proxy = new LBSProxyBase();
+ }
+ LOC_LOGD("%s:%d]: Exiting\n", __func__, __LINE__);
+ return proxy;
+}
+
+LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
+{
+ LocApiBase* locApi = NULL;
+ const char* libname = LOC_APIV2_0_LIB_NAME;
+
+ // Check the target
+ if (TARGET_NO_GNSS != loc_get_target()){
+
+ if (NULL == (locApi = mLBSProxy->getLocApi(exMask, this))) {
+ void *handle = NULL;
+
+ if (IS_SS5_HW_ENABLED == mGps_conf.GNSS_DEPLOYMENT) {
+ libname = SLL_LOC_API_LIB_NAME;
+ }
+
+ if ((handle = dlopen(libname, RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: %s is present", __func__, __LINE__, libname);
+ getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
+ if (getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL of %s", __func__,
+ __LINE__, libname);
+ locApi = (*getter)(exMask, this);
+ }
+ }
+ // only RPC is the option now
+ else {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC",
+ __func__, __LINE__);
+ handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
+ if (NULL != handle) {
+ getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
+ if (NULL != getter) {
+ LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__,
+ __LINE__);
+ locApi = (*getter)(exMask, this);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(exMask, this);
+ }
+
+ return locApi;
+}
+
+ContextBase::ContextBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ const char* libName) :
+ mLBSProxy(getLBSProxy(libName)),
+ mMsgTask(msgTask),
+ mLocApi(createLocApi(exMask)),
+ mLocApiProxy(mLocApi->getLocApiProxy())
+{
+}
+
+void ContextBase::setEngineCapabilities(uint64_t supportedMsgMask,
+ uint8_t *featureList, bool gnssMeasurementSupported) {
+
+ if (ContextBase::sIsEngineCapabilitiesKnown == false) {
+ ContextBase::sSupportedMsgMask = supportedMsgMask;
+ ContextBase::sGnssMeasurementSupported = gnssMeasurementSupported;
+ if (featureList != NULL) {
+ memcpy((void *)ContextBase::sFeaturesSupported,
+ (void *)featureList, sizeof(ContextBase::sFeaturesSupported));
+ }
+
+ ContextBase::sIsEngineCapabilitiesKnown = true;
+ }
+}
+
+
+bool ContextBase::isFeatureSupported(uint8_t featureVal)
+{
+ uint8_t arrayIndex = featureVal >> 3;
+ uint8_t bitPos = featureVal & 7;
+
+ if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
+ return ((ContextBase::sFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
+}
+
+bool ContextBase::gnssConstellationConfig() {
+ return sGnssMeasurementSupported;
+}
+
+}
diff --git a/gps/core/ContextBase.h b/gps/core/ContextBase.h
new file mode 100644
index 0000000..1a003c8
--- /dev/null
+++ b/gps/core/ContextBase.h
@@ -0,0 +1,263 @@
+/* Copyright (c) 2011-2017, 2020, 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_CONTEXT_BASE__
+#define __LOC_CONTEXT_BASE__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <MsgTask.h>
+#include <LocApiBase.h>
+#include <LBSProxyBase.h>
+#include <loc_cfg.h>
+
+/* GPS.conf support */
+/* NOTE: the implementaiton of the parser casts number
+ fields to 32 bit. To ensure all 'n' fields working,
+ they must all be 32 bit fields. */
+typedef struct loc_gps_cfg_s
+{
+ uint32_t INTERMEDIATE_POS;
+ uint32_t ACCURACY_THRES;
+ uint32_t SUPL_VER;
+ uint32_t SUPL_MODE;
+ uint32_t SUPL_ES;
+ uint32_t CAPABILITIES;
+ uint32_t LPP_PROFILE;
+ uint32_t XTRA_VERSION_CHECK;
+ char XTRA_SERVER_1[LOC_MAX_PARAM_STRING];
+ char XTRA_SERVER_2[LOC_MAX_PARAM_STRING];
+ char XTRA_SERVER_3[LOC_MAX_PARAM_STRING];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ GnssConfigGpsLock GPS_LOCK;
+ uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
+ uint32_t AGPS_CERT_WRITABLE_MASK;
+ uint32_t AGPS_CONFIG_INJECT;
+ uint32_t LPPE_CP_TECHNOLOGY;
+ uint32_t LPPE_UP_TECHNOLOGY;
+ uint32_t EXTERNAL_DR_ENABLED;
+ char SUPL_HOST[LOC_MAX_PARAM_STRING];
+ uint32_t SUPL_PORT;
+ uint32_t MODEM_TYPE;
+ char MO_SUPL_HOST[LOC_MAX_PARAM_STRING];
+ uint32_t MO_SUPL_PORT;
+ uint32_t CONSTRAINED_TIME_UNCERTAINTY_ENABLED;
+ double CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD;
+ uint32_t CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET;
+ uint32_t POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED;
+ char PROXY_APP_PACKAGE_NAME[LOC_MAX_PARAM_STRING];
+ uint32_t CP_MTLR_ES;
+ uint32_t GNSS_DEPLOYMENT;
+ uint32_t CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED;
+ uint32_t NI_SUPL_DENY_ON_NFW_LOCKED;
+ uint32_t ENABLE_NMEA_PRINT;
+} loc_gps_cfg_s_type;
+
+/* NOTE: the implementaiton of the parser casts number
+ fields to 32 bit. To ensure all 'n' fields working,
+ they must all be 32 bit fields. */
+/* Meanwhile, *_valid fields are 8 bit fields, and 'f'
+ fields are double. Rigid as they are, it is the
+ the status quo, until the parsing mechanism is
+ change, that is. */
+typedef struct
+{
+ uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
+ double GYRO_BIAS_RANDOM_WALK;
+ uint32_t SENSOR_ACCEL_BATCHES_PER_SEC;
+ uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH;
+ uint32_t SENSOR_GYRO_BATCHES_PER_SEC;
+ uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH;
+ uint32_t SENSOR_ACCEL_BATCHES_PER_SEC_HIGH;
+ uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
+ uint32_t SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
+ uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
+ uint32_t SENSOR_CONTROL_MODE;
+ uint32_t SENSOR_ALGORITHM_CONFIG_MASK;
+ uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY;
+ uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY;
+ uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double RATE_RANDOM_WALK_SPECTRAL_DENSITY;
+ uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY;
+} loc_sap_cfg_s_type;
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class ContextBase {
+ static LBSProxyBase* getLBSProxy(const char* libName);
+ LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
+ static const loc_param_s_type mGps_conf_table[];
+ static const loc_param_s_type mSap_conf_table[];
+protected:
+ const LBSProxyBase* mLBSProxy;
+ const MsgTask* mMsgTask;
+ LocApiBase* mLocApi;
+ LocApiProxyBase *mLocApiProxy;
+
+public:
+ ContextBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ const char* libName);
+ inline virtual ~ContextBase() {
+ if (nullptr != mLocApi) {
+ mLocApi->destroy();
+ mLocApi = nullptr;
+ }
+ if (nullptr != mLBSProxy) {
+ delete mLBSProxy;
+ mLBSProxy = nullptr;
+ }
+ }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
+ inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
+ inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
+ inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
+ inline IzatDevId_t getIzatDevId() const {
+ return mLBSProxy->getIzatDevId();
+ }
+ inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
+
+ static loc_gps_cfg_s_type mGps_conf;
+ static loc_sap_cfg_s_type mSap_conf;
+ static bool sIsEngineCapabilitiesKnown;
+ static uint64_t sSupportedMsgMask;
+ static uint8_t sFeaturesSupported[MAX_FEATURE_LENGTH];
+ static bool sGnssMeasurementSupported;
+
+ void readConfig();
+ static uint32_t getCarrierCapabilities();
+ void setEngineCapabilities(uint64_t supportedMsgMask,
+ uint8_t *featureList, bool gnssMeasurementSupported);
+
+ static inline bool isEngineCapabilitiesKnown() {
+ return sIsEngineCapabilitiesKnown;
+ }
+
+ static inline bool isMessageSupported(LocCheckingMessagesID msgID) {
+
+ // confirm if msgID is not larger than the number of bits in
+ // mSupportedMsg
+ if ((uint64_t)msgID > (sizeof(sSupportedMsgMask) << 3)) {
+ return false;
+ } else {
+ uint32_t messageChecker = 1 << msgID;
+ return (messageChecker & sSupportedMsgMask) == messageChecker;
+ }
+ }
+
+ /*
+ Check if a feature is supported
+ */
+ static bool isFeatureSupported(uint8_t featureVal);
+
+ /*
+ Check if gnss measurement is supported
+ */
+ static bool gnssConstellationConfig();
+
+};
+
+struct LocApiResponse: LocMsg {
+ private:
+ ContextBase& mContext;
+ std::function<void (LocationError err)> mProcImpl;
+ inline virtual void proc() const {
+ mProcImpl(mLocationError);
+ }
+ protected:
+ LocationError mLocationError;
+ public:
+ inline LocApiResponse(ContextBase& context,
+ std::function<void (LocationError err)> procImpl ) :
+ mContext(context), mProcImpl(procImpl) {}
+
+ void returnToSender(const LocationError err) {
+ mLocationError = err;
+ mContext.sendMsg(this);
+ }
+};
+
+struct LocApiCollectiveResponse: LocMsg {
+ private:
+ ContextBase& mContext;
+ std::function<void (std::vector<LocationError> errs)> mProcImpl;
+ inline virtual void proc() const {
+ mProcImpl(mLocationErrors);
+ }
+ protected:
+ std::vector<LocationError> mLocationErrors;
+ public:
+ inline LocApiCollectiveResponse(ContextBase& context,
+ std::function<void (std::vector<LocationError> errs)> procImpl ) :
+ mContext(context), mProcImpl(procImpl) {}
+ inline virtual ~LocApiCollectiveResponse() {
+ }
+
+ void returnToSender(std::vector<LocationError>& errs) {
+ mLocationErrors = errs;
+ mContext.sendMsg(this);
+ }
+};
+
+
+template <typename DATA>
+struct LocApiResponseData: LocMsg {
+ private:
+ ContextBase& mContext;
+ std::function<void (LocationError err, DATA data)> mProcImpl;
+ inline virtual void proc() const {
+ mProcImpl(mLocationError, mData);
+ }
+ protected:
+ LocationError mLocationError;
+ DATA mData;
+ public:
+ inline LocApiResponseData(ContextBase& context,
+ std::function<void (LocationError err, DATA data)> procImpl ) :
+ mContext(context), mProcImpl(procImpl) {}
+
+ void returnToSender(const LocationError err, const DATA data) {
+ mLocationError = err;
+ mData = data;
+ mContext.sendMsg(this);
+ }
+};
+
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/gps/core/EngineHubProxyBase.h b/gps/core/EngineHubProxyBase.h
new file mode 100644
index 0000000..d46bca2
--- /dev/null
+++ b/gps/core/EngineHubProxyBase.h
@@ -0,0 +1,136 @@
+/* Copyright (c) 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 ENGINE_HUB_PROXY_BASE_H
+#define ENGINE_HUB_PROXY_BASE_H
+
+namespace loc_core {
+
+class EngineHubProxyBase {
+public:
+ inline EngineHubProxyBase() {
+ }
+ inline virtual ~EngineHubProxyBase() {}
+
+ // gnss session related functions
+ inline virtual bool gnssStartFix() {
+ return false;
+ }
+
+ inline virtual bool gnssStopFix() {
+ return false;
+ }
+
+ inline virtual bool gnssSetFixMode(const LocPosMode ¶ms) {
+ (void) params;
+ return false;
+ }
+
+ inline virtual bool gnssDeleteAidingData(const GnssAidingData &aidingData) {
+ (void) aidingData;
+ return false;
+ }
+
+ // GNSS reports
+ inline virtual bool gnssReportPosition(const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ enum loc_sess_status status) {
+ (void) location;
+ (void) locationExtended;
+ (void) status;
+ return false;
+ }
+
+ inline virtual bool gnssReportSv(const GnssSvNotification& svNotify) {
+ (void) svNotify;
+ return false;
+ }
+
+ inline virtual bool gnssReportSvMeasurement(const GnssSvMeasurementSet& svMeasurementSet) {
+ (void) svMeasurementSet;
+ return false;
+ }
+
+ inline virtual bool gnssReportSvPolynomial(const GnssSvPolynomial& svPolynomial) {
+ (void) svPolynomial;
+ return false;
+ }
+
+ inline virtual bool gnssReportSvEphemeris(const GnssSvEphemerisReport& svEphemeris) {
+ (void) svEphemeris;
+ return false;
+ }
+
+ inline virtual bool gnssReportSystemInfo(const LocationSystemInfo& systemInfo) {
+ (void) systemInfo;
+ return false;
+ }
+
+ inline virtual bool gnssReportKlobucharIonoModel(const GnssKlobucharIonoModel& ionoModel) {
+ (void) ionoModel;
+ return false;
+ }
+
+ inline virtual bool gnssReportAdditionalSystemInfo(
+ const GnssAdditionalSystemInfo& additionalSystemInfo) {
+ (void) additionalSystemInfo;
+ return false;
+ }
+
+ inline virtual bool configLeverArm(const LeverArmConfigInfo& configInfo) {
+ (void) configInfo;
+ return false;
+ }
+};
+
+typedef std::function<void(int count, EngineLocationInfo* locationArr)>
+ GnssAdapterReportEnginePositionsEventCb;
+
+typedef std::function<void(const GnssSvNotification& svNotify,
+ bool fromEngineHub)>
+ GnssAdapterReportSvEventCb;
+
+typedef std::function<void(const GnssAidingDataSvMask& svDataMask)>
+ GnssAdapterReqAidingDataCb;
+
+typedef std::function<void(bool nHzNeeded, bool nHzMeasNeeded)>
+ GnssAdapterUpdateNHzRequirementCb;
+
+// potential parameters: message queue: MsgTask * msgTask;
+// callback function to report back dr and ppe position and sv report
+typedef EngineHubProxyBase* (getEngHubProxyFn)(
+ const MsgTask * msgTask,
+ IOsObserver* osObserver,
+ GnssAdapterReportEnginePositionsEventCb positionEventCb,
+ GnssAdapterReportSvEventCb svEventCb,
+ GnssAdapterReqAidingDataCb reqAidingDataCb,
+ GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb);
+
+} // namespace loc_core
+
+#endif // ENGINE_HUB_PROXY_BASE_H
diff --git a/gps/core/LBSProxyBase.h b/gps/core/LBSProxyBase.h
new file mode 100644
index 0000000..564c60b
--- /dev/null
+++ b/gps/core/LBSProxyBase.h
@@ -0,0 +1,70 @@
+/* Copyright (c) 2013-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 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 IZAT_PROXY_BASE_H
+#define IZAT_PROXY_BASE_H
+#include <gps_extended.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+class ContextBase;
+
+class LBSProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) const {
+
+ (void)exMask;
+ (void)context;
+ return NULL;
+ }
+protected:
+ inline LBSProxyBase() {}
+public:
+ inline virtual ~LBSProxyBase() {}
+ inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
+ inline virtual void modemPowerVote(bool power) const {
+
+ (void)power;
+ }
+ virtual void injectFeatureConfig(ContextBase* context) const {
+
+ (void)context;
+ }
+ inline virtual bool hasNativeXtraClient() const { return false; }
+ inline virtual IzatDevId_t getIzatDevId() const { return 0; }
+};
+
+typedef LBSProxyBase* (getLBSProxy_t)();
+
+} // namespace loc_core
+
+#endif // IZAT_PROXY_BASE_H
diff --git a/gps/core/LocAdapterBase.cpp b/gps/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..8df7198
--- /dev/null
+++ b/gps/core/LocAdapterBase.cpp
@@ -0,0 +1,422 @@
+/* Copyright (c) 2011-2014, 2016-2020 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_LocAdapterBase"
+
+#include <dlfcn.h>
+#include <LocAdapterBase.h>
+#include <loc_target.h>
+#include <log_util.h>
+#include <LocAdapterProxyBase.h>
+
+namespace loc_core {
+
+// This is the top level class, so the constructor will
+// always gets called. Here we prepare for the default.
+// But if getLocApi(targetEnumType target) is overriden,
+// the right locApi should get created.
+LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, bool isMaster,
+ LocAdapterProxyBase *adapterProxyBase,
+ bool waitForDoneInit) :
+ mIsMaster(isMaster), mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
+ mMsgTask(context->getMsgTask()),
+ mIsEngineCapabilitiesKnown(ContextBase::sIsEngineCapabilitiesKnown)
+{
+ LOC_LOGd("waitForDoneInit: %d", waitForDoneInit);
+ if (!waitForDoneInit) {
+ mLocApi->addAdapter(this);
+ mAdapterAdded = true;
+ } else {
+ mAdapterAdded = false;
+ }
+}
+
+uint32_t LocAdapterBase::mSessionIdCounter(1);
+
+uint32_t LocAdapterBase::generateSessionId()
+{
+ if (++mSessionIdCounter == 0xFFFFFFFF)
+ mSessionIdCounter = 1;
+
+ return mSessionIdCounter;
+}
+
+void LocAdapterBase::handleEngineUpEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineUpEvent();
+ }
+}
+
+void LocAdapterBase::handleEngineDownEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineDownEvent();
+ }
+}
+
+void LocAdapterBase::
+ reportPositionEvent(const UlpLocation& location,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask,
+ GnssDataNotification* pDataNotify,
+ int msInWeek)
+{
+ if (mLocAdapterProxyBase != NULL) {
+ mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
+ (GpsLocationExtended&)locationExtended,
+ status,
+ loc_technology_mask);
+ } else {
+ DEFAULT_IMPL()
+ }
+}
+
+void LocAdapterBase::
+ reportSvEvent(const GnssSvNotification& /*svNotify*/,
+ bool /*fromEngineHub*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSvPolynomialEvent(GnssSvPolynomial &/*svPolynomial*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSvEphemerisEvent(GnssSvEphemerisReport &/*svEphemeris*/)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportStatus(LocGpsStatusValue /*status*/)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmeaEvent(const char* /*nmea*/, size_t /*length*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportDataEvent(const GnssDataNotification& /*dataNotify*/,
+ int /*msInWeek*/)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* /*url1*/, const char* /*url2*/,
+ const char* /*url3*/, const int /*maxlength*/)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ reportLocationSystemInfoEvent(const LocationSystemInfo& /*locationSystemInfo*/)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ requestXtraData()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestTime()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestLocation()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/,
+ LocApnTypeMask /*apn_type_mask*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int /*connHandle*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotifyEvent(const GnssNiNotification &/*notify*/,
+ const void* /*data*/,
+ const LocInEmergency emergencyState)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+reportGnssMeasurementsEvent(const GnssMeasurements& /*gnssMeasurements*/,
+ int /*msInWeek*/)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportZppBestAvailableFix(LocGpsLocation& /*zppLoc*/,
+ GpsLocationExtended& /*location_extended*/, LocPosTechMask /*tech_mask*/)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::reportGnssSvIdConfigEvent(const GnssSvIdConfig& /*config*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& /*config*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::reportGnssConfigEvent(uint32_t, /* session id*/
+ const GnssConfig& /*gnssConfig*/)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ requestOdcpiEvent(OdcpiRequestInfo& /*request*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportGnssEngEnergyConsumedEvent(uint64_t /*energyConsumedSinceFirstBoot*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDeleteAidingDataEvent(GnssAidingData & /*aidingData*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& /*ionoModel*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportGnssAdditionalSystemInfoEvent(GnssAdditionalSystemInfo& /*additionalSystemInfo*/)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ reportNfwNotificationEvent(GnssNfwNotification& /*notification*/)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::geofenceBreachEvent(size_t /*count*/, uint32_t* /*hwIds*/, Location& /*location*/,
+ GeofenceBreachType /*breachType*/, uint64_t /*timestamp*/)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::geofenceStatusEvent(GeofenceStatusAvailable /*available*/)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::reportLocationsEvent(const Location* /*locations*/, size_t /*count*/,
+ BatchingMode /*batchingMode*/)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::reportCompletedTripsEvent(uint32_t /*accumulated_distance*/)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::reportBatchStatusChangeEvent(BatchingStatus /*batchStatus*/)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::reportPositionEvent(UlpLocation& /*location*/,
+ GpsLocationExtended& /*locationExtended*/,
+ enum loc_sess_status /*status*/,
+ LocPosTechMask /*loc_technology_mask*/)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::saveClient(LocationAPI* client, const LocationCallbacks& callbacks)
+{
+ mClientData[client] = callbacks;
+ updateClientsEventMask();
+}
+
+void
+LocAdapterBase::eraseClient(LocationAPI* client)
+{
+ auto it = mClientData.find(client);
+ if (it != mClientData.end()) {
+ mClientData.erase(it);
+ }
+ updateClientsEventMask();
+}
+
+LocationCallbacks
+LocAdapterBase::getClientCallbacks(LocationAPI* client)
+{
+ LocationCallbacks callbacks = {};
+ auto it = mClientData.find(client);
+ if (it != mClientData.end()) {
+ callbacks = it->second;
+ }
+ return callbacks;
+}
+
+LocationCapabilitiesMask
+LocAdapterBase::getCapabilities()
+{
+ LocationCapabilitiesMask mask = 0;
+
+ if (isEngineCapabilitiesKnown()) {
+ // time based tracking always supported
+ mask |= LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT;
+ if (ContextBase::isMessageSupported(
+ LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING)){
+ mask |= LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT |
+ LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT;
+ }
+ if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING)) {
+ mask |= LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT;
+ }
+ if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING)) {
+ mask |= LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT;
+ }
+ // geofence always supported
+ mask |= LOCATION_CAPABILITIES_GEOFENCE_BIT;
+ if (ContextBase::gnssConstellationConfig()) {
+ mask |= LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT;
+ }
+ uint32_t carrierCapabilities = ContextBase::getCarrierCapabilities();
+ if (carrierCapabilities & LOC_GPS_CAPABILITY_MSB) {
+ mask |= LOCATION_CAPABILITIES_GNSS_MSB_BIT;
+ }
+ if (LOC_GPS_CAPABILITY_MSA & carrierCapabilities) {
+ mask |= LOCATION_CAPABILITIES_GNSS_MSA_BIT;
+ }
+ if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
+ mask |= LOCATION_CAPABILITIES_DEBUG_NMEA_BIT;
+ }
+ if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
+ mask |= LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT;
+ }
+ if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_AGPM_V02)) {
+ mask |= LOCATION_CAPABILITIES_AGPM_BIT;
+ }
+ if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY)) {
+ mask |= LOCATION_CAPABILITIES_PRIVACY_BIT;
+ }
+ } else {
+ LOC_LOGE("%s]: attempt to get capabilities before they are known.", __func__);
+ }
+
+ return mask;
+}
+
+void
+LocAdapterBase::broadcastCapabilities(LocationCapabilitiesMask mask)
+{
+ for (auto clientData : mClientData) {
+ if (nullptr != clientData.second.capabilitiesCb) {
+ clientData.second.capabilitiesCb(mask);
+ }
+ }
+}
+
+void
+LocAdapterBase::updateClientsEventMask()
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::stopClientSessions(LocationAPI* client)
+DEFAULT_IMPL()
+
+void
+LocAdapterBase::addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+
+ struct MsgAddClient : public LocMsg {
+ LocAdapterBase& mAdapter;
+ LocationAPI* mClient;
+ const LocationCallbacks mCallbacks;
+ inline MsgAddClient(LocAdapterBase& adapter,
+ LocationAPI* client,
+ const LocationCallbacks& callbacks) :
+ LocMsg(),
+ mAdapter(adapter),
+ mClient(client),
+ mCallbacks(callbacks) {}
+ inline virtual void proc() const {
+ mAdapter.saveClient(mClient, mCallbacks);
+ }
+ };
+
+ sendMsg(new MsgAddClient(*this, client, callbacks));
+}
+
+void
+LocAdapterBase::removeClientCommand(LocationAPI* client,
+ removeClientCompleteCallback rmClientCb)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+
+ struct MsgRemoveClient : public LocMsg {
+ LocAdapterBase& mAdapter;
+ LocationAPI* mClient;
+ removeClientCompleteCallback mRmClientCb;
+ inline MsgRemoveClient(LocAdapterBase& adapter,
+ LocationAPI* client,
+ removeClientCompleteCallback rmCb) :
+ LocMsg(),
+ mAdapter(adapter),
+ mClient(client),
+ mRmClientCb(rmCb){}
+ inline virtual void proc() const {
+ mAdapter.stopClientSessions(mClient);
+ mAdapter.eraseClient(mClient);
+ if (nullptr != mRmClientCb) {
+ (mRmClientCb)(mClient);
+ }
+ }
+ };
+
+ sendMsg(new MsgRemoveClient(*this, client, rmClientCb));
+}
+
+void
+LocAdapterBase::requestCapabilitiesCommand(LocationAPI* client)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgRequestCapabilities : public LocMsg {
+ LocAdapterBase& mAdapter;
+ LocationAPI* mClient;
+ inline MsgRequestCapabilities(LocAdapterBase& adapter,
+ LocationAPI* client) :
+ LocMsg(),
+ mAdapter(adapter),
+ mClient(client) {}
+ inline virtual void proc() const {
+ if (!mAdapter.isEngineCapabilitiesKnown()) {
+ mAdapter.mPendingMsgs.push_back(new MsgRequestCapabilities(*this));
+ return;
+ }
+ LocationCallbacks callbacks = mAdapter.getClientCallbacks(mClient);
+ if (callbacks.capabilitiesCb != nullptr) {
+ callbacks.capabilitiesCb(mAdapter.getCapabilities());
+ }
+ }
+ };
+
+ sendMsg(new MsgRequestCapabilities(*this, client));
+}
+
+} // namespace loc_core
diff --git a/gps/core/LocAdapterBase.h b/gps/core/LocAdapterBase.h
new file mode 100644
index 0000000..4a5d1ab
--- /dev/null
+++ b/gps/core/LocAdapterBase.h
@@ -0,0 +1,243 @@
+/* Copyright (c) 2011-2014, 2016-2020 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_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <ContextBase.h>
+#include <LocationAPI.h>
+#include <map>
+
+#define MIN_TRACKING_INTERVAL (100) // 100 msec
+
+typedef struct LocationSessionKey {
+ LocationAPI* client;
+ uint32_t id;
+ inline LocationSessionKey(LocationAPI* _client, uint32_t _id) :
+ client(_client), id(_id) {}
+} LocationSessionKey;
+inline bool operator <(LocationSessionKey const& left, LocationSessionKey const& right) {
+ return left.id < right.id || (left.id == right.id && left.client < right.client);
+}
+inline bool operator ==(LocationSessionKey const& left, LocationSessionKey const& right) {
+ return left.id == right.id && left.client == right.client;
+}
+inline bool operator !=(LocationSessionKey const& left, LocationSessionKey const& right) {
+ return left.id != right.id || left.client != right.client;
+}
+
+typedef void (*removeClientCompleteCallback)(LocationAPI* client);
+
+namespace loc_core {
+
+class LocAdapterProxyBase;
+
+class LocAdapterBase {
+private:
+ static uint32_t mSessionIdCounter;
+ const bool mIsMaster;
+ bool mIsEngineCapabilitiesKnown = false;
+
+protected:
+ LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ LocAdapterProxyBase* mLocAdapterProxyBase;
+ const MsgTask* mMsgTask;
+ bool mAdapterAdded;
+
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mIsMaster(false), mEvtMask(0), mContext(NULL), mLocApi(NULL),
+ mLocAdapterProxyBase(NULL), mMsgTask(msgTask), mAdapterAdded(false) {}
+
+ /* ==== CLIENT ========================================================================= */
+ typedef std::map<LocationAPI*, LocationCallbacks> ClientDataMap;
+ ClientDataMap mClientData;
+ std::vector<LocMsg*> mPendingMsgs; // For temporal storage of msgs before Open is completed
+ /* ======== UTILITIES ================================================================== */
+ void saveClient(LocationAPI* client, const LocationCallbacks& callbacks);
+ void eraseClient(LocationAPI* client);
+ LocationCallbacks getClientCallbacks(LocationAPI* client);
+ LocationCapabilitiesMask getCapabilities();
+ void broadcastCapabilities(LocationCapabilitiesMask mask);
+ virtual void updateClientsEventMask();
+ virtual void stopClientSessions(LocationAPI* client);
+
+public:
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+ // When waitForDoneInit is not specified or specified as false,
+ // handleEngineUpEvent may be called on the child adapter object from
+ // a different thread before the constructor of the child
+ // object finishes.
+ //
+ // If the handleEngineUpEvent relies on member variables of the constructor
+ // of the child adapter to be initialized first, we need to specify the
+ // waitForDoneInit to *TRUE* to delay handleEngineUpEvent to get called
+ // until when the child adapter finishes its initialization and notify
+ // LocAdapterBase via doneInit method.
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, bool isMaster = false,
+ LocAdapterProxyBase *adapterProxyBase = NULL,
+ bool waitForDoneInit = false);
+
+ inline void doneInit() {
+ if (!mAdapterAdded) {
+ mLocApi->addAdapter(this);
+ mAdapterAdded = true;
+ }
+ }
+
+ inline LOC_API_ADAPTER_EVENT_MASK_T
+ checkMask(LOC_API_ADAPTER_EVENT_MASK_T mask) const {
+ return mEvtMask & mask;
+ }
+
+ inline LOC_API_ADAPTER_EVENT_MASK_T getEvtMask() const {
+ return mEvtMask;
+ }
+
+ inline void sendMsg(const LocMsg* msg) const {
+ mMsgTask->sendMsg(msg);
+ }
+
+ inline void sendMsg(const LocMsg* msg) {
+ mMsgTask->sendMsg(msg);
+ }
+
+ inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status status)
+ {
+ switch(status) {
+ case (LOC_REGISTRATION_MASK_ENABLED):
+ mEvtMask = mEvtMask | event;
+ break;
+ case (LOC_REGISTRATION_MASK_DISABLED):
+ mEvtMask = mEvtMask &~ event;
+ break;
+ case (LOC_REGISTRATION_MASK_SET):
+ mEvtMask = event;
+ break;
+ }
+ mLocApi->updateEvtMask();
+ }
+
+ inline void updateNmeaMask(uint32_t mask)
+ {
+ mLocApi->updateNmeaMask(mask);
+ }
+
+ inline bool isFeatureSupported(uint8_t featureVal) {
+ return ContextBase::isFeatureSupported(featureVal);
+ }
+
+ uint32_t generateSessionId();
+
+ inline bool isAdapterMaster() {
+ return mIsMaster;
+ }
+
+ inline bool isEngineCapabilitiesKnown() { return mIsEngineCapabilitiesKnown;}
+ inline void setEngineCapabilitiesKnown(bool value) { mIsEngineCapabilitiesKnown = value;}
+
+ virtual void handleEngineUpEvent();
+ virtual void handleEngineDownEvent();
+ virtual void reportPositionEvent(const UlpLocation& location,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask,
+ GnssDataNotification* pDataNotify = nullptr,
+ int msInWeek = -1);
+ virtual void reportEnginePositionsEvent(unsigned int count,
+ EngineLocationInfo* locationArr) {
+ (void)count;
+ (void)locationArr;
+ }
+ virtual void reportSvEvent(const GnssSvNotification& svNotify,
+ bool fromEngineHub=false);
+ virtual void reportDataEvent(const GnssDataNotification& dataNotify, int msInWeek);
+ virtual void reportNmeaEvent(const char* nmea, size_t length);
+ virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
+ virtual void reportSvEphemerisEvent(GnssSvEphemerisReport &svEphemeris);
+ virtual void reportStatus(LocGpsStatusValue status);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual void reportLocationSystemInfoEvent(const LocationSystemInfo& locationSystemInfo);
+
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, LocAGpsType agps_type,
+ LocApnTypeMask apn_type_mask);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data,
+ const LocInEmergency emergencyState);
+ inline virtual bool isInSession() { return false; }
+ ContextBase* getContext() const { return mContext; }
+ virtual void reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurements,
+ int msInWeek);
+ virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
+ virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc,
+ GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
+ virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
+ virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
+ virtual void reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig);
+ virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
+ virtual bool reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
+ virtual bool reportDeleteAidingDataEvent(GnssAidingData &aidingData);
+ virtual bool reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& ionoModel);
+ virtual bool reportGnssAdditionalSystemInfoEvent(
+ GnssAdditionalSystemInfo& additionalSystemInfo);
+ virtual void reportNfwNotificationEvent(GnssNfwNotification& notification);
+
+ virtual void geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location,
+ GeofenceBreachType breachType, uint64_t timestamp);
+ virtual void geofenceStatusEvent(GeofenceStatusAvailable available);
+
+ virtual void reportPositionEvent(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+
+ virtual void reportLocationsEvent(const Location* locations, size_t count,
+ BatchingMode batchingMode);
+ virtual void reportCompletedTripsEvent(uint32_t accumulated_distance);
+ virtual void reportBatchStatusChangeEvent(BatchingStatus batchStatus);
+
+ /* ==== CLIENT ========================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ void addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks);
+ void removeClientCommand(LocationAPI* client,
+ removeClientCompleteCallback rmClientCb);
+ void requestCapabilitiesCommand(LocationAPI* client);
+
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/gps/core/LocAdapterProxyBase.h b/gps/core/LocAdapterProxyBase.h
new file mode 100644
index 0000000..727d424
--- /dev/null
+++ b/gps/core/LocAdapterProxyBase.h
@@ -0,0 +1,77 @@
+/* Copyright (c) 2014, 2016-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_ADAPTER_PROXY_BASE_H
+#define LOC_ADAPTER_PROXY_BASE_H
+
+#include <ContextBase.h>
+#include <gps_extended.h>
+
+namespace loc_core {
+
+class LocAdapterProxyBase {
+private:
+ LocAdapterBase *mLocAdapterBase;
+protected:
+ inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, bool isMaster = false):
+ mLocAdapterBase(new LocAdapterBase(mask, context, isMaster, this)) {
+ }
+ inline virtual ~LocAdapterProxyBase() {
+ delete mLocAdapterBase;
+ }
+ inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled) {
+ mLocAdapterBase->updateEvtMask(event,isEnabled);
+ }
+
+ inline uint32_t generateSessionId() {
+ return mLocAdapterBase->generateSessionId();
+ }
+public:
+ inline ContextBase* getContext() const {
+ return mLocAdapterBase->getContext();
+ }
+
+ inline virtual void handleEngineUpEvent() {};
+ inline virtual void handleEngineDownEvent() {};
+ inline virtual void reportPositionEvent(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ (void)location;
+ (void)locationExtended;
+ (void)status;
+ (void)loc_technology_mask;
+ }
+};
+
+} // namespace loc_core
+
+#endif //LOC_ADAPTER_PROXY_BASE_H
diff --git a/gps/core/LocApiBase.cpp b/gps/core/LocApiBase.cpp
new file mode 100644
index 0000000..60bfdd2
--- /dev/null
+++ b/gps/core/LocApiBase.cpp
@@ -0,0 +1,895 @@
+/* Copyright (c) 2011-2014, 2016-2020 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.
+ *
+ */
+#define LOG_NDEBUG 0 //Define to enable LOGV
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <inttypes.h>
+#include <gps_extended_c.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <log_util.h>
+#include <LocContext.h>
+
+namespace loc_core {
+
+#define TO_ALL_LOCADAPTERS(call) TO_ALL_ADAPTERS(mLocAdapters, (call))
+#define TO_1ST_HANDLING_LOCADAPTERS(call) TO_1ST_HANDLING_ADAPTER(mLocAdapters, (call))
+
+int hexcode(char *hexstring, int string_size,
+ const char *data, int data_size)
+{
+ int i;
+ for (i = 0; i < data_size; i++)
+ {
+ char ch = data[i];
+ if (i*2 + 3 <= string_size)
+ {
+ snprintf(&hexstring[i*2], 3, "%02X", ch);
+ }
+ else {
+ break;
+ }
+ }
+ return i;
+}
+
+int decodeAddress(char *addr_string, int string_size,
+ const char *data, int data_size)
+{
+ const char addr_prefix = 0x91;
+ int i, idxOutput = 0;
+
+ if (!data || !addr_string) { return 0; }
+
+ if (data[0] != addr_prefix)
+ {
+ LOC_LOGW("decodeAddress: address prefix is not 0x%x but 0x%x", addr_prefix, data[0]);
+ addr_string[0] = '\0';
+ return 0; // prefix not correct
+ }
+
+ for (i = 1; i < data_size; i++)
+ {
+ unsigned char ch = data[i], low = ch & 0x0F, hi = ch >> 4;
+ if (low <= 9 && idxOutput < string_size - 1) { addr_string[idxOutput++] = low + '0'; }
+ if (hi <= 9 && idxOutput < string_size - 1) { addr_string[idxOutput++] = hi + '0'; }
+ }
+
+ addr_string[idxOutput] = '\0'; // Terminates the string
+
+ return idxOutput;
+}
+
+struct LocSsrMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ inline LocSsrMsg(LocApiBase* locApi) :
+ LocMsg(), mLocApi(locApi)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->close();
+ if (LOC_API_ADAPTER_ERR_SUCCESS == mLocApi->open(mLocApi->getEvtMask())) {
+ // Notify adapters that engine up after SSR
+ mLocApi->handleEngineUpEvent();
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocOpenMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ LocAdapterBase* mAdapter;
+ inline LocOpenMsg(LocApiBase* locApi, LocAdapterBase* adapter = nullptr) :
+ LocMsg(), mLocApi(locApi), mAdapter(adapter)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (LOC_API_ADAPTER_ERR_SUCCESS == mLocApi->open(mLocApi->getEvtMask()) &&
+ nullptr != mAdapter) {
+ mAdapter->handleEngineUpEvent();
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGv("LocOpen Mask: %" PRIx64 "\n", mLocApi->getEvtMask());
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocCloseMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ inline LocCloseMsg(LocApiBase* locApi) :
+ LocMsg(), mLocApi(locApi)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->close();
+ }
+ inline void locallog() const {
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+MsgTask* LocApiBase::mMsgTask = nullptr;
+volatile int32_t LocApiBase::mMsgTaskRefCount = 0;
+
+LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mContext(context),
+ mMask(0), mExcludedMask(excludedMask)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+
+ android_atomic_inc(&mMsgTaskRefCount);
+ if (nullptr == mMsgTask) {
+ mMsgTask = new MsgTask("LocApiMsgTask", false);
+ }
+}
+
+LOC_API_ADAPTER_EVENT_MASK_T LocApiBase::getEvtMask()
+{
+ LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
+
+ TO_ALL_LOCADAPTERS(mask |= mLocAdapters[i]->getEvtMask());
+
+ return mask & ~mExcludedMask;
+}
+
+bool LocApiBase::isMaster()
+{
+ bool isMaster = false;
+
+ for (int i = 0;
+ !isMaster && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ isMaster |= mLocAdapters[i]->isAdapterMaster();
+ }
+ return isMaster;
+}
+
+bool LocApiBase::isInSession()
+{
+ bool inSession = false;
+
+ for (int i = 0;
+ !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ inSession = mLocAdapters[i]->isInSession();
+ }
+
+ return inSession;
+}
+
+bool LocApiBase::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 accept 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 LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ sendMsg(new LocOpenMsg(this, adapter));
+ break;
+ }
+ }
+}
+
+void LocApiBase::removeAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0;
+ i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ if (mLocAdapters[i] == adapter) {
+ mLocAdapters[i] = NULL;
+
+ // shift the rest of the adapters up so that the pointers
+ // in the array do not have holes. This should be more
+ // performant, because the array maintenance is much much
+ // less frequent than event handlings, which need to linear
+ // search all the adapters
+ int j = i;
+ while (++i < MAX_ADAPTERS && mLocAdapters[i] != NULL);
+
+ // i would be MAX_ADAPTERS or point to a NULL
+ i--;
+ // i now should point to a none NULL adapter within valid
+ // range although i could be equal to j, but it won't hurt.
+ // No need to check it, as it gains nothing.
+ mLocAdapters[j] = mLocAdapters[i];
+ // this makes sure that we exit the for loop
+ mLocAdapters[i] = NULL;
+
+ // if we have an empty list of adapters
+ if (0 == i) {
+ sendMsg(new LocCloseMsg(this));
+ } else {
+ // else we need to remove the bit
+ sendMsg(new LocOpenMsg(this));
+ }
+ }
+ }
+}
+
+void LocApiBase::updateEvtMask()
+{
+ sendMsg(new LocOpenMsg(this));
+}
+
+void LocApiBase::updateNmeaMask(uint32_t mask)
+{
+ struct LocSetNmeaMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ uint32_t mMask;
+ inline LocSetNmeaMsg(LocApiBase* locApi, uint32_t mask) :
+ LocMsg(), mLocApi(locApi), mMask(mask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->setNMEATypesSync(mMask);
+ }
+ inline void locallog() const {
+ LOC_LOGv("LocSyncNmea NmeaMask: %" PRIx32 "\n", mMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+ };
+
+ sendMsg(new LocSetNmeaMsg(this, mask));
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{ // This will take care of renegotiating the loc handle
+ sendMsg(new LocSsrMsg(this));
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
+}
+
+void LocApiBase::reportPosition(UlpLocation& location,
+ GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask,
+ GnssDataNotification* pDataNotify,
+ int msInWeek)
+{
+ // print the location info before delivering
+ LOC_LOGD("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n "
+ "altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n "
+ "timestamp: %" PRId64 "\n"
+ "Session status: %d\n Technology mask: %u\n "
+ "SV used in fix (gps/glo/bds/gal/qzss) : \
+ (0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 ")",
+ location.gpsLocation.flags, location.position_source,
+ location.gpsLocation.latitude, location.gpsLocation.longitude,
+ location.gpsLocation.altitude, location.gpsLocation.speed,
+ location.gpsLocation.bearing, location.gpsLocation.accuracy,
+ location.gpsLocation.timestamp, status, loc_technology_mask,
+ locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask,
+ locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask,
+ locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask,
+ locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask,
+ locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask);
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportPositionEvent(location, locationExtended,
+ status, loc_technology_mask,
+ pDataNotify, msInWeek)
+ );
+}
+
+void LocApiBase::reportWwanZppFix(LocGpsLocation &zppLoc)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
+}
+
+void LocApiBase::reportZppBestAvailableFix(LocGpsLocation &zppLoc,
+ GpsLocationExtended &location_extended, LocPosTechMask tech_mask)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportZppBestAvailableFix(zppLoc,
+ location_extended, tech_mask));
+}
+
+void LocApiBase::requestOdcpi(OdcpiRequestInfo& request)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestOdcpiEvent(request));
+}
+
+void LocApiBase::reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssEngEnergyConsumedEvent(
+ energyConsumedSinceFirstBoot));
+}
+
+void LocApiBase::reportDeleteAidingDataEvent(GnssAidingData& aidingData) {
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDeleteAidingDataEvent(aidingData));
+}
+
+void LocApiBase::reportKlobucharIonoModel(GnssKlobucharIonoModel & ionoModel) {
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportKlobucharIonoModelEvent(ionoModel));
+}
+
+void LocApiBase::reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo) {
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportGnssAdditionalSystemInfoEvent(
+ additionalSystemInfo));
+}
+
+void LocApiBase::sendNfwNotification(GnssNfwNotification& notification)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNfwNotificationEvent(notification));
+
+}
+
+void LocApiBase::reportSv(GnssSvNotification& svNotify)
+{
+ const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
+ "QZSS", "BEIDOU", "GALILEO", "NAVIC" };
+
+ // print the SV info before delivering
+ LOC_LOGV("num sv: %u\n"
+ " sv: constellation svid cN0"
+ " elevation azimuth flags",
+ svNotify.count);
+ for (size_t i = 0; i < svNotify.count && i < LOC_GNSS_MAX_SVS; i++) {
+ if (svNotify.gnssSvs[i].type >
+ sizeof(constellationString) / sizeof(constellationString[0]) - 1) {
+ svNotify.gnssSvs[i].type = GNSS_SV_TYPE_UNKNOWN;
+ }
+ // Display what we report to clients
+ LOC_LOGV(" %03zu: %*s %02d %f %f %f %f 0x%02X 0x%2X",
+ i,
+ 13,
+ constellationString[svNotify.gnssSvs[i].type],
+ svNotify.gnssSvs[i].svId,
+ svNotify.gnssSvs[i].cN0Dbhz,
+ svNotify.gnssSvs[i].elevation,
+ svNotify.gnssSvs[i].azimuth,
+ svNotify.gnssSvs[i].carrierFrequencyHz,
+ svNotify.gnssSvs[i].gnssSvOptionsMask,
+ svNotify.gnssSvs[i].gnssSignalTypeMask);
+ }
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvEvent(svNotify)
+ );
+}
+
+void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvPolynomialEvent(svPolynomial)
+ );
+}
+
+void LocApiBase::reportSvEphemeris(GnssSvEphemerisReport & svEphemeris)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvEphemerisEvent(svEphemeris)
+ );
+}
+
+void LocApiBase::reportStatus(LocGpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+void LocApiBase::reportData(GnssDataNotification& dataNotify, int msInWeek)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportDataEvent(dataNotify, msInWeek));
+}
+
+void LocApiBase::reportNmea(const char* nmea, int length)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmeaEvent(nmea, length));
+}
+
+void LocApiBase::reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportXtraServer(url1, url2, url3, maxlength));
+
+}
+
+void LocApiBase::reportLocationSystemInfo(const LocationSystemInfo& locationSystemInfo)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLocationSystemInfoEvent(locationSystemInfo));
+}
+
+void LocApiBase::requestXtraData()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestXtraData());
+}
+
+void LocApiBase::requestTime()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestTime());
+}
+
+void LocApiBase::requestLocation()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestLocation());
+}
+
+void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type,
+ LocApnTypeMask apn_type_mask)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(
+ mLocAdapters[i]->requestATL(connHandle, agps_type, apn_type_mask));
+}
+
+void LocApiBase::releaseATL(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(connHandle));
+}
+
+void LocApiBase::requestNiNotify(GnssNiNotification ¬ify, const void* data,
+ const LocInEmergency emergencyState)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(
+ mLocAdapters[i]->requestNiNotifyEvent(notify,
+ data,
+ emergencyState));
+}
+
+void* LocApiBase :: getSibling()
+ DEFAULT_IMPL(NULL)
+
+LocApiProxyBase* LocApiBase :: getLocApiProxy()
+ DEFAULT_IMPL(NULL)
+
+void LocApiBase::reportGnssMeasurements(GnssMeasurements& gnssMeasurements, int msInWeek)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementsEvent(gnssMeasurements, msInWeek));
+}
+
+void LocApiBase::reportGnssSvIdConfig(const GnssSvIdConfig& config)
+{
+ // Print the config
+ LOC_LOGv("gloBlacklistSvMask: %" PRIu64 ", bdsBlacklistSvMask: %" PRIu64 ",\n"
+ "qzssBlacklistSvMask: %" PRIu64 ", galBlacklistSvMask: %" PRIu64,
+ config.gloBlacklistSvMask, config.bdsBlacklistSvMask,
+ config.qzssBlacklistSvMask, config.galBlacklistSvMask);
+
+ // Loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssSvIdConfigEvent(config));
+}
+
+void LocApiBase::reportGnssSvTypeConfig(const GnssSvTypeConfig& config)
+{
+ // Print the config
+ LOC_LOGv("blacklistedMask: %" PRIu64 ", enabledMask: %" PRIu64,
+ config.blacklistedSvTypesMask, config.enabledSvTypesMask);
+
+ // Loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssSvTypeConfigEvent(config));
+}
+
+void LocApiBase::geofenceBreach(size_t count, uint32_t* hwIds, Location& location,
+ GeofenceBreachType breachType, uint64_t timestamp)
+{
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->geofenceBreachEvent(count, hwIds, location, breachType,
+ timestamp));
+}
+
+void LocApiBase::geofenceStatus(GeofenceStatusAvailable available)
+{
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->geofenceStatusEvent(available));
+}
+
+void LocApiBase::reportDBTPosition(UlpLocation &location, GpsLocationExtended &locationExtended,
+ enum loc_sess_status status, LocPosTechMask loc_technology_mask)
+{
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportPositionEvent(location, locationExtended, status,
+ loc_technology_mask));
+}
+
+void LocApiBase::reportLocations(Location* locations, size_t count, BatchingMode batchingMode)
+{
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLocationsEvent(locations, count, batchingMode));
+}
+
+void LocApiBase::reportCompletedTrips(uint32_t accumulated_distance)
+{
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportCompletedTripsEvent(accumulated_distance));
+}
+
+void LocApiBase::handleBatchStatusEvent(BatchingStatus batchStatus)
+{
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportBatchStatusChangeEvent(batchStatus));
+}
+
+void LocApiBase::reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssConfigEvent(sessionId, gnssConfig));
+}
+
+enum loc_api_adapter_err LocApiBase::
+ open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ close()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+void LocApiBase::startFix(const LocPosMode& /*posMode*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::stopFix(LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ deleteAidingData(const GnssAidingData& /*data*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ injectPosition(const Location& /*location*/, bool /*onDemandCpi*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ injectPosition(const GnssLocationInfoNotification & /*locationInfo*/, bool /*onDemandCpi*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
+DEFAULT_IMPL()
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* /*data*/, int /*length*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+void LocApiBase::
+ atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/, uint32_t /*apnLen*/,
+ AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/,
+ LocApnTypeMask /*mask*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ atlCloseStatus(int /*handle*/, int /*is_succ*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::
+ setServerSync(const char* /*url*/, int /*len*/, LocServerType /*type*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setServerSync(unsigned int /*ip*/, int /*port*/, LocServerType /*type*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::
+ informNiResponse(GnssNiResponse /*userResponse*/, const void* /*passThroughData*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::
+ setSUPLVersionSync(GnssConfigSuplVersion /*version*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setNMEATypesSync (uint32_t /*typesMask*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPConfigSync(GnssConfigLppProfile /*profile*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorPropertiesSync(bool /*gyroBiasVarianceRandomWalk_valid*/,
+ float /*gyroBiasVarianceRandomWalk*/,
+ bool /*accelBiasVarianceRandomWalk_valid*/,
+ float /*accelBiasVarianceRandomWalk*/,
+ bool /*angleBiasVarianceRandomWalk_valid*/,
+ float /*angleBiasVarianceRandomWalk*/,
+ bool /*rateBiasVarianceRandomWalk_valid*/,
+ float /*rateBiasVarianceRandomWalk*/,
+ bool /*velocityBiasVarianceRandomWalk_valid*/,
+ float /*velocityBiasVarianceRandomWalk*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorPerfControlConfigSync(int /*controlMode*/,
+ int /*accelSamplesPerBatch*/,
+ int /*accelBatchesPerSec*/,
+ int /*gyroSamplesPerBatch*/,
+ int /*gyroBatchesPerSec*/,
+ int /*accelSamplesPerBatchHigh*/,
+ int /*accelBatchesPerSecHigh*/,
+ int /*gyroSamplesPerBatchHigh*/,
+ int /*gyroBatchesPerSecHigh*/,
+ int /*algorithmConfig*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask /*aGlonassProtocol*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask /*lppeCP*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask /*lppeUP*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+GnssConfigSuplVersion LocApiBase::convertSuplVersion(const uint32_t /*suplVersion*/)
+DEFAULT_IMPL(GNSS_CONFIG_SUPL_VERSION_1_0_0)
+
+GnssConfigLppProfile LocApiBase::convertLppProfile(const uint32_t /*lppProfile*/)
+DEFAULT_IMPL(GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE)
+
+GnssConfigLppeControlPlaneMask LocApiBase::convertLppeCp(const uint32_t /*lppeControlPlaneMask*/)
+DEFAULT_IMPL(0)
+
+GnssConfigLppeUserPlaneMask LocApiBase::convertLppeUp(const uint32_t /*lppeUserPlaneMask*/)
+DEFAULT_IMPL(0)
+
+LocationError LocApiBase::setEmergencyExtensionWindowSync(
+ const uint32_t /*emergencyExtensionSeconds*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::
+ getWwanZppFix()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ getBestAvailableZppFix()
+DEFAULT_IMPL()
+
+LocationError LocApiBase::
+ setGpsLockSync(GnssConfigGpsLock /*lock*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::
+ requestForAidingData(GnssAidingDataSvMask /*svDataMask*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ installAGpsCert(const LocDerEncodedCertificate* /*pData*/,
+ size_t /*length*/,
+ uint32_t /*slotBitMask*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::
+ setXtraVersionCheckSync(uint32_t /*check*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::setBlacklistSvSync(const GnssSvIdConfig& /*config*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::setBlacklistSv(const GnssSvIdConfig& /*config*/)
+DEFAULT_IMPL()
+
+void LocApiBase::getBlacklistSv()
+DEFAULT_IMPL()
+
+void LocApiBase::setConstellationControl(const GnssSvTypeConfig& /*config*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::getConstellationControl()
+DEFAULT_IMPL()
+
+void LocApiBase::resetConstellationControl(LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ setConstrainedTuncMode(bool /*enabled*/,
+ float /*tuncConstraint*/,
+ uint32_t /*energyBudget*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ setPositionAssistedClockEstimatorMode(bool /*enabled*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::getGnssEnergyConsumed()
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+
+void LocApiBase::addGeofence(uint32_t /*clientId*/, const GeofenceOption& /*options*/,
+ const GeofenceInfo& /*info*/,
+ LocApiResponseData<LocApiGeofenceData>* /*adapterResponseData*/)
+DEFAULT_IMPL()
+
+void LocApiBase::removeGeofence(uint32_t /*hwId*/, uint32_t /*clientId*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::pauseGeofence(uint32_t /*hwId*/, uint32_t /*clientId*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::resumeGeofence(uint32_t /*hwId*/, uint32_t /*clientId*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::modifyGeofence(uint32_t /*hwId*/, uint32_t /*clientId*/,
+ const GeofenceOption& /*options*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::startTimeBasedTracking(const TrackingOptions& /*options*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::stopTimeBasedTracking(LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::startDistanceBasedTracking(uint32_t /*sessionId*/,
+ const LocationOptions& /*options*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::stopDistanceBasedTracking(uint32_t /*sessionId*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::startBatching(uint32_t /*sessionId*/, const LocationOptions& /*options*/,
+ uint32_t /*accuracy*/, uint32_t /*timeout*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::stopBatching(uint32_t /*sessionId*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::startOutdoorTripBatchingSync(uint32_t /*tripDistance*/,
+ uint32_t /*tripTbf*/, uint32_t /*timeout*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::startOutdoorTripBatching(uint32_t /*tripDistance*/, uint32_t /*tripTbf*/,
+ uint32_t /*timeout*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::reStartOutdoorTripBatching(uint32_t /*ongoingTripDistance*/,
+ uint32_t /*ongoingTripInterval*/, uint32_t /*batchingTimeout,*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::stopOutdoorTripBatchingSync(bool /*deallocBatchBuffer*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::stopOutdoorTripBatching(bool /*deallocBatchBuffer*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::getBatchedLocationsSync(size_t /*count*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::getBatchedLocations(size_t /*count*/, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::getBatchedTripLocationsSync(size_t /*count*/,
+ uint32_t /*accumulatedDistance*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::getBatchedTripLocations(size_t /*count*/, uint32_t /*accumulatedDistance*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+LocationError LocApiBase::queryAccumulatedTripDistanceSync(uint32_t& /*accumulated_trip_distance*/,
+ uint32_t& /*numOfBatchedPositions*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::queryAccumulatedTripDistance(
+ LocApiResponseData<LocApiBatchData>* /*adapterResponseData*/)
+DEFAULT_IMPL()
+
+void LocApiBase::setBatchSize(size_t /*size*/)
+DEFAULT_IMPL()
+
+void LocApiBase::setTripBatchSize(size_t /*size*/)
+DEFAULT_IMPL()
+
+void LocApiBase::addToCallQueue(LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::updateSystemPowerState(PowerStateType /*powerState*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ configRobustLocation(bool /*enabled*/,
+ bool /*enableForE911*/,
+ LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+void LocApiBase::
+ getRobustLocationConfig(uint32_t sessionId, LocApiResponse* /*adapterResponse*/)
+DEFAULT_IMPL()
+
+} // namespace loc_core
diff --git a/gps/core/LocApiBase.h b/gps/core/LocApiBase.h
new file mode 100644
index 0000000..1e8337c
--- /dev/null
+++ b/gps/core/LocApiBase.h
@@ -0,0 +1,332 @@
+/* Copyright (c) 2011-2014, 2016-2020 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_API_BASE_H
+#define LOC_API_BASE_H
+
+#include <stddef.h>
+#include <ctype.h>
+#include <gps_extended.h>
+#include <LocationAPI.h>
+#include <MsgTask.h>
+#include <LocSharedLock.h>
+#include <log_util.h>
+
+namespace loc_core {
+
+class ContextBase;
+struct LocApiResponse;
+template <typename> struct LocApiResponseData;
+
+int hexcode(char *hexstring, int string_size,
+ const char *data, int data_size);
+int decodeAddress(char *addr_string, int string_size,
+ const char *data, int data_size);
+
+#define MAX_ADAPTERS 10
+#define MAX_FEATURE_LENGTH 100
+
+#define TO_ALL_ADAPTERS(adapters, call) \
+ for (int i = 0; i < MAX_ADAPTERS && NULL != (adapters)[i]; i++) { \
+ call; \
+ }
+
+#define TO_1ST_HANDLING_ADAPTER(adapters, call) \
+ for (int i = 0; i <MAX_ADAPTERS && NULL != (adapters)[i] && !(call); i++);
+
+enum xtra_version_check {
+ DISABLED,
+ AUTO,
+ XTRA2,
+ XTRA3
+};
+
+class LocAdapterBase;
+struct LocSsrMsg;
+struct LocOpenMsg;
+
+typedef struct
+{
+ uint32_t accumulatedDistance;
+ uint32_t numOfBatchedPositions;
+} LocApiBatchData;
+
+typedef struct
+{
+ uint32_t hwId;
+} LocApiGeofenceData;
+
+struct LocApiMsg: LocMsg {
+ private:
+ std::function<void ()> mProcImpl;
+ inline virtual void proc() const {
+ mProcImpl();
+ }
+ public:
+ inline LocApiMsg(std::function<void ()> procImpl ) :
+ mProcImpl(procImpl) {}
+};
+
+class LocApiProxyBase {
+public:
+ inline LocApiProxyBase() {}
+ inline virtual ~LocApiProxyBase() {}
+ inline virtual void* getSibling2() { return NULL; }
+};
+
+class LocApiBase {
+ friend struct LocSsrMsg;
+ //LocOpenMsg calls open() which makes it necessary to declare
+ //it as a friend
+ friend struct LocOpenMsg;
+ friend struct LocCloseMsg;
+ friend struct LocKillMsg;
+ friend class ContextBase;
+ static MsgTask* mMsgTask;
+ static volatile int32_t mMsgTaskRefCount;
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+
+protected:
+ ContextBase *mContext;
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+ LOC_API_ADAPTER_EVENT_MASK_T getEvtMask();
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ uint32_t mNmeaMask;
+ LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
+ inline virtual ~LocApiBase() {
+ android_atomic_dec(&mMsgTaskRefCount);
+ if (nullptr != mMsgTask && 0 == mMsgTaskRefCount) {
+ mMsgTask->destroy();
+ mMsgTask = nullptr;
+ }
+ }
+ bool isInSession();
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+ bool isMaster();
+
+public:
+ inline void sendMsg(const LocMsg* msg) const {
+ if (nullptr != mMsgTask) {
+ mMsgTask->sendMsg(msg);
+ }
+ }
+ inline void destroy() {
+ close();
+ struct LocKillMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ inline LocKillMsg(LocApiBase* locApi) : LocMsg(), mLocApi(locApi) {}
+ inline virtual void proc() const {
+ delete mLocApi;
+ }
+ };
+ sendMsg(new LocKillMsg(this));
+ }
+
+ static bool needReport(const UlpLocation& ulpLocation,
+ enum loc_sess_status status,
+ LocPosTechMask techMask);
+
+ void addAdapter(LocAdapterBase* adapter);
+ void removeAdapter(LocAdapterBase* adapter);
+
+ // upward calls
+ void handleEngineUpEvent();
+ void handleEngineDownEvent();
+ void reportPosition(UlpLocation& location,
+ GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask =
+ LOC_POS_TECH_MASK_DEFAULT,
+ GnssDataNotification* pDataNotify = nullptr,
+ int msInWeek = -1);
+ void reportSv(GnssSvNotification& svNotify);
+ void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
+ void reportSvEphemeris(GnssSvEphemerisReport &svEphemeris);
+ void reportStatus(LocGpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportData(GnssDataNotification& dataNotify, int msInWeek);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void reportLocationSystemInfo(const LocationSystemInfo& locationSystemInfo);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask apn_type_mask);
+ void releaseATL(int connHandle);
+ void requestNiNotify(GnssNiNotification ¬ify, const void* data,
+ const LocInEmergency emergencyState);
+ void reportGnssMeasurements(GnssMeasurements& gnssMeasurements, int msInWeek);
+ void reportWwanZppFix(LocGpsLocation &zppLoc);
+ void reportZppBestAvailableFix(LocGpsLocation &zppLoc, GpsLocationExtended &location_extended,
+ LocPosTechMask tech_mask);
+ void reportGnssSvIdConfig(const GnssSvIdConfig& config);
+ void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);
+ void requestOdcpi(OdcpiRequestInfo& request);
+ void reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
+ void reportDeleteAidingDataEvent(GnssAidingData& aidingData);
+ void reportKlobucharIonoModel(GnssKlobucharIonoModel& ionoModel);
+ void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo);
+ void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
+ void sendNfwNotification(GnssNfwNotification& notification);
+
+ void geofenceBreach(size_t count, uint32_t* hwIds, Location& location,
+ GeofenceBreachType breachType, uint64_t timestamp);
+ void geofenceStatus(GeofenceStatusAvailable available);
+ void reportDBTPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ void reportLocations(Location* locations, size_t count, BatchingMode batchingMode);
+ void reportCompletedTrips(uint32_t accumulated_distance);
+ void handleBatchStatusEvent(BatchingStatus batchStatus);
+
+ // downward calls
+ virtual void* getSibling();
+ virtual LocApiProxyBase* getLocApiProxy();
+ virtual void startFix(const LocPosMode& fixCriteria, LocApiResponse* adapterResponse);
+ virtual void stopFix(LocApiResponse* adapterResponse);
+ virtual void deleteAidingData(const GnssAidingData& data, LocApiResponse* adapterResponse);
+ virtual void injectPosition(double latitude, double longitude, float accuracy);
+ virtual void injectPosition(const GnssLocationInfoNotification &locationInfo,
+ bool onDemandCpi=false);
+ virtual void injectPosition(const Location& location, bool onDemandCpi);
+ virtual void setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err setXtraData(char* data, int length);
+ virtual void atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen,
+ AGpsBearerType bear, LocAGpsType agpsType, LocApnTypeMask mask);
+ virtual void atlCloseStatus(int handle, int is_succ);
+ virtual LocationError setServerSync(const char* url, int len, LocServerType type);
+ virtual LocationError setServerSync(unsigned int ip, int port, LocServerType type);
+ virtual void informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
+ virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
+ virtual enum loc_api_adapter_err setNMEATypesSync(uint32_t typesMask);
+ virtual LocationError setLPPConfigSync(GnssConfigLppProfile profile);
+ virtual enum loc_api_adapter_err setSensorPropertiesSync(
+ bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
+ bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
+ bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
+ bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
+ bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk);
+ virtual enum loc_api_adapter_err setSensorPerfControlConfigSync(int controlMode,
+ int accelSamplesPerBatch, int accelBatchesPerSec, int gyroSamplesPerBatch,
+ int gyroBatchesPerSec, int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
+ virtual LocationError
+ setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
+ virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
+ virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
+ virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
+ virtual GnssConfigLppProfile convertLppProfile(const uint32_t lppProfile);
+ virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
+ virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
+ virtual LocationError setEmergencyExtensionWindowSync(const uint32_t emergencyExtensionSeconds);
+
+ virtual void getWwanZppFix();
+ virtual void getBestAvailableZppFix();
+ virtual void installAGpsCert(const LocDerEncodedCertificate* pData, size_t length,
+ uint32_t slotBitMask);
+ virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
+ virtual void requestForAidingData(GnssAidingDataSvMask svDataMask);
+ virtual LocationError setXtraVersionCheckSync(uint32_t check);
+ /* Requests for SV/Constellation Control */
+ virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
+ virtual void setBlacklistSv(const GnssSvIdConfig& config);
+ virtual void getBlacklistSv();
+ virtual void setConstellationControl(const GnssSvTypeConfig& config,
+ LocApiResponse *adapterResponse=nullptr);
+ virtual void getConstellationControl();
+ virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
+
+ virtual void setConstrainedTuncMode(bool enabled,
+ float tuncConstraint,
+ uint32_t energyBudget,
+ LocApiResponse* adapterResponse=nullptr);
+ virtual void setPositionAssistedClockEstimatorMode(bool enabled,
+ LocApiResponse* adapterResponse=nullptr);
+ virtual LocationError getGnssEnergyConsumed();
+
+ virtual void addGeofence(uint32_t clientId, const GeofenceOption& options,
+ const GeofenceInfo& info, LocApiResponseData<LocApiGeofenceData>* adapterResponseData);
+ virtual void removeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
+ virtual void pauseGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
+ virtual void resumeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
+ virtual void modifyGeofence(uint32_t hwId, uint32_t clientId, const GeofenceOption& options,
+ LocApiResponse* adapterResponse);
+
+ virtual void startTimeBasedTracking(const TrackingOptions& options,
+ LocApiResponse* adapterResponse);
+ virtual void stopTimeBasedTracking(LocApiResponse* adapterResponse);
+ virtual void startDistanceBasedTracking(uint32_t sessionId, const LocationOptions& options,
+ LocApiResponse* adapterResponse);
+ virtual void stopDistanceBasedTracking(uint32_t sessionId,
+ LocApiResponse* adapterResponse = nullptr);
+ virtual void startBatching(uint32_t sessionId, const LocationOptions& options,
+ uint32_t accuracy, uint32_t timeout, LocApiResponse* adapterResponse);
+ virtual void stopBatching(uint32_t sessionId, LocApiResponse* adapterResponse);
+ virtual LocationError startOutdoorTripBatchingSync(uint32_t tripDistance,
+ uint32_t tripTbf, uint32_t timeout);
+ virtual void startOutdoorTripBatching(uint32_t tripDistance,
+ uint32_t tripTbf, uint32_t timeout, LocApiResponse* adapterResponse);
+ virtual void reStartOutdoorTripBatching(uint32_t ongoingTripDistance,
+ uint32_t ongoingTripInterval, uint32_t batchingTimeout,
+ LocApiResponse* adapterResponse);
+ virtual LocationError stopOutdoorTripBatchingSync(bool deallocBatchBuffer = true);
+ virtual void stopOutdoorTripBatching(bool deallocBatchBuffer = true,
+ LocApiResponse* adapterResponse = nullptr);
+ virtual LocationError getBatchedLocationsSync(size_t count);
+ virtual void getBatchedLocations(size_t count, LocApiResponse* adapterResponse);
+ virtual LocationError getBatchedTripLocationsSync(size_t count, uint32_t accumulatedDistance);
+ virtual void getBatchedTripLocations(size_t count, uint32_t accumulatedDistance,
+ LocApiResponse* adapterResponse);
+ virtual LocationError queryAccumulatedTripDistanceSync(uint32_t &accumulated_trip_distance,
+ uint32_t &numOfBatchedPositions);
+ virtual void queryAccumulatedTripDistance(
+ LocApiResponseData<LocApiBatchData>* adapterResponseData);
+ virtual void setBatchSize(size_t size);
+ virtual void setTripBatchSize(size_t size);
+ virtual void addToCallQueue(LocApiResponse* adapterResponse);
+
+ void updateEvtMask();
+ void updateNmeaMask(uint32_t mask);
+
+ virtual void updateSystemPowerState(PowerStateType systemPowerState);
+ virtual void configRobustLocation(bool enable, bool enableForE911,
+ LocApiResponse* adapterResponse=nullptr);
+ virtual void getRobustLocationConfig(uint32_t sessionId, LocApiResponse* adapterResponse);
+};
+
+typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/gps/core/LocContext.cpp b/gps/core/LocContext.cpp
new file mode 100644
index 0000000..18d3f2d
--- /dev/null
+++ b/gps/core/LocContext.cpp
@@ -0,0 +1,98 @@
+/* Copyright (c) 2011-2014, 2016-2019 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_Ctx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocContext.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+const MsgTask* LocContext::mMsgTask = NULL;
+ContextBase* LocContext::mContext = NULL;
+// the name must be shorter than 15 chars
+const char* LocContext::mLocationHalName = "Loc_hal_worker";
+#ifndef USE_GLIB
+const char* LocContext::mLBSLibName = "liblbs_core.so";
+#else
+const char* LocContext::mLBSLibName = "liblbs_core.so.1";
+#endif
+
+pthread_mutex_t LocContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
+
+const MsgTask* LocContext::getMsgTask(LocThread::tCreate tCreator,
+ const char* name, bool joinable)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name, joinable);
+ }
+ return mMsgTask;
+}
+
+inline
+const MsgTask* LocContext::getMsgTask(const char* name, bool joinable) {
+ return getMsgTask((LocThread::tCreate)NULL, name, joinable);
+}
+
+ContextBase* LocContext::getLocContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mContext = new LocContext(msgTask);
+ }
+ pthread_mutex_unlock(&LocContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mContext->sendMsg(firstMsg);
+ }
+
+ return mContext;
+}
+
+void LocContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
+ __func__, __LINE__, ((LocContext *)curContext)->mLBSProxy);
+ ((LocContext *)curContext)->mLBSProxy->injectFeatureConfig(curContext);
+}
+
+LocContext::LocContext(const MsgTask* msgTask) :
+ ContextBase(msgTask, 0, mLBSLibName)
+{
+}
+
+}
diff --git a/gps/core/LocContext.h b/gps/core/LocContext.h
new file mode 100644
index 0000000..fb7d009
--- /dev/null
+++ b/gps/core/LocContext.h
@@ -0,0 +1,66 @@
+/* Copyright (c) 2011-2014, 2017-2019 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_CONTEXT__
+#define __LOC_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mContext;
+ static const MsgTask* getMsgTask(LocThread::tCreate tCreator,
+ const char* name, bool joinable = true);
+ static const MsgTask* getMsgTask(const char* name, bool joinable = true);
+ static pthread_mutex_t mGetLocContextMutex;
+
+protected:
+ LocContext(const MsgTask* msgTask);
+ inline virtual ~LocContext() {}
+
+public:
+ static const char* mLBSLibName;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocContext(const char* name, bool joinable = true) {
+ return getLocContext(NULL, NULL, name, joinable);
+ }
+
+ static void injectFeatureConfig(ContextBase *context);
+};
+
+}
+
+#endif //__LOC_CONTEXT__
diff --git a/gps/core/Makefile.am b/gps/core/Makefile.am
new file mode 100644
index 0000000..291dbb5
--- /dev/null
+++ b/gps/core/Makefile.am
@@ -0,0 +1,74 @@
+ACLOCAL_AMFLAGS = -I m4
+
+AM_CFLAGS = -I./ \
+ $(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 \
+ -std=c++11
+
+libloc_core_la_h_sources = \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocContext.h \
+ LBSProxyBase.h \
+ loc_core_log.h \
+ LocAdapterProxyBase.h \
+ EngineHubProxyBase.h \
+ data-items/DataItemId.h \
+ data-items/IDataItemCore.h \
+ data-items/DataItemConcreteTypesBase.h \
+ observer/IDataItemObserver.h \
+ observer/IDataItemSubscription.h \
+ observer/IFrameworkActionReq.h \
+ observer/IOsObserver.h \
+ SystemStatusOsObserver.h \
+ SystemStatus.h
+
+libloc_core_la_c_sources = \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocContext.cpp \
+ loc_core_log.cpp \
+ data-items/DataItemsFactoryProxy.cpp \
+ SystemStatusOsObserver.cpp \
+ SystemStatus.cpp
+
+if USE_EXTERNAL_AP
+AM_CFLAGS += -DFEATURE_EXTERNAL_AP
+endif
+
+library_includedir = $(pkgincludedir)
+
+library_include_HEADERS = $(libloc_core_la_h_sources)
+
+libloc_core_la_SOURCES = $(libloc_core_la_c_sources)
+
+if USE_GLIB
+libloc_core_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_core_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_core_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_core_la_CFLAGS = $(AM_CFLAGS)
+libloc_core_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libloc_core_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+if USE_FEATURE_AUTOMOTIVE
+AM_CFLAGS += -DFEATURE_AUTOMOTIVE
+endif
+
+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
new file mode 100644
index 0000000..393eead
--- /dev/null
+++ b/gps/core/SystemStatus.cpp
@@ -0,0 +1,1751 @@
+/* Copyright (c) 2017, 2019, 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.
+ *
+ */
+#define LOG_TAG "LocSvc_SystemStatus"
+
+#include <inttypes.h>
+#include <string>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <loc_pla.h>
+#include <log_util.h>
+#include <loc_nmea.h>
+#include <DataItemsFactoryProxy.h>
+#include <SystemStatus.h>
+#include <SystemStatusOsObserver.h>
+#include <DataItemConcreteTypesBase.h>
+
+namespace loc_core
+{
+
+/******************************************************************************
+ SystemStatusNmeaBase - base class for all NMEA parsers
+******************************************************************************/
+class SystemStatusNmeaBase
+{
+protected:
+ std::vector<std::string> mField;
+
+ SystemStatusNmeaBase(const char *str_in, uint32_t len_in)
+ {
+ // check size and talker
+ if (!loc_nmea_is_debug(str_in, len_in)) {
+ return;
+ }
+
+ std::string parser(str_in);
+ std::string::size_type index = 0;
+
+ // verify checksum field
+ index = parser.find("*");
+ if (index == std::string::npos) {
+ return;
+ }
+ parser[index] = ',';
+
+ // tokenize parser
+ while (1) {
+ std::string str;
+ index = parser.find(",");
+ if (index == std::string::npos) {
+ break;
+ }
+ str = parser.substr(0, index);
+ parser = parser.substr(index + 1);
+ mField.push_back(str);
+ }
+ }
+
+ virtual ~SystemStatusNmeaBase() { }
+
+public:
+ static const uint32_t NMEA_MINSIZE = DEBUG_NMEA_MINSIZE;
+ static const uint32_t NMEA_MAXSIZE = DEBUG_NMEA_MAXSIZE;
+};
+
+/******************************************************************************
+ SystemStatusPQWM1
+******************************************************************************/
+class SystemStatusPQWM1
+{
+public:
+ uint16_t mGpsWeek; // x1
+ uint32_t mGpsTowMs; // x2
+ uint8_t mTimeValid; // x3
+ uint8_t mTimeSource; // x4
+ int32_t mTimeUnc; // x5
+ int32_t mClockFreqBias; // x6
+ int32_t mClockFreqBiasUnc; // x7
+ uint8_t mXoState; // x8
+ int32_t mPgaGain; // x9
+ uint32_t mGpsBpAmpI; // xA
+ uint32_t mGpsBpAmpQ; // xB
+ uint32_t mAdcI; // xC
+ uint32_t mAdcQ; // xD
+ uint32_t mJammerGps; // xE
+ uint32_t mJammerGlo; // xF
+ uint32_t mJammerBds; // x10
+ uint32_t mJammerGal; // x11
+ uint32_t mRecErrorRecovery; // x12
+ double mAgcGps; // x13
+ double mAgcGlo; // x14
+ double mAgcBds; // x15
+ 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
+ uint64_t mTimeUncNs; // x1F
+};
+
+// parser
+class SystemStatusPQWM1parser : public SystemStatusNmeaBase
+{
+private:
+ enum
+ {
+ eTalker = 0,
+ eGpsWeek = 1,
+ eGpsTowMs = 2,
+ eTimeValid = 3,
+ eTimeSource = 4,
+ eTimeUnc = 5,
+ eClockFreqBias = 6,
+ eClockFreqBiasUnc = 7,
+ eXoState = 8,
+ ePgaGain = 9,
+ eGpsBpAmpI = 10,
+ eGpsBpAmpQ = 11,
+ eAdcI = 12,
+ eAdcQ = 13,
+ eJammerGps = 14,
+ eJammerGlo = 15,
+ eJammerBds = 16,
+ eJammerGal = 17,
+ eRecErrorRecovery = 18,
+ eAgcGps = 19,
+ eAgcGlo = 20,
+ eAgcBds = 21,
+ eAgcGal = 22,
+ eMax0 = eAgcGal,
+ eLeapSeconds = 23,
+ eLeapSecUnc = 24,
+ eGloBpAmpI = 25,
+ eGloBpAmpQ = 26,
+ eBdsBpAmpI = 27,
+ eBdsBpAmpQ = 28,
+ eGalBpAmpI = 29,
+ eGalBpAmpQ = 30,
+ eTimeUncNs = 31,
+ eMax
+ };
+ SystemStatusPQWM1 mM1;
+
+public:
+ inline uint16_t getGpsWeek() { return mM1.mGpsWeek; }
+ inline uint32_t getGpsTowMs() { return mM1.mGpsTowMs; }
+ inline uint8_t getTimeValid() { return mM1.mTimeValid; }
+ inline uint8_t getTimeSource() { return mM1.mTimeSource; }
+ inline int32_t getTimeUnc() { return mM1.mTimeUnc; }
+ inline int32_t getClockFreqBias() { return mM1.mClockFreqBias; }
+ inline int32_t getClockFreqBiasUnc() { return mM1.mClockFreqBiasUnc; }
+ inline uint8_t getXoState() { return mM1.mXoState;}
+ inline int32_t getPgaGain() { return mM1.mPgaGain; }
+ inline uint32_t getGpsBpAmpI() { return mM1.mGpsBpAmpI; }
+ inline uint32_t getGpsBpAmpQ() { return mM1.mGpsBpAmpQ; }
+ inline uint32_t getAdcI() { return mM1.mAdcI; }
+ inline uint32_t getAdcQ() { return mM1.mAdcQ; }
+ inline uint32_t getJammerGps() { return mM1.mJammerGps; }
+ inline uint32_t getJammerGlo() { return mM1.mJammerGlo; }
+ inline uint32_t getJammerBds() { return mM1.mJammerBds; }
+ inline uint32_t getJammerGal() { return mM1.mJammerGal; }
+ inline uint32_t getAgcGps() { return mM1.mAgcGps; }
+ inline uint32_t getAgcGlo() { return mM1.mAgcGlo; }
+ inline uint32_t getAgcBds() { return mM1.mAgcBds; }
+ inline uint32_t getAgcGal() { return mM1.mAgcGal; }
+ 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; }
+ inline uint64_t getTimeUncNs() { return mM1.mTimeUncNs; }
+
+ SystemStatusPQWM1parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ memset(&mM1, 0, sizeof(mM1));
+ if (mField.size() <= eMax0) {
+ LOC_LOGE("PQWM1parser - invalid size=%zu", mField.size());
+ mM1.mTimeValid = 0;
+ return;
+ }
+ mM1.mGpsWeek = atoi(mField[eGpsWeek].c_str());
+ mM1.mGpsTowMs = atoi(mField[eGpsTowMs].c_str());
+ mM1.mTimeValid = atoi(mField[eTimeValid].c_str());
+ mM1.mTimeSource = atoi(mField[eTimeSource].c_str());
+ mM1.mTimeUnc = atoi(mField[eTimeUnc].c_str());
+ mM1.mClockFreqBias = atoi(mField[eClockFreqBias].c_str());
+ mM1.mClockFreqBiasUnc = atoi(mField[eClockFreqBiasUnc].c_str());
+ mM1.mXoState = atoi(mField[eXoState].c_str());
+ mM1.mPgaGain = atoi(mField[ePgaGain].c_str());
+ mM1.mGpsBpAmpI = atoi(mField[eGpsBpAmpI].c_str());
+ mM1.mGpsBpAmpQ = atoi(mField[eGpsBpAmpQ].c_str());
+ mM1.mAdcI = atoi(mField[eAdcI].c_str());
+ mM1.mAdcQ = atoi(mField[eAdcQ].c_str());
+ mM1.mJammerGps = atoi(mField[eJammerGps].c_str());
+ mM1.mJammerGlo = atoi(mField[eJammerGlo].c_str());
+ mM1.mJammerBds = atoi(mField[eJammerBds].c_str());
+ mM1.mJammerGal = atoi(mField[eJammerGal].c_str());
+ mM1.mRecErrorRecovery = atoi(mField[eRecErrorRecovery].c_str());
+ mM1.mAgcGps = atof(mField[eAgcGps].c_str());
+ mM1.mAgcGlo = atof(mField[eAgcGlo].c_str());
+ mM1.mAgcBds = atof(mField[eAgcBds].c_str());
+ mM1.mAgcGal = atof(mField[eAgcGal].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());
+ }
+ if (mField.size() > eTimeUncNs) {
+ mM1.mTimeUncNs = strtoull(mField[eTimeUncNs].c_str(), nullptr, 10);
+ }
+ }
+
+ inline SystemStatusPQWM1& get() { return mM1;} //getparser
+};
+
+/******************************************************************************
+ SystemStatusPQWP1
+******************************************************************************/
+class SystemStatusPQWP1
+{
+public:
+ uint8_t mEpiValidity; // x4
+ float mEpiLat; // x5
+ float mEpiLon; // x6
+ float mEpiAlt; // x7
+ float mEpiHepe; // x8
+ float mEpiAltUnc; // x9
+ uint8_t mEpiSrc; // x10
+};
+
+class SystemStatusPQWP1parser : public SystemStatusNmeaBase
+{
+private:
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eEpiValidity = 2,
+ eEpiLat = 3,
+ eEpiLon = 4,
+ eEpiAlt = 5,
+ eEpiHepe = 6,
+ eEpiAltUnc = 7,
+ eEpiSrc = 8,
+ eMax
+ };
+ SystemStatusPQWP1 mP1;
+
+public:
+ inline uint8_t getEpiValidity() { return mP1.mEpiValidity; }
+ inline float getEpiLat() { return mP1.mEpiLat; }
+ inline float getEpiLon() { return mP1.mEpiLon; }
+ inline float getEpiAlt() { return mP1.mEpiAlt; }
+ inline float getEpiHepe() { return mP1.mEpiHepe; }
+ inline float getEpiAltUnc() { return mP1.mEpiAltUnc; }
+ inline uint8_t getEpiSrc() { return mP1.mEpiSrc; }
+
+ SystemStatusPQWP1parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP1, 0, sizeof(mP1));
+ mP1.mEpiValidity = strtol(mField[eEpiValidity].c_str(), NULL, 16);
+ mP1.mEpiLat = atof(mField[eEpiLat].c_str());
+ mP1.mEpiLon = atof(mField[eEpiLon].c_str());
+ mP1.mEpiAlt = atof(mField[eEpiAlt].c_str());
+ mP1.mEpiHepe = atoi(mField[eEpiHepe].c_str());
+ mP1.mEpiAltUnc = atof(mField[eEpiAltUnc].c_str());
+ mP1.mEpiSrc = atoi(mField[eEpiSrc].c_str());
+ }
+
+ inline SystemStatusPQWP1& get() { return mP1;}
+};
+
+/******************************************************************************
+ SystemStatusPQWP2
+******************************************************************************/
+class SystemStatusPQWP2
+{
+public:
+ float mBestLat; // x4
+ float mBestLon; // x5
+ float mBestAlt; // x6
+ float mBestHepe; // x7
+ float mBestAltUnc; // x8
+};
+
+class SystemStatusPQWP2parser : public SystemStatusNmeaBase
+{
+private:
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eBestLat = 2,
+ eBestLon = 3,
+ eBestAlt = 4,
+ eBestHepe = 5,
+ eBestAltUnc = 6,
+ eMax
+ };
+ SystemStatusPQWP2 mP2;
+
+public:
+ inline float getBestLat() { return mP2.mBestLat; }
+ inline float getBestLon() { return mP2.mBestLon; }
+ inline float getBestAlt() { return mP2.mBestAlt; }
+ inline float getBestHepe() { return mP2.mBestHepe; }
+ inline float getBestAltUnc() { return mP2.mBestAltUnc; }
+
+ SystemStatusPQWP2parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP2, 0, sizeof(mP2));
+ mP2.mBestLat = atof(mField[eBestLat].c_str());
+ mP2.mBestLon = atof(mField[eBestLon].c_str());
+ mP2.mBestAlt = atof(mField[eBestAlt].c_str());
+ mP2.mBestHepe = atof(mField[eBestHepe].c_str());
+ mP2.mBestAltUnc = atof(mField[eBestAltUnc].c_str());
+ }
+
+ inline SystemStatusPQWP2& get() { return mP2;}
+};
+
+/******************************************************************************
+ SystemStatusPQWP3
+******************************************************************************/
+class SystemStatusPQWP3
+{
+public:
+ uint8_t mXtraValidMask;
+ uint32_t mGpsXtraAge;
+ uint32_t mGloXtraAge;
+ uint32_t mBdsXtraAge;
+ uint32_t mGalXtraAge;
+ uint32_t mQzssXtraAge;
+ uint32_t mNavicXtraAge;
+ uint32_t mGpsXtraValid;
+ uint32_t mGloXtraValid;
+ uint64_t mBdsXtraValid;
+ uint64_t mGalXtraValid;
+ uint8_t mQzssXtraValid;
+ uint32_t mNavicXtraValid;
+};
+
+class SystemStatusPQWP3parser : public SystemStatusNmeaBase
+{
+private:
+ // todo: update for navic once available
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eXtraValidMask = 2,
+ eGpsXtraAge = 3,
+ eGloXtraAge = 4,
+ eBdsXtraAge = 5,
+ eGalXtraAge = 6,
+ eQzssXtraAge = 7,
+ eGpsXtraValid = 8,
+ eGloXtraValid = 9,
+ eBdsXtraValid = 10,
+ eGalXtraValid = 11,
+ eQzssXtraValid = 12,
+ eMax
+ };
+ SystemStatusPQWP3 mP3;
+
+public:
+ inline uint8_t getXtraValid() { return mP3.mXtraValidMask; }
+ inline uint32_t getGpsXtraAge() { return mP3.mGpsXtraAge; }
+ inline uint32_t getGloXtraAge() { return mP3.mGloXtraAge; }
+ inline uint32_t getBdsXtraAge() { return mP3.mBdsXtraAge; }
+ inline uint32_t getGalXtraAge() { return mP3.mGalXtraAge; }
+ inline uint32_t getQzssXtraAge() { return mP3.mQzssXtraAge; }
+ inline uint32_t getNavicXtraAge() { return mP3.mNavicXtraAge; }
+ inline uint32_t getGpsXtraValid() { return mP3.mGpsXtraValid; }
+ inline uint32_t getGloXtraValid() { return mP3.mGloXtraValid; }
+ inline uint64_t getBdsXtraValid() { return mP3.mBdsXtraValid; }
+ inline uint64_t getGalXtraValid() { return mP3.mGalXtraValid; }
+ inline uint8_t getQzssXtraValid() { return mP3.mQzssXtraValid; }
+ inline uint32_t getNavicXtraValid() { return mP3.mNavicXtraValid; }
+
+ SystemStatusPQWP3parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP3, 0, sizeof(mP3));
+ // todo: update for navic once available
+ mP3.mXtraValidMask = strtol(mField[eXtraValidMask].c_str(), NULL, 16);
+ mP3.mGpsXtraAge = atoi(mField[eGpsXtraAge].c_str());
+ mP3.mGloXtraAge = atoi(mField[eGloXtraAge].c_str());
+ mP3.mBdsXtraAge = atoi(mField[eBdsXtraAge].c_str());
+ mP3.mGalXtraAge = atoi(mField[eGalXtraAge].c_str());
+ mP3.mQzssXtraAge = atoi(mField[eQzssXtraAge].c_str());
+ mP3.mGpsXtraValid = strtol(mField[eGpsXtraValid].c_str(), NULL, 16);
+ mP3.mGloXtraValid = strtol(mField[eGloXtraValid].c_str(), NULL, 16);
+ mP3.mBdsXtraValid = strtol(mField[eBdsXtraValid].c_str(), NULL, 16);
+ mP3.mGalXtraValid = strtol(mField[eGalXtraValid].c_str(), NULL, 16);
+ mP3.mQzssXtraValid = strtol(mField[eQzssXtraValid].c_str(), NULL, 16);
+ }
+
+ inline SystemStatusPQWP3& get() { return mP3;}
+};
+
+/******************************************************************************
+ SystemStatusPQWP4
+******************************************************************************/
+class SystemStatusPQWP4
+{
+public:
+ uint32_t mGpsEpheValid;
+ uint32_t mGloEpheValid;
+ uint64_t mBdsEpheValid;
+ uint64_t mGalEpheValid;
+ uint8_t mQzssEpheValid;
+};
+
+class SystemStatusPQWP4parser : public SystemStatusNmeaBase
+{
+private:
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eGpsEpheValid = 2,
+ eGloEpheValid = 3,
+ eBdsEpheValid = 4,
+ eGalEpheValid = 5,
+ eQzssEpheValid = 6,
+ eMax
+ };
+ SystemStatusPQWP4 mP4;
+
+public:
+ inline uint32_t getGpsEpheValid() { return mP4.mGpsEpheValid; }
+ inline uint32_t getGloEpheValid() { return mP4.mGloEpheValid; }
+ inline uint64_t getBdsEpheValid() { return mP4.mBdsEpheValid; }
+ inline uint64_t getGalEpheValid() { return mP4.mGalEpheValid; }
+ inline uint8_t getQzssEpheValid() { return mP4.mQzssEpheValid; }
+
+ SystemStatusPQWP4parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP4, 0, sizeof(mP4));
+ mP4.mGpsEpheValid = strtol(mField[eGpsEpheValid].c_str(), NULL, 16);
+ mP4.mGloEpheValid = strtol(mField[eGloEpheValid].c_str(), NULL, 16);
+ mP4.mBdsEpheValid = strtol(mField[eBdsEpheValid].c_str(), NULL, 16);
+ mP4.mGalEpheValid = strtol(mField[eGalEpheValid].c_str(), NULL, 16);
+ mP4.mQzssEpheValid = strtol(mField[eQzssEpheValid].c_str(), NULL, 16);
+ }
+
+ inline SystemStatusPQWP4& get() { return mP4;}
+};
+
+/******************************************************************************
+ SystemStatusPQWP5
+******************************************************************************/
+class SystemStatusPQWP5
+{
+public:
+ uint32_t mGpsUnknownMask;
+ uint32_t mGloUnknownMask;
+ uint64_t mBdsUnknownMask;
+ uint64_t mGalUnknownMask;
+ uint8_t mQzssUnknownMask;
+ uint32_t mNavicUnknownMask;
+ uint32_t mGpsGoodMask;
+ uint32_t mGloGoodMask;
+ uint64_t mBdsGoodMask;
+ uint64_t mGalGoodMask;
+ uint8_t mQzssGoodMask;
+ uint32_t mNavicGoodMask;
+ uint32_t mGpsBadMask;
+ uint32_t mGloBadMask;
+ uint64_t mBdsBadMask;
+ uint64_t mGalBadMask;
+ uint8_t mQzssBadMask;
+ uint32_t mNavicBadMask;
+};
+
+class SystemStatusPQWP5parser : public SystemStatusNmeaBase
+{
+private:
+ // todo: update for navic once available
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eGpsUnknownMask = 2,
+ eGloUnknownMask = 3,
+ eBdsUnknownMask = 4,
+ eGalUnknownMask = 5,
+ eQzssUnknownMask = 6,
+ eGpsGoodMask = 7,
+ eGloGoodMask = 8,
+ eBdsGoodMask = 9,
+ eGalGoodMask = 10,
+ eQzssGoodMask = 11,
+ eGpsBadMask = 12,
+ eGloBadMask = 13,
+ eBdsBadMask = 14,
+ eGalBadMask = 15,
+ eQzssBadMask = 16,
+ eMax
+ };
+ SystemStatusPQWP5 mP5;
+
+public:
+ inline uint32_t getGpsUnknownMask() { return mP5.mGpsUnknownMask; }
+ inline uint32_t getGloUnknownMask() { return mP5.mGloUnknownMask; }
+ inline uint64_t getBdsUnknownMask() { return mP5.mBdsUnknownMask; }
+ inline uint64_t getGalUnknownMask() { return mP5.mGalUnknownMask; }
+ inline uint8_t getQzssUnknownMask() { return mP5.mQzssUnknownMask; }
+ inline uint32_t getNavicUnknownMask() { return mP5.mNavicUnknownMask; }
+ inline uint32_t getGpsGoodMask() { return mP5.mGpsGoodMask; }
+ inline uint32_t getGloGoodMask() { return mP5.mGloGoodMask; }
+ inline uint64_t getBdsGoodMask() { return mP5.mBdsGoodMask; }
+ inline uint64_t getGalGoodMask() { return mP5.mGalGoodMask; }
+ inline uint8_t getQzssGoodMask() { return mP5.mQzssGoodMask; }
+ inline uint32_t getNavicGoodMask() { return mP5.mNavicGoodMask; }
+ inline uint32_t getGpsBadMask() { return mP5.mGpsBadMask; }
+ inline uint32_t getGloBadMask() { return mP5.mGloBadMask; }
+ inline uint64_t getBdsBadMask() { return mP5.mBdsBadMask; }
+ inline uint64_t getGalBadMask() { return mP5.mGalBadMask; }
+ inline uint8_t getQzssBadMask() { return mP5.mQzssBadMask; }
+ inline uint32_t getNavicBadMask() { return mP5.mNavicBadMask; }
+
+ SystemStatusPQWP5parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP5, 0, sizeof(mP5));
+ // todo: update for navic once available
+ mP5.mGpsUnknownMask = strtol(mField[eGpsUnknownMask].c_str(), NULL, 16);
+ mP5.mGloUnknownMask = strtol(mField[eGloUnknownMask].c_str(), NULL, 16);
+ mP5.mBdsUnknownMask = strtol(mField[eBdsUnknownMask].c_str(), NULL, 16);
+ mP5.mGalUnknownMask = strtol(mField[eGalUnknownMask].c_str(), NULL, 16);
+ mP5.mQzssUnknownMask = strtol(mField[eQzssUnknownMask].c_str(), NULL, 16);
+ mP5.mGpsGoodMask = strtol(mField[eGpsGoodMask].c_str(), NULL, 16);
+ mP5.mGloGoodMask = strtol(mField[eGloGoodMask].c_str(), NULL, 16);
+ mP5.mBdsGoodMask = strtol(mField[eBdsGoodMask].c_str(), NULL, 16);
+ mP5.mGalGoodMask = strtol(mField[eGalGoodMask].c_str(), NULL, 16);
+ mP5.mQzssGoodMask = strtol(mField[eQzssGoodMask].c_str(), NULL, 16);
+ mP5.mGpsBadMask = strtol(mField[eGpsBadMask].c_str(), NULL, 16);
+ mP5.mGloBadMask = strtol(mField[eGloBadMask].c_str(), NULL, 16);
+ mP5.mBdsBadMask = strtol(mField[eBdsBadMask].c_str(), NULL, 16);
+ mP5.mGalBadMask = strtol(mField[eGalBadMask].c_str(), NULL, 16);
+ mP5.mQzssBadMask = strtol(mField[eQzssBadMask].c_str(), NULL, 16);
+ }
+
+ inline SystemStatusPQWP5& get() { return mP5;}
+};
+
+/******************************************************************************
+ SystemStatusPQWP6parser
+******************************************************************************/
+class SystemStatusPQWP6
+{
+public:
+ uint32_t mFixInfoMask;
+};
+
+class SystemStatusPQWP6parser : public SystemStatusNmeaBase
+{
+private:
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eFixInfoMask = 2,
+ eMax
+ };
+ SystemStatusPQWP6 mP6;
+
+public:
+ inline uint32_t getFixInfoMask() { return mP6.mFixInfoMask; }
+
+ SystemStatusPQWP6parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP6, 0, sizeof(mP6));
+ mP6.mFixInfoMask = strtol(mField[eFixInfoMask].c_str(), NULL, 16);
+ }
+
+ inline SystemStatusPQWP6& get() { return mP6;}
+};
+
+/******************************************************************************
+ SystemStatusPQWP7parser
+******************************************************************************/
+class SystemStatusPQWP7
+{
+public:
+ SystemStatusNav mNav[SV_ALL_NUM];
+};
+
+class SystemStatusPQWP7parser : public SystemStatusNmeaBase
+{
+private:
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eMin = 2 + SV_ALL_NUM_MIN*3,
+ eMax = 2 + SV_ALL_NUM*3
+ };
+ SystemStatusPQWP7 mP7;
+
+public:
+ SystemStatusPQWP7parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ uint32_t svLimit = SV_ALL_NUM;
+ if (mField.size() < eMin) {
+ LOC_LOGE("PQWP7parser - invalid size=%zu", mField.size());
+ return;
+ }
+ if (mField.size() < eMax) {
+ // Try reducing limit, accounting for possibly missing NAVIC support
+ svLimit = SV_ALL_NUM_MIN;
+ }
+
+ memset(mP7.mNav, 0, sizeof(mP7.mNav));
+ for (uint32_t i=0; i<svLimit; i++) {
+ mP7.mNav[i].mType = GnssEphemerisType(atoi(mField[i*3+2].c_str()));
+ mP7.mNav[i].mSource = GnssEphemerisSource(atoi(mField[i*3+3].c_str()));
+ mP7.mNav[i].mAgeSec = atoi(mField[i*3+4].c_str());
+ }
+ }
+
+ inline SystemStatusPQWP7& get() { return mP7;}
+};
+
+/******************************************************************************
+ SystemStatusPQWS1parser
+******************************************************************************/
+class SystemStatusPQWS1
+{
+public:
+ uint32_t mFixInfoMask;
+ uint32_t mHepeLimit;
+};
+
+class SystemStatusPQWS1parser : public SystemStatusNmeaBase
+{
+private:
+ enum
+ {
+ eTalker = 0,
+ eUtcTime = 1,
+ eFixInfoMask = 2,
+ eHepeLimit = 3,
+ eMax
+ };
+ SystemStatusPQWS1 mS1;
+
+public:
+ inline uint16_t getFixInfoMask() { return mS1.mFixInfoMask; }
+ inline uint32_t getHepeLimit() { return mS1.mHepeLimit; }
+
+ SystemStatusPQWS1parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mS1, 0, sizeof(mS1));
+ mS1.mFixInfoMask = atoi(mField[eFixInfoMask].c_str());
+ mS1.mHepeLimit = atoi(mField[eHepeLimit].c_str());
+ }
+
+ inline SystemStatusPQWS1& get() { return mS1;}
+};
+
+/******************************************************************************
+ SystemStatusTimeAndClock
+******************************************************************************/
+SystemStatusTimeAndClock::SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea) :
+ mGpsWeek(nmea.mGpsWeek),
+ mGpsTowMs(nmea.mGpsTowMs),
+ mTimeValid(nmea.mTimeValid),
+ mTimeSource(nmea.mTimeSource),
+ mTimeUnc(nmea.mTimeUnc),
+ mClockFreqBias(nmea.mClockFreqBias),
+ mClockFreqBiasUnc(nmea.mClockFreqBiasUnc),
+ mLeapSeconds(nmea.mLeapSeconds),
+ mLeapSecUnc(nmea.mLeapSecUnc),
+ mTimeUncNs(nmea.mTimeUncNs)
+{
+}
+
+bool SystemStatusTimeAndClock::equals(const SystemStatusTimeAndClock& peer)
+{
+ if ((mGpsWeek != peer.mGpsWeek) ||
+ (mGpsTowMs != peer.mGpsTowMs) ||
+ (mTimeValid != peer.mTimeValid) ||
+ (mTimeSource != peer.mTimeSource) ||
+ (mTimeUnc != peer.mTimeUnc) ||
+ (mClockFreqBias != peer.mClockFreqBias) ||
+ (mClockFreqBiasUnc != peer.mClockFreqBiasUnc) ||
+ (mLeapSeconds != peer.mLeapSeconds) ||
+ (mLeapSecUnc != peer.mLeapSecUnc) ||
+ (mTimeUncNs != peer.mTimeUncNs)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusTimeAndClock::dump()
+{
+ LOC_LOGV("TimeAndClock: u=%ld:%ld g=%d:%d v=%d ts=%d tu=%d b=%d bu=%d ls=%d lu=%d un=%" PRIu64,
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mGpsWeek,
+ mGpsTowMs,
+ mTimeValid,
+ mTimeSource,
+ mTimeUnc,
+ mClockFreqBias,
+ mClockFreqBiasUnc,
+ mLeapSeconds,
+ mLeapSecUnc,
+ mTimeUncNs);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusXoState
+******************************************************************************/
+SystemStatusXoState::SystemStatusXoState(const SystemStatusPQWM1& nmea) :
+ mXoState(nmea.mXoState)
+{
+}
+
+bool SystemStatusXoState::equals(const SystemStatusXoState& peer)
+{
+ if (mXoState != peer.mXoState) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusXoState::dump()
+{
+ LOC_LOGV("XoState: u=%ld:%ld x=%d",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mXoState);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusRfAndParams
+******************************************************************************/
+SystemStatusRfAndParams::SystemStatusRfAndParams(const SystemStatusPQWM1& nmea) :
+ mPgaGain(nmea.mPgaGain),
+ mGpsBpAmpI(nmea.mGpsBpAmpI),
+ mGpsBpAmpQ(nmea.mGpsBpAmpQ),
+ mAdcI(nmea.mAdcI),
+ mAdcQ(nmea.mAdcQ),
+ mJammerGps(nmea.mJammerGps),
+ mJammerGlo(nmea.mJammerGlo),
+ mJammerBds(nmea.mJammerBds),
+ mJammerGal(nmea.mJammerGal),
+ mAgcGps(nmea.mAgcGps),
+ mAgcGlo(nmea.mAgcGlo),
+ mAgcBds(nmea.mAgcBds),
+ mAgcGal(nmea.mAgcGal),
+ mGloBpAmpI(nmea.mGloBpAmpI),
+ mGloBpAmpQ(nmea.mGloBpAmpQ),
+ mBdsBpAmpI(nmea.mBdsBpAmpI),
+ mBdsBpAmpQ(nmea.mBdsBpAmpQ),
+ mGalBpAmpI(nmea.mGalBpAmpI),
+ mGalBpAmpQ(nmea.mGalBpAmpQ)
+{
+}
+
+bool SystemStatusRfAndParams::equals(const SystemStatusRfAndParams& peer)
+{
+ if ((mPgaGain != peer.mPgaGain) ||
+ (mGpsBpAmpI != peer.mGpsBpAmpI) ||
+ (mGpsBpAmpQ != peer.mGpsBpAmpQ) ||
+ (mAdcI != peer.mAdcI) ||
+ (mAdcQ != peer.mAdcQ) ||
+ (mJammerGps != peer.mJammerGps) ||
+ (mJammerGlo != peer.mJammerGlo) ||
+ (mJammerBds != peer.mJammerBds) ||
+ (mJammerGal != peer.mJammerGal) ||
+ (mAgcGps != peer.mAgcGps) ||
+ (mAgcGlo != peer.mAgcGlo) ||
+ (mAgcBds != peer.mAgcBds) ||
+ (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;
+}
+
+void SystemStatusRfAndParams::dump()
+{
+ LOC_LOGV("RfAndParams: u=%ld:%ld p=%d bi=%d bq=%d ai=%d aq=%d "
+ "jgp=%d jgl=%d jbd=%d jga=%d "
+ "agp=%lf agl=%lf abd=%lf aga=%lf",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mPgaGain,
+ mGpsBpAmpI,
+ mGpsBpAmpQ,
+ mAdcI,
+ mAdcQ,
+ mJammerGps,
+ mJammerGlo,
+ mJammerBds,
+ mJammerGal,
+ mAgcGps,
+ mAgcGlo,
+ mAgcBds,
+ mAgcGal);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusErrRecovery
+******************************************************************************/
+SystemStatusErrRecovery::SystemStatusErrRecovery(const SystemStatusPQWM1& nmea) :
+ mRecErrorRecovery(nmea.mRecErrorRecovery)
+{
+}
+
+bool SystemStatusErrRecovery::equals(const SystemStatusErrRecovery& peer)
+{
+ if (mRecErrorRecovery != peer.mRecErrorRecovery) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusErrRecovery::dump()
+{
+ LOC_LOGV("ErrRecovery: u=%ld:%ld e=%d",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mRecErrorRecovery);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusInjectedPosition
+******************************************************************************/
+SystemStatusInjectedPosition::SystemStatusInjectedPosition(const SystemStatusPQWP1& nmea) :
+ mEpiValidity(nmea.mEpiValidity),
+ mEpiLat(nmea.mEpiLat),
+ mEpiLon(nmea.mEpiLon),
+ mEpiAlt(nmea.mEpiAlt),
+ mEpiHepe(nmea.mEpiHepe),
+ mEpiAltUnc(nmea.mEpiAltUnc),
+ mEpiSrc(nmea.mEpiSrc)
+{
+}
+
+bool SystemStatusInjectedPosition::equals(const SystemStatusInjectedPosition& peer)
+{
+ if ((mEpiValidity != peer.mEpiValidity) ||
+ (mEpiLat != peer.mEpiLat) ||
+ (mEpiLon != peer.mEpiLon) ||
+ (mEpiAlt != peer.mEpiAlt) ||
+ (mEpiHepe != peer.mEpiHepe) ||
+ (mEpiAltUnc != peer.mEpiAltUnc) ||
+ (mEpiSrc != peer.mEpiSrc)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusInjectedPosition::dump()
+{
+ LOC_LOGV("InjectedPosition: u=%ld:%ld v=%x la=%f lo=%f al=%f he=%f au=%f es=%d",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mEpiValidity,
+ mEpiLat,
+ mEpiLon,
+ mEpiAlt,
+ mEpiHepe,
+ mEpiAltUnc,
+ mEpiSrc);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusBestPosition
+******************************************************************************/
+SystemStatusBestPosition::SystemStatusBestPosition(const SystemStatusPQWP2& nmea) :
+ mValid(true),
+ mBestLat(nmea.mBestLat),
+ mBestLon(nmea.mBestLon),
+ mBestAlt(nmea.mBestAlt),
+ mBestHepe(nmea.mBestHepe),
+ mBestAltUnc(nmea.mBestAltUnc)
+{
+}
+
+bool SystemStatusBestPosition::equals(const SystemStatusBestPosition& peer)
+{
+ if ((mBestLat != peer.mBestLat) ||
+ (mBestLon != peer.mBestLon) ||
+ (mBestAlt != peer.mBestAlt) ||
+ (mBestHepe != peer.mBestHepe) ||
+ (mBestAltUnc != peer.mBestAltUnc)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusBestPosition::dump()
+{
+ LOC_LOGV("BestPosition: u=%ld:%ld la=%f lo=%f al=%f he=%f au=%f",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mBestLat,
+ mBestLon,
+ mBestAlt,
+ mBestHepe,
+ mBestAltUnc);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusXtra
+******************************************************************************/
+SystemStatusXtra::SystemStatusXtra(const SystemStatusPQWP3& nmea) :
+ mXtraValidMask(nmea.mXtraValidMask),
+ mGpsXtraAge(nmea.mGpsXtraAge),
+ mGloXtraAge(nmea.mGloXtraAge),
+ mBdsXtraAge(nmea.mBdsXtraAge),
+ mGalXtraAge(nmea.mGalXtraAge),
+ mQzssXtraAge(nmea.mQzssXtraAge),
+ mNavicXtraAge(nmea.mNavicXtraAge),
+ mGpsXtraValid(nmea.mGpsXtraValid),
+ mGloXtraValid(nmea.mGloXtraValid),
+ mBdsXtraValid(nmea.mBdsXtraValid),
+ mGalXtraValid(nmea.mGalXtraValid),
+ mQzssXtraValid(nmea.mQzssXtraValid),
+ mNavicXtraValid(nmea.mNavicXtraValid)
+{
+}
+
+bool SystemStatusXtra::equals(const SystemStatusXtra& peer)
+{
+ if ((mXtraValidMask != peer.mXtraValidMask) ||
+ (mGpsXtraAge != peer.mGpsXtraAge) ||
+ (mGloXtraAge != peer.mGloXtraAge) ||
+ (mBdsXtraAge != peer.mBdsXtraAge) ||
+ (mGalXtraAge != peer.mGalXtraAge) ||
+ (mQzssXtraAge != peer.mQzssXtraAge) ||
+ (mNavicXtraAge != peer.mNavicXtraAge) ||
+ (mGpsXtraValid != peer.mGpsXtraValid) ||
+ (mGloXtraValid != peer.mGloXtraValid) ||
+ (mBdsXtraValid != peer.mBdsXtraValid) ||
+ (mGalXtraValid != peer.mGalXtraValid) ||
+ (mQzssXtraValid != peer.mQzssXtraValid) ||
+ (mNavicXtraValid != peer.mNavicXtraValid)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusXtra::dump()
+{
+ LOC_LOGV("SystemStatusXtra: u=%ld:%ld m=%x a=%d:%d:%d:%d:%d v=%x:%x:%" PRIx64 ":%" PRIx64":%x",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mXtraValidMask,
+ mGpsXtraAge,
+ mGloXtraAge,
+ mBdsXtraAge,
+ mGalXtraAge,
+ mQzssXtraAge,
+ mGpsXtraValid,
+ mGloXtraValid,
+ mBdsXtraValid,
+ mGalXtraValid,
+ mQzssXtraValid);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusEphemeris
+******************************************************************************/
+SystemStatusEphemeris::SystemStatusEphemeris(const SystemStatusPQWP4& nmea) :
+ mGpsEpheValid(nmea.mGpsEpheValid),
+ mGloEpheValid(nmea.mGloEpheValid),
+ mBdsEpheValid(nmea.mBdsEpheValid),
+ mGalEpheValid(nmea.mGalEpheValid),
+ mQzssEpheValid(nmea.mQzssEpheValid)
+{
+}
+
+bool SystemStatusEphemeris::equals(const SystemStatusEphemeris& peer)
+{
+ if ((mGpsEpheValid != peer.mGpsEpheValid) ||
+ (mGloEpheValid != peer.mGloEpheValid) ||
+ (mBdsEpheValid != peer.mBdsEpheValid) ||
+ (mGalEpheValid != peer.mGalEpheValid) ||
+ (mQzssEpheValid != peer.mQzssEpheValid)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusEphemeris::dump()
+{
+ LOC_LOGV("Ephemeris: u=%ld:%ld ev=%x:%x:%" PRIx64 ":%" PRIx64 ":%x",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mGpsEpheValid,
+ mGloEpheValid,
+ mBdsEpheValid,
+ mGalEpheValid,
+ mQzssEpheValid);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusSvHealth
+******************************************************************************/
+SystemStatusSvHealth::SystemStatusSvHealth(const SystemStatusPQWP5& nmea) :
+ mGpsUnknownMask(nmea.mGpsUnknownMask),
+ mGloUnknownMask(nmea.mGloUnknownMask),
+ mBdsUnknownMask(nmea.mBdsUnknownMask),
+ mGalUnknownMask(nmea.mGalUnknownMask),
+ mQzssUnknownMask(nmea.mQzssUnknownMask),
+ mNavicUnknownMask(nmea.mNavicUnknownMask),
+ mGpsGoodMask(nmea.mGpsGoodMask),
+ mGloGoodMask(nmea.mGloGoodMask),
+ mBdsGoodMask(nmea.mBdsGoodMask),
+ mGalGoodMask(nmea.mGalGoodMask),
+ mQzssGoodMask(nmea.mQzssGoodMask),
+ mNavicGoodMask(nmea.mNavicGoodMask),
+ mGpsBadMask(nmea.mGpsBadMask),
+ mGloBadMask(nmea.mGloBadMask),
+ mBdsBadMask(nmea.mBdsBadMask),
+ mGalBadMask(nmea.mGalBadMask),
+ mQzssBadMask(nmea.mQzssBadMask),
+ mNavicBadMask(nmea.mNavicBadMask)
+{
+}
+
+bool SystemStatusSvHealth::equals(const SystemStatusSvHealth& peer)
+{
+ if ((mGpsUnknownMask != peer.mGpsUnknownMask) ||
+ (mGloUnknownMask != peer.mGloUnknownMask) ||
+ (mBdsUnknownMask != peer.mBdsUnknownMask) ||
+ (mGalUnknownMask != peer.mGalUnknownMask) ||
+ (mQzssUnknownMask != peer.mQzssUnknownMask) ||
+ (mGpsGoodMask != peer.mGpsGoodMask) ||
+ (mGloGoodMask != peer.mGloGoodMask) ||
+ (mBdsGoodMask != peer.mBdsGoodMask) ||
+ (mGalGoodMask != peer.mGalGoodMask) ||
+ (mQzssGoodMask != peer.mQzssGoodMask) ||
+ (mGpsBadMask != peer.mGpsBadMask) ||
+ (mGloBadMask != peer.mGloBadMask) ||
+ (mBdsBadMask != peer.mBdsBadMask) ||
+ (mGalBadMask != peer.mGalBadMask) ||
+ (mQzssBadMask != peer.mQzssBadMask)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusSvHealth::dump()
+{
+ LOC_LOGV("SvHealth: u=%ld:%ld \
+ u=%x:%x:%" PRIx64 ":%" PRIx64 ":%x \
+ g=%x:%x:%" PRIx64 ":%" PRIx64 ":%x \
+ b=%x:%x:%" PRIx64 ":%" PRIx64 ":%x",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mGpsUnknownMask,
+ mGloUnknownMask,
+ mBdsUnknownMask,
+ mGalUnknownMask,
+ mQzssUnknownMask,
+ mGpsGoodMask,
+ mGloGoodMask,
+ mBdsGoodMask,
+ mGalGoodMask,
+ mQzssGoodMask,
+ mGpsBadMask,
+ mGloBadMask,
+ mBdsBadMask,
+ mGalBadMask,
+ mQzssBadMask);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusPdr
+******************************************************************************/
+SystemStatusPdr::SystemStatusPdr(const SystemStatusPQWP6& nmea) :
+ mFixInfoMask(nmea.mFixInfoMask)
+{
+}
+
+bool SystemStatusPdr::equals(const SystemStatusPdr& peer)
+{
+ if (mFixInfoMask != peer.mFixInfoMask) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusPdr::dump()
+{
+ LOC_LOGV("Pdr: u=%ld:%ld m=%x",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mFixInfoMask);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusNavData
+******************************************************************************/
+SystemStatusNavData::SystemStatusNavData(const SystemStatusPQWP7& nmea)
+{
+ for (uint32_t i=0; i<SV_ALL_NUM; i++) {
+ mNav[i] = nmea.mNav[i];
+ }
+}
+
+bool SystemStatusNavData::equals(const SystemStatusNavData& peer)
+{
+ for (uint32_t i=0; i<SV_ALL_NUM; i++) {
+ if ((mNav[i].mType != peer.mNav[i].mType) ||
+ (mNav[i].mSource != peer.mNav[i].mSource) ||
+ (mNav[i].mAgeSec != peer.mNav[i].mAgeSec)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+void SystemStatusNavData::dump()
+{
+ LOC_LOGV("NavData: u=%ld:%ld",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec);
+ for (uint32_t i=0; i<SV_ALL_NUM; i++) {
+ LOC_LOGV("i=%d type=%d src=%d age=%d",
+ i, mNav[i].mType, mNav[i].mSource, mNav[i].mAgeSec);
+ }
+ return;
+}
+
+/******************************************************************************
+ SystemStatusPositionFailure
+******************************************************************************/
+SystemStatusPositionFailure::SystemStatusPositionFailure(const SystemStatusPQWS1& nmea) :
+ mFixInfoMask(nmea.mFixInfoMask),
+ mHepeLimit(nmea.mHepeLimit)
+{
+}
+
+bool SystemStatusPositionFailure::equals(const SystemStatusPositionFailure& peer)
+{
+ if ((mFixInfoMask != peer.mFixInfoMask) ||
+ (mHepeLimit != peer.mHepeLimit)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusPositionFailure::dump()
+{
+ LOC_LOGV("PositionFailure: u=%ld:%ld m=%d h=%d",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mFixInfoMask,
+ mHepeLimit);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusLocation
+******************************************************************************/
+bool SystemStatusLocation::equals(const SystemStatusLocation& peer)
+{
+ if ((mLocation.gpsLocation.latitude != peer.mLocation.gpsLocation.latitude) ||
+ (mLocation.gpsLocation.longitude != peer.mLocation.gpsLocation.longitude) ||
+ (mLocation.gpsLocation.altitude != peer.mLocation.gpsLocation.altitude)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusLocation::dump()
+{
+ LOC_LOGV("Location: lat=%f lon=%f alt=%f spd=%f",
+ mLocation.gpsLocation.latitude,
+ mLocation.gpsLocation.longitude,
+ mLocation.gpsLocation.altitude,
+ mLocation.gpsLocation.speed);
+ return;
+}
+
+/******************************************************************************
+ SystemStatus
+******************************************************************************/
+pthread_mutex_t SystemStatus::mMutexSystemStatus = PTHREAD_MUTEX_INITIALIZER;
+SystemStatus* SystemStatus::mInstance = NULL;
+
+SystemStatus* SystemStatus::getInstance(const MsgTask* msgTask)
+{
+ pthread_mutex_lock(&mMutexSystemStatus);
+
+ if (!mInstance) {
+ // Instantiating for the first time. msgTask should not be NULL
+ if (msgTask == NULL) {
+ LOC_LOGE("SystemStatus: msgTask is NULL!!");
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return NULL;
+ }
+ mInstance = new (nothrow) SystemStatus(msgTask);
+ LOC_LOGD("SystemStatus::getInstance:%p. Msgtask:%p", mInstance, msgTask);
+ }
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return mInstance;
+}
+
+void SystemStatus::destroyInstance()
+{
+ delete mInstance;
+ mInstance = NULL;
+}
+
+IOsObserver* SystemStatus::getOsObserver()
+{
+ return &mSysStatusObsvr;
+}
+
+SystemStatus::SystemStatus(const MsgTask* msgTask) :
+ mSysStatusObsvr(this, msgTask)
+{
+ int result = 0;
+ ENTRY_LOG ();
+ mCache.mLocation.clear();
+
+ mCache.mTimeAndClock.clear();
+ mCache.mXoState.clear();
+ mCache.mRfAndParams.clear();
+ mCache.mErrRecovery.clear();
+
+ mCache.mInjectedPosition.clear();
+ mCache.mBestPosition.clear();
+ mCache.mXtra.clear();
+ mCache.mEphemeris.clear();
+ mCache.mSvHealth.clear();
+ mCache.mPdr.clear();
+ mCache.mNavData.clear();
+
+ mCache.mPositionFailure.clear();
+
+ mCache.mAirplaneMode.clear();
+ mCache.mENH.clear();
+ mCache.mGPSState.clear();
+ mCache.mNLPStatus.clear();
+ mCache.mWifiHardwareState.clear();
+ mCache.mNetworkInfo.clear();
+ mCache.mRilServiceInfo.clear();
+ mCache.mRilCellInfo.clear();
+ mCache.mServiceStatus.clear();
+ mCache.mModel.clear();
+ mCache.mManufacturer.clear();
+ mCache.mAssistedGps.clear();
+ mCache.mScreenState.clear();
+ mCache.mPowerConnectState.clear();
+ mCache.mTimeZoneChange.clear();
+ mCache.mTimeChange.clear();
+ mCache.mWifiSupplicantStatus.clear();
+ mCache.mShutdownState.clear();
+ mCache.mTac.clear();
+ mCache.mMccMnc.clear();
+ mCache.mBtDeviceScanDetail.clear();
+ mCache.mBtLeDeviceScanDetail.clear();
+
+ EXIT_LOG_WITH_ERROR ("%d",result);
+}
+
+/******************************************************************************
+ SystemStatus - storing dataitems
+******************************************************************************/
+template <typename TYPE_REPORT, typename TYPE_ITEM>
+bool SystemStatus::setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s)
+{
+ if (s.ignore()) {
+ return false;
+ }
+ 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;
+ }
+
+ // first event or updated
+ report.push_back(s);
+ if (report.size() > s.maxItem) {
+ report.erase(report.begin());
+ }
+ return true;
+}
+
+template <typename TYPE_REPORT, typename TYPE_ITEM>
+void SystemStatus::setDefaultIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s)
+{
+ report.push_back(s);
+ if (report.size() > s.maxItem) {
+ report.erase(report.begin());
+ }
+}
+
+template <typename TYPE_REPORT, typename TYPE_ITEM>
+void SystemStatus::getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) const
+{
+ reportout.clear();
+ if (c.size() >= 1) {
+ reportout.push_back(c.back());
+ reportout.back().dump();
+ }
+}
+
+/******************************************************************************
+@brief API to set report data into internal buffer
+
+@param[In] data pointer to the NMEA string
+@param[In] len length of the NMEA string
+
+@return true when the NMEA is consumed by the method.
+******************************************************************************/
+bool SystemStatus::setNmeaString(const char *data, uint32_t len)
+{
+ if (!loc_nmea_is_debug(data, len)) {
+ return false;
+ }
+
+ char buf[SystemStatusNmeaBase::NMEA_MAXSIZE + 1] = { 0 };
+ strlcpy(buf, data, sizeof(buf));
+
+ pthread_mutex_lock(&mMutexSystemStatus);
+
+ // parse the received nmea strings here
+ if (0 == strncmp(data, "$PQWM1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ SystemStatusPQWM1 s = SystemStatusPQWM1parser(buf, len).get();
+ 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)) {
+ setIteminReport(mCache.mInjectedPosition,
+ SystemStatusInjectedPosition(SystemStatusPQWP1parser(buf, len).get()));
+ }
+ else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ setIteminReport(mCache.mBestPosition,
+ SystemStatusBestPosition(SystemStatusPQWP2parser(buf, len).get()));
+ }
+ else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ setIteminReport(mCache.mXtra,
+ SystemStatusXtra(SystemStatusPQWP3parser(buf, len).get()));
+ }
+ else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ setIteminReport(mCache.mEphemeris,
+ SystemStatusEphemeris(SystemStatusPQWP4parser(buf, len).get()));
+ }
+ else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ setIteminReport(mCache.mSvHealth,
+ SystemStatusSvHealth(SystemStatusPQWP5parser(buf, len).get()));
+ }
+ else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ setIteminReport(mCache.mPdr,
+ SystemStatusPdr(SystemStatusPQWP6parser(buf, len).get()));
+ }
+ else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ setIteminReport(mCache.mNavData,
+ SystemStatusNavData(SystemStatusPQWP7parser(buf, len).get()));
+ }
+ else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ setIteminReport(mCache.mPositionFailure,
+ SystemStatusPositionFailure(SystemStatusPQWS1parser(buf, len).get()));
+ }
+ else {
+ // do nothing
+ }
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return true;
+}
+
+/******************************************************************************
+@brief API to set report position data into internal buffer
+
+@param[In] UlpLocation
+
+@return true when successfully done
+******************************************************************************/
+bool SystemStatus::eventPosition(const UlpLocation& location,
+ const GpsLocationExtended& locationEx)
+{
+ bool ret = false;
+ pthread_mutex_lock(&mMutexSystemStatus);
+
+ ret = setIteminReport(mCache.mLocation, SystemStatusLocation(location, locationEx));
+ LOC_LOGV("eventPosition - lat=%f lon=%f alt=%f speed=%f",
+ location.gpsLocation.latitude,
+ location.gpsLocation.longitude,
+ location.gpsLocation.altitude,
+ location.gpsLocation.speed);
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return ret;
+}
+
+/******************************************************************************
+@brief API to set report DataItem event into internal buffer
+
+@param[In] DataItem
+
+@return true when info is updatated
+******************************************************************************/
+bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem)
+{
+ bool ret = false;
+ pthread_mutex_lock(&mMutexSystemStatus);
+ switch(dataitem->getId())
+ {
+ case AIRPLANEMODE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mAirplaneMode,
+ SystemStatusAirplaneMode(*(static_cast<AirplaneModeDataItemBase*>(dataitem))));
+ break;
+ case ENH_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mENH,
+ SystemStatusENH(*(static_cast<ENHDataItemBase*>(dataitem))));
+ break;
+ case GPSSTATE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mGPSState,
+ SystemStatusGpsState(*(static_cast<GPSStateDataItemBase*>(dataitem))));
+ break;
+ case NLPSTATUS_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mNLPStatus,
+ SystemStatusNLPStatus(*(static_cast<NLPStatusDataItemBase*>(dataitem))));
+ break;
+ case WIFIHARDWARESTATE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mWifiHardwareState,
+ SystemStatusWifiHardwareState(*(static_cast<WifiHardwareStateDataItemBase*>(dataitem))));
+ break;
+ case NETWORKINFO_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mNetworkInfo,
+ SystemStatusNetworkInfo(*(static_cast<NetworkInfoDataItemBase*>(dataitem))));
+ break;
+ case RILSERVICEINFO_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mRilServiceInfo,
+ SystemStatusServiceInfo(*(static_cast<RilServiceInfoDataItemBase*>(dataitem))));
+ break;
+ case RILCELLINFO_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mRilCellInfo,
+ SystemStatusRilCellInfo(*(static_cast<RilCellInfoDataItemBase*>(dataitem))));
+ break;
+ case SERVICESTATUS_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mServiceStatus,
+ SystemStatusServiceStatus(*(static_cast<ServiceStatusDataItemBase*>(dataitem))));
+ break;
+ case MODEL_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mModel,
+ SystemStatusModel(*(static_cast<ModelDataItemBase*>(dataitem))));
+ break;
+ case MANUFACTURER_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mManufacturer,
+ SystemStatusManufacturer(*(static_cast<ManufacturerDataItemBase*>(dataitem))));
+ break;
+ case ASSISTED_GPS_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mAssistedGps,
+ SystemStatusAssistedGps(*(static_cast<AssistedGpsDataItemBase*>(dataitem))));
+ break;
+ case SCREEN_STATE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mScreenState,
+ SystemStatusScreenState(*(static_cast<ScreenStateDataItemBase*>(dataitem))));
+ break;
+ case POWER_CONNECTED_STATE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mPowerConnectState,
+ SystemStatusPowerConnectState(*(static_cast<PowerConnectStateDataItemBase*>(dataitem))));
+ break;
+ case TIMEZONE_CHANGE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mTimeZoneChange,
+ SystemStatusTimeZoneChange(*(static_cast<TimeZoneChangeDataItemBase*>(dataitem))));
+ break;
+ case TIME_CHANGE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mTimeChange,
+ SystemStatusTimeChange(*(static_cast<TimeChangeDataItemBase*>(dataitem))));
+ break;
+ case WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mWifiSupplicantStatus,
+ SystemStatusWifiSupplicantStatus(*(static_cast<WifiSupplicantStatusDataItemBase*>(dataitem))));
+ break;
+ case SHUTDOWN_STATE_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mShutdownState,
+ SystemStatusShutdownState(*(static_cast<ShutdownStateDataItemBase*>(dataitem))));
+ break;
+ case TAC_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mTac,
+ SystemStatusTac(*(static_cast<TacDataItemBase*>(dataitem))));
+ break;
+ case MCCMNC_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mMccMnc,
+ SystemStatusMccMnc(*(static_cast<MccmncDataItemBase*>(dataitem))));
+ break;
+ case BTLE_SCAN_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mBtDeviceScanDetail,
+ SystemStatusBtDeviceScanDetail(*(static_cast<BtDeviceScanDetailsDataItemBase*>(dataitem))));
+ break;
+ case BT_SCAN_DATA_ITEM_ID:
+ ret = setIteminReport(mCache.mBtLeDeviceScanDetail,
+ SystemStatusBtleDeviceScanDetail(*(static_cast<BtLeDeviceScanDetailsDataItemBase*>(dataitem))));
+ break;
+ default:
+ break;
+ }
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return ret;
+}
+
+/******************************************************************************
+@brief API to get report data into a given buffer
+
+@param[In] reference to report buffer
+@param[In] bool flag to identify latest only or entire buffer
+
+@return true when successfully done
+******************************************************************************/
+bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) const
+{
+ pthread_mutex_lock(&mMutexSystemStatus);
+
+ if (isLatestOnly) {
+ // push back only the latest report and return it
+ getIteminReport(report.mLocation, mCache.mLocation);
+
+ getIteminReport(report.mTimeAndClock, mCache.mTimeAndClock);
+ getIteminReport(report.mXoState, mCache.mXoState);
+ getIteminReport(report.mRfAndParams, mCache.mRfAndParams);
+ getIteminReport(report.mErrRecovery, mCache.mErrRecovery);
+
+ getIteminReport(report.mInjectedPosition, mCache.mInjectedPosition);
+ getIteminReport(report.mBestPosition, mCache.mBestPosition);
+ getIteminReport(report.mXtra, mCache.mXtra);
+ getIteminReport(report.mEphemeris, mCache.mEphemeris);
+ getIteminReport(report.mSvHealth, mCache.mSvHealth);
+ getIteminReport(report.mPdr, mCache.mPdr);
+ getIteminReport(report.mNavData, mCache.mNavData);
+
+ getIteminReport(report.mPositionFailure, mCache.mPositionFailure);
+
+ getIteminReport(report.mAirplaneMode, mCache.mAirplaneMode);
+ getIteminReport(report.mENH, mCache.mENH);
+ getIteminReport(report.mGPSState, mCache.mGPSState);
+ getIteminReport(report.mNLPStatus, mCache.mNLPStatus);
+ getIteminReport(report.mWifiHardwareState, mCache.mWifiHardwareState);
+ getIteminReport(report.mNetworkInfo, mCache.mNetworkInfo);
+ getIteminReport(report.mRilServiceInfo, mCache.mRilServiceInfo);
+ getIteminReport(report.mRilCellInfo, mCache.mRilCellInfo);
+ getIteminReport(report.mServiceStatus, mCache.mServiceStatus);
+ getIteminReport(report.mModel, mCache.mModel);
+ getIteminReport(report.mManufacturer, mCache.mManufacturer);
+ getIteminReport(report.mAssistedGps, mCache.mAssistedGps);
+ getIteminReport(report.mScreenState, mCache.mScreenState);
+ getIteminReport(report.mPowerConnectState, mCache.mPowerConnectState);
+ getIteminReport(report.mTimeZoneChange, mCache.mTimeZoneChange);
+ getIteminReport(report.mTimeChange, mCache.mTimeChange);
+ getIteminReport(report.mWifiSupplicantStatus, mCache.mWifiSupplicantStatus);
+ getIteminReport(report.mShutdownState, mCache.mShutdownState);
+ getIteminReport(report.mTac, mCache.mTac);
+ getIteminReport(report.mMccMnc, mCache.mMccMnc);
+ getIteminReport(report.mBtDeviceScanDetail, mCache.mBtDeviceScanDetail);
+ getIteminReport(report.mBtLeDeviceScanDetail, mCache.mBtLeDeviceScanDetail);
+ }
+ else {
+ // copy entire reports and return them
+ report.mLocation.clear();
+
+ report.mTimeAndClock.clear();
+ report.mXoState.clear();
+ report.mRfAndParams.clear();
+ report.mErrRecovery.clear();
+
+ report.mInjectedPosition.clear();
+ report.mBestPosition.clear();
+ report.mXtra.clear();
+ report.mEphemeris.clear();
+ report.mSvHealth.clear();
+ report.mPdr.clear();
+ report.mNavData.clear();
+
+ report.mPositionFailure.clear();
+
+ report.mAirplaneMode.clear();
+ report.mENH.clear();
+ report.mGPSState.clear();
+ report.mNLPStatus.clear();
+ report.mWifiHardwareState.clear();
+ report.mNetworkInfo.clear();
+ report.mRilServiceInfo.clear();
+ report.mRilCellInfo.clear();
+ report.mServiceStatus.clear();
+ report.mModel.clear();
+ report.mManufacturer.clear();
+ report.mAssistedGps.clear();
+ report.mScreenState.clear();
+ report.mPowerConnectState.clear();
+ report.mTimeZoneChange.clear();
+ report.mTimeChange.clear();
+ report.mWifiSupplicantStatus.clear();
+ report.mShutdownState.clear();
+ report.mTac.clear();
+ report.mMccMnc.clear();
+ report.mBtDeviceScanDetail.clear();
+ report.mBtLeDeviceScanDetail.clear();
+
+ report = mCache;
+ }
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return true;
+}
+
+/******************************************************************************
+@brief API to set default report data
+
+@param[In] none
+
+@return true when successfully done
+******************************************************************************/
+bool SystemStatus::setDefaultGnssEngineStates(void)
+{
+ pthread_mutex_lock(&mMutexSystemStatus);
+
+ setDefaultIteminReport(mCache.mLocation, SystemStatusLocation());
+
+ setDefaultIteminReport(mCache.mTimeAndClock, SystemStatusTimeAndClock());
+ setDefaultIteminReport(mCache.mXoState, SystemStatusXoState());
+ setDefaultIteminReport(mCache.mRfAndParams, SystemStatusRfAndParams());
+ setDefaultIteminReport(mCache.mErrRecovery, SystemStatusErrRecovery());
+
+ setDefaultIteminReport(mCache.mInjectedPosition, SystemStatusInjectedPosition());
+ setDefaultIteminReport(mCache.mBestPosition, SystemStatusBestPosition());
+ setDefaultIteminReport(mCache.mXtra, SystemStatusXtra());
+ setDefaultIteminReport(mCache.mEphemeris, SystemStatusEphemeris());
+ setDefaultIteminReport(mCache.mSvHealth, SystemStatusSvHealth());
+ setDefaultIteminReport(mCache.mPdr, SystemStatusPdr());
+ setDefaultIteminReport(mCache.mNavData, SystemStatusNavData());
+
+ setDefaultIteminReport(mCache.mPositionFailure, SystemStatusPositionFailure());
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return true;
+}
+
+/******************************************************************************
+@brief API to handle connection status update event from GnssRil
+
+@param[In] Connection status
+
+@return true when successfully done
+******************************************************************************/
+bool SystemStatus::eventConnectionStatus(bool connected, int8_t type,
+ bool roaming, NetworkHandle networkHandle)
+{
+ // send networkinof dataitem to systemstatus observer clients
+ SystemStatusNetworkInfo s(type, "", "", connected, roaming,
+ (uint64_t) networkHandle);
+ mSysStatusObsvr.notify({&s});
+
+ return true;
+}
+
+/******************************************************************************
+@brief API to update power connect state
+
+@param[In] power connect status
+
+@return true when successfully done
+******************************************************************************/
+bool SystemStatus::updatePowerConnectState(bool charging)
+{
+ SystemStatusPowerConnectState s(charging);
+ mSysStatusObsvr.notify({&s});
+ return true;
+}
+} // namespace loc_core
+
diff --git a/gps/core/SystemStatus.h b/gps/core/SystemStatus.h
new file mode 100644
index 0000000..8ec85fa
--- /dev/null
+++ b/gps/core/SystemStatus.h
@@ -0,0 +1,918 @@
+/* Copyright (c) 2017-2019, 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 __SYSTEM_STATUS__
+#define __SYSTEM_STATUS__
+
+#include <stdint.h>
+#include <sys/time.h>
+#include <vector>
+#include <algorithm>
+#include <iterator>
+#include <loc_pla.h>
+#include <log_util.h>
+#include <MsgTask.h>
+#include <IDataItemCore.h>
+#include <IOsObserver.h>
+#include <DataItemConcreteTypesBase.h>
+#include <SystemStatusOsObserver.h>
+
+#include <gps_extended_c.h>
+
+#define GPS_MIN (1) //1-32
+#define SBAS_MIN (33)
+#define GLO_MIN (65) //65-88
+#define QZSS_MIN (193) //193-197
+#define BDS_MIN (201) //201-237
+#define GAL_MIN (301) //301-336
+#define NAVIC_MIN (401) //401-414
+
+#define GPS_NUM (32)
+#define SBAS_NUM (32)
+#define GLO_NUM (24)
+#define QZSS_NUM (5)
+#define BDS_NUM (37)
+#define GAL_NUM (36)
+#define NAVIC_NUM (14)
+#define SV_ALL_NUM_MIN (GPS_NUM + GLO_NUM + QZSS_NUM + BDS_NUM + GAL_NUM) //=134
+#define SV_ALL_NUM (SV_ALL_NUM_MIN + NAVIC_NUM) //=148
+
+namespace loc_core
+{
+
+/******************************************************************************
+ SystemStatus report data structure
+******************************************************************************/
+class SystemStatusItemBase
+{
+public:
+ timespec mUtcTime;
+ timespec mUtcReported;
+ static const uint32_t maxItem = 5;
+
+ SystemStatusItemBase() {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ mUtcTime.tv_sec = tv.tv_sec;
+ mUtcTime.tv_nsec = tv.tv_usec*1000ULL;
+ mUtcReported = mUtcTime;
+ };
+ virtual ~SystemStatusItemBase() {};
+ inline virtual SystemStatusItemBase& collate(SystemStatusItemBase&) {
+ return *this;
+ }
+ virtual void dump(void) {};
+ inline virtual bool ignore() { return false; };
+};
+
+class SystemStatusLocation : public SystemStatusItemBase
+{
+public:
+ bool mValid;
+ UlpLocation mLocation;
+ GpsLocationExtended mLocationEx;
+ inline SystemStatusLocation() :
+ mValid(false) {}
+ inline SystemStatusLocation(const UlpLocation& location,
+ const GpsLocationExtended& locationEx) :
+ mValid(true),
+ mLocation(location),
+ mLocationEx(locationEx) {}
+ bool equals(const SystemStatusLocation& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWM1;
+class SystemStatusTimeAndClock : public SystemStatusItemBase
+{
+public:
+ uint16_t mGpsWeek;
+ uint32_t mGpsTowMs;
+ uint8_t mTimeValid;
+ uint8_t mTimeSource;
+ int32_t mTimeUnc;
+ int32_t mClockFreqBias;
+ int32_t mClockFreqBiasUnc;
+ int32_t mLeapSeconds;
+ int32_t mLeapSecUnc;
+ uint64_t mTimeUncNs;
+ inline SystemStatusTimeAndClock() :
+ mGpsWeek(0),
+ mGpsTowMs(0),
+ mTimeValid(0),
+ mTimeSource(0),
+ mTimeUnc(0),
+ mClockFreqBias(0),
+ mClockFreqBiasUnc(0),
+ mLeapSeconds(0),
+ mLeapSecUnc(0),
+ mTimeUncNs(0ULL) {}
+ inline SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea);
+ bool equals(const SystemStatusTimeAndClock& peer);
+ void dump(void) override;
+};
+
+class SystemStatusXoState : public SystemStatusItemBase
+{
+public:
+ uint8_t mXoState;
+ inline SystemStatusXoState() :
+ mXoState(0) {}
+ inline SystemStatusXoState(const SystemStatusPQWM1& nmea);
+ bool equals(const SystemStatusXoState& peer);
+ void dump(void) override;
+};
+
+class SystemStatusRfAndParams : public SystemStatusItemBase
+{
+public:
+ int32_t mPgaGain;
+ uint32_t mGpsBpAmpI;
+ uint32_t mGpsBpAmpQ;
+ uint32_t mAdcI;
+ uint32_t mAdcQ;
+ uint32_t mJammerGps;
+ uint32_t mJammerGlo;
+ uint32_t mJammerBds;
+ uint32_t mJammerGal;
+ double mAgcGps;
+ 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),
+ mGpsBpAmpQ(0),
+ mAdcI(0),
+ mAdcQ(0),
+ mJammerGps(0),
+ mJammerGlo(0),
+ mJammerBds(0),
+ mJammerGal(0),
+ mAgcGps(0),
+ mAgcGlo(0),
+ mAgcBds(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) override;
+};
+
+class SystemStatusErrRecovery : public SystemStatusItemBase
+{
+public:
+ uint32_t mRecErrorRecovery;
+ inline SystemStatusErrRecovery() :
+ mRecErrorRecovery(0) {};
+ inline SystemStatusErrRecovery(const SystemStatusPQWM1& nmea);
+ bool equals(const SystemStatusErrRecovery& peer);
+ inline bool ignore() override { return 0 == mRecErrorRecovery; };
+ void dump(void) override;
+};
+
+class SystemStatusPQWP1;
+class SystemStatusInjectedPosition : public SystemStatusItemBase
+{
+public:
+ uint8_t mEpiValidity;
+ float mEpiLat;
+ float mEpiLon;
+ float mEpiAlt;
+ float mEpiHepe;
+ float mEpiAltUnc;
+ uint8_t mEpiSrc;
+ inline SystemStatusInjectedPosition() :
+ mEpiValidity(0),
+ mEpiLat(0),
+ mEpiLon(0),
+ mEpiAlt(0),
+ mEpiHepe(0),
+ mEpiAltUnc(0),
+ mEpiSrc(0) {}
+ inline SystemStatusInjectedPosition(const SystemStatusPQWP1& nmea);
+ bool equals(const SystemStatusInjectedPosition& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWP2;
+class SystemStatusBestPosition : public SystemStatusItemBase
+{
+public:
+ bool mValid;
+ float mBestLat;
+ float mBestLon;
+ float mBestAlt;
+ float mBestHepe;
+ float mBestAltUnc;
+ inline SystemStatusBestPosition() :
+ mValid(false),
+ mBestLat(0),
+ mBestLon(0),
+ mBestAlt(0),
+ mBestHepe(0),
+ mBestAltUnc(0) {}
+ inline SystemStatusBestPosition(const SystemStatusPQWP2& nmea);
+ bool equals(const SystemStatusBestPosition& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWP3;
+class SystemStatusXtra : public SystemStatusItemBase
+{
+public:
+ uint8_t mXtraValidMask;
+ uint32_t mGpsXtraAge;
+ uint32_t mGloXtraAge;
+ uint32_t mBdsXtraAge;
+ uint32_t mGalXtraAge;
+ uint32_t mQzssXtraAge;
+ uint32_t mNavicXtraAge;
+ uint32_t mGpsXtraValid;
+ uint32_t mGloXtraValid;
+ uint64_t mBdsXtraValid;
+ uint64_t mGalXtraValid;
+ uint8_t mQzssXtraValid;
+ uint32_t mNavicXtraValid;
+ inline SystemStatusXtra() :
+ mXtraValidMask(0),
+ mGpsXtraAge(0),
+ mGloXtraAge(0),
+ mBdsXtraAge(0),
+ mGalXtraAge(0),
+ mQzssXtraAge(0),
+ mNavicXtraAge(0),
+ mGpsXtraValid(0),
+ mGloXtraValid(0),
+ mBdsXtraValid(0ULL),
+ mGalXtraValid(0ULL),
+ mQzssXtraValid(0),
+ mNavicXtraValid(0) {}
+ inline SystemStatusXtra(const SystemStatusPQWP3& nmea);
+ bool equals(const SystemStatusXtra& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWP4;
+class SystemStatusEphemeris : public SystemStatusItemBase
+{
+public:
+ uint32_t mGpsEpheValid;
+ uint32_t mGloEpheValid;
+ uint64_t mBdsEpheValid;
+ uint64_t mGalEpheValid;
+ uint8_t mQzssEpheValid;
+ inline SystemStatusEphemeris() :
+ mGpsEpheValid(0),
+ mGloEpheValid(0),
+ mBdsEpheValid(0ULL),
+ mGalEpheValid(0ULL),
+ mQzssEpheValid(0) {}
+ inline SystemStatusEphemeris(const SystemStatusPQWP4& nmea);
+ bool equals(const SystemStatusEphemeris& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWP5;
+class SystemStatusSvHealth : public SystemStatusItemBase
+{
+public:
+ uint32_t mGpsUnknownMask;
+ uint32_t mGloUnknownMask;
+ uint64_t mBdsUnknownMask;
+ uint64_t mGalUnknownMask;
+ uint8_t mQzssUnknownMask;
+ uint32_t mNavicUnknownMask;
+ uint32_t mGpsGoodMask;
+ uint32_t mGloGoodMask;
+ uint64_t mBdsGoodMask;
+ uint64_t mGalGoodMask;
+ uint8_t mQzssGoodMask;
+ uint32_t mNavicGoodMask;
+ uint32_t mGpsBadMask;
+ uint32_t mGloBadMask;
+ uint64_t mBdsBadMask;
+ uint64_t mGalBadMask;
+ uint8_t mQzssBadMask;
+ uint32_t mNavicBadMask;
+ inline SystemStatusSvHealth() :
+ mGpsUnknownMask(0),
+ mGloUnknownMask(0),
+ mBdsUnknownMask(0ULL),
+ mGalUnknownMask(0ULL),
+ mQzssUnknownMask(0),
+ mNavicUnknownMask(0),
+ mGpsGoodMask(0),
+ mGloGoodMask(0),
+ mBdsGoodMask(0ULL),
+ mGalGoodMask(0ULL),
+ mQzssGoodMask(0),
+ mNavicGoodMask(0),
+ mGpsBadMask(0),
+ mGloBadMask(0),
+ mBdsBadMask(0ULL),
+ mGalBadMask(0ULL),
+ mQzssBadMask(0),
+ mNavicBadMask(0) {}
+ inline SystemStatusSvHealth(const SystemStatusPQWP5& nmea);
+ bool equals(const SystemStatusSvHealth& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWP6;
+class SystemStatusPdr : public SystemStatusItemBase
+{
+public:
+ uint32_t mFixInfoMask;
+ inline SystemStatusPdr() :
+ mFixInfoMask(0) {}
+ inline SystemStatusPdr(const SystemStatusPQWP6& nmea);
+ bool equals(const SystemStatusPdr& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWP7;
+struct SystemStatusNav
+{
+ GnssEphemerisType mType;
+ GnssEphemerisSource mSource;
+ int32_t mAgeSec;
+};
+
+class SystemStatusNavData : public SystemStatusItemBase
+{
+public:
+ SystemStatusNav mNav[SV_ALL_NUM];
+ inline SystemStatusNavData() {
+ for (uint32_t i=0; i<SV_ALL_NUM; i++) {
+ mNav[i].mType = GNSS_EPH_TYPE_UNKNOWN;
+ mNav[i].mSource = GNSS_EPH_SOURCE_UNKNOWN;
+ mNav[i].mAgeSec = 0;
+ }
+ }
+ inline SystemStatusNavData(const SystemStatusPQWP7& nmea);
+ bool equals(const SystemStatusNavData& peer);
+ void dump(void) override;
+};
+
+class SystemStatusPQWS1;
+class SystemStatusPositionFailure : public SystemStatusItemBase
+{
+public:
+ uint32_t mFixInfoMask;
+ uint32_t mHepeLimit;
+ inline SystemStatusPositionFailure() :
+ mFixInfoMask(0),
+ mHepeLimit(0) {}
+ inline SystemStatusPositionFailure(const SystemStatusPQWS1& nmea);
+ bool equals(const SystemStatusPositionFailure& peer);
+ void dump(void) override;
+};
+
+/******************************************************************************
+ SystemStatus report data structure - from DataItem observer
+******************************************************************************/
+class SystemStatusAirplaneMode : public SystemStatusItemBase,
+ public AirplaneModeDataItemBase
+{
+public:
+ inline SystemStatusAirplaneMode(bool mode=false) :
+ AirplaneModeDataItemBase(mode) {}
+ inline SystemStatusAirplaneMode(const AirplaneModeDataItemBase& itemBase) :
+ AirplaneModeDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusAirplaneMode& peer) {
+ return (mMode == peer.mMode);
+ }
+};
+
+class SystemStatusENH : public SystemStatusItemBase,
+ public ENHDataItemBase
+{
+public:
+ inline SystemStatusENH(bool enabled=false) :
+ ENHDataItemBase(enabled) {}
+ inline SystemStatusENH(const ENHDataItemBase& itemBase) :
+ ENHDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusENH& peer) {
+ return (mEnabled == peer.mEnabled);
+ }
+};
+
+class SystemStatusGpsState : public SystemStatusItemBase,
+ public GPSStateDataItemBase
+{
+public:
+ inline SystemStatusGpsState(bool enabled=false) :
+ GPSStateDataItemBase(enabled) {}
+ inline SystemStatusGpsState(const GPSStateDataItemBase& itemBase) :
+ GPSStateDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusGpsState& peer) {
+ return (mEnabled == peer.mEnabled);
+ }
+ inline void dump(void) override {
+ LOC_LOGD("GpsState: state=%u", mEnabled);
+ }
+};
+
+class SystemStatusNLPStatus : public SystemStatusItemBase,
+ public NLPStatusDataItemBase
+{
+public:
+ inline SystemStatusNLPStatus(bool enabled=false) :
+ NLPStatusDataItemBase(enabled) {}
+ inline SystemStatusNLPStatus(const NLPStatusDataItemBase& itemBase) :
+ NLPStatusDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusNLPStatus& peer) {
+ return (mEnabled == peer.mEnabled);
+ }
+};
+
+class SystemStatusWifiHardwareState : public SystemStatusItemBase,
+ public WifiHardwareStateDataItemBase
+{
+public:
+ inline SystemStatusWifiHardwareState(bool enabled=false) :
+ WifiHardwareStateDataItemBase(enabled) {}
+ inline SystemStatusWifiHardwareState(const WifiHardwareStateDataItemBase& itemBase) :
+ WifiHardwareStateDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusWifiHardwareState& peer) {
+ return (mEnabled == peer.mEnabled);
+ }
+};
+
+class SystemStatusNetworkInfo : public SystemStatusItemBase,
+ public NetworkInfoDataItemBase
+{
+ NetworkInfoDataItemBase* mSrcObjPtr;
+public:
+ inline SystemStatusNetworkInfo(
+ int32_t type=0,
+ std::string typeName="",
+ string subTypeName="",
+ bool connected=false,
+ bool roaming=false,
+ uint64_t networkHandle=NETWORK_HANDLE_UNKNOWN) :
+ NetworkInfoDataItemBase(
+ (NetworkType)type,
+ type,
+ typeName,
+ subTypeName,
+ connected && (!roaming),
+ connected,
+ roaming,
+ networkHandle),
+ mSrcObjPtr(nullptr) {}
+ inline SystemStatusNetworkInfo(const NetworkInfoDataItemBase& itemBase) :
+ NetworkInfoDataItemBase(itemBase),
+ mSrcObjPtr((NetworkInfoDataItemBase*)&itemBase) {
+ mType = itemBase.getType();
+ }
+ inline bool equals(const SystemStatusNetworkInfo& peer) {
+ for (uint8_t i = 0; i < MAX_NETWORK_HANDLES; ++i) {
+ if (!(mAllNetworkHandles[i] == peer.mAllNetworkHandles[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) {
+ uint64_t allTypes = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mAllTypes;
+ uint64_t networkHandle =
+ (static_cast<SystemStatusNetworkInfo&>(curInfo)).mNetworkHandle;
+ int32_t type = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mType;
+ // Replace current with cached table for now and then update
+ memcpy(mAllNetworkHandles,
+ (static_cast<SystemStatusNetworkInfo&>(curInfo)).getNetworkHandle(),
+ sizeof(mAllNetworkHandles));
+ if (mConnected) {
+ mAllTypes |= allTypes;
+ for (uint8_t i = 0; i < MAX_NETWORK_HANDLES; ++i) {
+ if (mNetworkHandle == mAllNetworkHandles[i].networkHandle) {
+ LOC_LOGD("collate duplicate detected, not updating");
+ break;
+ }
+ if (NETWORK_HANDLE_UNKNOWN == mAllNetworkHandles[i].networkHandle) {
+ mAllNetworkHandles[i].networkHandle = mNetworkHandle;
+ mAllNetworkHandles[i].networkType = (loc_core::NetworkType) mType;
+ break;
+ }
+ }
+ } else if (0 != mAllTypes) {
+ uint8_t deletedIndex = MAX_NETWORK_HANDLES;
+ uint8_t lastValidIndex = 0;
+ uint8_t typeCount = 0;
+ for (; lastValidIndex < MAX_NETWORK_HANDLES &&
+ NETWORK_HANDLE_UNKNOWN != mAllNetworkHandles[lastValidIndex].networkHandle;
+ ++lastValidIndex) {
+ // Maintain count for number of network handles still
+ // connected for given type
+ if (mType == mAllNetworkHandles[lastValidIndex].networkType) {
+ typeCount++;
+ }
+
+ if (mNetworkHandle == mAllNetworkHandles[lastValidIndex].networkHandle) {
+ deletedIndex = lastValidIndex;
+ typeCount--;
+ }
+ }
+
+ if (MAX_NETWORK_HANDLES != deletedIndex) {
+ LOC_LOGD("deletedIndex:%u, lastValidIndex:%u, typeCount:%u",
+ deletedIndex, lastValidIndex, typeCount);
+ mAllNetworkHandles[deletedIndex] = mAllNetworkHandles[lastValidIndex];
+ mAllNetworkHandles[lastValidIndex].networkHandle = NETWORK_HANDLE_UNKNOWN;
+ mAllNetworkHandles[lastValidIndex].networkType = TYPE_UNKNOWN;
+ }
+
+ // If no more handles of given type, set bitmask
+ if (0 == typeCount) {
+ mAllTypes = (allTypes & (~mAllTypes));
+ LOC_LOGD("mAllTypes:%" PRIx64, 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;
+ memcpy(mSrcObjPtr->mAllNetworkHandles,
+ mAllNetworkHandles,
+ sizeof(mSrcObjPtr->mAllNetworkHandles));
+ }
+ return *this;
+ }
+ inline void dump(void) override {
+ LOC_LOGD("NetworkInfo: mAllTypes=%" PRIx64 " connected=%u mType=%x",
+ mAllTypes, mConnected, mType);
+ }
+};
+
+class SystemStatusServiceInfo : public SystemStatusItemBase,
+ public RilServiceInfoDataItemBase
+{
+public:
+ inline SystemStatusServiceInfo() :
+ RilServiceInfoDataItemBase() {}
+ inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) :
+ RilServiceInfoDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusServiceInfo& peer) {
+ return static_cast<const RilServiceInfoDataItemBase&>(peer) ==
+ static_cast<const RilServiceInfoDataItemBase&>(*this);
+ }
+};
+
+class SystemStatusRilCellInfo : public SystemStatusItemBase,
+ public RilCellInfoDataItemBase
+{
+public:
+ inline SystemStatusRilCellInfo() :
+ RilCellInfoDataItemBase() {}
+ inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) :
+ RilCellInfoDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusRilCellInfo& peer) {
+ return static_cast<const RilCellInfoDataItemBase&>(peer) ==
+ static_cast<const RilCellInfoDataItemBase&>(*this);
+ }
+};
+
+class SystemStatusServiceStatus : public SystemStatusItemBase,
+ public ServiceStatusDataItemBase
+{
+public:
+ inline SystemStatusServiceStatus(int32_t mServiceState=0) :
+ ServiceStatusDataItemBase(mServiceState) {}
+ inline SystemStatusServiceStatus(const ServiceStatusDataItemBase& itemBase) :
+ ServiceStatusDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusServiceStatus& peer) {
+ return (mServiceState == peer.mServiceState);
+ }
+};
+
+class SystemStatusModel : public SystemStatusItemBase,
+ public ModelDataItemBase
+{
+public:
+ inline SystemStatusModel(string name="") :
+ ModelDataItemBase(name) {}
+ inline SystemStatusModel(const ModelDataItemBase& itemBase) :
+ ModelDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusModel& peer) {
+ return (mModel == peer.mModel);
+ }
+};
+
+class SystemStatusManufacturer : public SystemStatusItemBase,
+ public ManufacturerDataItemBase
+{
+public:
+ inline SystemStatusManufacturer(string name="") :
+ ManufacturerDataItemBase(name) {}
+ inline SystemStatusManufacturer(const ManufacturerDataItemBase& itemBase) :
+ ManufacturerDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusManufacturer& peer) {
+ return (mManufacturer == peer.mManufacturer);
+ }
+};
+
+class SystemStatusAssistedGps : public SystemStatusItemBase,
+ public AssistedGpsDataItemBase
+{
+public:
+ inline SystemStatusAssistedGps(bool enabled=false) :
+ AssistedGpsDataItemBase(enabled) {}
+ inline SystemStatusAssistedGps(const AssistedGpsDataItemBase& itemBase) :
+ AssistedGpsDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusAssistedGps& peer) {
+ return (mEnabled == peer.mEnabled);
+ }
+};
+
+class SystemStatusScreenState : public SystemStatusItemBase,
+ public ScreenStateDataItemBase
+{
+public:
+ inline SystemStatusScreenState(bool state=false) :
+ ScreenStateDataItemBase(state) {}
+ inline SystemStatusScreenState(const ScreenStateDataItemBase& itemBase) :
+ ScreenStateDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusScreenState& peer) {
+ return (mState == peer.mState);
+ }
+};
+
+class SystemStatusPowerConnectState : public SystemStatusItemBase,
+ public PowerConnectStateDataItemBase
+{
+public:
+ inline SystemStatusPowerConnectState(bool state=false) :
+ PowerConnectStateDataItemBase(state) {}
+ inline SystemStatusPowerConnectState(const PowerConnectStateDataItemBase& itemBase) :
+ PowerConnectStateDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusPowerConnectState& peer) {
+ return (mState == peer.mState);
+ }
+};
+
+class SystemStatusTimeZoneChange : public SystemStatusItemBase,
+ public TimeZoneChangeDataItemBase
+{
+public:
+ inline SystemStatusTimeZoneChange(
+ int64_t currTimeMillis=0ULL, int32_t rawOffset=0, int32_t dstOffset=0) :
+ TimeZoneChangeDataItemBase(currTimeMillis, rawOffset, dstOffset) {}
+ inline SystemStatusTimeZoneChange(const TimeZoneChangeDataItemBase& itemBase) :
+ TimeZoneChangeDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusTimeZoneChange& peer) {
+ return ((mCurrTimeMillis == peer.mCurrTimeMillis) &&
+ (mRawOffsetTZ == peer.mRawOffsetTZ) &&
+ (mDstOffsetTZ == peer.mDstOffsetTZ));
+ }
+};
+
+class SystemStatusTimeChange : public SystemStatusItemBase,
+ public TimeChangeDataItemBase
+{
+public:
+ inline SystemStatusTimeChange(
+ int64_t currTimeMillis=0ULL, int32_t rawOffset=0, int32_t dstOffset=0) :
+ TimeChangeDataItemBase(currTimeMillis, rawOffset, dstOffset) {}
+ inline SystemStatusTimeChange(const TimeChangeDataItemBase& itemBase) :
+ TimeChangeDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusTimeChange& peer) {
+ return ((mCurrTimeMillis == peer.mCurrTimeMillis) &&
+ (mRawOffsetTZ == peer.mRawOffsetTZ) &&
+ (mDstOffsetTZ == peer.mDstOffsetTZ));
+ }
+};
+
+class SystemStatusWifiSupplicantStatus : public SystemStatusItemBase,
+ public WifiSupplicantStatusDataItemBase
+{
+public:
+ inline SystemStatusWifiSupplicantStatus() :
+ WifiSupplicantStatusDataItemBase() {}
+ inline SystemStatusWifiSupplicantStatus(const WifiSupplicantStatusDataItemBase& itemBase) :
+ WifiSupplicantStatusDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusWifiSupplicantStatus& peer) {
+ return ((mState == peer.mState) &&
+ (mApMacAddressValid == peer.mApMacAddressValid) &&
+ (mWifiApSsidValid == peer.mWifiApSsidValid) &&
+ (mWifiApSsid == peer.mWifiApSsid));
+ }
+};
+
+class SystemStatusShutdownState : public SystemStatusItemBase,
+ public ShutdownStateDataItemBase
+{
+public:
+ inline SystemStatusShutdownState(bool state=false) :
+ ShutdownStateDataItemBase(state) {}
+ inline SystemStatusShutdownState(const ShutdownStateDataItemBase& itemBase) :
+ ShutdownStateDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusShutdownState& peer) {
+ return (mState == peer.mState);
+ }
+};
+
+class SystemStatusTac : public SystemStatusItemBase,
+ public TacDataItemBase
+{
+public:
+ inline SystemStatusTac(std::string value="") :
+ TacDataItemBase(value) {}
+ inline SystemStatusTac(const TacDataItemBase& itemBase) :
+ TacDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusTac& peer) {
+ return (mValue == peer.mValue);
+ }
+ inline void dump(void) override {
+ LOC_LOGD("Tac: value=%s", mValue.c_str());
+ }
+};
+
+class SystemStatusMccMnc : public SystemStatusItemBase,
+ public MccmncDataItemBase
+{
+public:
+ inline SystemStatusMccMnc(std::string value="") :
+ MccmncDataItemBase(value) {}
+ inline SystemStatusMccMnc(const MccmncDataItemBase& itemBase) :
+ MccmncDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusMccMnc& peer) {
+ return (mValue == peer.mValue);
+ }
+ inline void dump(void) override {
+ LOC_LOGD("TacMccMnc value=%s", mValue.c_str());
+ }
+};
+
+class SystemStatusBtDeviceScanDetail : public SystemStatusItemBase,
+ public BtDeviceScanDetailsDataItemBase
+{
+public:
+ inline SystemStatusBtDeviceScanDetail() :
+ BtDeviceScanDetailsDataItemBase() {}
+ inline SystemStatusBtDeviceScanDetail(const BtDeviceScanDetailsDataItemBase& itemBase) :
+ BtDeviceScanDetailsDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusBtDeviceScanDetail& peer) {
+ return ((mApSrnRssi == peer.mApSrnRssi) &&
+ (0 == memcmp(mApSrnMacAddress, peer.mApSrnMacAddress, sizeof(mApSrnMacAddress))) &&
+ (mApSrnTimestamp == peer.mApSrnTimestamp) &&
+ (mRequestTimestamp == peer.mRequestTimestamp) &&
+ (mReceiveTimestamp == peer.mReceiveTimestamp));
+ }
+};
+
+class SystemStatusBtleDeviceScanDetail : public SystemStatusItemBase,
+ public BtLeDeviceScanDetailsDataItemBase
+{
+public:
+ inline SystemStatusBtleDeviceScanDetail() :
+ BtLeDeviceScanDetailsDataItemBase() {}
+ inline SystemStatusBtleDeviceScanDetail(const BtLeDeviceScanDetailsDataItemBase& itemBase) :
+ BtLeDeviceScanDetailsDataItemBase(itemBase) {}
+ inline bool equals(const SystemStatusBtleDeviceScanDetail& peer) {
+ return ((mApSrnRssi == peer.mApSrnRssi) &&
+ (0 == memcmp(mApSrnMacAddress, peer.mApSrnMacAddress, sizeof(mApSrnMacAddress))) &&
+ (mApSrnTimestamp == peer.mApSrnTimestamp) &&
+ (mRequestTimestamp == peer.mRequestTimestamp) &&
+ (mReceiveTimestamp == peer.mReceiveTimestamp));
+ }
+};
+
+/******************************************************************************
+ SystemStatusReports
+******************************************************************************/
+class SystemStatusReports
+{
+public:
+ // from QMI_LOC indication
+ std::vector<SystemStatusLocation> mLocation;
+
+ // from ME debug NMEA
+ std::vector<SystemStatusTimeAndClock> mTimeAndClock;
+ std::vector<SystemStatusXoState> mXoState;
+ std::vector<SystemStatusRfAndParams> mRfAndParams;
+ std::vector<SystemStatusErrRecovery> mErrRecovery;
+
+ // from PE debug NMEA
+ std::vector<SystemStatusInjectedPosition> mInjectedPosition;
+ std::vector<SystemStatusBestPosition> mBestPosition;
+ std::vector<SystemStatusXtra> mXtra;
+ std::vector<SystemStatusEphemeris> mEphemeris;
+ std::vector<SystemStatusSvHealth> mSvHealth;
+ std::vector<SystemStatusPdr> mPdr;
+ std::vector<SystemStatusNavData> mNavData;
+
+ // from SM debug NMEA
+ std::vector<SystemStatusPositionFailure> mPositionFailure;
+
+ // from dataitems observer
+ std::vector<SystemStatusAirplaneMode> mAirplaneMode;
+ std::vector<SystemStatusENH> mENH;
+ std::vector<SystemStatusGpsState> mGPSState;
+ std::vector<SystemStatusNLPStatus> mNLPStatus;
+ std::vector<SystemStatusWifiHardwareState> mWifiHardwareState;
+ std::vector<SystemStatusNetworkInfo> mNetworkInfo;
+ std::vector<SystemStatusServiceInfo> mRilServiceInfo;
+ std::vector<SystemStatusRilCellInfo> mRilCellInfo;
+ std::vector<SystemStatusServiceStatus> mServiceStatus;
+ std::vector<SystemStatusModel> mModel;
+ std::vector<SystemStatusManufacturer> mManufacturer;
+ std::vector<SystemStatusAssistedGps> mAssistedGps;
+ std::vector<SystemStatusScreenState> mScreenState;
+ std::vector<SystemStatusPowerConnectState> mPowerConnectState;
+ std::vector<SystemStatusTimeZoneChange> mTimeZoneChange;
+ std::vector<SystemStatusTimeChange> mTimeChange;
+ std::vector<SystemStatusWifiSupplicantStatus> mWifiSupplicantStatus;
+ std::vector<SystemStatusShutdownState> mShutdownState;
+ std::vector<SystemStatusTac> mTac;
+ std::vector<SystemStatusMccMnc> mMccMnc;
+ std::vector<SystemStatusBtDeviceScanDetail> mBtDeviceScanDetail;
+ std::vector<SystemStatusBtleDeviceScanDetail> mBtLeDeviceScanDetail;
+};
+
+/******************************************************************************
+ SystemStatus
+******************************************************************************/
+class SystemStatus
+{
+private:
+ static SystemStatus *mInstance;
+ SystemStatusOsObserver mSysStatusObsvr;
+ // ctor
+ SystemStatus(const MsgTask* msgTask);
+ // dtor
+ inline ~SystemStatus() {}
+
+ // Data members
+ static pthread_mutex_t mMutexSystemStatus;
+ SystemStatusReports mCache;
+
+ template <typename TYPE_REPORT, typename TYPE_ITEM>
+ bool setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s);
+
+ // set default dataitem derived item in report cache
+ template <typename TYPE_REPORT, typename TYPE_ITEM>
+ void setDefaultIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s);
+
+ template <typename TYPE_REPORT, typename TYPE_ITEM>
+ void getIteminReport(TYPE_REPORT& reportout, const TYPE_ITEM& c) const;
+
+public:
+ // Static methods
+ static SystemStatus* getInstance(const MsgTask* msgTask);
+ static void destroyInstance();
+ IOsObserver* getOsObserver();
+
+ // Helpers
+ bool eventPosition(const UlpLocation& location,const GpsLocationExtended& locationEx);
+ bool eventDataItemNotify(IDataItemCore* dataitem);
+ bool setNmeaString(const char *data, uint32_t len);
+ bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const;
+ bool setDefaultGnssEngineStates(void);
+ bool eventConnectionStatus(bool connected, int8_t type,
+ bool roaming, NetworkHandle networkHandle);
+ bool updatePowerConnectState(bool charging);
+};
+
+} // namespace loc_core
+
+#endif //__SYSTEM_STATUS__
+
diff --git a/gps/core/SystemStatusOsObserver.cpp b/gps/core/SystemStatusOsObserver.cpp
new file mode 100644
index 0000000..98f5f74
--- /dev/null
+++ b/gps/core/SystemStatusOsObserver.cpp
@@ -0,0 +1,580 @@
+/* Copyright (c) 2015-2020, 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.
+ *
+ */
+#define LOG_TAG "LocSvc_SystemStatusOsObserver"
+
+#include <algorithm>
+#include <SystemStatus.h>
+#include <SystemStatusOsObserver.h>
+#include <IDataItemCore.h>
+#include <DataItemsFactoryProxy.h>
+
+namespace loc_core
+{
+template <typename CINT, typename COUT>
+COUT SystemStatusOsObserver::containerTransfer(CINT& inContainer) {
+ COUT outContainer = {};
+ for (auto item : inContainer) {
+ outContainer.insert(outContainer.begin(), item);
+ }
+ return outContainer;
+}
+
+SystemStatusOsObserver::~SystemStatusOsObserver() {
+ // Close data-item library handle
+ DataItemsFactoryProxy::closeDataItemLibraryHandle();
+
+ // Destroy cache
+ for (auto each : mDataItemCache) {
+ if (nullptr != each.second) {
+ delete each.second;
+ }
+ }
+
+ mDataItemCache.clear();
+}
+
+void SystemStatusOsObserver::setSubscriptionObj(IDataItemSubscription* subscriptionObj)
+{
+ struct SetSubsObj : public LocMsg {
+ ObserverContext& mContext;
+ IDataItemSubscription* mSubsObj;
+ inline SetSubsObj(ObserverContext& context, IDataItemSubscription* subscriptionObj) :
+ mContext(context), mSubsObj(subscriptionObj) {}
+ void proc() const {
+ LOC_LOGi("SetSubsObj::enter");
+ 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);
+ }
+ LOC_LOGi("SetSubsObj::exit");
+ }
+ };
+
+ 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,
+ bool toRequestData)
+{
+ struct HandleSubscribeReq : public LocMsg {
+ inline HandleSubscribeReq(SystemStatusOsObserver* parent,
+ list<DataItemId>& l, IDataItemObserver* client, bool requestData) :
+ mParent(parent), mClient(client),
+ mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)),
+ diItemlist(l),
+ mToRequestData(requestData) {}
+
+ void proc() const {
+ unordered_set<DataItemId> dataItemsToSubscribe = {};
+ mParent->mDataItemToClients.add(mDataItemSet, {mClient}, &dataItemsToSubscribe);
+ mParent->mClientToDataItems.add(mClient, mDataItemSet);
+
+ mParent->sendCachedDataItems(mDataItemSet, mClient);
+
+ // Send subscription set to framework
+ if (nullptr != mParent->mContext.mSubscriptionObj) {
+ if (mToRequestData) {
+ LOC_LOGD("Request Data sent to framework for the following");
+ mParent->mContext.mSubscriptionObj->requestData(diItemlist, mParent);
+ } else 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);
+ }
+ }
+ }
+ mutable SystemStatusOsObserver* mParent;
+ IDataItemObserver* mClient;
+ const unordered_set<DataItemId> mDataItemSet;
+ const list<DataItemId> diItemlist;
+ bool mToRequestData;
+ };
+
+ 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)
+{
+ struct HandleUpdateSubscriptionReq : public LocMsg {
+ HandleUpdateSubscriptionReq(SystemStatusOsObserver* parent,
+ list<DataItemId>& l, IDataItemObserver* client) :
+ mParent(parent), mClient(client),
+ mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
+
+ void proc() const {
+ unordered_set<DataItemId> dataItemsToSubscribe = {};
+ unordered_set<DataItemId> dataItemsToUnsubscribe = {};
+ 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->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);
+ }
+
+ // Send unsubscribe to framework
+ 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;
+ unordered_set<DataItemId> mDataItemSet;
+ };
+
+ 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));
+ }
+}
+
+void SystemStatusOsObserver::unsubscribe(
+ const list<DataItemId>& l, IDataItemObserver* client)
+{
+ struct HandleUnsubscribeReq : public LocMsg {
+ HandleUnsubscribeReq(SystemStatusOsObserver* parent,
+ list<DataItemId>& l, IDataItemObserver* client) :
+ mParent(parent), mClient(client),
+ mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
+
+ void proc() const {
+ unordered_set<DataItemId> dataItemsUnusedByClient = {};
+ unordered_set<IDataItemObserver*> clientToRemove = {};
+ unordered_set<DataItemId> dataItemsToUnsubscribe = {};
+ mParent->mClientToDataItems.trimOrRemove({mClient}, mDataItemSet, &clientToRemove,
+ &dataItemsUnusedByClient);
+ 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);
+
+ // Send unsubscribe to framework
+ mParent->mContext.mSubscriptionObj->unsubscribe(
+ containerTransfer<unordered_set<DataItemId>, list<DataItemId>>(
+ std::move(dataItemsToUnsubscribe)),
+ mParent);
+ }
+ }
+ SystemStatusOsObserver* mParent;
+ IDataItemObserver* mClient;
+ unordered_set<DataItemId> mDataItemSet;
+ };
+
+ 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)
+{
+ struct HandleUnsubscribeAllReq : public LocMsg {
+ HandleUnsubscribeAllReq(SystemStatusOsObserver* parent,
+ IDataItemObserver* client) :
+ mParent(parent), mClient(client) {}
+
+ 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;
+ };
+
+ if (nullptr == client) {
+ LOC_LOGw("Data item set is empty or client is nullptr");
+ } else {
+ mContext.mMsgTask->sendMsg(new HandleUnsubscribeAllReq(this, client));
+ }
+}
+
+/******************************************************************************
+ IDataItemObserver Overrides
+******************************************************************************/
+void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
+{
+ struct HandleNotify : public LocMsg {
+ 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.
+ unordered_set<DataItemId> dataItemIdsToBeSent = {};
+ for (auto item : mDiVec) {
+ if (mParent->updateCache(item)) {
+ dataItemIdsToBeSent.insert(item->getId());
+ }
+ }
+
+ // Send data item to all subscribed clients
+ unordered_set<IDataItemObserver*> clientSet = {};
+ for (auto each : dataItemIdsToBeSent) {
+ auto clients = mParent->mDataItemToClients.getValSetPtr(each);
+ if (nullptr != clients) {
+ clientSet.insert(clients->begin(), clients->end());
+ }
+ }
+
+ 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 vector<IDataItemCore*> mDiVec;
+ };
+
+ if (!dlist.empty()) {
+ vector<IDataItemCore*> dataItemVec(dlist.size());
+
+ for (auto each : dlist) {
+
+ 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_LOC_LOGD {
+ string dv;
+ di->stringify(dv);
+ LOC_LOGd("notify: DataItem In Value:%s", dv.c_str());
+ }
+ }
+
+ if (!dataItemVec.empty()) {
+ mContext.mMsgTask->sendMsg(new HandleNotify(this, dataItemVec));
+ }
+ }
+}
+
+/******************************************************************************
+ IFrameworkActionReq Overrides
+******************************************************************************/
+void SystemStatusOsObserver::turnOn(DataItemId dit, int timeOut)
+{
+ if (nullptr == mContext.mFrameworkActionReqObj) {
+ LOC_LOGE("%s:%d]: Framework action request object is NULL", __func__, __LINE__);
+ return;
+ }
+
+ // Check if data item exists in mActiveRequestCount
+ 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
+ pair<DataItemId, int> cpair(dit, 1);
+ mActiveRequestCount.insert(cpair);
+ LOC_LOGD("Sending turnOn request");
+
+ // Send action turn on to framework
+ struct HandleTurnOnMsg : public LocMsg {
+ HandleTurnOnMsg(IFrameworkActionReq* framework,
+ DataItemId dit, int timeOut) :
+ mFrameworkActionReqObj(framework), mDataItemId(dit), mTimeOut(timeOut) {}
+ virtual ~HandleTurnOnMsg() {}
+ void proc() const {
+ mFrameworkActionReqObj->turnOn(mDataItemId, mTimeOut);
+ }
+ IFrameworkActionReq* mFrameworkActionReqObj;
+ DataItemId mDataItemId;
+ int mTimeOut;
+ };
+ mContext.mMsgTask->sendMsg(
+ new (nothrow) HandleTurnOnMsg(mContext.mFrameworkActionReqObj, dit, timeOut));
+ }
+ else {
+ // Found in map, update reference count
+ citer->second++;
+ LOC_LOGD("turnOn - Data item:%d Num_refs:%d", dit, citer->second);
+ }
+}
+
+void SystemStatusOsObserver::turnOff(DataItemId dit)
+{
+ if (nullptr == mContext.mFrameworkActionReqObj) {
+ LOC_LOGE("%s:%d]: Framework action request object is NULL", __func__, __LINE__);
+ return;
+ }
+
+ // Check if data item exists in mActiveRequestCount
+ DataItemIdToInt::iterator citer = mActiveRequestCount.find(dit);
+ if (citer != mActiveRequestCount.end()) {
+ // found
+ citer->second--;
+ LOC_LOGD("turnOff - Data item:%d Remaining:%d", dit, citer->second);
+ if(citer->second == 0) {
+ // if this was last reference, remove item from map and turn off module
+ mActiveRequestCount.erase(citer);
+
+ // Send action turn off to framework
+ struct HandleTurnOffMsg : public LocMsg {
+ HandleTurnOffMsg(IFrameworkActionReq* framework, DataItemId dit) :
+ mFrameworkActionReqObj(framework), mDataItemId(dit) {}
+ virtual ~HandleTurnOffMsg() {}
+ void proc() const {
+ mFrameworkActionReqObj->turnOff(mDataItemId);
+ }
+ IFrameworkActionReq* mFrameworkActionReqObj;
+ DataItemId mDataItemId;
+ };
+ mContext.mMsgTask->sendMsg(
+ new (nothrow) HandleTurnOffMsg(mContext.mFrameworkActionReqObj, dit));
+ }
+ }
+}
+
+#ifdef USE_GLIB
+bool SystemStatusOsObserver::connectBackhaul()
+{
+ bool result = false;
+
+ if (mContext.mFrameworkActionReqObj != NULL) {
+ struct HandleConnectBackhaul : public LocMsg {
+ HandleConnectBackhaul(IFrameworkActionReq* fwkActReq) :
+ mFwkActionReqObj(fwkActReq) {}
+ virtual ~HandleConnectBackhaul() {}
+ void proc() const {
+ LOC_LOGi("HandleConnectBackhaul::enter");
+ mFwkActionReqObj->connectBackhaul();
+ LOC_LOGi("HandleConnectBackhaul::exit");
+ }
+ IFrameworkActionReq* mFwkActionReqObj;
+ };
+ mContext.mMsgTask->sendMsg(
+ new (nothrow) HandleConnectBackhaul(mContext.mFrameworkActionReqObj));
+ result = true;
+ }
+ else {
+ ++mBackHaulConnectReqCount;
+ LOC_LOGE("Framework action request object is NULL.Caching connect request: %d",
+ mBackHaulConnectReqCount);
+ result = false;
+ }
+ return result;
+
+}
+
+bool SystemStatusOsObserver::disconnectBackhaul()
+{
+ bool result = false;
+
+ if (mContext.mFrameworkActionReqObj != NULL) {
+ struct HandleDisconnectBackhaul : public LocMsg {
+ HandleDisconnectBackhaul(IFrameworkActionReq* fwkActReq) :
+ mFwkActionReqObj(fwkActReq) {}
+ virtual ~HandleDisconnectBackhaul() {}
+ void proc() const {
+ LOC_LOGi("HandleDisconnectBackhaul::enter");
+ mFwkActionReqObj->disconnectBackhaul();
+ LOC_LOGi("HandleDisconnectBackhaul::exit");
+ }
+ IFrameworkActionReq* mFwkActionReqObj;
+ };
+ mContext.mMsgTask->sendMsg(
+ new (nothrow) HandleDisconnectBackhaul(mContext.mFrameworkActionReqObj));
+ }
+ else {
+ if (mBackHaulConnectReqCount > 0) {
+ --mBackHaulConnectReqCount;
+ }
+ LOC_LOGE("Framework action request object is NULL.Caching disconnect request: %d",
+ mBackHaulConnectReqCount);
+ result = false;
+ }
+ return result;
+}
+#endif
+/******************************************************************************
+ Helpers
+******************************************************************************/
+void SystemStatusOsObserver::sendCachedDataItems(
+ const unordered_set<DataItemId>& s, IDataItemObserver* to)
+{
+ if (nullptr == to) {
+ LOC_LOGv("client pointer is NULL.");
+ } else {
+ string clientName;
+ to->getName(clientName);
+ list<IDataItemCore*> dataItems = {};
+
+ 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);
+ }
+ }
+}
+
+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);
+ }
+
+ 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
new file mode 100644
index 0000000..fd60606
--- /dev/null
+++ b/gps/core/SystemStatusOsObserver.h
@@ -0,0 +1,176 @@
+/* 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 __SYSTEM_STATUS_OSOBSERVER__
+#define __SYSTEM_STATUS_OSOBSERVER__
+
+#include <cinttypes>
+#include <string>
+#include <list>
+#include <map>
+#include <new>
+#include <vector>
+
+#include <MsgTask.h>
+#include <DataItemId.h>
+#include <IOsObserver.h>
+#include <loc_pla.h>
+#include <log_util.h>
+#include <LocUnorderedSetMap.h>
+
+namespace loc_core
+{
+/******************************************************************************
+ SystemStatusOsObserver
+******************************************************************************/
+using namespace std;
+using namespace loc_util;
+
+// Forward Declarations
+class IDataItemCore;
+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 ObserverContext {
+ IDataItemSubscription* mSubscriptionObj;
+ IFrameworkActionReq* mFrameworkActionReqObj;
+ const MsgTask* mMsgTask;
+ SystemStatusOsObserver* mSSObserver;
+
+ inline ObserverContext(const MsgTask* msgTask, SystemStatusOsObserver* observer) :
+ mSubscriptionObj(NULL), mFrameworkActionReqObj(NULL),
+ mMsgTask(msgTask), mSSObserver(observer) {}
+};
+
+// 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 SystemStatusOsObserver : public IOsObserver {
+
+public:
+ // ctor
+ 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
+ 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) override;
+ inline virtual void getName(string& name) override {
+ name = mAddress;
+ }
+
+ // IFrameworkActionReq Overrides
+ 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;
+ ObserverContext mContext;
+ const string mAddress;
+ ClientToDataItems mClientToDataItems;
+ DataItemToClients mDataItemToClients;
+ DataItemIdToCore mDataItemCache;
+ DataItemIdToInt mActiveRequestCount;
+
+ // Cache the subscribe and requestData till subscription obj is obtained
+ 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 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);
+ }
+ }
+ }
+};
+
+} // namespace loc_core
+
+#endif //__SYSTEM_STATUS__
+
diff --git a/gps/core/configure.ac b/gps/core/configure.ac
new file mode 100644
index 0000000..19db9cf
--- /dev/null
+++ b/gps/core/configure.ac
@@ -0,0 +1,107 @@
+# 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-hal package version 1.0.0
+AC_INIT([loc-core],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+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])
+
+# 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_ARG_WITH([auto_feature],
+ AC_HELP_STRING([--with-auto_feature=@<:@dir@:>@],
+ [Using Automotive feature]),
+ [],
+ with_auto_feature=no)
+
+if test "x$with_auto_feature" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_AUTOMOTIVE"
+fi
+
+AM_CONDITIONAL(USE_FEATURE_AUTOMOTIVE, test "x${with_auto_feature}" = "xyes")
+
+# External AP
+AC_ARG_WITH([external_ap],
+ AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
+ [Using External Application Processor]),
+ [],
+ with_external_ap=no)
+
+if test "x$with_external_ap" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
+fi
+
+AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "xyes")
+
+AC_CONFIG_FILES([ \
+ Makefile \
+ loc-core.pc \
+ ])
+
+AC_OUTPUT
diff --git a/gps/core/data-items/DataItemConcreteTypesBase.h b/gps/core/data-items/DataItemConcreteTypesBase.h
new file mode 100644
index 0000000..c32d65d
--- /dev/null
+++ b/gps/core/data-items/DataItemConcreteTypesBase.h
@@ -0,0 +1,554 @@
+/* Copyright (c) 2015-2017, 2019, 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 __DATAITEMCONCRETEBASETYPES__
+#define __DATAITEMCONCRETEBASETYPES__
+
+#include <string>
+#include <cstring>
+#include <sstream>
+#include <DataItemId.h>
+#include <IDataItemCore.h>
+#include <gps_extended_c.h>
+#include <inttypes.h>
+
+#define MAC_ADDRESS_LENGTH 6
+// MAC address length in bytes
+// QMI_LOC_SRN_MAC_ADDR_LENGTH_V02
+#define SRN_MAC_ADDRESS_LENGTH 6
+#define WIFI_SUPPLICANT_DEFAULT_STATE 0
+
+static constexpr char sDelimit = ':';
+
+namespace loc_core
+{
+using namespace std;
+
+enum NetworkType {
+ TYPE_MOBILE = 0,
+ TYPE_WIFI,
+ TYPE_ETHERNET,
+ TYPE_BLUETOOTH,
+ TYPE_MMS,
+ TYPE_SUPL,
+ TYPE_DUN,
+ TYPE_HIPRI,
+ TYPE_WIMAX,
+ TYPE_PROXY,
+ TYPE_UNKNOWN,
+};
+
+typedef struct NetworkInfoType
+{
+ // Unique network handle ID
+ uint64_t networkHandle;
+ // Type of network for corresponding network handle
+ NetworkType networkType;
+ NetworkInfoType() : networkHandle(NETWORK_HANDLE_UNKNOWN), networkType(TYPE_UNKNOWN) {}
+ NetworkInfoType(string strObj) {
+ size_t posDelimit = strObj.find(sDelimit);
+
+ if ( posDelimit != string::npos) {
+ int32_t type = TYPE_UNKNOWN;
+ string handleStr = strObj.substr(0, posDelimit);
+ string typeStr = strObj.substr(posDelimit + 1, strObj.length() - posDelimit - 1);
+ stringstream(handleStr) >> networkHandle;
+ stringstream(typeStr) >> type;
+ networkType = (NetworkType) type;
+ } else {
+ networkHandle = NETWORK_HANDLE_UNKNOWN;
+ networkType = TYPE_UNKNOWN;
+ }
+ }
+ bool operator== (const NetworkInfoType& other) {
+ return ((networkHandle == other.networkHandle) && (networkType == other.networkType));
+ }
+ string toString() {
+ string valueStr;
+ valueStr.clear ();
+ char nethandle [32];
+ memset (nethandle, 0, 32);
+ snprintf(nethandle, sizeof(nethandle), "%" PRIu64, networkHandle);
+ valueStr += string(nethandle);
+ valueStr += sDelimit;
+ char type [12];
+ memset (type, 0, 12);
+ snprintf (type, 12, "%u", networkType);
+ valueStr += string (type);
+ return valueStr;
+ }
+} NetworkInfoType;
+
+
+class AirplaneModeDataItemBase : public IDataItemCore {
+public:
+ AirplaneModeDataItemBase(bool mode):
+ mMode(mode),
+ mId(AIRPLANEMODE_DATA_ITEM_ID) {}
+ virtual ~AirplaneModeDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mMode;
+
+protected:
+ DataItemId mId;
+};
+
+class ENHDataItemBase : public IDataItemCore {
+public:
+ ENHDataItemBase(bool enabled) :
+ mEnabled(enabled),
+ mId(ENH_DATA_ITEM_ID) {}
+ virtual ~ENHDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mEnabled;
+protected:
+ DataItemId mId;
+};
+
+class GPSStateDataItemBase : public IDataItemCore {
+public:
+ GPSStateDataItemBase(bool enabled) :
+ mEnabled(enabled),
+ mId(GPSSTATE_DATA_ITEM_ID) {}
+ virtual ~GPSStateDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mEnabled;
+protected:
+ DataItemId mId;
+};
+
+class NLPStatusDataItemBase : public IDataItemCore {
+public:
+ NLPStatusDataItemBase(bool enabled) :
+ mEnabled(enabled),
+ mId(NLPSTATUS_DATA_ITEM_ID) {}
+ virtual ~NLPStatusDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mEnabled;
+protected:
+ DataItemId mId;
+};
+
+class WifiHardwareStateDataItemBase : public IDataItemCore {
+public:
+ WifiHardwareStateDataItemBase(bool enabled) :
+ mEnabled(enabled),
+ mId(WIFIHARDWARESTATE_DATA_ITEM_ID) {}
+ virtual ~WifiHardwareStateDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mEnabled;
+protected:
+ DataItemId mId;
+};
+
+class ScreenStateDataItemBase : public IDataItemCore {
+public:
+ ScreenStateDataItemBase(bool state) :
+ mState(state),
+ mId(SCREEN_STATE_DATA_ITEM_ID) {}
+ virtual ~ScreenStateDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mState;
+protected:
+ DataItemId mId;
+};
+
+class PowerConnectStateDataItemBase : public IDataItemCore {
+public:
+ PowerConnectStateDataItemBase(bool state) :
+ mState(state),
+ mId(POWER_CONNECTED_STATE_DATA_ITEM_ID) {}
+ virtual ~PowerConnectStateDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mState;
+protected:
+ DataItemId mId;
+};
+
+class TimeZoneChangeDataItemBase : public IDataItemCore {
+public:
+ TimeZoneChangeDataItemBase(int64_t currTimeMillis, int32_t rawOffset, int32_t dstOffset) :
+ mCurrTimeMillis (currTimeMillis),
+ mRawOffsetTZ (rawOffset),
+ mDstOffsetTZ (dstOffset),
+ mId(TIMEZONE_CHANGE_DATA_ITEM_ID) {}
+ virtual ~TimeZoneChangeDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ int64_t mCurrTimeMillis;
+ int32_t mRawOffsetTZ;
+ int32_t mDstOffsetTZ;
+protected:
+ DataItemId mId;
+};
+
+class TimeChangeDataItemBase : public IDataItemCore {
+public:
+ TimeChangeDataItemBase(int64_t currTimeMillis, int32_t rawOffset, int32_t dstOffset) :
+ mCurrTimeMillis (currTimeMillis),
+ mRawOffsetTZ (rawOffset),
+ mDstOffsetTZ (dstOffset),
+ mId(TIME_CHANGE_DATA_ITEM_ID) {}
+ virtual ~TimeChangeDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ int64_t mCurrTimeMillis;
+ int32_t mRawOffsetTZ;
+ int32_t mDstOffsetTZ;
+protected:
+ DataItemId mId;
+};
+
+class ShutdownStateDataItemBase : public IDataItemCore {
+public:
+ ShutdownStateDataItemBase(bool state) :
+ mState (state),
+ mId(SHUTDOWN_STATE_DATA_ITEM_ID) {}
+ virtual ~ShutdownStateDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mState;
+protected:
+ DataItemId mId;
+};
+
+class AssistedGpsDataItemBase : public IDataItemCore {
+public:
+ AssistedGpsDataItemBase(bool enabled) :
+ mEnabled(enabled),
+ mId(ASSISTED_GPS_DATA_ITEM_ID) {}
+ virtual ~AssistedGpsDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ bool mEnabled;
+protected:
+ DataItemId mId;
+};
+
+class NetworkInfoDataItemBase : public IDataItemCore {
+public:
+ NetworkInfoDataItemBase(
+ NetworkType initialType, int32_t type, string typeName, string subTypeName,
+ bool available, bool connected, bool roaming, uint64_t networkHandle ):
+ mAllTypes(typeToAllTypes(initialType)),
+ mType(type),
+ mTypeName(typeName),
+ mSubTypeName(subTypeName),
+ mAvailable(available),
+ mConnected(connected),
+ mRoaming(roaming),
+ mNetworkHandle(networkHandle),
+ mId(NETWORKINFO_DATA_ITEM_ID) {
+ mAllNetworkHandles[0].networkHandle = networkHandle;
+ mAllNetworkHandles[0].networkType = initialType;
+ }
+ virtual ~NetworkInfoDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+ inline virtual NetworkType getType(void) const {
+ return (NetworkType)mType;
+ }
+ inline uint64_t getAllTypes() { return mAllTypes; }
+ inline NetworkInfoType* getNetworkHandle() {
+ return &mAllNetworkHandles[0];
+ }
+ // Data members
+ uint64_t mAllTypes;
+ int32_t mType;
+ string mTypeName;
+ string mSubTypeName;
+ bool mAvailable;
+ bool mConnected;
+ bool mRoaming;
+ NetworkInfoType mAllNetworkHandles[MAX_NETWORK_HANDLES];
+ uint64_t mNetworkHandle;
+protected:
+ DataItemId mId;
+ inline uint64_t typeToAllTypes(NetworkType type) {
+ return (type >= TYPE_UNKNOWN || type < TYPE_MOBILE) ? 0 : (1<<type);
+ }
+};
+
+class ServiceStatusDataItemBase : public IDataItemCore {
+public:
+ ServiceStatusDataItemBase(int32_t serviceState) :
+ mServiceState (serviceState),
+ mId(SERVICESTATUS_DATA_ITEM_ID) {}
+ virtual ~ServiceStatusDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ int32_t mServiceState;
+protected:
+ DataItemId mId;
+};
+
+class ModelDataItemBase : public IDataItemCore {
+public:
+ ModelDataItemBase(const string & name) :
+ mModel (name),
+ mId(MODEL_DATA_ITEM_ID) {}
+ virtual ~ModelDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ string mModel;
+protected:
+ DataItemId mId;
+};
+
+class ManufacturerDataItemBase : public IDataItemCore {
+public:
+ ManufacturerDataItemBase(const string & name) :
+ mManufacturer (name),
+ mId(MANUFACTURER_DATA_ITEM_ID) {}
+ virtual ~ManufacturerDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ string mManufacturer;
+protected:
+ DataItemId mId;
+};
+
+class RilServiceInfoDataItemBase : public IDataItemCore {
+public:
+ 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:
+ 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;
+};
+
+class WifiSupplicantStatusDataItemBase : public IDataItemCore {
+public:
+ WifiSupplicantStatusDataItemBase() :
+ mState((WifiSupplicantState)WIFI_SUPPLICANT_DEFAULT_STATE),
+ mApMacAddressValid(false),
+ mWifiApSsidValid(false),
+ mId(WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID) {
+ memset (&mApMacAddress, 0, sizeof (mApMacAddress));
+ mWifiApSsid.clear();
+ }
+ virtual ~WifiSupplicantStatusDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+ // Data members
+ typedef enum WifiSupplicantState {
+ DISCONNECTED,
+ INTERFACE_DISABLED,
+ INACTIVE,
+ SCANNING,
+ AUTHENTICATING,
+ ASSOCIATING,
+ ASSOCIATED,
+ FOUR_WAY_HANDSHAKE,
+ GROUP_HANDSHAKE,
+ COMPLETED,
+ DORMANT,
+ UNINITIALIZED,
+ INVALID
+ } WifiSupplicantState;
+ /* Represents whether access point attach state*/
+ WifiSupplicantState mState;
+ /* Represents info on whether ap mac address is valid */
+ bool mApMacAddressValid;
+ /* Represents mac address of the wifi access point*/
+ uint8_t mApMacAddress[MAC_ADDRESS_LENGTH];
+ /* Represents info on whether ap SSID is valid */
+ bool mWifiApSsidValid;
+ /* Represents Wifi SSID string*/
+ string mWifiApSsid;
+protected:
+ DataItemId mId;
+};
+
+class TacDataItemBase : public IDataItemCore {
+public:
+ TacDataItemBase(const string & name) :
+ mValue (name),
+ mId(TAC_DATA_ITEM_ID) {}
+ virtual ~TacDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ string mValue;
+protected:
+ DataItemId mId;
+};
+
+class MccmncDataItemBase : public IDataItemCore {
+public:
+ MccmncDataItemBase(const string & name) :
+ mValue(name),
+ mId(MCCMNC_DATA_ITEM_ID) {}
+ virtual ~MccmncDataItemBase() {}
+ inline virtual DataItemId getId() { return mId; }
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+// Data members
+ string mValue;
+protected:
+ DataItemId mId;
+};
+
+class SrnDeviceScanDetailsDataItemBase : public IDataItemCore {
+public:
+ SrnDeviceScanDetailsDataItemBase(DataItemId Id) :
+ mValidSrnData(false),
+ mApSrnRssi(-1),
+ mApSrnTimestamp(0),
+ mRequestTimestamp(0),
+ mReceiveTimestamp(0),
+ mErrorCause(-1),
+ mId(Id) {}
+ 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)*/
+ bool mValidSrnData;
+ /* SRN device RSSI reported */
+ int32_t mApSrnRssi;
+ /* MAC adress of SRN device */
+ uint8_t mApSrnMacAddress[SRN_MAC_ADDRESS_LENGTH];
+ /* UTC timestamp at which the scan was requested.for this SRN device*/
+ int64_t mApSrnTimestamp;
+ /* UTC timestamp at which the scan was started. */
+ int64_t mRequestTimestamp;
+ /* UTC timestamp at which the scan was received.*/
+ int64_t mReceiveTimestamp;
+ /* Reason for the error/failure if SRN details are not valid */
+ int32_t mErrorCause;
+protected:
+ DataItemId mId;
+};
+
+class BtDeviceScanDetailsDataItemBase : public SrnDeviceScanDetailsDataItemBase {
+
+public:
+ BtDeviceScanDetailsDataItemBase() :
+ SrnDeviceScanDetailsDataItemBase(BT_SCAN_DATA_ITEM_ID) {}
+ virtual ~BtDeviceScanDetailsDataItemBase() {}
+ virtual void stringify(string& /*valueStr*/) {}
+ virtual int32_t copy(IDataItemCore* /*src*/, bool* /*dataItemCopied = NULL*/) {return 1;}
+};
+
+class BtLeDeviceScanDetailsDataItemBase : public SrnDeviceScanDetailsDataItemBase {
+
+public:
+ BtLeDeviceScanDetailsDataItemBase() :
+ SrnDeviceScanDetailsDataItemBase(BTLE_SCAN_DATA_ITEM_ID) {}
+ virtual ~BtLeDeviceScanDetailsDataItemBase() {}
+ virtual void stringify(string& /*valueStr*/) {}
+ 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
new file mode 100644
index 0000000..1661be6
--- /dev/null
+++ b/gps/core/data-items/DataItemId.h
@@ -0,0 +1,79 @@
+/* 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 __DATAITEMID_H__
+#define __DATAITEMID_H__
+
+/**
+ * Enumeration of Data Item types
+ * When add/remove/update changes are made to Data Items, this file needs to be updated
+ * accordingly
+ */
+typedef enum e_DataItemId {
+ INVALID_DATA_ITEM_ID = -1,
+ // 0 - 4
+ AIRPLANEMODE_DATA_ITEM_ID,
+ ENH_DATA_ITEM_ID,
+ GPSSTATE_DATA_ITEM_ID,
+ NLPSTATUS_DATA_ITEM_ID,
+ WIFIHARDWARESTATE_DATA_ITEM_ID,
+ // 5 - 9
+ NETWORKINFO_DATA_ITEM_ID,
+ RILVERSION_DATA_ITEM_ID,
+ RILSERVICEINFO_DATA_ITEM_ID,
+ RILCELLINFO_DATA_ITEM_ID,
+ SERVICESTATUS_DATA_ITEM_ID,
+ // 10 - 14
+ MODEL_DATA_ITEM_ID,
+ MANUFACTURER_DATA_ITEM_ID,
+ VOICECALL_DATA_ITEM,
+ ASSISTED_GPS_DATA_ITEM_ID,
+ SCREEN_STATE_DATA_ITEM_ID,
+ // 15 - 19
+ POWER_CONNECTED_STATE_DATA_ITEM_ID,
+ TIMEZONE_CHANGE_DATA_ITEM_ID,
+ TIME_CHANGE_DATA_ITEM_ID,
+ WIFI_SUPPLICANT_STATUS_DATA_ITEM_ID,
+ SHUTDOWN_STATE_DATA_ITEM_ID,
+ // 20 - 24
+ TAC_DATA_ITEM_ID,
+ MCCMNC_DATA_ITEM_ID,
+ BTLE_SCAN_DATA_ITEM_ID,
+ BT_SCAN_DATA_ITEM_ID,
+ OEM_GTP_UPLOAD_TRIGGER_READY_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
new file mode 100644
index 0000000..10f73f4
--- /dev/null
+++ b/gps/core/data-items/DataItemsFactoryProxy.cpp
@@ -0,0 +1,82 @@
+/* Copyright (c) 2017-2020, 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.
+ *
+ */
+#define LOG_TAG "DataItemsFactoryProxy"
+
+#include <dlfcn.h>
+#include <DataItemId.h>
+#include <IDataItemCore.h>
+#include <DataItemsFactoryProxy.h>
+#include <loc_pla.h>
+#include <log_util.h>
+#include "loc_misc_utils.h"
+
+namespace loc_core
+{
+void* DataItemsFactoryProxy::dataItemLibHandle = NULL;
+get_concrete_data_item_fn* DataItemsFactoryProxy::getConcreteDIFunc = NULL;
+
+IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id)
+{
+ IDataItemCore *mydi = nullptr;
+
+ if (NULL != getConcreteDIFunc) {
+ mydi = (*getConcreteDIFunc)(id);
+ }
+ else {
+ getConcreteDIFunc = (get_concrete_data_item_fn * )
+ dlGetSymFromLib(dataItemLibHandle, DATA_ITEMS_LIB_NAME, DATA_ITEMS_GET_CONCRETE_DI);
+
+ if (NULL != getConcreteDIFunc) {
+ LOC_LOGd("Loaded function %s : %p", DATA_ITEMS_GET_CONCRETE_DI, getConcreteDIFunc);
+ mydi = (*getConcreteDIFunc)(id);
+ }
+ else {
+ // dlysm failed.
+ const char * err = dlerror();
+ if (NULL == err)
+ {
+ err = "Unknown";
+ }
+ LOC_LOGe("failed to find symbol %s; error=%s", DATA_ITEMS_GET_CONCRETE_DI, err);
+ }
+ }
+ return mydi;
+}
+
+void DataItemsFactoryProxy::closeDataItemLibraryHandle()
+{
+ if (NULL != dataItemLibHandle) {
+ dlclose(dataItemLibHandle);
+ dataItemLibHandle = NULL;
+ }
+}
+
+} // namespace loc_core
+
+
diff --git a/gps/core/data-items/DataItemsFactoryProxy.h b/gps/core/data-items/DataItemsFactoryProxy.h
new file mode 100644
index 0000000..cfd447d
--- /dev/null
+++ b/gps/core/data-items/DataItemsFactoryProxy.h
@@ -0,0 +1,55 @@
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __DATAITEMFACTORYBASE__
+#define __DATAITEMFACTORYBASE__
+
+#include <DataItemId.h>
+#include <IDataItemCore.h>
+
+namespace loc_core
+{
+
+#define DATA_ITEMS_LIB_NAME "libdataitems.so"
+#define DATA_ITEMS_GET_CONCRETE_DI "getConcreteDataItem"
+
+typedef IDataItemCore * (get_concrete_data_item_fn)(DataItemId);
+
+class DataItemsFactoryProxy {
+public:
+ static IDataItemCore* createNewDataItem(DataItemId id);
+ static void closeDataItemLibraryHandle();
+ static void *dataItemLibHandle;
+ static get_concrete_data_item_fn *getConcreteDIFunc;
+};
+
+} // namespace loc_core
+
+#endif //__DATAITEMFACTORYBASE__
+
diff --git a/gps/core/data-items/IDataItemCore.h b/gps/core/data-items/IDataItemCore.h
new file mode 100644
index 0000000..6084c92
--- /dev/null
+++ b/gps/core/data-items/IDataItemCore.h
@@ -0,0 +1,82 @@
+/* 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 __IDATAITEMCORE_H__
+#define __IDATAITEMCORE_H__
+
+#include <string>
+#include <DataItemId.h>
+
+namespace loc_core {
+
+using namespace std;
+
+/**
+ * @brief IDataItemCore interface.
+ * @details IDataItemCore interface.
+ *
+ */
+class IDataItemCore {
+public:
+ /**
+ * @brief Gets Data item id.
+ * @details Gets Data item id.
+ * @return Data item id.
+ */
+ virtual DataItemId getId () = 0;
+
+ /**
+ * @brief Stringify.
+ * @details Stringify.
+ *
+ * @param valueStr Reference to string.
+ */
+ virtual void stringify (string & valueStr) = 0;
+
+ /**
+ * @brief copy.
+ * @details copy.
+ *
+ * @param src Where to copy from.
+ * @param dataItemCopied Boolean flag indicated whether or not copied.
+ *
+ * @return Zero for success or non zero for failure.
+ */
+ virtual int32_t copy (IDataItemCore * src, bool *dataItemCopied = nullptr) = 0;
+
+ /**
+ * @brief Destructor.
+ * @details Destructor.
+ */
+ virtual ~IDataItemCore () {}
+};
+
+} // namespace loc_core
+
+#endif // __IDATAITEMCORE_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
new file mode 100644
index 0000000..904f94b
--- /dev/null
+++ b/gps/core/loc_core_log.cpp
@@ -0,0 +1,215 @@
+/* Copyright (c) 2011-2015, 2020 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_core_log"
+
+#include <log_util.h>
+#include <loc_log.h>
+#include <loc_core_log.h>
+#include <loc_pla.h>
+
+void LocPosMode::logv() const
+{
+ LOC_LOGV ("Position mode: %s\n Position recurrence: %s\n "
+ "min interval: %d\n preferred accuracy: %d\n "
+ "preferred time: %d\n credentials: %s provider: %s \n "
+ "power mode: %d\n tbm %d",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider,
+ powerMode,
+ timeBetweenMeasurements);
+}
+
+/* GPS status names */
+DECLARE_TBL(gps_status_name) =
+{
+ NAME_VAL( LOC_GPS_STATUS_NONE ),
+ NAME_VAL( LOC_GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( LOC_GPS_STATUS_SESSION_END ),
+ NAME_VAL( LOC_GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( LOC_GPS_STATUS_ENGINE_OFF ),
+};
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(LocGpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name_tbl, (int64_t) gps_status);
+}
+
+
+
+DECLARE_TBL(loc_eng_position_modes) =
+{
+ NAME_VAL( LOC_POSITION_MODE_STANDALONE ),
+ NAME_VAL( LOC_POSITION_MODE_MS_BASED ),
+ NAME_VAL( LOC_POSITION_MODE_MS_ASSISTED ),
+ NAME_VAL( LOC_POSITION_MODE_RESERVED_1 ),
+ NAME_VAL( LOC_POSITION_MODE_RESERVED_2 ),
+ NAME_VAL( LOC_POSITION_MODE_RESERVED_3 ),
+ NAME_VAL( LOC_POSITION_MODE_RESERVED_4 ),
+ NAME_VAL( LOC_POSITION_MODE_RESERVED_5 )
+};
+
+const char* loc_get_position_mode_name(LocGpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes_tbl, (int64_t) mode);
+}
+
+
+
+DECLARE_TBL(loc_eng_position_recurrences) =
+{
+ NAME_VAL( LOC_GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( LOC_GPS_POSITION_RECURRENCE_SINGLE )
+};
+
+const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences_tbl, (int64_t) recur);
+}
+
+const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
+{
+ return NULL;
+}
+
+
+DECLARE_TBL(loc_eng_agps_types) =
+{
+ NAME_VAL( LOC_AGPS_TYPE_INVALID ),
+ NAME_VAL( LOC_AGPS_TYPE_ANY ),
+ NAME_VAL( LOC_AGPS_TYPE_SUPL ),
+ NAME_VAL( LOC_AGPS_TYPE_C2K ),
+ NAME_VAL( LOC_AGPS_TYPE_WWAN_ANY )
+};
+
+const char* loc_get_agps_type_name(LocAGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types_tbl, (int64_t) type);
+}
+
+
+DECLARE_TBL(loc_eng_ni_types) =
+{
+ NAME_VAL( LOC_GPS_NI_TYPE_VOICE ),
+ NAME_VAL( LOC_GPS_NI_TYPE_UMTS_SUPL ),
+ NAME_VAL( LOC_GPS_NI_TYPE_UMTS_CTRL_PLANE ),
+ NAME_VAL( LOC_GPS_NI_TYPE_EMERGENCY_SUPL )
+};
+
+const char* loc_get_ni_type_name(LocGpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types_tbl, (int64_t) type);
+}
+
+
+DECLARE_TBL(loc_eng_ni_responses) =
+{
+ NAME_VAL( LOC_GPS_NI_RESPONSE_ACCEPT ),
+ NAME_VAL( LOC_GPS_NI_RESPONSE_DENY ),
+ NAME_VAL( LOC_GPS_NI_RESPONSE_DENY )
+};
+
+const char* loc_get_ni_response_name(LocGpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses_tbl, (int64_t) response);
+}
+
+
+DECLARE_TBL(loc_eng_ni_encodings) =
+{
+ NAME_VAL( LOC_GPS_ENC_NONE ),
+ NAME_VAL( LOC_GPS_ENC_SUPL_GSM_DEFAULT ),
+ NAME_VAL( LOC_GPS_ENC_SUPL_UTF8 ),
+ NAME_VAL( LOC_GPS_ENC_SUPL_UCS2 ),
+ NAME_VAL( LOC_GPS_ENC_UNKNOWN )
+};
+
+const char* loc_get_ni_encoding_name(LocGpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings_tbl, (int64_t) encoding);
+}
+
+DECLARE_TBL(loc_eng_agps_bears) =
+{
+ NAME_VAL( AGPS_APN_BEARER_INVALID ),
+ NAME_VAL( AGPS_APN_BEARER_IPV4 ),
+ NAME_VAL( AGPS_APN_BEARER_IPV6 ),
+ NAME_VAL( AGPS_APN_BEARER_IPV4V6 )
+};
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears_tbl, (int64_t) bearer);
+}
+
+DECLARE_TBL(loc_eng_server_types) =
+{
+ NAME_VAL( LOC_AGPS_CDMA_PDE_SERVER ),
+ NAME_VAL( LOC_AGPS_CUSTOM_PDE_SERVER ),
+ NAME_VAL( LOC_AGPS_MPC_SERVER ),
+ NAME_VAL( LOC_AGPS_SUPL_SERVER )
+};
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types_tbl, (int64_t) type);
+}
+
+DECLARE_TBL(loc_eng_position_sess_status_types) =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+
+const char* loc_get_position_sess_status_name(enum loc_sess_status status)
+{
+ return loc_get_name_from_val(loc_eng_position_sess_status_types_tbl, (int64_t) status);
+}
+
+DECLARE_TBL(loc_eng_agps_status_names) =
+{
+ NAME_VAL( LOC_GPS_REQUEST_AGPS_DATA_CONN ),
+ NAME_VAL( LOC_GPS_RELEASE_AGPS_DATA_CONN ),
+ NAME_VAL( LOC_GPS_AGPS_DATA_CONNECTED ),
+ NAME_VAL( LOC_GPS_AGPS_DATA_CONN_DONE ),
+ NAME_VAL( LOC_GPS_AGPS_DATA_CONN_FAILED )
+};
+
+const char* loc_get_agps_status_name(LocAGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names_tbl, (int64_t) status);
+}
diff --git a/gps/core/loc_core_log.h b/gps/core/loc_core_log.h
new file mode 100644
index 0000000..2beb687
--- /dev/null
+++ b/gps/core/loc_core_log.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2011-2013, 2016-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_CORE_LOG_H
+#define LOC_CORE_LOG_H
+
+#include <ctype.h>
+#include <gps_extended.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+const char* loc_get_gps_status_name(LocGpsStatusValue gps_status);
+const char* loc_get_position_mode_name(LocGpsPositionMode mode);
+const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur);
+const char* loc_get_aiding_data_mask_names(LocGpsAidingData data);
+const char* loc_get_agps_type_name(LocAGpsType type);
+const char* loc_get_ni_type_name(LocGpsNiType type);
+const char* loc_get_ni_response_name(LocGpsUserResponseType response);
+const char* loc_get_ni_encoding_name(LocGpsNiEncodingType encoding);
+const char* loc_get_agps_bear_name(AGpsBearerType bear);
+const char* loc_get_server_type_name(LocServerType type);
+const char* loc_get_position_sess_status_name(enum loc_sess_status status);
+const char* loc_get_agps_status_name(LocAGpsStatusValue status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CORE_LOG_H */
diff --git a/gps/core/observer/IDataItemObserver.h b/gps/core/observer/IDataItemObserver.h
new file mode 100644
index 0000000..7954d85
--- /dev/null
+++ b/gps/core/observer/IDataItemObserver.h
@@ -0,0 +1,76 @@
+/* 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 __IDATAITEMOBSERVER_H__
+#define __IDATAITEMOBSERVER_H__
+
+#include <list>
+#include <string>
+
+using namespace std;
+
+namespace loc_core
+{
+class IDataItemCore;
+
+/**
+ * @brief IDataItemObserver interface
+ * @details IDataItemObserver interface;
+ * In OS dependent code this type serves as a handle to an OS independent instance of this interface.
+ */
+class IDataItemObserver {
+
+public:
+
+ /**
+ * @brief Gets name of Data Item Observer
+ * @details Gets name of Data Item Observer
+ *
+ * @param name reference to name of Data Item Observer
+ */
+ virtual void getName (string & name) = 0;
+
+ /**
+ * @brief Notify updated values of Data Items
+ * @details Notifys updated values of Data items
+ *
+ * @param dlist List of updated data items
+ */
+ virtual void notify (const std :: list <IDataItemCore *> & dlist) = 0;
+
+ /**
+ * @brief Destructor
+ * @details Destructor
+ */
+ virtual ~IDataItemObserver () {}
+};
+
+} // namespace loc_core
+
+#endif // #ifndef __IDATAITEMOBSERVER_H__
diff --git a/gps/core/observer/IDataItemSubscription.h b/gps/core/observer/IDataItemSubscription.h
new file mode 100644
index 0000000..7e8b8c8
--- /dev/null
+++ b/gps/core/observer/IDataItemSubscription.h
@@ -0,0 +1,129 @@
+/* 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 __IDATAITEMSUBSCRIPTION_H__
+#define __IDATAITEMSUBSCRIPTION_H__
+
+#include <list>
+#include <DataItemId.h>
+
+namespace loc_core
+{
+class IDataItemObserver;
+
+/**
+ * @brief IDataItemSubscription interface
+ * @details IDataItemSubscription interface;
+ * Defines an interface for operations such as subscribe,
+ * unsubscribe data items by their IDs.
+ * Must be implemented by OS dependent code.
+ */
+class IDataItemSubscription {
+
+public:
+ /**
+ * @brief Subscribe for data items by their IDs
+ * @details Subscribe for data items by their IDs;
+ * An IDataItemObserver implementer invokes this method to subscribe
+ * for a list of DataItems by passing in their Ids.
+ * A symbolic invocation of this method in the following order
+ * subscribe ( {1,2,3}, &obj), subscribe ( {2,3,4,5}, &obj)
+ * where the numbers enclosed in braces indicate a list of data item Ids
+ * will cause this class implementer to update its subscription list for
+ * &obj to only contain the following Data Item Ids 1,2,3,4,5.
+ *
+ * @param l List of DataItemId
+ * @param o Pointer to an instance of IDataItemObserver
+ */
+ virtual void subscribe (const std :: list <DataItemId> & l, IDataItemObserver * o = NULL) = 0;
+
+ /**
+ * @brief Update subscription for Data items
+ * @details Update subscription for Data items;
+ * An IDataItemObserver implementer invokes this method to update their
+ * subscription for a list of DataItems by passing in their Ids
+ * A symbolic invocation of this method in the following order
+ * updateSubscription ( {1,2,3}, &obj),updateSubscription ( {2,3,4,5}, &obj)
+ * where the numbers enclosed in braces indicate a list of data item Ids
+ * will cause this class implementer to update its subscription list for
+ * &obj to only contain the following Data Item Ids 2,3,4,5.
+ * Note that this method may or may not be called.
+ *
+ * @param l List of DataItemId
+ * @param o Pointer to an instance of IDataItemObserver
+ */
+ virtual void updateSubscription (const std :: list <DataItemId> & l, IDataItemObserver * o = NULL) = 0;
+
+ /**
+ * @brief Request Data
+ * @details Request Data
+ *
+ * @param l List of DataItemId
+ * @param o Pointer to an instance of IDataItemObserver
+ */
+ virtual void requestData (const std :: list <DataItemId> & l, IDataItemObserver * o = NULL) = 0;
+
+ /**
+ * @brief Unsubscribe Data items
+ * @details Unsubscrbe Data items;
+ * An IDataItemObserver implementer invokes this method to unsubscribe their
+ * subscription for a list of DataItems by passing in their Ids
+ * Suppose this class implementor has a currently active subscription list
+ * containing 1,2,3,4,5,6,7 for &obj then a symbolic invocation of this
+ * method in the following order
+ * unsubscribe ( {1,2,3}, &obj), unsubscribe ( {1,2,3,4}, &obj),
+ * unsubscribe ( {7}, &obj)
+ * where the numbers enclosed in braces indicate a list of data item Ids
+ * will cause this class implementer to update its subscription list for
+ * &obj to only contain the following data item id 5,6.
+ *
+ * @param l List of DataItemId
+ * @param o Pointer to an instance of IDataItemObserver
+ */
+ virtual void unsubscribe (const std :: list <DataItemId> & l, IDataItemObserver * o = NULL) = 0;
+
+ /**
+ * @brief Unsubscribe all data items
+ * @details Unsubscribe all data items
+ *
+ * @param o Pointer to an instance of IDataItemObserver
+ */
+ virtual void unsubscribeAll (IDataItemObserver * o = NULL) = 0;
+
+ /**
+ * @brief Destructor
+ * @details Destructor
+ */
+ virtual ~IDataItemSubscription () {}
+};
+
+} // namespace loc_core
+
+#endif // #ifndef __IDATAITEMSUBSCRIPTION_H__
+
diff --git a/gps/core/observer/IFrameworkActionReq.h b/gps/core/observer/IFrameworkActionReq.h
new file mode 100644
index 0000000..4be947f
--- /dev/null
+++ b/gps/core/observer/IFrameworkActionReq.h
@@ -0,0 +1,101 @@
+/* Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __IFRAMEWORKACTIONREQ_H__
+#define __IFRAMEWORKACTIONREQ_H__
+
+#include <DataItemId.h>
+
+namespace loc_core
+{
+
+/**
+ * @brief IFrameworkActionReq interface
+ * @details IFrameworkActionReq interface;
+ * Defines an interface for operations such as turnOn, turnOff a
+ * framework module described by the data item. Framework module
+ * could be bluetooth, wifi etc.
+ * Must be implemented by OS dependent code.
+ *
+ */
+class IFrameworkActionReq {
+
+public:
+ /**
+ * @brief Turn on the framework module described by the data item.
+ * @details Turn on the framework module described by the data item;
+ * An IFrameworkActionReq implementer invokes this method to
+ * turn on the framework module described by the data item.
+ * Framework module could be bluetooth, wifi etc.
+ *
+ * @param dit DataItemId
+ * @param timeout Timeout after which to turn off the framework module.
+ */
+ virtual void turnOn (DataItemId dit, int timeOut = 0) = 0;
+
+ /**
+ * @brief Turn off the framework module described by the data item.
+ * @details Turn off the framework module described by the data item;
+ * An IFrameworkActionReq implementer invokes this method to
+ * turn off the framework module described by the data item.
+ * Framework module could be bluetooth, wifi etc.
+ *
+ * @param dit DataItemId
+ */
+ 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
+ */
+ virtual ~IFrameworkActionReq () {}
+};
+
+} // namespace loc_core
+
+#endif // #ifndef __IFRAMEWORKACTIONREQ_H__
+
diff --git a/gps/core/observer/IOsObserver.h b/gps/core/observer/IOsObserver.h
new file mode 100644
index 0000000..f661828
--- /dev/null
+++ b/gps/core/observer/IOsObserver.h
@@ -0,0 +1,107 @@
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __IOSOBSERVER_H__
+#define __IOSOBSERVER_H__
+
+#include <list>
+#include <string>
+#include <IDataItemObserver.h>
+#include <IDataItemSubscription.h>
+#include <IFrameworkActionReq.h>
+
+using namespace std;
+
+namespace loc_core
+{
+
+/**
+ * @brief IOsObserver interface
+ * @details IOsObserver interface;
+ * In OS dependent code this type serves as a handle to
+ * an OS independent instance of this interface.
+ */
+class IOsObserver :
+ public IDataItemObserver,
+ public IDataItemSubscription,
+ public IFrameworkActionReq {
+
+public:
+
+ // To set the subscription object
+ virtual void setSubscriptionObj(IDataItemSubscription *subscriptionObj) = 0;
+
+ // To set the framework action request object
+ virtual void setFrameworkActionReqObj(IFrameworkActionReq *frameworkActionReqObj) = 0;
+
+ // IDataItemObserver Overrides
+ inline virtual void getName (string & /*name*/) {}
+ inline virtual void notify (const std::list <IDataItemCore *> & /*dlist*/) {}
+
+ // IDataItemSubscription Overrides
+ inline virtual void subscribe
+ (
+ const std :: list <DataItemId> & /*l*/,
+ IDataItemObserver * /*client*/
+ ){}
+ inline virtual void updateSubscription
+ (
+ const std :: list <DataItemId> & /*l*/,
+ IDataItemObserver * /*client*/
+ ){}
+ inline virtual void requestData
+ (
+ const std :: list <DataItemId> & /*l*/,
+ IDataItemObserver * /*client*/
+ ){}
+ inline virtual void unsubscribe
+ (
+ const std :: list <DataItemId> & /*l*/,
+ IDataItemObserver * /*client*/
+ ){}
+ inline virtual void unsubscribeAll (IDataItemObserver * /*client*/){}
+
+ // IFrameworkActionReq Overrides
+ inline virtual void turnOn (DataItemId /*dit*/, int /*timeOut*/){}
+ inline virtual void turnOff (DataItemId /*dit*/) {}
+#ifdef USE_GLIB
+ inline virtual bool connectBackhaul() { return false; }
+ inline virtual bool disconnectBackhaul() { return false; }
+#endif
+
+ /**
+ * @brief Destructor
+ * @details Destructor
+ */
+ virtual ~IOsObserver () {}
+};
+
+} // namespace loc_core
+
+#endif // #ifndef __IOSOBSERVER_H__
diff --git a/gps/etc/Android.mk b/gps/etc/Android.mk
new file mode 100644
index 0000000..22ca2f7
--- /dev/null
+++ b/gps/etc/Android.mk
@@ -0,0 +1,21 @@
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := gps.conf
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := gps.conf
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := flp.conf
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := flp.conf
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)
+include $(BUILD_PREBUILT)
+
diff --git a/gps/etc/flp.conf b/gps/etc/flp.conf
new file mode 100644
index 0000000..65d54d3
--- /dev/null
+++ b/gps/etc/flp.conf
@@ -0,0 +1,60 @@
+###################################
+##### FLP settings #####
+###################################
+
+###################################
+# FLP BATCH SIZE
+###################################
+# The number of batched locations
+# requested to modem. The desired number
+# defined below may not be satisfied, as
+# the modem can only return the number
+# of batched locations that can be allocated,
+# which is limited by memory. The default
+# batch size defined as 20 as below.
+BATCH_SIZE=20
+
+###################################
+# FLP OUTDOOR TRIP BATCH SIZE
+###################################
+# The number of batched locations
+# requested to modem for outdoor
+# trip batching. The desired number
+# defined below may not be satisfied, as
+# the modem can only return the number
+# of batched locations that can be allocated,
+# which is limited by memory. The default
+# trip batch size defined as 600 as below.
+OUTDOOR_TRIP_BATCH_SIZE=600
+
+###################################
+# FLP BATCHING SESSION TIMEOUT
+###################################
+# Duration with which batch session timeout
+# happens in milliseconds. If not specified
+# or set to zero, batching session timeout
+# defaults to 20 seconds by the modem.
+# BATCH_SESSION_TIMEOUT=20000
+
+###################################
+# FLP BATCHING ACCURACY
+###################################
+# Set to one of the defined values below
+# to define the accuracy of batching.
+# If not specified, accuracy defaults
+# to LOW.
+# FLP BATCHING ACCURACY values:
+# Low accuracy = 0
+# Medium accuracy = 1
+# High accuracy = 2
+ACCURACY=1
+
+####################################
+# By default if network fixes are not sensor assisted
+# these fixes must be dropped. This parameter adds an exception
+# for targets where there is no PDR and we still want to
+# report out network fixes
+# 0: MUST NOT ALLOW NETWORK FIXES
+# 1: ALLOW NETWORK FIXES
+####################################
+ALLOW_NETWORK_FIXES = 0
diff --git a/gps/etc/gps.conf b/gps/etc/gps.conf
new file mode 100644
index 0000000..78e5d84
--- /dev/null
+++ b/gps/etc/gps.conf
@@ -0,0 +1,346 @@
+#Version check for XTRA
+#DISABLE = 0
+#AUTO = 1
+#XTRA2 = 2
+#XTRA3 = 3
+XTRA_VERSION_CHECK=0
+
+# Error Estimate
+# _SET = 1
+# _CLEAR = 0
+ERR_ESTIMATE=0
+
+#NTP server
+NTP_SERVER=time.izatcloud.net
+
+#XTRA CA path
+XTRA_CA_PATH=/usr/lib/ssl-1.1/certs
+
+# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
+# 4 - Debug, 5 - Verbose
+# If DEBUG_LEVEL is commented, Android's logging levels will be used
+DEBUG_LEVEL = 3
+
+# Intermediate position report, 1=enable, 0=disable
+INTERMEDIATE_POS=0
+
+# supl version 1.0
+SUPL_VER=0x10000
+
+# Emergency SUPL, 1=enable, 0=disable
+#SUPL_ES=1
+
+#Choose PDN for Emergency SUPL
+#1 - Use emergency PDN
+#0 - Use regular SUPL PDN for Emergency SUPL
+#USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=0
+
+#SUPL_MODE is a bit mask set in config.xml per carrier by default.
+#If it is uncommented here, this value will overwrite the value from
+#config.xml.
+#MSA=0X2
+#MSB=0X1
+#SUPL_MODE=
+
+# GPS Capabilities bit mask
+# SCHEDULING = 0x01
+# MSB = 0x02
+# MSA = 0x04
+# ON_DEMAND_TIME = 0x10
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING
+CAPABILITIES=0x17
+
+# Accuracy threshold for intermediate positions
+# less accurate positions are ignored, 0 for passing all positions
+# ACCURACY_THRES=5000
+
+################################
+##### AGPS server settings #####
+################################
+
+# FOR SUPL SUPPORT, set the following
+# SUPL_HOST=supl.host.com or IP
+# SUPL_PORT=1234
+
+# FOR MO SUPL SUPPORT, set the following
+# MO_SUPL_HOST=supl.host.com or IP
+# MO_SUPL_PORT=1234
+
+# FOR C2K PDE SUPPORT, set the following
+# C2K_HOST=c2k.pde.com or IP
+# C2K_PORT=1234
+
+# Bitmask of slots that are available
+# for write/install to, where 1s indicate writable,
+# and the default value is 0 where no slots
+# are writable. For example, AGPS_CERT_WRITABLE_MASK
+# of b1000001010 makes 3 slots available
+# and the remaining 7 slots unwritable.
+#AGPS_CERT_WRITABLE_MASK=0
+
+####################################
+# LTE Positioning Profile Settings
+####################################
+# 0: Enable RRLP on LTE(Default)
+# 1: Enable LPP_User_Plane on LTE
+# 2: Enable LPP_Control_Plane
+# 3: Enable both LPP_User_Plane and LPP_Control_Plane
+LPP_PROFILE = 2
+
+####################################
+#Datum Type
+####################################
+# 0: WGS-84
+# 1: PZ-90
+DATUM_TYPE = 0
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=0
+
+# Customized NMEA GGA fix quality that can be used to tell
+# whether SENSOR contributed to the fix.
+#
+# When this configuration item is not enabled (set to any value that is not 1),
+# GGA fix quality conforms to NMEA standard spec as below:
+# PPP/DGNSS/SBAS correction fix w/ or w/o sensor: 2
+# RTK fixed fix w/ or w/o sensor: 4
+# RTK float fix w/ or w/o sensor: 5
+# SPE fix w/ or w/o sensor: 1
+# Sensor dead reckoning fix: 6
+#
+# When this configuration is enabled (set to 1), GGA fix quality
+# will be output as below:
+# PPP fix w/o sensor: 59, w/ sensor: 69
+# DGNSS/SBAS correction fix w/o sensor: 2, w/ sensor: 62
+# RTK fixed fix w/o sensor: 4, w/ sensor: 64
+# RTK float fix w/o sensor: 5, w/ sensor: 65,
+# SPE fix w/o sensor: 1, and w/ sensor: 61
+# Sensor dead reckoning fix: 6
+#
+# any value that is not 1 - disabled
+# 1 - enabled
+CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0
+
+# Mark if it is a SGLTE target (1=SGLTE, 0=nonSGLTE)
+SGLTE_TARGET=0
+
+##################################################
+# Select Positioning Protocol on A-GLONASS system
+##################################################
+# 0x1: RRC CPlane
+# 0x2: RRLP UPlane
+# 0x4: LLP Uplane
+A_GLONASS_POS_PROTOCOL_SELECT = 0
+
+##################################################
+# Select technology for LPPe Control Plane
+##################################################
+# 0x1: DBH for LPPe CP
+# 0x2: WLAN AP Measurements for LPPe CP
+# 0x4: SRN AP measurement for CP
+# 0x8: Sensor Barometer Measurement LPPe CP
+#LPPE_CP_TECHNOLOGY = 0
+
+##################################################
+# Select technology for LPPe User Plane
+##################################################
+# 0x1: DBH for LPPe UP
+# 0x2: WLAN AP Measurements for LPPe UP
+# 0x4: SRN AP measurement for UP
+# 0x8: Sensor Barometer Measurement LPPe UP
+#LPPE_UP_TECHNOLOGY = 0
+
+##################################################
+# AGPS_CONFIG_INJECT
+##################################################
+# enable/disable injection of AGPS configurations:
+# SUPL_VER
+# SUPL_HOST
+# SUPL_PORT
+# MO_SUPL_HOST
+# MO_SUPL_PORT
+# C2K_HOST
+# C2K_PORT
+# LPP_PROFILE
+# A_GLONASS_POS_PROTOCOL_SELECT
+# 0: disable
+# 1: enable
+AGPS_CONFIG_INJECT = 1
+
+##################################################
+# GNSS settings for automotive use cases
+# Configurations in following section are
+# specific to automotive use cases, others
+# please do not change, keep the default values
+##################################################
+
+# AP Coarse Timestamp Uncertainty
+##################################################
+# default : 10
+# AP time stamp uncertainty, until GNSS receiver
+# is able to acquire better timing information
+AP_TIMESTAMP_UNCERTAINTY = 10
+
+##################################################
+# QDR engine availability status
+##################################################
+# 0 : NO QDR (default)
+# 1 : QDR enabled
+# This settings enables QDR Configuration for
+# automotive use case, if enabled then
+# DR_AP_Service needs to be enabled in izat.conf
+#EXTERNAL_DR_ENABLED = 0
+
+#####################################
+# DR_SYNC Pulse Availability
+#####################################
+# 0 : DR_SYNC pulse not available (default)
+# 1 : DR_SYNC pulse available
+# This configuration enables the driver to make use
+# of PPS events generated by DR_SYNC pulse
+# Standard Linux PPS driver needs to be enabled
+DR_SYNC_ENABLED = 0
+
+#####################################
+# PPS Device name
+#####################################
+PPS_DEVICENAME = /dev/pps0
+
+#####################################
+# Ignore PPS at Startup and after long outage
+#####################################
+IGNORE_PPS_PULSE_COUNT = 1
+
+#####################################
+# Long GNSS RF outage in seconds
+#####################################
+GNSS_OUTAGE_DURATION = 10
+
+#####################################
+# AP Clock Accuracy
+#####################################
+# Quality of APPS processor clock (in PPM).
+# Value specified is used for calculation of
+# APPS time stamp uncertainty
+AP_CLOCK_PPM = 100
+
+#####################################
+# MAX ms difference to detect missing pulse
+#####################################
+# Specifies time threshold in ms to validate any missing PPS pulses
+MISSING_PULSE_TIME_DELTA = 900
+
+#####################################
+# Propagation time uncertainty
+#####################################
+# 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
+
+#####################################
+# Modem type
+#####################################
+# This setting configures modem type
+# (external=0 or internal=1)
+# comment out the next line to vote
+# for the first modem in the list
+MODEM_TYPE = 1
+
+##################################################
+# CONSTRAINED TIME UNCERTAINTY MODE
+##################################################
+# 0 : disabled (default)
+# 1 : enabled
+# This setting enables GPS engine to keep its time
+# uncertainty below the specified constraint
+#CONSTRAINED_TIME_UNCERTAINTY_ENABLED = 0
+
+# If constrained time uncertainty mode is enabled,
+# this setting specifies the time uncertainty
+# threshold that gps engine need to maintain.
+# In unit of milli-seconds.
+# Default is 0.0 meaning that modem default value
+# of time uncertainty threshold will be used.
+#CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD = 0.0
+
+# If constrained time uncertainty mode is enabled,
+# this setting specifies the power budget that
+# gps engine is allowed to spend to maintain the time
+# uncertainty.
+# Default is 0 meaning that GPS engine is not constained
+# by power budget and can spend as much power as needed.
+# In unit of 0.1 milli watt second.
+#CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET = 0
+
+##################################################
+# POSITION ASSISTED CLOCK ESTIMATOR
+##################################################
+# 0 : disabled (default)
+# 1 : enabled
+# This setting enables GPS engine to estimate clock
+# bias and drift when the signal from at least 1
+# SV is available and the UEÂ’s position is known by
+# other position engines.
+#POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED = 0
+
+#####################################
+# proxyAppPackageName
+#####################################
+# This is a string that is sent to the framework
+# in nfwNotifyCb callback
+PROXY_APP_PACKAGE_NAME = com.google.android.carrierlocation
+
+#####################################
+# CP_MTLR_ES
+#####################################
+# CP MTLR ES, 1=enable, 0=disable
+CP_MTLR_ES=0
+
+##################################################
+# GNSS_DEPLOYMENT
+##################################################
+# 0 : Enable QTI GNSS (default)
+# 1 : Enable QCSR SS5
+# 2 : Enable PDS API
+# This setting use to select between QTI GNSS,
+# QCSR SS5 hardware receiver, and PDS API.
+# By default QTI GNSS receiver is enabled.
+# GNSS_DEPLOYMENT = 0
+
+##################################################
+## LOG BUFFER CONFIGURATION
+##################################################
+#LOG_BUFFER_ENABLED, 1=enable, 0=disable
+#*_LEVEL_TIME_DEPTH, maximum time depth of level *
+#in log buffer, unit is second
+#*_LEVEL_MAX_CAPACITY, maximum numbers of level *
+#log print sentences in log buffer
+LOG_BUFFER_ENABLED = 0
+E_LEVEL_TIME_DEPTH = 600
+E_LEVEL_MAX_CAPACITY = 50
+W_LEVEL_TIME_DEPTH = 500
+W_LEVEL_MAX_CAPACITY = 100
+I_LEVEL_TIME_DEPTH = 400
+I_LEVEL_MAX_CAPACITY = 200
+D_LEVEL_TIME_DEPTH = 30
+D_LEVEL_MAX_CAPACITY = 300
+V_LEVEL_TIME_DEPTH = 200
+V_LEVEL_MAX_CAPACITY = 400
+
diff --git a/gps/geofence/Android.mk b/gps/geofence/Android.mk
new file mode 100644
index 0000000..7e0e34e
--- /dev/null
+++ b/gps/geofence/Android.mk
@@ -0,0 +1,39 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libgeofencing
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES:= \
+ GeofenceAdapter.cpp \
+ location_geofence.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libgps.utils \
+ liblog \
+ libloc_core \
+ liblbs_core
+
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
+
diff --git a/gps/geofence/GeofenceAdapter.cpp b/gps/geofence/GeofenceAdapter.cpp
new file mode 100644
index 0000000..e299589
--- /dev/null
+++ b/gps/geofence/GeofenceAdapter.cpp
@@ -0,0 +1,870 @@
+/* Copyright (c) 2013-2019, 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.
+ *
+ */
+#define LOG_TAG "LocSvc_GeofenceAdapter"
+
+#include <GeofenceAdapter.h>
+#include "loc_log.h"
+#include <log_util.h>
+#include <string>
+
+using namespace loc_core;
+
+GeofenceAdapter::GeofenceAdapter() :
+ LocAdapterBase(0,
+ LocContext::getLocContext(
+ NULL,
+ NULL,
+ LocContext::mLocationHalName,
+ false),
+ true /*isMaster*/)
+{
+ LOC_LOGD("%s]: Constructor", __func__);
+}
+
+void
+GeofenceAdapter::stopClientSessions(LocationAPI* client)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+
+
+ for (auto it = mGeofenceIds.begin(); it != mGeofenceIds.end();) {
+ uint32_t hwId = it->second;
+ GeofenceKey key(it->first);
+ if (client == key.client) {
+ it = mGeofenceIds.erase(it);
+ mLocApi->removeGeofence(hwId, key.id,
+ new LocApiResponse(*getContext(),
+ [this, hwId] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ auto it2 = mGeofences.find(hwId);
+ if (it2 != mGeofences.end()) {
+ mGeofences.erase(it2);
+ } else {
+ LOC_LOGE("%s]:geofence item to erase not found. hwId %u", __func__, hwId);
+ }
+ }
+ }));
+ continue;
+ }
+ ++it; // increment only when not erasing an iterator
+ }
+
+}
+
+void
+GeofenceAdapter::updateClientsEventMask()
+{
+ LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (it->second.geofenceBreachCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT;
+ mask |= LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL;
+ }
+ if (it->second.geofenceStatusCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT;
+ }
+ }
+ updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
+}
+
+LocationError
+GeofenceAdapter::getHwIdFromClient(LocationAPI* client, uint32_t clientId, uint32_t& hwId)
+{
+ GeofenceKey key(client, clientId);
+ auto it = mGeofenceIds.find(key);
+ if (it != mGeofenceIds.end()) {
+ hwId = it->second;
+ return LOCATION_ERROR_SUCCESS;
+ }
+ return LOCATION_ERROR_ID_UNKNOWN;
+}
+
+LocationError
+GeofenceAdapter::getGeofenceKeyFromHwId(uint32_t hwId, GeofenceKey& key)
+{
+ auto it = mGeofences.find(hwId);
+ if (it != mGeofences.end()) {
+ key = it->second.key;
+ return LOCATION_ERROR_SUCCESS;
+ }
+ return LOCATION_ERROR_ID_UNKNOWN;
+}
+
+void
+GeofenceAdapter::handleEngineUpEvent()
+{
+ struct MsgSSREvent : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ inline MsgSSREvent(GeofenceAdapter& adapter) :
+ LocMsg(),
+ mAdapter(adapter) {}
+ virtual void proc() const {
+ mAdapter.setEngineCapabilitiesKnown(true);
+ mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
+ mAdapter.restartGeofences();
+ for (auto msg: mAdapter.mPendingMsgs) {
+ mAdapter.sendMsg(msg);
+ }
+ mAdapter.mPendingMsgs.clear();
+ }
+ };
+
+ sendMsg(new MsgSSREvent(*this));
+}
+
+void
+GeofenceAdapter::restartGeofences()
+{
+ if (mGeofences.empty()) {
+ return;
+ }
+
+ GeofencesMap oldGeofences(mGeofences);
+ mGeofences.clear();
+ mGeofenceIds.clear();
+
+ for (auto it = oldGeofences.begin(); it != oldGeofences.end(); it++) {
+ GeofenceObject object = it->second;
+ GeofenceOption options = {sizeof(GeofenceOption),
+ object.breachMask,
+ object.responsiveness,
+ object.dwellTime};
+ GeofenceInfo info = {sizeof(GeofenceInfo),
+ object.latitude,
+ object.longitude,
+ object.radius};
+ mLocApi->addGeofence(object.key.id,
+ options,
+ info,
+ new LocApiResponseData<LocApiGeofenceData>(*getContext(),
+ [this, object, options, info] (LocationError err, LocApiGeofenceData data) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ if (true == object.paused) {
+ mLocApi->pauseGeofence(data.hwId, object.key.id,
+ new LocApiResponse(*getContext(), [] (LocationError err ) {}));
+ }
+ saveGeofenceItem(object.key.client, object.key.id, data.hwId, options, info);
+ }
+ }));
+ }
+}
+
+void
+GeofenceAdapter::reportResponse(LocationAPI* client, size_t count, LocationError* errs,
+ uint32_t* ids)
+{
+ IF_LOC_LOGD {
+ std::string idsString = "[";
+ std::string errsString = "[";
+ if (NULL != ids && NULL != errs) {
+ for (size_t i=0; i < count; ++i) {
+ idsString += std::to_string(ids[i]) + " ";
+ errsString += std::to_string(errs[i]) + " ";
+ }
+ }
+ idsString += "]";
+ errsString += "]";
+
+ LOC_LOGD("%s]: client %p ids %s errs %s",
+ __func__, client, idsString.c_str(), errsString.c_str());
+ }
+
+ auto it = mClientData.find(client);
+ if (it != mClientData.end() && it->second.collectiveResponseCb != nullptr) {
+ it->second.collectiveResponseCb(count, errs, ids);
+ } else {
+ LOC_LOGE("%s]: client %p response not found in info", __func__, client);
+ }
+}
+
+uint32_t*
+GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, GeofenceOption* options,
+ GeofenceInfo* infos)
+{
+ LOC_LOGD("%s]: client %p count %zu", __func__, client, count);
+
+ struct MsgAddGeofences : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ size_t mCount;
+ uint32_t* mIds;
+ GeofenceOption* mOptions;
+ GeofenceInfo* mInfos;
+ inline MsgAddGeofences(GeofenceAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ size_t count,
+ uint32_t* ids,
+ GeofenceOption* options,
+ GeofenceInfo* infos) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mCount(count),
+ mIds(ids),
+ mOptions(options),
+ mInfos(infos) {}
+ inline virtual void proc() const {
+ LocationError* errs = new LocationError[mCount];
+ if (nullptr == errs) {
+ LOC_LOGE("%s]: new failed to allocate errs", __func__);
+ return;
+ }
+ for (size_t i=0; i < mCount; ++i) {
+ if (NULL == mIds || NULL == mOptions || NULL == mInfos) {
+ errs[i] = LOCATION_ERROR_INVALID_PARAMETER;
+ } else {
+ mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
+ mOptions = mOptions, mInfos = mInfos, mIds = mIds, &mApi = mApi,
+ errs, i] (LocationError err ) {
+ mApi.addGeofence(mIds[i], mOptions[i], mInfos[i],
+ new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
+ mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i]
+ (LocationError err, LocApiGeofenceData data) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.saveGeofenceItem(mClient,
+ mIds[i],
+ data.hwId,
+ mOptions[i],
+ mInfos[i]);
+ }
+ errs[i] = err;
+
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ delete[] mOptions;
+ delete[] mInfos;
+ }
+ }));
+ }));
+ }
+ }
+ }
+ };
+
+ if (0 == count) {
+ return NULL;
+ }
+ uint32_t* ids = new uint32_t[count];
+ if (nullptr == ids) {
+ LOC_LOGE("%s]: new failed to allocate ids", __func__);
+ return NULL;
+ }
+ if (NULL != ids) {
+ for (size_t i=0; i < count; ++i) {
+ ids[i] = generateSessionId();
+ }
+ }
+ GeofenceOption* optionsCopy;
+ if (options == NULL) {
+ optionsCopy = NULL;
+ } else {
+ optionsCopy = new GeofenceOption[count];
+ if (nullptr == optionsCopy) {
+ LOC_LOGE("%s]: new failed to allocate optionsCopy", __func__);
+ return NULL;
+ }
+ COPY_IF_NOT_NULL(optionsCopy, options, count);
+ }
+ GeofenceInfo* infosCopy;
+ if (infos == NULL) {
+ infosCopy = NULL;
+ } else {
+ infosCopy = new GeofenceInfo[count];
+ if (nullptr == infosCopy) {
+ LOC_LOGE("%s]: new failed to allocate infosCopy", __func__);
+ return NULL;
+ }
+ COPY_IF_NOT_NULL(infosCopy, infos, count);
+ }
+
+ sendMsg(new MsgAddGeofences(*this, *mLocApi, client, count, ids, optionsCopy, infosCopy));
+ return ids;
+}
+
+void
+GeofenceAdapter::removeGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids)
+{
+ LOC_LOGD("%s]: client %p count %zu", __func__, client, count);
+
+ struct MsgRemoveGeofences : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ size_t mCount;
+ uint32_t* mIds;
+ inline MsgRemoveGeofences(GeofenceAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ size_t count,
+ uint32_t* ids) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mCount(count),
+ mIds(ids) {}
+ inline virtual void proc() const {
+ LocationError* errs = new LocationError[mCount];
+ if (nullptr == errs) {
+ LOC_LOGE("%s]: new failed to allocate errs", __func__);
+ return;
+ }
+ for (size_t i=0; i < mCount; ++i) {
+ mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
+ &mApi = mApi, errs, i] (LocationError err ) {
+ uint32_t hwId = 0;
+ errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
+ if (LOCATION_ERROR_SUCCESS == errs[i]) {
+ mApi.removeGeofence(hwId, mIds[i],
+ new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
+ hwId, errs, i] (LocationError err ) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.removeGeofenceItem(hwId);
+ }
+ errs[i] = err;
+
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ }
+ }));
+ } else {
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ }
+ }
+ }));
+ }
+ }
+ };
+
+ if (0 == count) {
+ return;
+ }
+ uint32_t* idsCopy = new uint32_t[count];
+ if (nullptr == idsCopy) {
+ LOC_LOGE("%s]: new failed to allocate idsCopy", __func__);
+ return;
+ }
+ COPY_IF_NOT_NULL(idsCopy, ids, count);
+ sendMsg(new MsgRemoveGeofences(*this, *mLocApi, client, count, idsCopy));
+}
+
+void
+GeofenceAdapter::pauseGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids)
+{
+ LOC_LOGD("%s]: client %p count %zu", __func__, client, count);
+
+ struct MsgPauseGeofences : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ size_t mCount;
+ uint32_t* mIds;
+ inline MsgPauseGeofences(GeofenceAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ size_t count,
+ uint32_t* ids) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mCount(count),
+ mIds(ids) {}
+ inline virtual void proc() const {
+ LocationError* errs = new LocationError[mCount];
+ if (nullptr == errs) {
+ LOC_LOGE("%s]: new failed to allocate errs", __func__);
+ return;
+ }
+ for (size_t i=0; i < mCount; ++i) {
+ mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
+ &mApi = mApi, errs, i] (LocationError err ) {
+ uint32_t hwId = 0;
+ errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
+ if (LOCATION_ERROR_SUCCESS == errs[i]) {
+ mApi.pauseGeofence(hwId, mIds[i], new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
+ hwId, errs, i] (LocationError err ) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.pauseGeofenceItem(hwId);
+ }
+ errs[i] = err;
+
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ }
+ }));
+ } else {
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ }
+ }
+ }));
+ }
+ }
+ };
+
+ if (0 == count) {
+ return;
+ }
+ uint32_t* idsCopy = new uint32_t[count];
+ if (nullptr == idsCopy) {
+ LOC_LOGE("%s]: new failed to allocate idsCopy", __func__);
+ return;
+ }
+ COPY_IF_NOT_NULL(idsCopy, ids, count);
+ sendMsg(new MsgPauseGeofences(*this, *mLocApi, client, count, idsCopy));
+}
+
+void
+GeofenceAdapter::resumeGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids)
+{
+ LOC_LOGD("%s]: client %p count %zu", __func__, client, count);
+
+ struct MsgResumeGeofences : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ size_t mCount;
+ uint32_t* mIds;
+ inline MsgResumeGeofences(GeofenceAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ size_t count,
+ uint32_t* ids) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mCount(count),
+ mIds(ids) {}
+ inline virtual void proc() const {
+ LocationError* errs = new LocationError[mCount];
+ if (nullptr == errs) {
+ LOC_LOGE("%s]: new failed to allocate errs", __func__);
+ return;
+ }
+ for (size_t i=0; i < mCount; ++i) {
+ mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
+ &mApi = mApi, errs, i] (LocationError err ) {
+ uint32_t hwId = 0;
+ errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
+ if (LOCATION_ERROR_SUCCESS == errs[i]) {
+ mApi.resumeGeofence(hwId, mIds[i],
+ new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, hwId,
+ errs, mIds = mIds, i] (LocationError err ) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ errs[i] = err;
+
+ mAdapter.resumeGeofenceItem(hwId);
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ }
+ }
+ }));
+ } else {
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ }
+ }
+ }));
+ }
+ }
+ };
+
+ if (0 == count) {
+ return;
+ }
+ uint32_t* idsCopy = new uint32_t[count];
+ if (nullptr == idsCopy) {
+ LOC_LOGE("%s]: new failed to allocate idsCopy", __func__);
+ return;
+ }
+ COPY_IF_NOT_NULL(idsCopy, ids, count);
+ sendMsg(new MsgResumeGeofences(*this, *mLocApi, client, count, idsCopy));
+}
+
+void
+GeofenceAdapter::modifyGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids,
+ GeofenceOption* options)
+{
+ LOC_LOGD("%s]: client %p count %zu", __func__, client, count);
+
+ struct MsgModifyGeofences : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ size_t mCount;
+ uint32_t* mIds;
+ GeofenceOption* mOptions;
+ inline MsgModifyGeofences(GeofenceAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ size_t count,
+ uint32_t* ids,
+ GeofenceOption* options) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mCount(count),
+ mIds(ids),
+ mOptions(options) {}
+ inline virtual void proc() const {
+ LocationError* errs = new LocationError[mCount];
+ if (nullptr == errs) {
+ LOC_LOGE("%s]: new failed to allocate errs", __func__);
+ return;
+ }
+ for (size_t i=0; i < mCount; ++i) {
+ if (NULL == mIds || NULL == mOptions) {
+ errs[i] = LOCATION_ERROR_INVALID_PARAMETER;
+ } else {
+ mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
+ &mApi = mApi, mOptions = mOptions, errs, i] (LocationError err ) {
+ uint32_t hwId = 0;
+ errs[i] = mAdapter.getHwIdFromClient(mClient, mIds[i], hwId);
+ if (LOCATION_ERROR_SUCCESS == errs[i]) {
+ mApi.modifyGeofence(hwId, mIds[i], mOptions[i],
+ new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
+ mIds = mIds, mOptions = mOptions, hwId, errs, i]
+ (LocationError err ) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ errs[i] = err;
+
+ mAdapter.modifyGeofenceItem(hwId, mOptions[i]);
+ }
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ delete[] mOptions;
+ }
+ }));
+ } else {
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ delete[] mOptions;
+ }
+ }
+ }));
+ }
+ }
+ }
+ };
+
+ if (0 == count) {
+ return;
+ }
+ uint32_t* idsCopy = new uint32_t[count];
+ if (nullptr == idsCopy) {
+ LOC_LOGE("%s]: new failed to allocate idsCopy", __func__);
+ return;
+ }
+ COPY_IF_NOT_NULL(idsCopy, ids, count);
+ GeofenceOption* optionsCopy;
+ if (options == NULL) {
+ optionsCopy = NULL;
+ } else {
+ optionsCopy = new GeofenceOption[count];
+ if (nullptr == optionsCopy) {
+ LOC_LOGE("%s]: new failed to allocate optionsCopy", __func__);
+ return;
+ }
+ COPY_IF_NOT_NULL(optionsCopy, options, count);
+ }
+
+ sendMsg(new MsgModifyGeofences(*this, *mLocApi, client, count, idsCopy, optionsCopy));
+}
+
+void
+GeofenceAdapter::saveGeofenceItem(LocationAPI* client, uint32_t clientId, uint32_t hwId,
+ const GeofenceOption& options, const GeofenceInfo& info)
+{
+ LOC_LOGD("%s]: hwId %u client %p clientId %u", __func__, hwId, client, clientId);
+ GeofenceKey key(client, clientId);
+ GeofenceObject object = {key,
+ options.breachTypeMask,
+ options.responsiveness,
+ options.dwellTime,
+ info.latitude,
+ info.longitude,
+ info.radius,
+ false};
+ mGeofences[hwId] = object;
+ mGeofenceIds[key] = hwId;
+ dump();
+}
+
+void
+GeofenceAdapter::removeGeofenceItem(uint32_t hwId)
+{
+ GeofenceKey key;
+ LocationError err = getGeofenceKeyFromHwId(hwId, key);
+ if (LOCATION_ERROR_SUCCESS != err) {
+ LOC_LOGE("%s]: can not find the key for hwId %u", __func__, hwId);
+ } else {
+ auto it1 = mGeofenceIds.find(key);
+ if (it1 != mGeofenceIds.end()) {
+ mGeofenceIds.erase(it1);
+
+ auto it2 = mGeofences.find(hwId);
+ if (it2 != mGeofences.end()) {
+ mGeofences.erase(it2);
+ dump();
+ } else {
+ LOC_LOGE("%s]:geofence item to erase not found. hwId %u", __func__, hwId);
+ }
+ } else {
+ LOC_LOGE("%s]: geofence item to erase not found. hwId %u", __func__, hwId);
+ }
+ }
+}
+
+void
+GeofenceAdapter::pauseGeofenceItem(uint32_t hwId)
+{
+ auto it = mGeofences.find(hwId);
+ if (it != mGeofences.end()) {
+ it->second.paused = true;
+ dump();
+ } else {
+ LOC_LOGE("%s]: geofence item to pause not found. hwId %u", __func__, hwId);
+ }
+}
+
+void
+GeofenceAdapter::resumeGeofenceItem(uint32_t hwId)
+{
+ auto it = mGeofences.find(hwId);
+ if (it != mGeofences.end()) {
+ it->second.paused = false;
+ dump();
+ } else {
+ LOC_LOGE("%s]: geofence item to resume not found. hwId %u", __func__, hwId);
+ }
+}
+
+void
+GeofenceAdapter::modifyGeofenceItem(uint32_t hwId, const GeofenceOption& options)
+{
+ auto it = mGeofences.find(hwId);
+ if (it != mGeofences.end()) {
+ it->second.breachMask = options.breachTypeMask;
+ it->second.responsiveness = options.responsiveness;
+ it->second.dwellTime = options.dwellTime;
+ dump();
+ } else {
+ LOC_LOGE("%s]: geofence item to modify not found. hwId %u", __func__, hwId);
+ }
+}
+
+
+void
+GeofenceAdapter::geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location,
+ GeofenceBreachType breachType, uint64_t timestamp)
+{
+
+ IF_LOC_LOGD {
+ std::string idsString = "[";
+ if (NULL != hwIds) {
+ for (size_t i=0; i < count; ++i) {
+ idsString += std::to_string(hwIds[i]) + " ";
+ }
+ }
+ idsString += "]";
+ LOC_LOGD("%s]: breachType %u count %zu ids %s",
+ __func__, breachType, count, idsString.c_str());
+ }
+
+ if (0 == count || NULL == hwIds)
+ return;
+
+ struct MsgGeofenceBreach : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ size_t mCount;
+ uint32_t* mHwIds;
+ Location mLocation;
+ GeofenceBreachType mBreachType;
+ uint64_t mTimestamp;
+ inline MsgGeofenceBreach(GeofenceAdapter& adapter,
+ size_t count,
+ uint32_t* hwIds,
+ Location& location,
+ GeofenceBreachType breachType,
+ uint64_t timestamp) :
+ LocMsg(),
+ mAdapter(adapter),
+ mCount(count),
+ mHwIds(new uint32_t[count]),
+ mLocation(location),
+ mBreachType(breachType),
+ mTimestamp(timestamp)
+ {
+ if (nullptr == mHwIds) {
+ LOC_LOGE("%s]: new failed to allocate mHwIds", __func__);
+ return;
+ }
+ COPY_IF_NOT_NULL(mHwIds, hwIds, mCount);
+ }
+ inline virtual ~MsgGeofenceBreach() {
+ delete[] mHwIds;
+ }
+ inline virtual void proc() const {
+ mAdapter.geofenceBreach(mCount, mHwIds, mLocation, mBreachType, mTimestamp);
+ }
+ };
+
+ sendMsg(new MsgGeofenceBreach(*this, count, hwIds, location, breachType, timestamp));
+
+}
+
+void
+GeofenceAdapter::geofenceBreach(size_t count, uint32_t* hwIds, const Location& location,
+ GeofenceBreachType breachType, uint64_t timestamp)
+{
+
+ for (auto it = mClientData.begin(); it != mClientData.end(); ++it) {
+ uint32_t* clientIds = new uint32_t[count];
+ if (nullptr == clientIds) {
+ return;
+ }
+ uint32_t index = 0;
+ for (size_t i=0; i < count; ++i) {
+ GeofenceKey key;
+ LocationError err = getGeofenceKeyFromHwId(hwIds[i], key);
+ if (LOCATION_ERROR_SUCCESS == err) {
+ if (key.client == it->first) {
+ clientIds[index++] = key.id;
+ }
+ }
+ }
+ if (index > 0 && it->second.geofenceBreachCb != nullptr) {
+ GeofenceBreachNotification notify = {sizeof(GeofenceBreachNotification),
+ index,
+ clientIds,
+ location,
+ breachType,
+ timestamp};
+
+ it->second.geofenceBreachCb(notify);
+ }
+ delete[] clientIds;
+ }
+}
+
+void
+GeofenceAdapter::geofenceStatusEvent(GeofenceStatusAvailable available)
+{
+ LOC_LOGD("%s]: available %u ", __func__, available);
+
+ struct MsgGeofenceStatus : public LocMsg {
+ GeofenceAdapter& mAdapter;
+ GeofenceStatusAvailable mAvailable;
+ inline MsgGeofenceStatus(GeofenceAdapter& adapter,
+ GeofenceStatusAvailable available) :
+ LocMsg(),
+ mAdapter(adapter),
+ mAvailable(available) {}
+ inline virtual void proc() const {
+ mAdapter.geofenceStatus(mAvailable);
+ }
+ };
+
+ sendMsg(new MsgGeofenceStatus(*this, available));
+}
+
+void
+GeofenceAdapter::geofenceStatus(GeofenceStatusAvailable available)
+{
+ for (auto it = mClientData.begin(); it != mClientData.end(); ++it) {
+ if (it->second.geofenceStatusCb != nullptr) {
+ GeofenceStatusNotification notify = {sizeof(GeofenceStatusNotification),
+ available,
+ LOCATION_TECHNOLOGY_TYPE_GNSS};
+ it->second.geofenceStatusCb(notify);
+ }
+ }
+}
+
+void
+GeofenceAdapter::dump()
+{
+ IF_LOC_LOGV {
+ LOC_LOGV(
+ "HAL | hwId | mask | respon | latitude | longitude | radius | paused | Id | client");
+ for (auto it = mGeofences.begin(); it != mGeofences.end(); ++it) {
+ uint32_t hwId = it->first;
+ GeofenceObject object = it->second;
+ LOC_LOGV(" | %5u | %4u | %6u | %8.2f | %9.2f | %6.2f | %6u | %04x | %p ",
+ hwId, object.breachMask, object.responsiveness,
+ object.latitude, object.longitude, object.radius,
+ object.paused, object.key.id, object.key.client);
+ }
+ }
+}
+
diff --git a/gps/geofence/GeofenceAdapter.h b/gps/geofence/GeofenceAdapter.h
new file mode 100644
index 0000000..38f4823
--- /dev/null
+++ b/gps/geofence/GeofenceAdapter.h
@@ -0,0 +1,136 @@
+/* Copyright (c) 2013-2019, 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 GEOFENCE_ADAPTER_H
+#define GEOFENCE_ADAPTER_H
+
+#include <LocAdapterBase.h>
+#include <LocContext.h>
+#include <LocationAPI.h>
+#include <map>
+
+using namespace loc_core;
+
+#define COPY_IF_NOT_NULL(dest, src, len) do { \
+ if (NULL!=dest && NULL!=src) { \
+ for (size_t i=0; i<len; ++i) { \
+ dest[i] = src[i]; \
+ } \
+ } \
+} while (0)
+
+typedef struct GeofenceKey {
+ LocationAPI* client;
+ uint32_t id;
+ inline GeofenceKey() :
+ client(NULL), id(0) {}
+ inline GeofenceKey(LocationAPI* _client, uint32_t _id) :
+ client(_client), id(_id) {}
+} GeofenceKey;
+inline bool operator <(GeofenceKey const& left, GeofenceKey const& right) {
+ return left.id < right.id || (left.id == right.id && left.client < right.client);
+}
+inline bool operator ==(GeofenceKey const& left, GeofenceKey const& right) {
+ return left.id == right.id && left.client == right.client;
+}
+inline bool operator !=(GeofenceKey const& left, GeofenceKey const& right) {
+ return left.id != right.id || left.client != right.client;
+}
+typedef struct {
+ GeofenceKey key;
+ GeofenceBreachTypeMask breachMask;
+ uint32_t responsiveness;
+ uint32_t dwellTime;
+ double latitude;
+ double longitude;
+ double radius;
+ bool paused;
+} GeofenceObject;
+typedef std::map<uint32_t, GeofenceObject> GeofencesMap; //map of hwId to GeofenceObject
+typedef std::map<GeofenceKey, uint32_t> GeofenceIdMap; //map of GeofenceKey to hwId
+
+class GeofenceAdapter : public LocAdapterBase {
+
+ /* ==== GEOFENCES ====================================================================== */
+ GeofencesMap mGeofences; //map hwId to GeofenceObject
+ GeofenceIdMap mGeofenceIds; //map of GeofenceKey to hwId
+
+protected:
+
+ /* ==== CLIENT ========================================================================= */
+ virtual void updateClientsEventMask();
+ virtual void stopClientSessions(LocationAPI* client);
+
+public:
+
+ GeofenceAdapter();
+ virtual ~GeofenceAdapter() {}
+
+ /* ==== SSR ============================================================================ */
+ /* ======== EVENTS ====(Called from QMI Thread)========================================= */
+ virtual void handleEngineUpEvent();
+ /* ======== UTILITIES ================================================================== */
+ void restartGeofences();
+
+ /* ==== GEOFENCES ====================================================================== */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ uint32_t* addGeofencesCommand(LocationAPI* client, size_t count,
+ GeofenceOption* options, GeofenceInfo* info);
+ void removeGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids);
+ void pauseGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids);
+ void resumeGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids);
+ void modifyGeofencesCommand(LocationAPI* client, size_t count, uint32_t* ids,
+ GeofenceOption* options);
+ /* ======== RESPONSES ================================================================== */
+ void reportResponse(LocationAPI* client, size_t count, LocationError* errs, uint32_t* ids);
+ /* ======== UTILITIES ================================================================== */
+ void saveGeofenceItem(LocationAPI* client,
+ uint32_t clientId,
+ uint32_t hwId,
+ const GeofenceOption& options,
+ const GeofenceInfo& info);
+ void removeGeofenceItem(uint32_t hwId);
+ void pauseGeofenceItem(uint32_t hwId);
+ void resumeGeofenceItem(uint32_t hwId);
+ void modifyGeofenceItem(uint32_t hwId, const GeofenceOption& options);
+ LocationError getHwIdFromClient(LocationAPI* client, uint32_t clientId, uint32_t& hwId);
+ LocationError getGeofenceKeyFromHwId(uint32_t hwId, GeofenceKey& key);
+ void dump();
+
+ /* ==== REPORTS ======================================================================== */
+ /* ======== EVENTS ====(Called from QMI Thread)========================================= */
+ void geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location,
+ GeofenceBreachType breachType, uint64_t timestamp);
+ void geofenceStatusEvent(GeofenceStatusAvailable available);
+ /* ======== UTILITIES ================================================================== */
+ void geofenceBreach(size_t count, uint32_t* hwIds, const Location& location,
+ GeofenceBreachType breachType, uint64_t timestamp);
+ void geofenceStatus(GeofenceStatusAvailable available);
+};
+
+#endif /* GEOFENCE_ADAPTER_H */
diff --git a/gps/geofence/Makefile.am b/gps/geofence/Makefile.am
new file mode 100644
index 0000000..61883ff
--- /dev/null
+++ b/gps/geofence/Makefile.am
@@ -0,0 +1,50 @@
+AM_CFLAGS = -Wundef \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ ${GPSUTILS_CFLAGS} \
+ ${LOCCORE_CFLAGS} \
+ $(LOCPLA_CFLAGS) \
+ -D__func__=__PRETTY_FUNCTION__ \
+ -std=c++1y
+
+AM_CPPFLAGS = $(AM_CFLAGS)
+
+ACLOCAL_AMFLAGS = -I m4
+
+requiredlibs = \
+ ${LOCCORE_LIBS} \
+ $(GPSUTILS_LIBS) \
+ -llog
+
+h_sources = \
+ GeofenceAdapter.h
+
+c_sources = \
+ GeofenceAdapter.cpp \
+ location_geofence.cpp
+
+libgeofencing_la_SOURCES = $(c_sources)
+if USE_GLIB
+libgeofencing_la_CFLAGS = -DUSE_GLIB @GLIB_CFLAGS@ $(AM_CFLAGS)
+libgeofencing_la_CPPFLAGS = -DUSE_GLIB @GLIB_CFLAGS@ $(AM_CFLAGS) $(AM_CPPFLAGS)
+libgeofencing_la_LDFLAGS = -lstdc++ -Wl,-z,defs @GLIB_LIBS@ $(requiredlibs) -shared -version-info 1:0:0
+libgeofencing_la_LIBDADD = $(requiredlibs) -lstdc++ @GLIB_LIBS@
+else
+libgeofencing_la_CFLAGS = $(AM_CFLAGS)
+libgeofencing_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+libgeofencing_la_LDFLAGS = -lstdc++ -Wl,-z,defs $(requiredlibs) -shared -version-info 1:0:0
+libgeofencing_la_LIBDADD = $(requiredlibs) -lstdc++
+endif
+
+library_include_HEADERS = $(h_sources)
+
+library_includedir = $(pkgincludedir)
+
+lib_LTLIBRARIES = libgeofencing.la
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-geofence.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/gps/geofence/configure.ac b/gps/geofence/configure.ac
new file mode 100644
index 0000000..74eae7a
--- /dev/null
+++ b/gps/geofence/configure.ac
@@ -0,0 +1,72 @@
+AC_PREREQ(2.61)
+AC_INIT([location-geofence], 1.0.0)
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Check 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
+
+# Check for libraries
+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])
+
+AS_CASE([$host],
+ [arm*], [ARM=yes],
+ [ARM=no]
+)
+
+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],
+ 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_SUBST([CFLAGS])
+AC_SUBST([CPPFLAGS])
+AC_SUBST([LIBS])
+
+AC_CONFIG_FILES([ \
+ Makefile \
+ location-geofence.pc
+ ])
+
+AC_OUTPUT
diff --git a/gps/geofence/location-geofence.pc.in b/gps/geofence/location-geofence.pc.in
new file mode 100644
index 0000000..6a0781f
--- /dev/null
+++ b/gps/geofence/location-geofence.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-geofence
+Description: QTI GPS Geofence
+Version: @VERSION
+Libs: -L${libdir} -lgeofencing
+Cflags: -I${includedir}/location-geofence
diff --git a/gps/geofence/location_geofence.cpp b/gps/geofence/location_geofence.cpp
new file mode 100644
index 0000000..66729f4
--- /dev/null
+++ b/gps/geofence/location_geofence.cpp
@@ -0,0 +1,145 @@
+/* Copyright (c) 2017-2019, 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 "GeofenceAdapter.h"
+#include "location_interface.h"
+
+static GeofenceAdapter* gGeofenceAdapter = NULL;
+
+static void initialize();
+static void deinitialize();
+
+static void addClient(LocationAPI* client, const LocationCallbacks& callbacks);
+static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb);
+static void requestCapabilities(LocationAPI* client);
+
+static uint32_t* addGeofences(LocationAPI* client, size_t count, GeofenceOption*, GeofenceInfo*);
+static void removeGeofences(LocationAPI* client, size_t count, uint32_t* ids);
+static void modifyGeofences(LocationAPI* client, size_t count, uint32_t* ids,
+ GeofenceOption* options);
+static void pauseGeofences(LocationAPI* client, size_t count, uint32_t* ids);
+static void resumeGeofences(LocationAPI* client, size_t count, uint32_t* ids);
+
+static const GeofenceInterface gGeofenceInterface = {
+ sizeof(GeofenceInterface),
+ initialize,
+ deinitialize,
+ addClient,
+ removeClient,
+ requestCapabilities,
+ addGeofences,
+ removeGeofences,
+ modifyGeofences,
+ pauseGeofences,
+ resumeGeofences
+};
+
+#ifndef DEBUG_X86
+extern "C" const GeofenceInterface* getGeofenceInterface()
+#else
+const GeofenceInterface* getGeofenceInterface()
+#endif // DEBUG_X86
+{
+ return &gGeofenceInterface;
+}
+
+static void initialize()
+{
+ if (NULL == gGeofenceAdapter) {
+ gGeofenceAdapter = new GeofenceAdapter();
+ }
+}
+
+static void deinitialize()
+{
+ if (NULL != gGeofenceAdapter) {
+ delete gGeofenceAdapter;
+ gGeofenceAdapter = NULL;
+ }
+}
+
+static void addClient(LocationAPI* client, const LocationCallbacks& callbacks)
+{
+ if (NULL != gGeofenceAdapter) {
+ gGeofenceAdapter->addClientCommand(client, callbacks);
+ }
+}
+
+static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb)
+{
+ if (NULL != gGeofenceAdapter) {
+ gGeofenceAdapter->removeClientCommand(client, rmClientCb);
+ }
+}
+
+static void requestCapabilities(LocationAPI* client)
+{
+ if (NULL != gGeofenceAdapter) {
+ gGeofenceAdapter->requestCapabilitiesCommand(client);
+ }
+}
+
+static uint32_t* addGeofences(LocationAPI* client, size_t count,
+ GeofenceOption* options, GeofenceInfo* info)
+{
+ if (NULL != gGeofenceAdapter) {
+ return gGeofenceAdapter->addGeofencesCommand(client, count, options, info);
+ } else {
+ return NULL;
+ }
+}
+
+static void removeGeofences(LocationAPI* client, size_t count, uint32_t* ids)
+{
+ if (NULL != gGeofenceAdapter) {
+ return gGeofenceAdapter->removeGeofencesCommand(client, count, ids);
+ }
+}
+
+static void modifyGeofences(LocationAPI* client, size_t count, uint32_t* ids,
+ GeofenceOption* options)
+{
+ if (NULL != gGeofenceAdapter) {
+ return gGeofenceAdapter->modifyGeofencesCommand(client, count, ids, options);
+ }
+}
+
+static void pauseGeofences(LocationAPI* client, size_t count, uint32_t* ids)
+{
+ if (NULL != gGeofenceAdapter) {
+ return gGeofenceAdapter->pauseGeofencesCommand(client, count, ids);
+ }
+}
+
+static void resumeGeofences(LocationAPI* client, size_t count, uint32_t* ids)
+{
+ if (NULL != gGeofenceAdapter) {
+ return gGeofenceAdapter->resumeGeofencesCommand(client, count, ids);
+ }
+}
+
diff --git a/gps/gnss/Agps.cpp b/gps/gnss/Agps.cpp
new file mode 100644
index 0000000..9255f88
--- /dev/null
+++ b/gps/gnss/Agps.cpp
@@ -0,0 +1,675 @@
+/* Copyright (c) 2012-2019, 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_Agps"
+
+#include <Agps.h>
+#include <loc_pla.h>
+#include <ContextBase.h>
+#include <loc_timer.h>
+#include <inttypes.h>
+
+/* --------------------------------------------------------------------
+ * AGPS State Machine Methods
+ * -------------------------------------------------------------------*/
+void AgpsStateMachine::processAgpsEvent(AgpsEvent event){
+
+ LOC_LOGD("processAgpsEvent(): SM %p, Event %d, State %d",
+ this, event, mState);
+
+ switch (event) {
+
+ case AGPS_EVENT_SUBSCRIBE:
+ processAgpsEventSubscribe();
+ break;
+
+ case AGPS_EVENT_UNSUBSCRIBE:
+ processAgpsEventUnsubscribe();
+ break;
+
+ case AGPS_EVENT_GRANTED:
+ processAgpsEventGranted();
+ break;
+
+ case AGPS_EVENT_RELEASED:
+ processAgpsEventReleased();
+ break;
+
+ case AGPS_EVENT_DENIED:
+ processAgpsEventDenied();
+ break;
+
+ default:
+ LOC_LOGE("Invalid Loc Agps Event");
+ }
+}
+
+void AgpsStateMachine::processAgpsEventSubscribe(){
+
+ switch (mState) {
+
+ case AGPS_STATE_RELEASED:
+ /* Add subscriber to list
+ * No notifications until we get RSRC_GRANTED */
+ addSubscriber(mCurrentSubscriber);
+ requestOrReleaseDataConn(true);
+ transitionState(AGPS_STATE_PENDING);
+ break;
+
+ case AGPS_STATE_PENDING:
+ /* Already requested for data connection,
+ * do nothing until we get RSRC_GRANTED event;
+ * Just add this subscriber to the list, for notifications */
+ addSubscriber(mCurrentSubscriber);
+ break;
+
+ case AGPS_STATE_ACQUIRED:
+ /* We already have the data connection setup,
+ * Notify current subscriber with GRANTED event,
+ * And add it to the subscriber list for further notifications. */
+ notifyEventToSubscriber(AGPS_EVENT_GRANTED, mCurrentSubscriber, false);
+ addSubscriber(mCurrentSubscriber);
+ break;
+
+ case AGPS_STATE_RELEASING:
+ addSubscriber(mCurrentSubscriber);
+ break;
+
+ default:
+ LOC_LOGE("Invalid state: %d", mState);
+ }
+}
+
+void AgpsStateMachine::processAgpsEventUnsubscribe(){
+
+ switch (mState) {
+
+ case AGPS_STATE_RELEASED:
+ notifyEventToSubscriber(
+ AGPS_EVENT_UNSUBSCRIBE, mCurrentSubscriber, false);
+ break;
+
+ case AGPS_STATE_PENDING:
+ case AGPS_STATE_ACQUIRED:
+ /* If the subscriber wishes to wait for connection close,
+ * before being removed from list, move to inactive state
+ * and notify */
+ if (mCurrentSubscriber->mWaitForCloseComplete) {
+ mCurrentSubscriber->mIsInactive = true;
+ }
+ else {
+ /* Notify only current subscriber and then delete it from
+ * subscriberList */
+ notifyEventToSubscriber(
+ AGPS_EVENT_UNSUBSCRIBE, mCurrentSubscriber, true);
+ }
+
+ /* If no subscribers in list, release data connection */
+ if (mSubscriberList.empty()) {
+ transitionState(AGPS_STATE_RELEASED);
+ requestOrReleaseDataConn(false);
+ }
+ /* Some subscribers in list, but all inactive;
+ * Release data connection */
+ else if(!anyActiveSubscribers()) {
+ transitionState(AGPS_STATE_RELEASING);
+ requestOrReleaseDataConn(false);
+ }
+ break;
+
+ case AGPS_STATE_RELEASING:
+ /* If the subscriber wishes to wait for connection close,
+ * before being removed from list, move to inactive state
+ * and notify */
+ if (mCurrentSubscriber->mWaitForCloseComplete) {
+ mCurrentSubscriber->mIsInactive = true;
+ }
+ else {
+ /* Notify only current subscriber and then delete it from
+ * subscriberList */
+ notifyEventToSubscriber(
+ AGPS_EVENT_UNSUBSCRIBE, mCurrentSubscriber, true);
+ }
+
+ /* If no subscribers in list, just move the state.
+ * Request for releasing data connection should already have been
+ * sent */
+ if (mSubscriberList.empty()) {
+ transitionState(AGPS_STATE_RELEASED);
+ }
+ break;
+
+ default:
+ LOC_LOGE("Invalid state: %d", mState);
+ }
+}
+
+void AgpsStateMachine::processAgpsEventGranted(){
+
+ switch (mState) {
+
+ case AGPS_STATE_RELEASED:
+ case AGPS_STATE_ACQUIRED:
+ case AGPS_STATE_RELEASING:
+ LOC_LOGE("Unexpected event GRANTED in state %d", mState);
+ break;
+
+ case AGPS_STATE_PENDING:
+ // Move to acquired state
+ transitionState(AGPS_STATE_ACQUIRED);
+ notifyAllSubscribers(
+ AGPS_EVENT_GRANTED, false,
+ AGPS_NOTIFICATION_TYPE_FOR_ACTIVE_SUBSCRIBERS);
+ break;
+
+ default:
+ LOC_LOGE("Invalid state: %d", mState);
+ }
+}
+
+void AgpsStateMachine::processAgpsEventReleased(){
+
+ switch (mState) {
+
+ case AGPS_STATE_RELEASED:
+ /* Subscriber list should be empty if we are in released state */
+ if (!mSubscriberList.empty()) {
+ LOC_LOGE("Unexpected event RELEASED in RELEASED state");
+ }
+ break;
+
+ case AGPS_STATE_ACQUIRED:
+ /* Force release received */
+ LOC_LOGW("Force RELEASED event in ACQUIRED state");
+ transitionState(AGPS_STATE_RELEASED);
+ notifyAllSubscribers(
+ AGPS_EVENT_RELEASED, true,
+ AGPS_NOTIFICATION_TYPE_FOR_ALL_SUBSCRIBERS);
+ break;
+
+ case AGPS_STATE_RELEASING:
+ /* Notify all inactive subscribers about the event */
+ notifyAllSubscribers(
+ AGPS_EVENT_RELEASED, true,
+ AGPS_NOTIFICATION_TYPE_FOR_INACTIVE_SUBSCRIBERS);
+
+ /* If we have active subscribers now, they must be waiting for
+ * data conn setup */
+ if (anyActiveSubscribers()) {
+ transitionState(AGPS_STATE_PENDING);
+ requestOrReleaseDataConn(true);
+ }
+ /* No active subscribers, move to released state */
+ else {
+ transitionState(AGPS_STATE_RELEASED);
+ }
+ break;
+
+ case AGPS_STATE_PENDING:
+ /* NOOP */
+ break;
+
+ default:
+ LOC_LOGE("Invalid state: %d", mState);
+ }
+}
+
+void AgpsStateMachine::processAgpsEventDenied(){
+
+ switch (mState) {
+
+ case AGPS_STATE_RELEASED:
+ LOC_LOGE("Unexpected event DENIED in state %d", mState);
+ break;
+
+ case AGPS_STATE_ACQUIRED:
+ /* NOOP */
+ break;
+
+ case AGPS_STATE_RELEASING:
+ /* Notify all inactive subscribers about the event */
+ notifyAllSubscribers(
+ AGPS_EVENT_RELEASED, true,
+ AGPS_NOTIFICATION_TYPE_FOR_INACTIVE_SUBSCRIBERS);
+
+ /* If we have active subscribers now, they must be waiting for
+ * data conn setup */
+ if (anyActiveSubscribers()) {
+ transitionState(AGPS_STATE_PENDING);
+ requestOrReleaseDataConn(true);
+ }
+ /* No active subscribers, move to released state */
+ else {
+ transitionState(AGPS_STATE_RELEASED);
+ }
+ break;
+
+ case AGPS_STATE_PENDING:
+ transitionState(AGPS_STATE_RELEASED);
+ notifyAllSubscribers(
+ AGPS_EVENT_DENIED, true,
+ AGPS_NOTIFICATION_TYPE_FOR_ALL_SUBSCRIBERS);
+ break;
+
+ default:
+ LOC_LOGE("Invalid state: %d", mState);
+ }
+}
+
+/* Request or Release data connection
+ * bool request :
+ * true = Request data connection
+ * false = Release data connection */
+void AgpsStateMachine::requestOrReleaseDataConn(bool request){
+
+ AGnssExtStatusIpV4 nifRequest;
+ memset(&nifRequest, 0, sizeof(nifRequest));
+
+ nifRequest.type = mAgpsType;
+ nifRequest.apnTypeMask = mApnTypeMask;
+ if (request) {
+ LOC_LOGD("AGPS Data Conn Request mAgpsType=%d mApnTypeMask=0x%X",
+ mAgpsType, mApnTypeMask);
+ nifRequest.status = LOC_GPS_REQUEST_AGPS_DATA_CONN;
+ }
+ else{
+ LOC_LOGD("AGPS Data Conn Release mAgpsType=%d mApnTypeMask=0x%X",
+ mAgpsType, mApnTypeMask);
+ nifRequest.status = LOC_GPS_RELEASE_AGPS_DATA_CONN;
+ }
+
+ mFrameworkStatusV4Cb(nifRequest);
+}
+
+void AgpsStateMachine::notifyAllSubscribers(
+ AgpsEvent event, bool deleteSubscriberPostNotify,
+ AgpsNotificationType notificationType){
+
+ LOC_LOGD("notifyAllSubscribers(): "
+ "SM %p, Event %d Delete %d Notification Type %d",
+ this, event, deleteSubscriberPostNotify, notificationType);
+
+ std::list<AgpsSubscriber*>::const_iterator it = mSubscriberList.begin();
+ while ( it != mSubscriberList.end() ) {
+
+ AgpsSubscriber* subscriber = *it;
+
+ if (notificationType == AGPS_NOTIFICATION_TYPE_FOR_ALL_SUBSCRIBERS ||
+ (notificationType == AGPS_NOTIFICATION_TYPE_FOR_INACTIVE_SUBSCRIBERS &&
+ subscriber->mIsInactive) ||
+ (notificationType == AGPS_NOTIFICATION_TYPE_FOR_ACTIVE_SUBSCRIBERS &&
+ !subscriber->mIsInactive)) {
+
+ /* Deleting via this call would require another traversal
+ * through subscriber list, inefficient; hence pass in false*/
+ notifyEventToSubscriber(event, subscriber, false);
+
+ if (deleteSubscriberPostNotify) {
+ it = mSubscriberList.erase(it);
+ delete subscriber;
+ } else {
+ it++;
+ }
+ } else {
+ it++;
+ }
+ }
+}
+
+void AgpsStateMachine::notifyEventToSubscriber(
+ AgpsEvent event, AgpsSubscriber* subscriberToNotify,
+ bool deleteSubscriberPostNotify) {
+
+ LOC_LOGD("notifyEventToSubscriber(): "
+ "SM %p, Event %d Subscriber %p Delete %d",
+ this, event, subscriberToNotify, deleteSubscriberPostNotify);
+
+ switch (event) {
+
+ case AGPS_EVENT_GRANTED:
+ mAgpsManager->mAtlOpenStatusCb(
+ subscriberToNotify->mConnHandle, 1, getAPN(), getAPNLen(),
+ getBearer(), mAgpsType, mApnTypeMask);
+ break;
+
+ case AGPS_EVENT_DENIED:
+ mAgpsManager->mAtlOpenStatusCb(
+ subscriberToNotify->mConnHandle, 0, getAPN(), getAPNLen(),
+ getBearer(), mAgpsType, mApnTypeMask);
+ break;
+
+ case AGPS_EVENT_UNSUBSCRIBE:
+ case AGPS_EVENT_RELEASED:
+ mAgpsManager->mAtlCloseStatusCb(subscriberToNotify->mConnHandle, 1);
+ break;
+
+ default:
+ LOC_LOGE("Invalid event %d", event);
+ }
+
+ /* Search this subscriber in list and delete */
+ if (deleteSubscriberPostNotify) {
+ deleteSubscriber(subscriberToNotify);
+ }
+}
+
+void AgpsStateMachine::transitionState(AgpsState newState){
+
+ LOC_LOGD("transitionState(): SM %p, old %d, new %d",
+ this, mState, newState);
+
+ mState = newState;
+
+ // notify state transitions to all subscribers ?
+}
+
+void AgpsStateMachine::addSubscriber(AgpsSubscriber* subscriberToAdd){
+
+ LOC_LOGD("addSubscriber(): SM %p, Subscriber %p",
+ this, subscriberToAdd);
+
+ // Check if subscriber is already present in the current list
+ // If not, then add
+ std::list<AgpsSubscriber*>::const_iterator it = mSubscriberList.begin();
+ for (; it != mSubscriberList.end(); it++) {
+ AgpsSubscriber* subscriber = *it;
+ if (subscriber->equals(subscriberToAdd)) {
+ LOC_LOGE("Subscriber already in list");
+ return;
+ }
+ }
+
+ AgpsSubscriber* cloned = subscriberToAdd->clone();
+ LOC_LOGD("addSubscriber(): cloned subscriber: %p", cloned);
+ mSubscriberList.push_back(cloned);
+}
+
+void AgpsStateMachine::deleteSubscriber(AgpsSubscriber* subscriberToDelete){
+
+ LOC_LOGD("deleteSubscriber(): SM %p, Subscriber %p",
+ this, subscriberToDelete);
+
+ std::list<AgpsSubscriber*>::const_iterator it = mSubscriberList.begin();
+ while ( it != mSubscriberList.end() ) {
+
+ AgpsSubscriber* subscriber = *it;
+ if (subscriber && subscriber->equals(subscriberToDelete)) {
+
+ it = mSubscriberList.erase(it);
+ delete subscriber;
+ } else {
+ it++;
+ }
+ }
+}
+
+bool AgpsStateMachine::anyActiveSubscribers(){
+
+ std::list<AgpsSubscriber*>::const_iterator it = mSubscriberList.begin();
+ for (; it != mSubscriberList.end(); it++) {
+ AgpsSubscriber* subscriber = *it;
+ if (!subscriber->mIsInactive) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void AgpsStateMachine::setAPN(char* apn, unsigned int len){
+
+ if (NULL != mAPN) {
+ delete mAPN;
+ mAPN = NULL;
+ }
+
+ if (NULL == apn || len <= 0 || len > MAX_APN_LEN || strlen(apn) != len) {
+ LOC_LOGD("Invalid apn len (%d) or null apn", len);
+ mAPN = NULL;
+ mAPNLen = 0;
+ } else {
+ mAPN = new char[len+1];
+ if (NULL != mAPN) {
+ memcpy(mAPN, apn, len);
+ mAPN[len] = '\0';
+ mAPNLen = len;
+ }
+ }
+}
+
+AgpsSubscriber* AgpsStateMachine::getSubscriber(int connHandle){
+
+ /* Go over the subscriber list */
+ std::list<AgpsSubscriber*>::const_iterator it = mSubscriberList.begin();
+ for (; it != mSubscriberList.end(); it++) {
+ AgpsSubscriber* subscriber = *it;
+ if (subscriber->mConnHandle == connHandle) {
+ return subscriber;
+ }
+ }
+
+ /* Not found, return NULL */
+ return NULL;
+}
+
+AgpsSubscriber* AgpsStateMachine::getFirstSubscriber(bool isInactive){
+
+ /* Go over the subscriber list */
+ std::list<AgpsSubscriber*>::const_iterator it = mSubscriberList.begin();
+ for (; it != mSubscriberList.end(); it++) {
+ AgpsSubscriber* subscriber = *it;
+ if(subscriber->mIsInactive == isInactive) {
+ return subscriber;
+ }
+ }
+
+ /* Not found, return NULL */
+ return NULL;
+}
+
+void AgpsStateMachine::dropAllSubscribers(){
+
+ LOC_LOGD("dropAllSubscribers(): SM %p", this);
+
+ /* Go over the subscriber list */
+ std::list<AgpsSubscriber*>::const_iterator it = mSubscriberList.begin();
+ while ( it != mSubscriberList.end() ) {
+ AgpsSubscriber* subscriber = *it;
+ it = mSubscriberList.erase(it);
+ delete subscriber;
+ }
+}
+
+/* --------------------------------------------------------------------
+ * Loc AGPS Manager Methods
+ * -------------------------------------------------------------------*/
+
+/* CREATE AGPS STATE MACHINES
+ * Must be invoked in Msg Handler context */
+void AgpsManager::createAgpsStateMachines(const AgpsCbInfo& cbInfo) {
+
+ LOC_LOGD("AgpsManager::createAgpsStateMachines");
+
+ bool agpsCapable =
+ ((loc_core::ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA) ||
+ (loc_core::ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB));
+
+ if (NULL == mInternetNif && (cbInfo.atlType & AGPS_ATL_TYPE_WWAN)) {
+ mInternetNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_WWAN_ANY);
+ mInternetNif->registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb);
+ LOC_LOGD("Internet NIF: %p", mInternetNif);
+ }
+ if (agpsCapable) {
+ if (NULL == mAgnssNif && (cbInfo.atlType & AGPS_ATL_TYPE_SUPL) &&
+ (cbInfo.atlType & AGPS_ATL_TYPE_SUPL_ES)) {
+ mAgnssNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_SUPL);
+ mAgnssNif->registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb);
+ LOC_LOGD("AGNSS NIF: %p", mAgnssNif);
+ }
+ }
+}
+
+AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) {
+
+ LOC_LOGD("AgpsManager::getAgpsStateMachine(): agpsType %d", agpsType);
+
+ switch (agpsType) {
+
+ case LOC_AGPS_TYPE_INVALID:
+ case LOC_AGPS_TYPE_SUPL:
+ case LOC_AGPS_TYPE_SUPL_ES:
+ if (mAgnssNif == NULL) {
+ LOC_LOGE("NULL AGNSS NIF !");
+ }
+ return mAgnssNif;
+ case LOC_AGPS_TYPE_WWAN_ANY:
+ if (mInternetNif == NULL) {
+ LOC_LOGE("NULL Internet NIF !");
+ }
+ return mInternetNif;
+ default:
+ return mInternetNif;
+ }
+
+ LOC_LOGE("No SM found !");
+ return NULL;
+}
+
+void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType,
+ LocApnTypeMask apnTypeMask){
+
+ LOC_LOGD("AgpsManager::requestATL(): connHandle %d, agpsType 0x%X apnTypeMask: 0x%X",
+ connHandle, agpsType, apnTypeMask);
+
+ if (0 == loc_core::ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL &&
+ LOC_AGPS_TYPE_SUPL_ES == agpsType) {
+ agpsType = LOC_AGPS_TYPE_SUPL;
+ apnTypeMask &= ~LOC_APN_TYPE_MASK_EMERGENCY;
+ apnTypeMask |= LOC_APN_TYPE_MASK_SUPL;
+ LOC_LOGD("Changed agpsType to non-emergency when USE_EMERGENCY... is 0"
+ "and removed LOC_APN_TYPE_MASK_EMERGENCY from apnTypeMask"
+ "agpsType 0x%X apnTypeMask : 0x%X",
+ agpsType, apnTypeMask);
+ }
+ AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
+
+ if (sm == NULL) {
+
+ LOC_LOGE("No AGPS State Machine for agpsType: %d apnTypeMask: 0x%X",
+ agpsType, apnTypeMask);
+ mAtlOpenStatusCb(
+ connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType, apnTypeMask);
+ return;
+ }
+ sm->setType(agpsType);
+ sm->setApnTypeMask(apnTypeMask);
+
+ /* Invoke AGPS SM processing */
+ AgpsSubscriber subscriber(connHandle, false, false, apnTypeMask);
+ sm->setCurrentSubscriber(&subscriber);
+ /* Send subscriber event */
+ sm->processAgpsEvent(AGPS_EVENT_SUBSCRIBE);
+}
+
+void AgpsManager::releaseATL(int connHandle){
+
+ LOC_LOGD("AgpsManager::releaseATL(): connHandle %d", connHandle);
+
+ /* First find the subscriber with specified handle.
+ * We need to search in all state machines. */
+ AgpsStateMachine* sm = NULL;
+ AgpsSubscriber* subscriber = NULL;
+
+ if (mAgnssNif &&
+ (subscriber = mAgnssNif->getSubscriber(connHandle)) != NULL) {
+ sm = mAgnssNif;
+ }
+ else if (mInternetNif &&
+ (subscriber = mInternetNif->getSubscriber(connHandle)) != NULL) {
+ sm = mInternetNif;
+ }
+ if (sm == NULL) {
+ LOC_LOGE("Subscriber with connHandle %d not found in any SM",
+ connHandle);
+ return;
+ }
+
+ /* Now send unsubscribe event */
+ sm->setCurrentSubscriber(subscriber);
+ sm->processAgpsEvent(AGPS_EVENT_UNSUBSCRIBE);
+}
+
+void AgpsManager::reportAtlOpenSuccess(
+ AGpsExtType agpsType, char* apnName, int apnLen,
+ AGpsBearerType bearerType){
+
+ LOC_LOGD("AgpsManager::reportAtlOpenSuccess(): "
+ "AgpsType %d, APN [%s], Len %d, BearerType %d",
+ agpsType, apnName, apnLen, bearerType);
+
+ /* Find the state machine instance */
+ AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
+
+ /* Set bearer and apn info in state machine instance */
+ sm->setBearer(bearerType);
+ sm->setAPN(apnName, apnLen);
+
+ /* Send GRANTED event to state machine */
+ sm->processAgpsEvent(AGPS_EVENT_GRANTED);
+}
+
+void AgpsManager::reportAtlOpenFailed(AGpsExtType agpsType){
+
+ LOC_LOGD("AgpsManager::reportAtlOpenFailed(): AgpsType %d", agpsType);
+
+ /* Fetch SM and send DENIED event */
+ AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
+ sm->processAgpsEvent(AGPS_EVENT_DENIED);
+}
+
+void AgpsManager::reportAtlClosed(AGpsExtType agpsType){
+
+ LOC_LOGD("AgpsManager::reportAtlClosed(): AgpsType %d", agpsType);
+
+ /* Fetch SM and send RELEASED event */
+ AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
+ sm->processAgpsEvent(AGPS_EVENT_RELEASED);
+}
+
+void AgpsManager::handleModemSSR(){
+
+ LOC_LOGD("AgpsManager::handleModemSSR");
+
+ /* Drop subscribers from all state machines */
+ if (mAgnssNif) {
+ mAgnssNif->dropAllSubscribers();
+ }
+ if (mInternetNif) {
+ mInternetNif->dropAllSubscribers();
+ }
+}
diff --git a/gps/gnss/Agps.h b/gps/gnss/Agps.h
new file mode 100644
index 0000000..d559377
--- /dev/null
+++ b/gps/gnss/Agps.h
@@ -0,0 +1,316 @@
+/* Copyright (c) 2012-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 AGPS_H
+#define AGPS_H
+
+#include <functional>
+#include <list>
+#include <MsgTask.h>
+#include <gps_extended_c.h>
+#include <loc_pla.h>
+#include <log_util.h>
+
+/* ATL callback function pointers
+ * Passed in by Adapter to AgpsManager */
+typedef std::function<void(
+ int handle, int isSuccess, char* apn, uint32_t apnLen,
+ AGpsBearerType bearerType, AGpsExtType agpsType,
+ LocApnTypeMask mask)> AgpsAtlOpenStatusCb;
+
+typedef std::function<void(int handle, int isSuccess)> AgpsAtlCloseStatusCb;
+
+/* Post message to adapter's message queue */
+typedef std::function<void(LocMsg* msg)> SendMsgToAdapterMsgQueueFn;
+
+/* AGPS States */
+typedef enum {
+ AGPS_STATE_INVALID = 0,
+ AGPS_STATE_RELEASED,
+ AGPS_STATE_PENDING,
+ AGPS_STATE_ACQUIRED,
+ AGPS_STATE_RELEASING
+} AgpsState;
+
+typedef enum {
+ AGPS_EVENT_INVALID = 0,
+ AGPS_EVENT_SUBSCRIBE,
+ AGPS_EVENT_UNSUBSCRIBE,
+ AGPS_EVENT_GRANTED,
+ AGPS_EVENT_RELEASED,
+ AGPS_EVENT_DENIED
+} AgpsEvent;
+
+/* Notification Types sent to subscribers */
+typedef enum {
+ AGPS_NOTIFICATION_TYPE_INVALID = 0,
+
+ /* Meant for all subscribers, either active or inactive */
+ AGPS_NOTIFICATION_TYPE_FOR_ALL_SUBSCRIBERS,
+
+ /* Meant for only inactive subscribers */
+ AGPS_NOTIFICATION_TYPE_FOR_INACTIVE_SUBSCRIBERS,
+
+ /* Meant for only active subscribers */
+ AGPS_NOTIFICATION_TYPE_FOR_ACTIVE_SUBSCRIBERS
+} AgpsNotificationType;
+
+/* Classes in this header */
+class AgpsSubscriber;
+class AgpsManager;
+class AgpsStateMachine;
+
+/* SUBSCRIBER
+ * Each Subscriber instance corresponds to one AGPS request,
+ * received by the AGPS state machine */
+class AgpsSubscriber {
+
+public:
+ int mConnHandle;
+
+ /* Does this subscriber wait for data call close complete,
+ * before being notified ATL close ?
+ * While waiting for data call close, subscriber will be in
+ * inactive state. */
+ bool mWaitForCloseComplete;
+ bool mIsInactive;
+ LocApnTypeMask mApnTypeMask;
+
+ inline AgpsSubscriber(
+ int connHandle, bool waitForCloseComplete, bool isInactive,
+ LocApnTypeMask apnTypeMask) :
+ mConnHandle(connHandle),
+ mWaitForCloseComplete(waitForCloseComplete),
+ mIsInactive(isInactive),
+ mApnTypeMask(apnTypeMask) {}
+ inline virtual ~AgpsSubscriber() {}
+
+ inline virtual bool equals(const AgpsSubscriber *s) const
+ { return (mConnHandle == s->mConnHandle); }
+
+ inline virtual AgpsSubscriber* clone()
+ { return new AgpsSubscriber(
+ mConnHandle, mWaitForCloseComplete, mIsInactive, mApnTypeMask); }
+};
+
+/* AGPS STATE MACHINE */
+class AgpsStateMachine {
+protected:
+ /* AGPS Manager instance, from where this state machine is created */
+ AgpsManager* mAgpsManager;
+
+ /* List of all subscribers for this State Machine.
+ * Once a subscriber is notified for ATL open/close status,
+ * it is deleted */
+ std::list<AgpsSubscriber*> mSubscriberList;
+
+ /* Current subscriber, whose request this State Machine is
+ * currently processing */
+ AgpsSubscriber* mCurrentSubscriber;
+
+ /* Current state for this state machine */
+ AgpsState mState;
+
+ AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
+private:
+ /* AGPS Type for this state machine
+ LOC_AGPS_TYPE_ANY 0
+ LOC_AGPS_TYPE_SUPL 1
+ LOC_AGPS_TYPE_WWAN_ANY 3
+ LOC_AGPS_TYPE_SUPL_ES 5 */
+ AGpsExtType mAgpsType;
+ LocApnTypeMask mApnTypeMask;
+
+ /* APN and IP Type info for AGPS Call */
+ char* mAPN;
+ unsigned int mAPNLen;
+ AGpsBearerType mBearer;
+
+public:
+ /* CONSTRUCTOR */
+ AgpsStateMachine(AgpsManager* agpsManager, AGpsExtType agpsType):
+ mFrameworkStatusV4Cb(NULL),
+ mAgpsManager(agpsManager), mSubscriberList(),
+ mCurrentSubscriber(NULL), mState(AGPS_STATE_RELEASED),
+ mAgpsType(agpsType), mAPN(NULL), mAPNLen(0),
+ mBearer(AGPS_APN_BEARER_INVALID) {};
+
+ virtual ~AgpsStateMachine() { if(NULL != mAPN) delete[] mAPN; };
+
+ /* Getter/Setter methods */
+ void setAPN(char* apn, unsigned int len);
+ inline char* getAPN() const { return (char*)mAPN; }
+ inline uint32_t getAPNLen() const { return mAPNLen; }
+ inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline LocApnTypeMask getApnTypeMask() const { return mApnTypeMask; }
+ inline void setApnTypeMask(LocApnTypeMask apnTypeMask)
+ { mApnTypeMask = apnTypeMask; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline void setType(AGpsExtType type) { mAgpsType = type; }
+ inline AGpsExtType getType() const { return mAgpsType; }
+ inline void setCurrentSubscriber(AgpsSubscriber* subscriber)
+ { mCurrentSubscriber = subscriber; }
+
+ inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
+ mFrameworkStatusV4Cb = frameworkStatusV4Cb;
+ }
+
+ /* Fetch subscriber with specified handle */
+ AgpsSubscriber* getSubscriber(int connHandle);
+
+ /* Fetch first active or inactive subscriber in list
+ * isInactive = true : fetch first inactive subscriber
+ * isInactive = false : fetch first active subscriber */
+ AgpsSubscriber* getFirstSubscriber(bool isInactive);
+
+ /* Process LOC AGPS Event being passed in
+ * onRsrcEvent */
+ virtual void processAgpsEvent(AgpsEvent event);
+
+ /* Drop all subscribers, in case of Modem SSR */
+ void dropAllSubscribers();
+
+protected:
+ /* Remove the specified subscriber from list if present.
+ * Also delete the subscriber instance. */
+ void deleteSubscriber(AgpsSubscriber* subscriber);
+
+private:
+ /* Send call setup request to framework
+ * sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
+ * sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
+ void requestOrReleaseDataConn(bool request);
+
+ /* Individual event processing methods */
+ void processAgpsEventSubscribe();
+ void processAgpsEventUnsubscribe();
+ void processAgpsEventGranted();
+ void processAgpsEventReleased();
+ void processAgpsEventDenied();
+
+ /* Clone the passed in subscriber and add to the subscriber list
+ * if not already present */
+ void addSubscriber(AgpsSubscriber* subscriber);
+
+ /* Notify subscribers about AGPS events */
+ void notifyAllSubscribers(
+ AgpsEvent event, bool deleteSubscriberPostNotify,
+ AgpsNotificationType notificationType);
+ virtual void notifyEventToSubscriber(
+ AgpsEvent event, AgpsSubscriber* subscriber,
+ bool deleteSubscriberPostNotify);
+
+ /* Do we have any subscribers in active state */
+ bool anyActiveSubscribers();
+
+ /* Transition state */
+ void transitionState(AgpsState newState);
+};
+
+/* LOC AGPS MANAGER */
+class AgpsManager {
+
+ friend class AgpsStateMachine;
+public:
+ /* CONSTRUCTOR */
+ AgpsManager():
+ mAtlOpenStatusCb(), mAtlCloseStatusCb(),
+ mAgnssNif(NULL), mInternetNif(NULL)/*, mDsNif(NULL)*/ {}
+
+ /* Register callbacks */
+ inline void registerATLCallbacks(AgpsAtlOpenStatusCb atlOpenStatusCb,
+ AgpsAtlCloseStatusCb atlCloseStatusCb) {
+
+ mAtlOpenStatusCb = atlOpenStatusCb;
+ mAtlCloseStatusCb = atlCloseStatusCb;
+ }
+
+ /* Check if AGPS client is registered */
+ inline bool isRegistered() { return nullptr != mAgnssNif || nullptr != mInternetNif; }
+
+ /* Create all AGPS state machines */
+ void createAgpsStateMachines(const AgpsCbInfo& cbInfo);
+
+ /* Process incoming ATL requests */
+ void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask apnTypeMask);
+ void releaseATL(int connHandle);
+ /* Process incoming framework data call events */
+ void reportAtlOpenSuccess(AGpsExtType agpsType, char* apnName, int apnLen,
+ AGpsBearerType bearerType);
+ void reportAtlOpenFailed(AGpsExtType agpsType);
+ void reportAtlClosed(AGpsExtType agpsType);
+
+ /* Handle Modem SSR */
+ void handleModemSSR();
+
+protected:
+
+ AgpsAtlOpenStatusCb mAtlOpenStatusCb;
+ AgpsAtlCloseStatusCb mAtlCloseStatusCb;
+ AgpsStateMachine* mAgnssNif;
+ AgpsStateMachine* mInternetNif;
+private:
+ /* Fetch state machine for handling request ATL call */
+ AgpsStateMachine* getAgpsStateMachine(AGpsExtType agpsType);
+};
+
+/* Request SUPL/INTERNET/SUPL_ES ATL
+ * This LocMsg is defined in this header since it has to be used from more
+ * than one place, other Agps LocMsg are restricted to GnssAdapter and
+ * declared inline */
+struct AgpsMsgRequestATL: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+ int mConnHandle;
+ AGpsExtType mAgpsType;
+ LocApnTypeMask mApnTypeMask;
+
+ inline AgpsMsgRequestATL(AgpsManager* agpsManager, int connHandle,
+ AGpsExtType agpsType, LocApnTypeMask apnTypeMask) :
+ LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle),
+ mAgpsType(agpsType), mApnTypeMask(apnTypeMask){
+
+ LOC_LOGV("AgpsMsgRequestATL");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgRequestATL::proc()");
+ mAgpsManager->requestATL(mConnHandle, mAgpsType, mApnTypeMask);
+ }
+};
+
+namespace AgpsUtils {
+
+AGpsBearerType ipTypeToBearerType(LocApnIpType ipType);
+LocApnIpType bearerTypeToIpType(AGpsBearerType bearerType);
+
+}
+
+#endif /* AGPS_H */
diff --git a/gps/gnss/Android.mk b/gps/gnss/Android.mk
new file mode 100644
index 0000000..c1b5944
--- /dev/null
+++ b/gps/gnss/Android.mk
@@ -0,0 +1,49 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libgnss
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libdl \
+ liblog \
+ libloc_core \
+ libgps.utils
+
+LOCAL_SRC_FILES += \
+ location_gnss.cpp \
+ GnssAdapter.cpp \
+ Agps.cpp \
+ XtraSystemStatusObserver.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
+endif
+
+LOCAL_HEADER_LIBRARIES := \
+ libgps.utils_headers \
+ libloc_core_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/gnss/GnssAdapter.cpp b/gps/gnss/GnssAdapter.cpp
new file mode 100644
index 0000000..0e8ed8c
--- /dev/null
+++ b/gps/gnss/GnssAdapter.cpp
@@ -0,0 +1,5711 @@
+/* Copyright (c) 2017-2020 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_GnssAdapter"
+
+#include <inttypes.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <math.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <GnssAdapter.h>
+#include <string>
+#include <sstream>
+#include <loc_log.h>
+#include <loc_nmea.h>
+#include <Agps.h>
+#include <SystemStatus.h>
+#include <vector>
+
+#define RAD2DEG (180.0 / M_PI)
+#define PROCESS_NAME_ENGINE_SERVICE "engine-service"
+#define MIN_TRACKING_INTERVAL (100) // 100 msec
+
+using namespace loc_core;
+
+/* Method to fetch status cb from loc_net_iface library */
+typedef AgpsCbInfo& (*LocAgpsGetAgpsCbInfo)(LocAgpsOpenResultCb openResultCb,
+ LocAgpsCloseResultCb closeResultCb, void* userDataPtr);
+
+static void agpsOpenResultCb (bool isSuccess, AGpsExtType agpsType, const char* apn,
+ AGpsBearerType bearerType, void* userDataPtr);
+static void agpsCloseResultCb (bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
+
+GnssAdapter::GnssAdapter() :
+ LocAdapterBase(0,
+ LocContext::getLocContext(NULL,
+ NULL,
+ LocContext::mLocationHalName,
+ false),
+ true, nullptr, true),
+ mEngHubProxy(new EngineHubProxyBase()),
+ mLocPositionMode(),
+ mNHzNeeded(false),
+ mSPEAlreadyRunningAtHighestInterval(false),
+ mGnssSvIdUsedInPosition(),
+ mGnssSvIdUsedInPosAvail(false),
+ mControlCallbacks(),
+ mAfwControlId(0),
+ mNmeaMask(0),
+ mGnssSvIdConfig(),
+ mGnssSvTypeConfig(),
+ mGnssSvTypeConfigCb(nullptr),
+ mLocConfigInfo{},
+ mNiData(),
+ mAgpsManager(),
+ mOdcpiRequestCb(nullptr),
+ mOdcpiRequestActive(false),
+ mOdcpiTimer(this),
+ mOdcpiRequest(),
+ mCallbackPriority(OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW),
+ mSystemStatus(SystemStatus::getInstance(mMsgTask)),
+ mServerUrl(":"),
+ mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask),
+ mLocSystemInfo{},
+ mBlockCPIInfo{},
+ mNfwCb(NULL),
+ mPowerOn(false),
+ mAllowFlpNetworkFixes(0),
+ mGnssEnergyConsumedCb(nullptr),
+ mPowerStateCb(nullptr),
+ mIsE911Session(NULL),
+ mGnssMbSvIdUsedInPosition{},
+ mGnssMbSvIdUsedInPosAvail(false),
+ mSupportNfwControl(true),
+ mSystemPowerState(POWER_STATE_UNKNOWN)
+{
+ LOC_LOGD("%s]: Constructor %p", __func__, this);
+ mLocPositionMode.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, uint32_t apnLen,
+ AGpsBearerType bearerType, AGpsExtType agpsType, LocApnTypeMask mask) {
+
+ mLocApi->atlOpenStatus(
+ handle, isSuccess, apn, apnLen, bearerType, agpsType, mask);
+ };
+ AgpsAtlCloseStatusCb atlCloseStatusCb =
+ [this](int handle, int isSuccess) {
+
+ mLocApi->atlCloseStatus(handle, isSuccess);
+ };
+ mAgpsManager.registerATLCallbacks(atlOpenStatusCb, atlCloseStatusCb);
+
+ readConfigCommand();
+ initDefaultAgpsCommand();
+ initEngHubProxyCommand();
+
+ // at last step, let us inform adapater base that we are done
+ // with initialization, e.g.: ready to process handleEngineUpEvent
+ doneInit();
+}
+
+void
+GnssAdapter::setControlCallbacksCommand(LocationControlCallbacks& controlCallbacks)
+{
+ struct MsgSetControlCallbacks : public LocMsg {
+ GnssAdapter& mAdapter;
+ const LocationControlCallbacks mControlCallbacks;
+ inline MsgSetControlCallbacks(GnssAdapter& adapter,
+ LocationControlCallbacks& controlCallbacks) :
+ LocMsg(),
+ mAdapter(adapter),
+ mControlCallbacks(controlCallbacks) {}
+ inline virtual void proc() const {
+ mAdapter.setControlCallbacks(mControlCallbacks);
+ }
+ };
+
+ sendMsg(new MsgSetControlCallbacks(*this, controlCallbacks));
+}
+
+void
+GnssAdapter::convertOptions(LocPosMode& out, const TrackingOptions& trackingOptions)
+{
+ switch (trackingOptions.mode) {
+ case GNSS_SUPL_MODE_MSB:
+ out.mode = LOC_POSITION_MODE_MS_BASED;
+ break;
+ case GNSS_SUPL_MODE_MSA:
+ out.mode = LOC_POSITION_MODE_MS_ASSISTED;
+ break;
+ default:
+ out.mode = LOC_POSITION_MODE_STANDALONE;
+ break;
+ }
+ out.share_position = true;
+ out.min_interval = trackingOptions.minInterval;
+ out.powerMode = trackingOptions.powerMode;
+ out.timeBetweenMeasurements = trackingOptions.tbm;
+}
+
+bool
+GnssAdapter::checkAndSetSPEToRunforNHz(TrackingOptions & out) {
+ // first check if NHz meas is needed at all, if not, just return false
+ // if a NHz capable engine is subscribed for NHz measurement or NHz positions,
+ // always run the SPE only session at 100ms TBF.
+ // If SPE session is already set to highest interval, no need to start it again.
+
+ bool isSPERunningAtHighestInterval = false;
+
+ if (!mNHzNeeded) {
+ LOC_LOGd("No nHz session needed.");
+ } else if (mSPEAlreadyRunningAtHighestInterval) {
+ LOC_LOGd("SPE is already running at highest interval.");
+ isSPERunningAtHighestInterval = true;
+ } else if (out.minInterval > MIN_TRACKING_INTERVAL) {
+ out.minInterval = MIN_TRACKING_INTERVAL;
+ LOC_LOGd("nHz session is needed, starting SPE only session at 100ms TBF.");
+ mSPEAlreadyRunningAtHighestInterval = true;
+ }
+
+ return isSPERunningAtHighestInterval;
+}
+
+
+void
+GnssAdapter::convertLocation(Location& out, const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ const LocPosTechMask techMask)
+{
+ memset(&out, 0, sizeof(Location));
+ out.size = sizeof(Location);
+ if (LOC_GPS_LOCATION_HAS_LAT_LONG & ulpLocation.gpsLocation.flags) {
+ out.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ out.latitude = ulpLocation.gpsLocation.latitude;
+ out.longitude = ulpLocation.gpsLocation.longitude;
+ }
+ if (LOC_GPS_LOCATION_HAS_ALTITUDE & ulpLocation.gpsLocation.flags) {
+ out.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ out.altitude = ulpLocation.gpsLocation.altitude;
+ }
+ if (LOC_GPS_LOCATION_HAS_SPEED & ulpLocation.gpsLocation.flags) {
+ out.flags |= LOCATION_HAS_SPEED_BIT;
+ out.speed = ulpLocation.gpsLocation.speed;
+ }
+ if (LOC_GPS_LOCATION_HAS_BEARING & ulpLocation.gpsLocation.flags) {
+ out.flags |= LOCATION_HAS_BEARING_BIT;
+ out.bearing = ulpLocation.gpsLocation.bearing;
+ }
+ if (LOC_GPS_LOCATION_HAS_ACCURACY & ulpLocation.gpsLocation.flags) {
+ out.flags |= LOCATION_HAS_ACCURACY_BIT;
+ out.accuracy = ulpLocation.gpsLocation.accuracy;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_VERT_UNC & locationExtended.flags) {
+ out.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ out.verticalAccuracy = locationExtended.vert_unc;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_SPEED_UNC & locationExtended.flags) {
+ out.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ out.speedAccuracy = locationExtended.speed_unc;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_BEARING_UNC & locationExtended.flags) {
+ out.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ out.bearingAccuracy = locationExtended.bearing_unc;
+ }
+ out.timestamp = ulpLocation.gpsLocation.timestamp;
+ if (LOC_POS_TECH_MASK_SATELLITE & techMask) {
+ out.techMask |= LOCATION_TECHNOLOGY_GNSS_BIT;
+ }
+ if (LOC_POS_TECH_MASK_CELLID & techMask) {
+ out.techMask |= LOCATION_TECHNOLOGY_CELL_BIT;
+ }
+ if (LOC_POS_TECH_MASK_WIFI & techMask) {
+ out.techMask |= LOCATION_TECHNOLOGY_WIFI_BIT;
+ }
+ if (LOC_POS_TECH_MASK_SENSORS & techMask) {
+ out.techMask |= LOCATION_TECHNOLOGY_SENSORS_BIT;
+ }
+
+ if (LOC_GPS_LOCATION_HAS_SPOOF_MASK & ulpLocation.gpsLocation.flags) {
+ out.flags |= LOCATION_HAS_SPOOF_MASK;
+ out.spoofMask = ulpLocation.gpsLocation.spoof_mask;
+ }
+ if (LOC_GPS_LOCATION_HAS_ELAPSED_REAL_TIME & ulpLocation.gpsLocation.flags) {
+ out.flags |= LOCATION_HAS_ELAPSED_REAL_TIME;
+ out.elapsedRealTime = ulpLocation.gpsLocation.elapsedRealTime;
+ out.elapsedRealTimeUnc = ulpLocation.gpsLocation.elapsedRealTimeUnc;
+ }
+}
+
+/* This is utility routine that computes number of SV used
+ in the fix from the svUsedIdsMask.
+ */
+#define MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION 64
+uint16_t GnssAdapter::getNumSvUsed(uint64_t svUsedIdsMask,
+ int totalSvCntInThisConstellation)
+{
+ if (totalSvCntInThisConstellation > MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION) {
+ LOC_LOGe ("error: total SV count in this constellation %d exceeded limit of %d",
+ totalSvCntInThisConstellation, MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION);
+ return 0;
+ }
+
+ uint16_t numSvUsed = 0;
+ uint64_t mask = 0x1;
+ for (int i = 0; i < totalSvCntInThisConstellation; i++) {
+ if (svUsedIdsMask & mask) {
+ numSvUsed++;
+ }
+ mask <<= 1;
+ }
+
+ return numSvUsed;
+}
+
+void
+GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out,
+ const GpsLocationExtended& locationExtended)
+{
+ out.size = sizeof(GnssLocationInfoNotification);
+ if (GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT;
+ out.altitudeMeanSeaLevel = locationExtended.altitudeMeanSeaLevel;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_EXT_DOP & locationExtended.flags) {
+ out.flags |= (GNSS_LOCATION_INFO_DOP_BIT|GNSS_LOCATION_INFO_EXT_DOP_BIT);
+ out.pdop = locationExtended.extDOP.PDOP;
+ out.hdop = locationExtended.extDOP.HDOP;
+ out.vdop = locationExtended.extDOP.VDOP;
+ out.gdop = locationExtended.extDOP.GDOP;
+ out.tdop = locationExtended.extDOP.TDOP;
+ } else if (GPS_LOCATION_EXTENDED_HAS_DOP & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_DOP_BIT;
+ out.pdop = locationExtended.pdop;
+ out.hdop = locationExtended.hdop;
+ out.vdop = locationExtended.vdop;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_MAG_DEV & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT;
+ out.magneticDeviation = locationExtended.magneticDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT;
+ switch (locationExtended.horizontal_reliability) {
+ case LOC_RELIABILITY_VERY_LOW:
+ out.horReliability = LOCATION_RELIABILITY_VERY_LOW;
+ break;
+ case LOC_RELIABILITY_LOW:
+ out.horReliability = LOCATION_RELIABILITY_LOW;
+ break;
+ case LOC_RELIABILITY_MEDIUM:
+ out.horReliability = LOCATION_RELIABILITY_MEDIUM;
+ break;
+ case LOC_RELIABILITY_HIGH:
+ out.horReliability = LOCATION_RELIABILITY_HIGH;
+ break;
+ default:
+ out.horReliability = LOCATION_RELIABILITY_NOT_SET;
+ break;
+ }
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_VER_RELIABILITY_BIT;
+ switch (locationExtended.vertical_reliability) {
+ case LOC_RELIABILITY_VERY_LOW:
+ out.verReliability = LOCATION_RELIABILITY_VERY_LOW;
+ break;
+ case LOC_RELIABILITY_LOW:
+ out.verReliability = LOCATION_RELIABILITY_LOW;
+ break;
+ case LOC_RELIABILITY_MEDIUM:
+ out.verReliability = LOCATION_RELIABILITY_MEDIUM;
+ break;
+ case LOC_RELIABILITY_HIGH:
+ out.verReliability = LOCATION_RELIABILITY_HIGH;
+ break;
+ default:
+ out.verReliability = LOCATION_RELIABILITY_NOT_SET;
+ break;
+ }
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT;
+ out.horUncEllipseSemiMajor = locationExtended.horUncEllipseSemiMajor;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT;
+ out.horUncEllipseSemiMinor = locationExtended.horUncEllipseSemiMinor;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT;
+ out.horUncEllipseOrientAzimuth = locationExtended.horUncEllipseOrientAzimuth;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT;
+ out.northStdDeviation = locationExtended.northStdDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_EAST_STD_DEV_BIT;
+ out.eastStdDeviation = locationExtended.eastStdDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_NORTH_VEL & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_NORTH_VEL_BIT;
+ out.northVelocity = locationExtended.northVelocity;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT;
+ out.northVelocityStdDeviation = locationExtended.northVelocityStdDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_EAST_VEL & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_EAST_VEL_BIT;
+ out.eastVelocity = locationExtended.eastVelocity;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT;
+ out.eastVelocityStdDeviation = locationExtended.eastVelocityStdDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_UP_VEL & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_UP_VEL_BIT;
+ out.upVelocity = locationExtended.upVelocity;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_UP_VEL_UNC_BIT;
+ out.upVelocityStdDeviation = locationExtended.upVelocityStdDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT;
+ out.svUsedInPosition.gpsSvUsedIdsMask =
+ locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask;
+ out.svUsedInPosition.gloSvUsedIdsMask =
+ locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask;
+ out.svUsedInPosition.galSvUsedIdsMask =
+ locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask;
+ out.svUsedInPosition.bdsSvUsedIdsMask =
+ locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask;
+ out.svUsedInPosition.qzssSvUsedIdsMask =
+ locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask;
+
+ out.flags |= GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT;
+ out.numSvUsedInPosition = getNumSvUsed(out.svUsedInPosition.gpsSvUsedIdsMask,
+ GPS_SV_PRN_MAX - GPS_SV_PRN_MIN + 1);
+ out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.gloSvUsedIdsMask,
+ GLO_SV_PRN_MAX - GLO_SV_PRN_MIN + 1);
+ out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.qzssSvUsedIdsMask,
+ QZSS_SV_PRN_MAX - QZSS_SV_PRN_MIN + 1);
+ out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.bdsSvUsedIdsMask,
+ BDS_SV_PRN_MAX - BDS_SV_PRN_MIN + 1);
+ out.numSvUsedInPosition += getNumSvUsed(out.svUsedInPosition.galSvUsedIdsMask,
+ GAL_SV_PRN_MAX - GAL_SV_PRN_MIN + 1);
+
+ out.numOfMeasReceived = locationExtended.numOfMeasReceived;
+ for (int idx =0; idx < locationExtended.numOfMeasReceived; idx++) {
+ out.measUsageInfo[idx].gnssSignalType =
+ locationExtended.measUsageInfo[idx].gnssSignalType;
+ out.measUsageInfo[idx].gnssSvId =
+ locationExtended.measUsageInfo[idx].gnssSvId;
+ out.measUsageInfo[idx].gnssConstellation =
+ locationExtended.measUsageInfo[idx].gnssConstellation;
+ }
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT;
+ out.navSolutionMask = locationExtended.navSolutionMask;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_POS_TECH_MASK_BIT;
+ out.posTechMask = locationExtended.tech_mask;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA;
+ if (locationExtended.bodyFrameData.bodyFrameDataMask &
+ LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT) {
+ out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT;
+ }
+ if (locationExtended.bodyFrameData.bodyFrameDataMask &
+ LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT) {
+ out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT;
+ }
+ if (locationExtended.bodyFrameData.bodyFrameDataMask &
+ LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT) {
+ out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT;
+ }
+ if (locationExtended.bodyFrameData.bodyFrameDataMask & LOCATION_NAV_DATA_HAS_YAW_RATE_BIT) {
+ out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_YAW_RATE_BIT;
+ }
+ if (locationExtended.bodyFrameData.bodyFrameDataMask & LOCATION_NAV_DATA_HAS_PITCH_BIT) {
+ out.bodyFrameData.bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_PITCH_BIT;
+ }
+ out.bodyFrameData.longAccel = locationExtended.bodyFrameData.longAccel;
+ out.bodyFrameData.latAccel = locationExtended.bodyFrameData.latAccel;
+ out.bodyFrameData.vertAccel = locationExtended.bodyFrameData.vertAccel;
+ out.bodyFrameData.yawRate = locationExtended.bodyFrameData.yawRate;
+ out.bodyFrameData.pitch = locationExtended.bodyFrameData.pitch;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_GPS_TIME & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_GPS_TIME;
+ out.gnssSystemTime.gnssSystemTimeSrc = locationExtended.gnssSystemTime.gnssSystemTimeSrc;
+ out.gnssSystemTime.u = locationExtended.gnssSystemTime.u;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_NORTH_VEL & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_NORTH_VEL;
+ out.northVelocity = locationExtended.northVelocity;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_EAST_VEL & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_EAST_VEL;
+ out.eastVelocity = locationExtended.eastVelocity;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_UP_VEL & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_UP_VEL;
+ out.upVelocity = locationExtended.upVelocity;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC;
+ out.northVelocityStdDeviation = locationExtended.northVelocityStdDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC;
+ out.eastVelocityStdDeviation = locationExtended.eastVelocityStdDeviation;
+ }
+ if (GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC & locationExtended.flags) {
+ out.flags |= GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC;
+ out.upVelocityStdDeviation = locationExtended.upVelocityStdDeviation;
+ }
+
+ // Validity of this structure is established from the timeSrc of the GnssSystemTime structure.
+ out.gnssSystemTime = locationExtended.gnssSystemTime;
+
+ if (GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_LEAP_SECONDS_BIT;
+ out.leapSeconds = locationExtended.leapSeconds;
+ }
+
+ if (GPS_LOCATION_EXTENDED_HAS_TIME_UNC & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_TIME_UNC_BIT;
+ out.timeUncMs = locationExtended.timeUncMs;
+ }
+
+ if (GPS_LOCATION_EXTENDED_HAS_CALIBRATION_CONFIDENCE & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_BIT;
+ out.calibrationConfidence = locationExtended.calibrationConfidence;
+ }
+
+ if (GPS_LOCATION_EXTENDED_HAS_CALIBRATION_STATUS & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT;
+ out.calibrationStatus = locationExtended.calibrationStatus;
+ }
+
+ if (GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT;
+ out.locOutputEngType = locationExtended.locOutputEngType;
+ }
+
+ if (GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT;
+ out.locOutputEngMask = locationExtended.locOutputEngMask;
+ }
+
+ if (GPS_LOCATION_EXTENDED_HAS_CONFORMITY_INDEX & locationExtended.flags) {
+ out.flags |= GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT;
+ out.conformityIndex = locationExtended.conformityIndex;
+ }
+}
+
+
+
+inline uint32_t
+GnssAdapter::convertSuplVersion(const GnssConfigSuplVersion suplVersion)
+{
+ switch (suplVersion) {
+ case GNSS_CONFIG_SUPL_VERSION_2_0_4:
+ return 0x00020004;
+ case GNSS_CONFIG_SUPL_VERSION_2_0_0:
+ return 0x00020000;
+ case GNSS_CONFIG_SUPL_VERSION_2_0_2:
+ return 0x00020002;
+ case GNSS_CONFIG_SUPL_VERSION_1_0_0:
+ default:
+ return 0x00010000;
+ }
+}
+
+inline uint32_t
+GnssAdapter::convertLppProfile(const GnssConfigLppProfile lppProfile)
+{
+ switch (lppProfile) {
+ case GNSS_CONFIG_LPP_PROFILE_USER_PLANE:
+ return 1;
+ case GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE:
+ return 2;
+ case GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE:
+ return 3;
+ case GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE:
+ default:
+ return 0;
+ }
+}
+
+uint32_t
+GnssAdapter::convertLppeCp(const GnssConfigLppeControlPlaneMask lppeControlPlaneMask)
+{
+ uint32_t mask = 0;
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT & lppeControlPlaneMask) {
+ mask |= (1<<0);
+ }
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT & lppeControlPlaneMask) {
+ mask |= (1<<1);
+ }
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT & lppeControlPlaneMask) {
+ mask |= (1<<2);
+ }
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT & lppeControlPlaneMask) {
+ mask |= (1<<3);
+ }
+ return mask;
+}
+
+uint32_t
+GnssAdapter::convertLppeUp(const GnssConfigLppeUserPlaneMask lppeUserPlaneMask)
+{
+ uint32_t mask = 0;
+ if (GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT & lppeUserPlaneMask) {
+ mask |= (1<<0);
+ }
+ if (GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT & lppeUserPlaneMask) {
+ mask |= (1<<1);
+ }
+ if (GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT & lppeUserPlaneMask) {
+ mask |= (1<<2);
+ }
+ if (GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT & lppeUserPlaneMask) {
+ mask |= (1<<3);
+ }
+ return mask;
+}
+
+uint32_t
+GnssAdapter::convertAGloProt(const GnssConfigAGlonassPositionProtocolMask aGloPositionProtocolMask)
+{
+ uint32_t mask = 0;
+ if (GNSS_CONFIG_RRC_CONTROL_PLANE_BIT & aGloPositionProtocolMask) {
+ mask |= (1<<0);
+ }
+ if (GNSS_CONFIG_RRLP_USER_PLANE_BIT & aGloPositionProtocolMask) {
+ mask |= (1<<1);
+ }
+ if (GNSS_CONFIG_LLP_USER_PLANE_BIT & aGloPositionProtocolMask) {
+ mask |= (1<<2);
+ }
+ if (GNSS_CONFIG_LLP_CONTROL_PLANE_BIT & aGloPositionProtocolMask) {
+ mask |= (1<<3);
+ }
+ return mask;
+}
+
+uint32_t
+GnssAdapter::convertEP4ES(const GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl)
+{
+ switch (emergencyPdnForEmergencySupl) {
+ case GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES:
+ return 1;
+ case GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO:
+ default:
+ return 0;
+ }
+}
+
+uint32_t
+GnssAdapter::convertSuplEs(const GnssConfigSuplEmergencyServices suplEmergencyServices)
+{
+ switch (suplEmergencyServices) {
+ case GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES:
+ return 1;
+ case GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO:
+ default:
+ return 0;
+ }
+}
+
+uint32_t
+GnssAdapter::convertSuplMode(const GnssConfigSuplModeMask suplModeMask)
+{
+ uint32_t mask = 0;
+ if (GNSS_CONFIG_SUPL_MODE_MSB_BIT & suplModeMask) {
+ mask |= (1<<0);
+ }
+ if (GNSS_CONFIG_SUPL_MODE_MSA_BIT & suplModeMask) {
+ mask |= (1<<1);
+ }
+ return mask;
+}
+
+void
+GnssAdapter::readConfigCommand()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgReadConfig : public LocMsg {
+ GnssAdapter* mAdapter;
+ ContextBase& mContext;
+ inline MsgReadConfig(GnssAdapter* adapter,
+ ContextBase& context) :
+ LocMsg(),
+ mAdapter(adapter),
+ mContext(context) {}
+ inline virtual void proc() const {
+ static bool confReadDone = false;
+ if (!confReadDone) {
+ confReadDone = true;
+ // reads config into mContext->mGps_conf
+ mContext.readConfig();
+
+ uint32_t allowFlpNetworkFixes = 0;
+ static const loc_param_s_type flp_conf_param_table[] =
+ {
+ {"ALLOW_NETWORK_FIXES", &allowFlpNetworkFixes, NULL, 'n'},
+ };
+ UTIL_READ_CONF(LOC_PATH_FLP_CONF, flp_conf_param_table);
+ LOC_LOGd("allowFlpNetworkFixes %u", allowFlpNetworkFixes);
+ mAdapter->setAllowFlpNetworkFixes(allowFlpNetworkFixes);
+ }
+ }
+ };
+
+ if (mContext != NULL) {
+ sendMsg(new MsgReadConfig(this, *mContext));
+ }
+}
+
+void
+GnssAdapter::setSuplHostServer(const char* server, int port, LocServerType type)
+{
+ if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
+ char serverUrl[MAX_URL_LEN] = {};
+ int32_t length = -1;
+ const char noHost[] = "NONE";
+
+ 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 (LOC_AGPS_SUPL_SERVER != type && LOC_AGPS_MO_SUPL_SERVER != type) {
+ LOC_LOGe("Invalid type=%d", type);
+ } else if (length >= 0) {
+ if (LOC_AGPS_SUPL_SERVER == type) {
+ getServerUrl().assign(serverUrl);
+ strlcpy(ContextBase::mGps_conf.SUPL_HOST, server, LOC_MAX_PARAM_STRING);
+ ContextBase::mGps_conf.SUPL_PORT = port;
+ } else {
+ if (strncasecmp(getMoServerUrl().c_str(), serverUrl, sizeof(serverUrl)) != 0) {
+ getMoServerUrl().assign(serverUrl);
+ }
+ }
+ }
+ }
+}
+
+void
+GnssAdapter::setConfig()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ // set nmea mask type
+ uint32_t mask = 0;
+ if (NMEA_PROVIDER_MP == ContextBase::mGps_conf.NMEA_PROVIDER) {
+ mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
+ }
+ if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
+ mask |= LOC_NMEA_MASK_DEBUG_V02;
+ }
+ if (mNmeaMask != mask) {
+ mNmeaMask = mask;
+ if (mNmeaMask) {
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if ((it->second.gnssNmeaCb != nullptr)) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT,
+ LOC_REGISTRATION_MASK_ENABLED);
+ break;
+ }
+ }
+ }
+ }
+
+ std::string oldMoServerUrl = getMoServerUrl();
+ setSuplHostServer(ContextBase::mGps_conf.SUPL_HOST,
+ ContextBase::mGps_conf.SUPL_PORT,
+ LOC_AGPS_SUPL_SERVER);
+ setSuplHostServer(ContextBase::mGps_conf.MO_SUPL_HOST,
+ ContextBase::mGps_conf.MO_SUPL_PORT,
+ LOC_AGPS_MO_SUPL_SERVER);
+
+ // inject the configurations into modem
+ loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
+ loc_sap_cfg_s_type sapConf = ContextBase::mSap_conf;
+
+ //cache the injected configuration with GnssConfigRequested struct
+ GnssConfig gnssConfigRequested = {};
+ gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT |
+ GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
+ /* Here we process an SSR. We need to set the GPS_LOCK to the proper values, as follows:
+ 1. Q behavior. This is identified by mSupportNfwControl being 1. In this case
+ ContextBase::mGps_conf.GPS_LOCK is a "state", meaning it should reflect the
+ NV value. Therefore we will set the NV to ContextBase::mGps_conf.GPS_LOCK
+ 2. P behavior. This is identified by mSupportNfwControl being 0. In this case
+ ContextBase::mGps_conf.GPS_LOCK is a "configuration", meaning it should hold
+ the "mask" for NI. There are two subcases:
+ a. Location enabled in GUI (1 == getAfwControlId()). We need to set
+ the NV to GNSS_CONFIG_GPS_LOCK_NONE (both MO and NI enabled)
+ b. Location disabled in GUI (0 == getAfwControlId()). We need to set
+ the NV to ContextBase::mGps_conf.GPS_LOCK (the "mask", which is SIM-card
+ specific)
+ */
+ if (mSupportNfwControl || (0 == getAfwControlId())) {
+ gnssConfigRequested.gpsLock = gpsConf.GPS_LOCK;
+ } else {
+ gnssConfigRequested.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
+ }
+ gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
+ GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT |
+ GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT |
+ GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT;
+ gnssConfigRequested.suplVersion =
+ mLocApi->convertSuplVersion(gpsConf.SUPL_VER);
+ gnssConfigRequested.lppProfile =
+ mLocApi->convertLppProfile(gpsConf.LPP_PROFILE);
+ gnssConfigRequested.aGlonassPositionProtocolMask =
+ gpsConf.A_GLONASS_POS_PROTOCOL_SELECT;
+ if (gpsConf.LPPE_CP_TECHNOLOGY) {
+ gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
+ gnssConfigRequested.lppeControlPlaneMask =
+ mLocApi->convertLppeCp(gpsConf.LPPE_CP_TECHNOLOGY);
+ }
+
+ if (gpsConf.LPPE_UP_TECHNOLOGY) {
+ gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT;
+ gnssConfigRequested.lppeUserPlaneMask =
+ mLocApi->convertLppeUp(gpsConf.LPPE_UP_TECHNOLOGY);
+ }
+ gnssConfigRequested.blacklistedSvIds.assign(mBlacklistedSvIds.begin(),
+ mBlacklistedSvIds.end());
+ mLocApi->sendMsg(new LocApiMsg(
+ [this, gpsConf, sapConf, oldMoServerUrl, gnssConfigRequested] () mutable {
+ gnssUpdateConfig(oldMoServerUrl, gnssConfigRequested, gnssConfigRequested);
+
+ // set nmea mask type
+ uint32_t mask = 0;
+ if (NMEA_PROVIDER_MP == gpsConf.NMEA_PROVIDER) {
+ mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
+ }
+ if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
+ mask |= LOC_NMEA_MASK_DEBUG_V02;
+ }
+
+ if (mask != 0) {
+ mLocApi->setNMEATypesSync(mask);
+ }
+
+ mLocApi->setXtraVersionCheckSync(gpsConf.XTRA_VERSION_CHECK);
+
+ // load tunc configuration from config file on first boot-up,
+ // e.g.: adapter.mLocConfigInfo.tuncConfigInfo.isValid is false
+ if (mLocConfigInfo.tuncConfigInfo.isValid == false) {
+ mLocConfigInfo.tuncConfigInfo.isValid = true;
+ mLocConfigInfo.tuncConfigInfo.enable =
+ (gpsConf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED == 1);
+ mLocConfigInfo.tuncConfigInfo.tuncThresholdMs =
+ (float)gpsConf.CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD;
+ mLocConfigInfo.tuncConfigInfo.energyBudget =
+ gpsConf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET;
+ }
+
+ mLocApi->setConstrainedTuncMode(
+ mLocConfigInfo.tuncConfigInfo.enable,
+ mLocConfigInfo.tuncConfigInfo.tuncThresholdMs,
+ mLocConfigInfo.tuncConfigInfo.energyBudget);
+
+ // load pace configuration from config file on first boot-up,
+ // e.g.: adapter.mLocConfigInfo.paceConfigInfo.isValid is false
+ if (mLocConfigInfo.paceConfigInfo.isValid == false) {
+ mLocConfigInfo.paceConfigInfo.isValid = true;
+ mLocConfigInfo.paceConfigInfo.enable =
+ (gpsConf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED==1);
+ }
+ mLocApi->setPositionAssistedClockEstimatorMode(
+ mLocConfigInfo.paceConfigInfo.enable);
+
+ // we do not support control robust location from gps.conf
+ if (mLocConfigInfo.robustLocationConfigInfo.isValid == true) {
+ mLocApi->configRobustLocation(
+ mLocConfigInfo.robustLocationConfigInfo.enable,
+ mLocConfigInfo.robustLocationConfigInfo.enableFor911);
+ }
+
+ if (sapConf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ sapConf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sapConf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sapConf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sapConf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) {
+ mLocApi->setSensorPropertiesSync(
+ sapConf.GYRO_BIAS_RANDOM_WALK_VALID,
+ sapConf.GYRO_BIAS_RANDOM_WALK,
+ sapConf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sapConf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ sapConf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sapConf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sapConf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sapConf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sapConf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sapConf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY);
+ }
+ mLocApi->setSensorPerfControlConfigSync(
+ sapConf.SENSOR_CONTROL_MODE,
+ sapConf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ sapConf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ sapConf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ sapConf.SENSOR_GYRO_BATCHES_PER_SEC,
+ sapConf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ sapConf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ sapConf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ sapConf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ sapConf.SENSOR_ALGORITHM_CONFIG_MASK);
+ } ));
+
+}
+
+std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldMoServerUrl,
+ GnssConfig& gnssConfigRequested, GnssConfig& gnssConfigNeedEngineUpdate, size_t count) {
+ loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
+ size_t index = 0;
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ std::vector<LocationError> errsList = {err};
+ if (count > 0) {
+ errsList.insert(errsList.begin(), count, LOCATION_ERROR_SUCCESS);
+ }
+
+ std::string serverUrl = getServerUrl();
+ std::string moServerUrl = getMoServerUrl();
+
+ int serverUrlLen = serverUrl.length();
+ int moServerUrlLen = moServerUrl.length();
+
+ if (!ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
+ LOC_LOGd("AGPS_CONFIG_INJECT is 0. Not setting flags for AGPS configurations");
+ gnssConfigRequested.flags &= ~(GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
+ GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT |
+ GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT |
+ GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT);
+ }
+
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ err = mLocApi->setGpsLockSync(gnssConfigRequested.gpsLock);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ index++;
+ }
+
+ if (gnssConfigRequested.flags &
+ GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags &
+ GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.assistanceServer.type ==
+ GNSS_ASSISTANCE_TYPE_SUPL) {
+ err = mLocApi->setServerSync(
+ serverUrl.c_str(), serverUrlLen, LOC_AGPS_SUPL_SERVER);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ if (0 != oldMoServerUrl.compare(moServerUrl)) {
+ LocationError locErr =
+ mLocApi->setServerSync(moServerUrl.c_str(),
+ moServerUrlLen,
+ LOC_AGPS_MO_SUPL_SERVER);
+ if (locErr != LOCATION_ERROR_SUCCESS) {
+ LOC_LOGe("Error while setting MO SUPL_HOST server:%s",
+ moServerUrl.c_str());
+ }
+ }
+ } else if (gnssConfigNeedEngineUpdate.assistanceServer.type ==
+ GNSS_ASSISTANCE_TYPE_C2K) {
+ struct in_addr addr;
+ struct hostent* hp;
+ bool resolveAddrSuccess = true;
+
+ hp = gethostbyname(
+ gnssConfigNeedEngineUpdate.assistanceServer.hostName);
+ if (hp != NULL) { /* DNS OK */
+ memcpy(&addr, hp->h_addr_list[0], hp->h_length);
+ } else {
+ /* Try IP representation */
+ if (inet_aton(
+ gnssConfigNeedEngineUpdate.assistanceServer.hostName,
+ &addr) == 0) {
+ /* IP not valid */
+ LOC_LOGE("%s]: hostname '%s' cannot be resolved ",
+ __func__,
+ gnssConfigNeedEngineUpdate.assistanceServer.hostName);
+ if (index < count) {
+ errsList[index] = LOCATION_ERROR_INVALID_PARAMETER;
+ }
+ } else {
+ resolveAddrSuccess = false;
+ }
+ }
+
+ if (resolveAddrSuccess) {
+ unsigned int ip = htonl(addr.s_addr);
+ err = mLocApi->setServerSync(ip,
+ gnssConfigNeedEngineUpdate.assistanceServer.port,
+ LOC_AGPS_CDMA_PDE_SERVER);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ }
+ }
+ index++;
+ }
+
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags &
+ GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ err = mLocApi->setSUPLVersionSync(gnssConfigRequested.suplVersion);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ index++;
+ }
+
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags &
+ GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ err = mLocApi->setLPPConfigSync(gnssConfigRequested.lppProfile);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ index++;
+ }
+
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags &
+ GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ err = mLocApi->setLPPeProtocolCpSync(
+ gnssConfigRequested.lppeControlPlaneMask);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ index++;
+ }
+
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags &
+ GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ err = mLocApi->setLPPeProtocolUpSync(
+ gnssConfigRequested.lppeUserPlaneMask);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ index++;
+ }
+
+ if (gnssConfigRequested.flags &
+ GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags &
+ GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ err = mLocApi->setAGLONASSProtocolSync(
+ gnssConfigRequested.aGlonassPositionProtocolMask);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
+ // Check if feature is supported
+ if (!ContextBase::isFeatureSupported(
+ LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
+ LOC_LOGe("Feature constellation enablement not supported.");
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ } else {
+ // Send the SV ID Config to Modem
+ mBlacklistedSvIds.assign(gnssConfigRequested.blacklistedSvIds.begin(),
+ gnssConfigRequested.blacklistedSvIds.end());
+ err = gnssSvIdConfigUpdateSync(gnssConfigRequested.blacklistedSvIds);
+ if (LOCATION_ERROR_SUCCESS != err) {
+ LOC_LOGe("Failed to send config to modem, err %d", err);
+ }
+ }
+ if (index < count) {
+ errsList[index] = err;
+ }
+ index++;
+ }
+ if (gnssConfigRequested.flags &
+ GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT) {
+ if (gnssConfigNeedEngineUpdate.flags &
+ GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT) {
+ err = mLocApi->setEmergencyExtensionWindowSync(
+ gnssConfigRequested.emergencyExtensionSeconds);
+ if (index < count) {
+ errsList[index] = err;
+ }
+ }
+ index++;
+ }
+ return errsList;
+}
+
+uint32_t*
+GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
+{
+ // count the number of bits set
+ GnssConfigFlagsMask flagsCopy = config.flags;
+ size_t count = 0;
+ while (flagsCopy > 0) {
+ if (flagsCopy & 1) {
+ count++;
+ }
+ flagsCopy >>= 1;
+ }
+ std::string idsString = "[";
+ uint32_t* ids = NULL;
+ if (count > 0) {
+ ids = new uint32_t[count];
+ if (ids == nullptr) {
+ LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
+ return nullptr;
+ }
+ for (size_t i=0; i < count; ++i) {
+ ids[i] = generateSessionId();
+ IF_LOC_LOGD {
+ idsString += std::to_string(ids[i]) + " ";
+ }
+ }
+ }
+ idsString += "]";
+
+ LOC_LOGD("%s]: ids %s flags 0x%X", __func__, idsString.c_str(), config.flags);
+
+ struct MsgGnssUpdateConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ GnssConfig mConfig;
+ size_t mCount;
+ uint32_t* mIds;
+ inline MsgGnssUpdateConfig(GnssAdapter& adapter,
+ LocApiBase& api,
+ GnssConfig config,
+ uint32_t* ids,
+ size_t count) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mConfig(config),
+ mCount(count),
+ mIds(ids) {}
+ inline MsgGnssUpdateConfig(const MsgGnssUpdateConfig& obj) :
+ MsgGnssUpdateConfig(obj.mAdapter, obj.mApi, obj.mConfig,
+ new uint32_t[obj.mCount], obj.mCount) {
+ if (mIds != nullptr) {
+ for (int i = 0; i < mCount; ++i) {
+ mIds[i] = obj.mIds[i];
+ }
+ }
+ }
+ inline virtual ~MsgGnssUpdateConfig()
+ {
+ delete[] mIds;
+ }
+
+ inline virtual void proc() const {
+ if (!mAdapter.isEngineCapabilitiesKnown()) {
+ mAdapter.mPendingMsgs.push_back(new MsgGnssUpdateConfig(*this));
+ return;
+ }
+ GnssAdapter& adapter = mAdapter;
+ size_t countOfConfigs = mCount;
+ GnssConfig gnssConfigRequested = mConfig;
+ GnssConfig gnssConfigNeedEngineUpdate = mConfig;
+
+ std::vector<uint32_t> sessionIds;
+ sessionIds.assign(mIds, mIds + mCount);
+ std::vector<LocationError> errs(mCount, LOCATION_ERROR_SUCCESS);
+ int index = 0;
+
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ GnssConfigGpsLock newGpsLock = gnssConfigRequested.gpsLock;
+
+ newGpsLock |= GNSS_CONFIG_GPS_LOCK_MO;
+ ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
+ /* If we get here it means that the changes in the framework to request for
+ 'P' behavior were made, and therefore we need to "behave" as in 'P'
+ However, we need to determine if enableCommand function has already been
+ called, since it could get called before this function.*/
+ if (0 != mAdapter.getAfwControlId()) {
+ /* enableCommand function has already been called since getAfwControlId
+ returns non zero. Now there are two possible cases:
+ 1. This is the first time this function is called
+ (mSupportNfwControl is true). We need to behave as in 'P', but
+ for the first time, meaning MO was enabled, but NI was not, so
+ we need to unlock NI
+ 2. This is not the first time this function is called, meaning we
+ are already behaving as in 'P'. No need to update the configuration
+ in this case (return to 'P' code) */
+ if (mAdapter.mSupportNfwControl) {
+ // case 1 above
+ newGpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
+ } else {
+ // case 2 above
+ gnssConfigNeedEngineUpdate.flags &= ~(GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT);
+ }
+ }
+ gnssConfigRequested.gpsLock = newGpsLock;
+ mAdapter.mSupportNfwControl = false;
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ uint32_t newSuplVersion =
+ mAdapter.convertSuplVersion(gnssConfigRequested.suplVersion);
+ ContextBase::mGps_conf.SUPL_VER = newSuplVersion;
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ if (GNSS_ASSISTANCE_TYPE_SUPL == mConfig.assistanceServer.type) {
+ mAdapter.setSuplHostServer(mConfig.assistanceServer.hostName,
+ mConfig.assistanceServer.port,
+ LOC_AGPS_SUPL_SERVER);
+ } else {
+ LOC_LOGE("%s]: Not a valid gnss assistance type %u",
+ __func__, mConfig.assistanceServer.type);
+ errs.at(index) = LOCATION_ERROR_INVALID_PARAMETER;
+ gnssConfigNeedEngineUpdate.flags &=
+ ~(GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT);
+ }
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ uint32_t newLppProfile = mAdapter.convertLppProfile(gnssConfigRequested.lppProfile);
+ ContextBase::mGps_conf.LPP_PROFILE = newLppProfile;
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ uint32_t newLppeControlPlaneMask =
+ mAdapter.convertLppeCp(gnssConfigRequested.lppeControlPlaneMask);
+ ContextBase::mGps_conf.LPPE_CP_TECHNOLOGY = newLppeControlPlaneMask;
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ uint32_t newLppeUserPlaneMask =
+ mAdapter.convertLppeUp(gnssConfigRequested.lppeUserPlaneMask);
+ ContextBase::mGps_conf.LPPE_UP_TECHNOLOGY = newLppeUserPlaneMask;
+ index++;
+ }
+ if (gnssConfigRequested.flags &
+ GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ uint32_t newAGloProtMask =
+ mAdapter.convertAGloProt(gnssConfigRequested.aGlonassPositionProtocolMask);
+ ContextBase::mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT = newAGloProtMask;
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
+ uint32_t newEP4ES = mAdapter.convertEP4ES(
+ gnssConfigRequested.emergencyPdnForEmergencySupl);
+ if (newEP4ES != ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
+ ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = newEP4ES;
+ }
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
+ uint32_t newSuplEs = mAdapter.convertSuplEs(
+ gnssConfigRequested.suplEmergencyServices);
+ if (newSuplEs != ContextBase::mGps_conf.SUPL_ES) {
+ ContextBase::mGps_conf.SUPL_ES = newSuplEs;
+ }
+ index++;
+ }
+ if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
+ uint32_t newSuplMode = mAdapter.convertSuplMode(gnssConfigRequested.suplModeMask);
+ ContextBase::mGps_conf.SUPL_MODE = newSuplMode;
+ mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
+ index++;
+ }
+
+ LocApiCollectiveResponse *configCollectiveResponse = new LocApiCollectiveResponse(
+ *adapter.getContext(),
+ [&adapter, sessionIds, countOfConfigs] (std::vector<LocationError> errs) {
+
+ std::vector<uint32_t> ids(sessionIds);
+ adapter.reportResponse(countOfConfigs, errs.data(), ids.data());
+ });
+
+ mApi.sendMsg(new LocApiMsg(
+ [&adapter, gnssConfigRequested, gnssConfigNeedEngineUpdate,
+ countOfConfigs, configCollectiveResponse, errs] () mutable {
+ std::vector<LocationError> errsList = adapter.gnssUpdateConfig("",
+ gnssConfigRequested, gnssConfigNeedEngineUpdate, countOfConfigs);
+
+ configCollectiveResponse->returnToSender(errsList);
+ }));
+ }
+ };
+
+ if (NULL != ids) {
+ sendMsg(new MsgGnssUpdateConfig(*this, *mLocApi, config, ids, count));
+ } else {
+ LOC_LOGE("%s]: No GNSS config items to update", __func__);
+ }
+
+ return ids;
+}
+
+void
+GnssAdapter::gnssSvIdConfigUpdate(const std::vector<GnssSvIdSource>& blacklistedSvIds)
+{
+ // Clear the existing config
+ memset(&mGnssSvIdConfig, 0, sizeof(GnssSvIdConfig));
+
+ // Convert the sv id lists to masks
+ bool convertSuccess = convertToGnssSvIdConfig(blacklistedSvIds, mGnssSvIdConfig);
+
+ // Now send to Modem if conversion successful
+ if (convertSuccess) {
+ gnssSvIdConfigUpdate();
+ } else {
+ LOC_LOGe("convertToGnssSvIdConfig failed");
+ }
+}
+
+void
+GnssAdapter::gnssSvIdConfigUpdate()
+{
+ LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
+ ", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
+ mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask,
+ mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask,
+ mGnssSvIdConfig.sbasBlacklistSvMask);
+
+ // Now set required blacklisted SVs
+ mLocApi->setBlacklistSv(mGnssSvIdConfig);
+}
+
+LocationError
+GnssAdapter::gnssSvIdConfigUpdateSync(const std::vector<GnssSvIdSource>& blacklistedSvIds)
+{
+ // Clear the existing config
+ memset(&mGnssSvIdConfig, 0, sizeof(GnssSvIdConfig));
+
+ // Convert the sv id lists to masks
+ convertToGnssSvIdConfig(blacklistedSvIds, mGnssSvIdConfig);
+
+ // Now send to Modem
+ return gnssSvIdConfigUpdateSync();
+}
+
+LocationError
+GnssAdapter::gnssSvIdConfigUpdateSync()
+{
+ LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
+ ", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
+ mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask,
+ mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask,
+ mGnssSvIdConfig.sbasBlacklistSvMask);
+
+ // Now set required blacklisted SVs
+ return mLocApi->setBlacklistSvSync(mGnssSvIdConfig);
+}
+
+uint32_t*
+GnssAdapter::gnssGetConfigCommand(GnssConfigFlagsMask configMask) {
+
+ // count the number of bits set
+ GnssConfigFlagsMask flagsCopy = configMask;
+ size_t count = 0;
+ while (flagsCopy > 0) {
+ if (flagsCopy & 1) {
+ count++;
+ }
+ flagsCopy >>= 1;
+ }
+ std::string idsString = "[";
+ uint32_t* ids = NULL;
+ if (count > 0) {
+ ids = new uint32_t[count];
+ if (nullptr == ids) {
+ LOC_LOGe("new allocation failed, fatal error.");
+ return nullptr;
+ }
+ for (size_t i=0; i < count; ++i) {
+ ids[i] = generateSessionId();
+ IF_LOC_LOGD {
+ idsString += std::to_string(ids[i]) + " ";
+ }
+ }
+ }
+ idsString += "]";
+
+ LOC_LOGd("ids %s flags 0x%X", idsString.c_str(), configMask);
+
+ struct MsgGnssGetConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ GnssConfigFlagsMask mConfigMask;
+ uint32_t* mIds;
+ size_t mCount;
+ inline MsgGnssGetConfig(GnssAdapter& adapter,
+ LocApiBase& api,
+ GnssConfigFlagsMask configMask,
+ uint32_t* ids,
+ size_t count) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mConfigMask(configMask),
+ mIds(ids),
+ mCount(count) {}
+
+ inline MsgGnssGetConfig(const MsgGnssGetConfig& obj) :
+ MsgGnssGetConfig(obj.mAdapter, obj.mApi, obj.mConfigMask,
+ new uint32_t[obj.mCount], obj.mCount) {
+ if (mIds != nullptr) {
+ for (int i = 0; i < mCount; ++i) {
+ mIds[i] = obj.mIds[i];
+ }
+ }
+ }
+ inline virtual ~MsgGnssGetConfig()
+ {
+ delete[] mIds;
+ }
+ inline virtual void proc() const {
+ if (!mAdapter.isEngineCapabilitiesKnown()) {
+ mAdapter.mPendingMsgs.push_back(new MsgGnssGetConfig(*this));
+ return;
+ }
+ LocationError* errs = new LocationError[mCount];
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ uint32_t index = 0;
+
+ if (nullptr == errs) {
+ LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
+ return;
+ }
+
+ if (mConfigMask & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
+ // Check if feature is supported
+ if (!ContextBase::isFeatureSupported(
+ LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
+ LOC_LOGe("Feature not supported.");
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ } else {
+ // Send request to Modem to fetch the config
+ mApi.getBlacklistSv();
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT) {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ if (index < mCount) {
+ errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }
+ if (mConfigMask & GNSS_CONFIG_FLAGS_ROBUST_LOCATION_BIT) {
+ uint32_t sessionId = *(mIds+index);
+ LocApiResponse* locApiResponse =
+ new LocApiResponse(*mAdapter.getContext(),
+ [this, sessionId] (LocationError err) {
+ mAdapter.reportResponse(err, sessionId);});
+ if (!locApiResponse) {
+ LOC_LOGe("memory alloc failed");
+ mAdapter.reportResponse(LOCATION_ERROR_GENERAL_FAILURE, sessionId);
+ } else {
+ mApi.getRobustLocationConfig(sessionId, locApiResponse);
+ }
+ }
+
+ mAdapter.reportResponse(index, errs, mIds);
+ delete[] errs;
+
+ }
+ };
+
+ if (NULL != ids) {
+ sendMsg(new MsgGnssGetConfig(*this, *mLocApi, configMask, ids, count));
+ } else {
+ LOC_LOGe("No GNSS config items to Get");
+ }
+
+ return ids;
+}
+
+bool
+GnssAdapter::convertToGnssSvIdConfig(
+ const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config)
+{
+ bool retVal = false;
+ config.size = sizeof(GnssSvIdConfig);
+
+ // Empty vector => Clear any previous blacklisted SVs
+ if (0 == blacklistedSvIds.size()) {
+ config.gloBlacklistSvMask = 0;
+ config.bdsBlacklistSvMask = 0;
+ config.qzssBlacklistSvMask = 0;
+ config.galBlacklistSvMask = 0;
+ config.sbasBlacklistSvMask = 0;
+ retVal = true;
+ } else {
+ // Parse the vector and convert SV IDs to mask values
+ for (GnssSvIdSource source : blacklistedSvIds) {
+ uint64_t* svMaskPtr = NULL;
+ GnssSvId initialSvId = 0;
+ uint16_t svIndexOffset = 0;
+ switch(source.constellation) {
+ case GNSS_SV_TYPE_GLONASS:
+ svMaskPtr = &config.gloBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_GLO_INITIAL_SV_ID;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ svMaskPtr = &config.bdsBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_BDS_INITIAL_SV_ID;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ svMaskPtr = &config.qzssBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ svMaskPtr = &config.galBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ // SBAS does not support enable/disable whole constellation
+ // so do not set up svTypeMask for SBAS
+ svMaskPtr = &config.sbasBlacklistSvMask;
+ // SBAS currently has two ranges
+ // range of SV id: 120 to 158 and 183 to 191
+ if (0 == source.svId) {
+ LOC_LOGd("blacklist all SBAS SV");
+ } else if (source.svId >= GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID) {
+ // handle SV id in range of 183 to 191
+ initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID;
+ svIndexOffset = GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH;
+ } else if ((source.svId >= GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID) &&
+ (source.svId < (GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID +
+ GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH))){
+ // handle SV id in range of 120 to 158
+ initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID;
+ } else {
+ LOC_LOGe("invalid SBAS sv id %d", source.svId);
+ svMaskPtr = nullptr;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (NULL == svMaskPtr) {
+ LOC_LOGe("Invalid constellation %d", source.constellation);
+ } else {
+ // SV ID 0 = All SV IDs
+ if (0 == source.svId) {
+ *svMaskPtr = GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK;
+ } else if (source.svId < initialSvId || source.svId >= initialSvId + 64) {
+ LOC_LOGe("Invalid sv id %d for sv type %d",
+ source.svId, source.constellation);
+ } else {
+ uint32_t shiftCnt = source.svId + svIndexOffset - initialSvId;
+ *svMaskPtr |= (1ULL << shiftCnt);
+ }
+ }
+ }
+
+ // Return true if any one source is valid
+ if (0 != config.gloBlacklistSvMask ||
+ 0 != config.bdsBlacklistSvMask ||
+ 0 != config.galBlacklistSvMask ||
+ 0 != config.qzssBlacklistSvMask ||
+ 0 != config.sbasBlacklistSvMask) {
+ retVal = true;
+ }
+ }
+
+ LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
+ ", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
+ config.bdsBlacklistSvMask, config.gloBlacklistSvMask,
+ config.qzssBlacklistSvMask, config.galBlacklistSvMask,
+ config.sbasBlacklistSvMask);
+
+ return retVal;
+}
+
+void GnssAdapter::convertFromGnssSvIdConfig(
+ const GnssSvIdConfig& svConfig, std::vector<GnssSvIdSource>& blacklistedSvIds)
+{
+ // Convert blacklisted SV mask values to vectors
+ if (svConfig.bdsBlacklistSvMask) {
+ convertGnssSvIdMaskToList(
+ svConfig.bdsBlacklistSvMask, blacklistedSvIds,
+ GNSS_SV_CONFIG_BDS_INITIAL_SV_ID, GNSS_SV_TYPE_BEIDOU);
+ }
+ if (svConfig.galBlacklistSvMask) {
+ convertGnssSvIdMaskToList(
+ svConfig.galBlacklistSvMask, blacklistedSvIds,
+ GNSS_SV_CONFIG_GAL_INITIAL_SV_ID, GNSS_SV_TYPE_GALILEO);
+ }
+ if (svConfig.gloBlacklistSvMask) {
+ convertGnssSvIdMaskToList(
+ svConfig.gloBlacklistSvMask, blacklistedSvIds,
+ GNSS_SV_CONFIG_GLO_INITIAL_SV_ID, GNSS_SV_TYPE_GLONASS);
+ }
+ if (svConfig.qzssBlacklistSvMask) {
+ convertGnssSvIdMaskToList(
+ svConfig.qzssBlacklistSvMask, blacklistedSvIds,
+ GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID, GNSS_SV_TYPE_QZSS);
+ }
+ if (svConfig.sbasBlacklistSvMask) {
+ convertGnssSvIdMaskToList(
+ svConfig.sbasBlacklistSvMask, blacklistedSvIds,
+ GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID, GNSS_SV_TYPE_SBAS);
+ }
+}
+
+void GnssAdapter::convertGnssSvIdMaskToList(
+ uint64_t svIdMask, std::vector<GnssSvIdSource>& svIds,
+ GnssSvId initialSvId, GnssSvType svType)
+{
+ GnssSvIdSource source = {};
+ source.size = sizeof(GnssSvIdSource);
+ source.constellation = svType;
+
+ // SV ID 0 => All SV IDs in mask
+ if (GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK == svIdMask) {
+ LOC_LOGd("blacklist all SVs in constellation %d", source.constellation);
+ source.svId = 0;
+ svIds.push_back(source);
+ return;
+ }
+
+ // Convert each bit in svIdMask to vector entry
+ uint32_t bitNumber = 0;
+ while (svIdMask > 0) {
+ if (svIdMask & 0x1) {
+ source.svId = bitNumber + initialSvId;
+ // SBAS has two ranges:
+ // SBAS - SV 120 to 158, maps to 0 to 38
+ // SV 183 to 191, maps to 39 to 47
+ // #define GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID 120
+ // #define GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH 39
+ // #define GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID 183
+ if (svType == GNSS_SV_TYPE_SBAS) {
+ if (bitNumber >= GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH) {
+ source.svId = bitNumber - GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH +
+ GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID;
+ }
+ }
+ svIds.push_back(source);
+ }
+ bitNumber++;
+ svIdMask >>= 1;
+ }
+}
+
+void GnssAdapter::reportGnssSvIdConfigEvent(const GnssSvIdConfig& config)
+{
+ struct MsgReportGnssSvIdConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ const GnssSvIdConfig mConfig;
+ inline MsgReportGnssSvIdConfig(GnssAdapter& adapter,
+ const GnssSvIdConfig& config) :
+ LocMsg(),
+ mAdapter(adapter),
+ mConfig(config) {}
+ inline virtual void proc() const {
+ mAdapter.reportGnssSvIdConfig(mConfig);
+ }
+ };
+
+ sendMsg(new MsgReportGnssSvIdConfig(*this, config));
+}
+
+void GnssAdapter::reportGnssSvIdConfig(const GnssSvIdConfig& svIdConfig)
+{
+ GnssConfig config = {};
+ config.size = sizeof(GnssConfig);
+
+ // Invoke control clients config callback
+ if (nullptr != mControlCallbacks.gnssConfigCb &&
+ svIdConfig.size == sizeof(GnssSvIdConfig)) {
+
+ convertFromGnssSvIdConfig(svIdConfig, config.blacklistedSvIds);
+ if (config.blacklistedSvIds.size() > 0) {
+ config.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
+ }
+ LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64 ", "
+ "qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
+ svIdConfig.bdsBlacklistSvMask, svIdConfig.gloBlacklistSvMask,
+ svIdConfig.qzssBlacklistSvMask, svIdConfig.galBlacklistSvMask,
+ svIdConfig.sbasBlacklistSvMask);
+ // use 0 session id to indicate that receiver does not yet care about session id
+ mControlCallbacks.gnssConfigCb(0, config);
+ } else {
+ LOC_LOGe("Failed to report, size %d", (uint32_t)config.size);
+ }
+}
+
+void
+GnssAdapter::gnssUpdateSvTypeConfigCommand(GnssSvTypeConfig config)
+{
+ struct MsgGnssUpdateSvTypeConfig : public LocMsg {
+ GnssAdapter* mAdapter;
+ LocApiBase* mApi;
+ GnssSvTypeConfig mConfig;
+ inline MsgGnssUpdateSvTypeConfig(
+ GnssAdapter* adapter,
+ LocApiBase* api,
+ GnssSvTypeConfig& config) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mConfig(config) {}
+ inline virtual void proc() const {
+ if (!mAdapter->isEngineCapabilitiesKnown()) {
+ mAdapter->mPendingMsgs.push_back(new MsgGnssUpdateSvTypeConfig(*this));
+ return;
+ }
+ // Check if feature is supported
+ if (!ContextBase::isFeatureSupported(
+ LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
+ LOC_LOGe("Feature not supported.");
+ } else {
+ // Send update request to modem
+ mAdapter->gnssSvTypeConfigUpdate(mConfig);
+ }
+ }
+ };
+
+ sendMsg(new MsgGnssUpdateSvTypeConfig(this, mLocApi, config));
+}
+
+void
+GnssAdapter::gnssSvTypeConfigUpdate(const GnssSvTypeConfig& config)
+{
+ // Gather bits removed from enabled mask
+ GnssSvTypesMask enabledRemoved = mGnssSvTypeConfig.enabledSvTypesMask &
+ (mGnssSvTypeConfig.enabledSvTypesMask ^ config.enabledSvTypesMask);
+ // Send reset if any constellation is removed from the enabled list
+ bool sendReset = (enabledRemoved != 0);
+ // Save new config and update
+ gnssSetSvTypeConfig(config);
+ gnssSvTypeConfigUpdate(sendReset);
+}
+
+void
+GnssAdapter::gnssSvTypeConfigUpdate(bool sendReset)
+{
+ LOC_LOGd("size %" PRIu32" constellations blacklisted 0x%" PRIx64 ", enabled 0x%" PRIx64
+ ", sendReset %d",
+ mGnssSvTypeConfig.size, mGnssSvTypeConfig.blacklistedSvTypesMask,
+ mGnssSvTypeConfig.enabledSvTypesMask, sendReset);
+
+ LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
+ ", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
+ mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask,
+ mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask,
+ mGnssSvIdConfig.sbasBlacklistSvMask);
+
+ if (mGnssSvTypeConfig.size == sizeof(mGnssSvTypeConfig)) {
+
+ if (sendReset) {
+ mLocApi->resetConstellationControl();
+ }
+
+ GnssSvIdConfig blacklistConfig = {};
+ // Revert to previously blacklisted SVs for each enabled constellation
+ blacklistConfig = mGnssSvIdConfig;
+ // Blacklist all SVs for each disabled constellation
+ if (mGnssSvTypeConfig.blacklistedSvTypesMask) {
+ if (mGnssSvTypeConfig.blacklistedSvTypesMask & GNSS_SV_TYPES_MASK_GLO_BIT) {
+ blacklistConfig.gloBlacklistSvMask = GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK;
+ }
+ if (mGnssSvTypeConfig.blacklistedSvTypesMask & GNSS_SV_TYPES_MASK_BDS_BIT) {
+ blacklistConfig.bdsBlacklistSvMask = GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK;
+ }
+ if (mGnssSvTypeConfig.blacklistedSvTypesMask & GNSS_SV_TYPES_MASK_QZSS_BIT) {
+ blacklistConfig.qzssBlacklistSvMask = GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK;
+ }
+ if (mGnssSvTypeConfig.blacklistedSvTypesMask & GNSS_SV_TYPES_MASK_GAL_BIT) {
+ blacklistConfig.galBlacklistSvMask = GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK;
+ }
+ }
+
+ // Send blacklist info
+ mLocApi->setBlacklistSv(blacklistConfig);
+
+ // Send only enabled constellation config
+ if (mGnssSvTypeConfig.enabledSvTypesMask) {
+ GnssSvTypeConfig svTypeConfig = {sizeof(GnssSvTypeConfig), 0, 0};
+ svTypeConfig.enabledSvTypesMask = mGnssSvTypeConfig.enabledSvTypesMask;
+ mLocApi->setConstellationControl(svTypeConfig);
+ }
+ }
+}
+
+void
+GnssAdapter::gnssGetSvTypeConfigCommand(GnssSvTypeConfigCallback callback)
+{
+ struct MsgGnssGetSvTypeConfig : public LocMsg {
+ GnssAdapter* mAdapter;
+ LocApiBase* mApi;
+ GnssSvTypeConfigCallback mCallback;
+ inline MsgGnssGetSvTypeConfig(
+ GnssAdapter* adapter,
+ LocApiBase* api,
+ GnssSvTypeConfigCallback callback) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mCallback(callback) {}
+ inline virtual void proc() const {
+ if (!mAdapter->isEngineCapabilitiesKnown()) {
+ mAdapter->mPendingMsgs.push_back(new MsgGnssGetSvTypeConfig(*this));
+ return;
+ }
+ if (!ContextBase::isFeatureSupported(
+ LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
+ LOC_LOGe("Feature not supported.");
+ } else {
+ // Save the callback
+ mAdapter->gnssSetSvTypeConfigCallback(mCallback);
+ // Send GET request to modem
+ mApi->getConstellationControl();
+ }
+ }
+ };
+
+ sendMsg(new MsgGnssGetSvTypeConfig(this, mLocApi, callback));
+}
+
+void
+GnssAdapter::gnssResetSvTypeConfigCommand()
+{
+ struct MsgGnssResetSvTypeConfig : public LocMsg {
+ GnssAdapter* mAdapter;
+ LocApiBase* mApi;
+ inline MsgGnssResetSvTypeConfig(
+ GnssAdapter* adapter,
+ LocApiBase* api) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api) {}
+ inline virtual void proc() const {
+ if (!mAdapter->isEngineCapabilitiesKnown()) {
+ mAdapter->mPendingMsgs.push_back(new MsgGnssResetSvTypeConfig(*this));
+ return;
+ }
+ if (!ContextBase::isFeatureSupported(
+ LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
+ LOC_LOGe("Feature not supported.");
+ } else {
+ // Reset constellation config
+ mAdapter->gnssSetSvTypeConfig({sizeof(GnssSvTypeConfig), 0, 0});
+ // Re-enforce SV blacklist config
+ mAdapter->gnssSvIdConfigUpdate();
+ // Send reset request to modem
+ mApi->resetConstellationControl();
+ }
+ }
+ };
+
+ sendMsg(new MsgGnssResetSvTypeConfig(this, mLocApi));
+}
+
+void GnssAdapter::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config)
+{
+ struct MsgReportGnssSvTypeConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ const GnssSvTypeConfig mConfig;
+ inline MsgReportGnssSvTypeConfig(GnssAdapter& adapter,
+ const GnssSvTypeConfig& config) :
+ LocMsg(),
+ mAdapter(adapter),
+ mConfig(config) {}
+ inline virtual void proc() const {
+ mAdapter.reportGnssSvTypeConfig(mConfig);
+ }
+ };
+
+ sendMsg(new MsgReportGnssSvTypeConfig(*this, config));
+}
+
+void GnssAdapter::reportGnssSvTypeConfig(const GnssSvTypeConfig& config)
+{
+ // Invoke Get SV Type Callback
+ if (NULL != mGnssSvTypeConfigCb &&
+ config.size == sizeof(GnssSvTypeConfig)) {
+ LOC_LOGd("constellations blacklisted 0x%" PRIx64 ", enabled 0x%" PRIx64,
+ config.blacklistedSvTypesMask, config.enabledSvTypesMask);
+ mGnssSvTypeConfigCb(config);
+ } else {
+ LOC_LOGe("Failed to report, size %d", (uint32_t)config.size);
+ }
+}
+
+void GnssAdapter::deleteAidingData(const GnssAidingData &data, uint32_t sessionId) {
+ mLocApi->deleteAidingData(data, new LocApiResponse(*getContext(),
+ [this, sessionId] (LocationError err) {
+ reportResponse(err, sessionId);
+ }));
+}
+
+uint32_t
+GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data)
+{
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGD("%s]: id %u", __func__, sessionId);
+
+ struct MsgDeleteAidingData : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+ GnssAidingData mData;
+ inline MsgDeleteAidingData(GnssAdapter& adapter,
+ uint32_t sessionId,
+ GnssAidingData& data) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId),
+ mData(data) {}
+ inline virtual void proc() const {
+ if ((mData.posEngineMask & STANDARD_POSITIONING_ENGINE) != 0) {
+ mAdapter.deleteAidingData(mData, mSessionId);
+
+ SystemStatus* s = mAdapter.getSystemStatus();
+ if ((nullptr != s) && (mData.deleteAll)) {
+ s->setDefaultGnssEngineStates();
+ }
+ }
+
+ mAdapter.mEngHubProxy->gnssDeleteAidingData(mData);
+ }
+ };
+
+ sendMsg(new MsgDeleteAidingData(*this, sessionId, data));
+ return sessionId;
+}
+
+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",
+ __func__, latitude, longitude, accuracy);
+
+ struct MsgInjectLocation : public LocMsg {
+ LocApiBase& mApi;
+ ContextBase& mContext;
+ BlockCPIInfo& mBlockCPI;
+ double mLatitude;
+ double mLongitude;
+ float mAccuracy;
+ inline MsgInjectLocation(LocApiBase& api,
+ ContextBase& context,
+ BlockCPIInfo& blockCPIInfo,
+ double latitude,
+ double longitude,
+ float accuracy) :
+ LocMsg(),
+ mApi(api),
+ mContext(context),
+ mBlockCPI(blockCPIInfo),
+ mLatitude(latitude),
+ mLongitude(longitude),
+ mAccuracy(accuracy) {}
+ inline virtual void proc() const {
+ if ((uptimeMillis() <= mBlockCPI.blockedTillTsMs) &&
+ (fabs(mLatitude-mBlockCPI.latitude) <= mBlockCPI.latLonDiffThreshold) &&
+ (fabs(mLongitude-mBlockCPI.longitude) <= mBlockCPI.latLonDiffThreshold)) {
+
+ LOC_LOGD("%s]: positon injeciton blocked: lat: %f, lon: %f, accuracy: %f",
+ __func__, mLatitude, mLongitude, mAccuracy);
+
+ } else {
+ mApi.injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ }
+ };
+
+ sendMsg(new MsgInjectLocation(*mLocApi, *mContext, mBlockCPIInfo,
+ latitude, longitude, accuracy));
+}
+
+void
+GnssAdapter::injectLocationExtCommand(const GnssLocationInfoNotification &locationInfo)
+{
+ LOC_LOGd("latitude %8.4f longitude %8.4f accuracy %8.4f, tech mask 0x%x",
+ locationInfo.location.latitude, locationInfo.location.longitude,
+ locationInfo.location.accuracy, locationInfo.location.techMask);
+
+ struct MsgInjectLocationExt : public LocMsg {
+ LocApiBase& mApi;
+ ContextBase& mContext;
+ GnssLocationInfoNotification mLocationInfo;
+ inline MsgInjectLocationExt(LocApiBase& api,
+ ContextBase& context,
+ GnssLocationInfoNotification locationInfo) :
+ LocMsg(),
+ mApi(api),
+ mContext(context),
+ mLocationInfo(locationInfo) {}
+ inline virtual void proc() const {
+ // false to indicate for none-ODCPI
+ mApi.injectPosition(mLocationInfo, false);
+ }
+ };
+
+ sendMsg(new MsgInjectLocationExt(*mLocApi, *mContext, locationInfo));
+}
+
+void
+GnssAdapter::injectTimeCommand(int64_t time, int64_t timeReference, int32_t uncertainty)
+{
+ LOC_LOGD("%s]: time %lld timeReference %lld uncertainty %d",
+ __func__, (long long)time, (long long)timeReference, uncertainty);
+
+ struct MsgInjectTime : public LocMsg {
+ LocApiBase& mApi;
+ ContextBase& mContext;
+ int64_t mTime;
+ int64_t mTimeReference;
+ int32_t mUncertainty;
+ inline MsgInjectTime(LocApiBase& api,
+ ContextBase& context,
+ int64_t time,
+ int64_t timeReference,
+ int32_t uncertainty) :
+ LocMsg(),
+ mApi(api),
+ mContext(context),
+ mTime(time),
+ mTimeReference(timeReference),
+ mUncertainty(uncertainty) {}
+ inline virtual void proc() const {
+ mApi.setTime(mTime, mTimeReference, mUncertainty);
+ }
+ };
+
+ sendMsg(new MsgInjectTime(*mLocApi, *mContext, time, timeReference, uncertainty));
+}
+
+// This command is to called to block the position to be injected to the modem.
+// This can happen for network position that comes from modem.
+void
+GnssAdapter::blockCPICommand(double latitude, double longitude,
+ float accuracy, int blockDurationMsec,
+ double latLonDiffThreshold)
+{
+ struct MsgBlockCPI : public LocMsg {
+ BlockCPIInfo& mDstCPIInfo;
+ BlockCPIInfo mSrcCPIInfo;
+
+ inline MsgBlockCPI(BlockCPIInfo& dstCPIInfo,
+ BlockCPIInfo& srcCPIInfo) :
+ mDstCPIInfo(dstCPIInfo),
+ mSrcCPIInfo(srcCPIInfo) {}
+ inline virtual void proc() const {
+ // in the same hal thread, save the cpi to be blocked
+ // the global variable
+ mDstCPIInfo = mSrcCPIInfo;
+ }
+ };
+
+ // construct the new block CPI info and queue on the same thread
+ // for processing
+ BlockCPIInfo blockCPIInfo;
+ blockCPIInfo.latitude = latitude;
+ blockCPIInfo.longitude = longitude;
+ blockCPIInfo.accuracy = accuracy;
+ blockCPIInfo.blockedTillTsMs = uptimeMillis() + blockDurationMsec;
+ blockCPIInfo.latLonDiffThreshold = latLonDiffThreshold;
+
+ LOC_LOGD("%s]: block CPI lat: %f, lon: %f ", __func__, latitude, longitude);
+ // send a message to record down the coarse position
+ // to be blocked from injection in the master copy (mBlockCPIInfo)
+ sendMsg(new MsgBlockCPI(mBlockCPIInfo, blockCPIInfo));
+}
+
+void
+GnssAdapter::updateSystemPowerState(PowerStateType systemPowerState) {
+ if (POWER_STATE_UNKNOWN != systemPowerState) {
+ mSystemPowerState = systemPowerState;
+ mLocApi->updateSystemPowerState(mSystemPowerState);
+ }
+}
+
+void
+GnssAdapter::updateSystemPowerStateCommand(PowerStateType systemPowerState) {
+ LOC_LOGd("power event %d", systemPowerState);
+
+ struct MsgUpdatePowerState : public LocMsg {
+ GnssAdapter& mAdapter;
+ PowerStateType mSystemPowerState;
+
+ inline MsgUpdatePowerState(GnssAdapter& adapter,
+ PowerStateType systemPowerState) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSystemPowerState(systemPowerState) {}
+ inline virtual void proc() const {
+ mAdapter.updateSystemPowerState(mSystemPowerState);
+ }
+ };
+
+ sendMsg(new MsgUpdatePowerState(*this, systemPowerState));
+}
+
+void
+GnssAdapter::addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+
+ struct MsgAddClient : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocationAPI* mClient;
+ const LocationCallbacks mCallbacks;
+ inline MsgAddClient(GnssAdapter& adapter,
+ LocationAPI* client,
+ const LocationCallbacks& callbacks) :
+ LocMsg(),
+ mAdapter(adapter),
+ mClient(client),
+ mCallbacks(callbacks) {}
+ inline virtual void proc() const {
+ // check whether we need to notify client of cached location system info
+ mAdapter.notifyClientOfCachedLocationSystemInfo(mClient, mCallbacks);
+ mAdapter.saveClient(mClient, mCallbacks);
+ }
+ };
+
+ sendMsg(new MsgAddClient(*this, client, callbacks));
+}
+
+void
+GnssAdapter::stopClientSessions(LocationAPI* client)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+
+ /* Time-based Tracking */
+ std::vector<LocationSessionKey> vTimeBasedTrackingClient;
+ for (auto it : mTimeBasedTrackingSessions) {
+ if (client == it.first.client) {
+ vTimeBasedTrackingClient.emplace_back(it.first.client, it.first.id);
+ }
+ }
+ for (auto key : vTimeBasedTrackingClient) {
+ stopTimeBasedTrackingMultiplex(key.client, key.id);
+ eraseTrackingSession(key.client, key.id);
+ }
+
+ /* Distance-based Tracking */
+ for (auto it = mDistanceBasedTrackingSessions.begin();
+ it != mDistanceBasedTrackingSessions.end(); /* no increment here*/) {
+ if (client == it->first.client) {
+ mLocApi->stopDistanceBasedTracking(it->first.id, new LocApiResponse(*getContext(),
+ [this, client, id=it->first.id] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ eraseTrackingSession(client, id);
+ }
+ }
+ ));
+ }
+ ++it; // increment only when not erasing an iterator
+ }
+
+}
+
+void
+GnssAdapter::updateClientsEventMask()
+{
+ LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (it->second.trackingCb != nullptr ||
+ it->second.gnssLocationInfoCb != nullptr ||
+ it->second.engineLocationsInfoCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
+ }
+ if (it->second.gnssSvCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_SATELLITE_REPORT;
+ }
+ if ((it->second.gnssNmeaCb != nullptr) && (mNmeaMask)) {
+ mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
+ }
+ if (it->second.gnssMeasurementsCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ }
+ if (it->second.gnssDataCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
+ mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
+ updateNmeaMask(mNmeaMask | LOC_NMEA_MASK_DEBUG_V02);
+ }
+ }
+
+ /*
+ ** For Automotive use cases we need to enable MEASUREMENT, POLY and EPHEMERIS
+ ** when QDR is enabled (e.g.: either enabled via conf file or
+ ** engine hub is loaded successfully).
+ ** Note: this need to be called from msg queue thread.
+ */
+ if((1 == ContextBase::mGps_conf.EXTERNAL_DR_ENABLED) ||
+ (true == initEngHubProxy())) {
+ mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
+ mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT;
+ mask |= LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT;
+ mask |= LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO;
+ mask |= LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO;
+
+ // Nhz measurement bit is set based on callback from loc eng hub
+ // for Nhz engines.
+ mask |= checkMask(LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT);
+
+ LOC_LOGd("Auto usecase, Enable MEAS/POLY/EPHEMERIS - mask 0x%" PRIx64 "",
+ mask);
+ }
+
+ if (mAgpsManager.isRegistered()) {
+ mask |= LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST;
+ }
+ // Add ODCPI handling
+ if (nullptr != mOdcpiRequestCb) {
+ mask |= LOC_API_ADAPTER_BIT_REQUEST_WIFI;
+ }
+
+ // need to register for leap second info
+ // for proper nmea generation
+ mask |= LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO;
+
+ // always register for NI NOTIFY VERIFY to handle internally in HAL
+ mask |= LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+ updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
+}
+
+void
+GnssAdapter::handleEngineUpEvent()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgHandleEngineUpEvent : public LocMsg {
+ GnssAdapter& mAdapter;
+ inline MsgHandleEngineUpEvent(GnssAdapter& adapter) :
+ LocMsg(),
+ mAdapter(adapter) {}
+ virtual void proc() const {
+ mAdapter.setEngineCapabilitiesKnown(true);
+ mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
+ // must be called only after capabilities are known
+ mAdapter.setConfig();
+ mAdapter.gnssSvIdConfigUpdate();
+ mAdapter.gnssSvTypeConfigUpdate();
+ mAdapter.updateSystemPowerState(mAdapter.getSystemPowerState());
+ // restart sessions
+ mAdapter.restartSessions(true);
+ for (auto msg: mAdapter.mPendingMsgs) {
+ mAdapter.sendMsg(msg);
+ }
+ mAdapter.mPendingMsgs.clear();
+ }
+ };
+
+ readConfigCommand();
+ sendMsg(new MsgHandleEngineUpEvent(*this));
+}
+
+void
+GnssAdapter::restartSessions(bool modemSSR)
+{
+ LOC_LOGi(":enter");
+
+ if (modemSSR) {
+ // odcpi session is no longer active after restart
+ mOdcpiRequestActive = false;
+ }
+
+ // SPE will be restarted now, so set this variable to false.
+ mSPEAlreadyRunningAtHighestInterval = false;
+
+ checkAndRestartTimeBasedSession();
+
+ for (auto it = mDistanceBasedTrackingSessions.begin();
+ it != mDistanceBasedTrackingSessions.end(); ++it) {
+ mLocApi->startDistanceBasedTracking(it->first.id, it->second,
+ new LocApiResponse(*getContext(),
+ [] (LocationError /*err*/) {}));
+ }
+}
+
+// suspend all on-going sessions
+void
+GnssAdapter::suspendSessions()
+{
+ LOC_LOGi(":enter");
+
+ if (!mTimeBasedTrackingSessions.empty()) {
+ // inform engine hub that GNSS session has stopped
+ mEngHubProxy->gnssStopFix();
+ mLocApi->stopFix(nullptr);
+ mSPEAlreadyRunningAtHighestInterval = false;
+ }
+}
+
+void GnssAdapter::checkAndRestartTimeBasedSession()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ if (!mTimeBasedTrackingSessions.empty()) {
+ // get the LocationOptions that has the smallest interval, which should be the active one
+ TrackingOptions smallestIntervalOptions; // size is zero until set for the first time
+ TrackingOptions highestPowerTrackingOptions;
+ memset(&smallestIntervalOptions, 0, sizeof(smallestIntervalOptions));
+ memset(&highestPowerTrackingOptions, 0, sizeof(highestPowerTrackingOptions));
+ for (auto it = mTimeBasedTrackingSessions.begin();
+ it != mTimeBasedTrackingSessions.end(); ++it) {
+ // size of zero means we havent set it yet
+ if (0 == smallestIntervalOptions.size ||
+ it->second.minInterval < smallestIntervalOptions.minInterval) {
+ smallestIntervalOptions = it->second;
+ }
+ GnssPowerMode powerMode = it->second.powerMode;
+ // Size of zero means we havent set it yet
+ if (0 == highestPowerTrackingOptions.size ||
+ (GNSS_POWER_MODE_INVALID != powerMode &&
+ powerMode < highestPowerTrackingOptions.powerMode)) {
+ highestPowerTrackingOptions = it->second;
+ }
+ }
+
+ highestPowerTrackingOptions.setLocationOptions(smallestIntervalOptions);
+ // want to run SPE session at a fixed min interval in some automotive scenarios
+ if(!checkAndSetSPEToRunforNHz(highestPowerTrackingOptions)) {
+ mLocApi->startTimeBasedTracking(highestPowerTrackingOptions, nullptr);
+ }
+ }
+}
+
+void
+GnssAdapter::notifyClientOfCachedLocationSystemInfo(
+ LocationAPI* client, const LocationCallbacks& callbacks) {
+
+ if (mLocSystemInfo.systemInfoMask) {
+ // client need to be notified if client has not yet previously registered
+ // for the info but now register for it.
+ bool notifyClientOfSystemInfo = false;
+ // check whether we need to notify client of cached location system info
+ //
+ // client need to be notified if client has not yet previously registered
+ // for the info but now register for it.
+ if (callbacks.locationSystemInfoCb) {
+ notifyClientOfSystemInfo = true;
+ auto it = mClientData.find(client);
+ if (it != mClientData.end()) {
+ LocationCallbacks oldCallbacks = it->second;
+ if (oldCallbacks.locationSystemInfoCb) {
+ notifyClientOfSystemInfo = false;
+ }
+ }
+ }
+
+ if (notifyClientOfSystemInfo) {
+ callbacks.locationSystemInfoCb(mLocSystemInfo);
+ }
+ }
+}
+
+bool
+GnssAdapter::isTimeBasedTrackingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ return (mTimeBasedTrackingSessions.find(key) != mTimeBasedTrackingSessions.end());
+}
+
+bool
+GnssAdapter::isDistanceBasedTrackingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ return (mDistanceBasedTrackingSessions.find(key) != mDistanceBasedTrackingSessions.end());
+}
+
+bool
+GnssAdapter::hasCallbacksToStartTracking(LocationAPI* client)
+{
+ bool allowed = false;
+ auto it = mClientData.find(client);
+ if (it != mClientData.end()) {
+ if (it->second.trackingCb || it->second.gnssLocationInfoCb ||
+ it->second.engineLocationsInfoCb || it->second.gnssMeasurementsCb) {
+ allowed = true;
+ } else {
+ LOC_LOGi("missing right callback to start tracking")
+ }
+ } else {
+ LOC_LOGi("client %p not found", client)
+ }
+ return allowed;
+}
+
+bool
+GnssAdapter::isTrackingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ return (mTimeBasedTrackingSessions.find(key) != mTimeBasedTrackingSessions.end());
+}
+
+void
+GnssAdapter::reportPowerStateIfChanged()
+{
+ bool newPowerOn = !mTimeBasedTrackingSessions.empty() ||
+ !mDistanceBasedTrackingSessions.empty();
+ if (newPowerOn != mPowerOn) {
+ mPowerOn = newPowerOn;
+ if (mPowerStateCb != nullptr) {
+ mPowerStateCb(mPowerOn);
+ }
+ }
+}
+
+void
+GnssAdapter::getPowerStateChangesCommand(std::function<void(bool)> powerStateCb)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgReportLocation : public LocMsg {
+ GnssAdapter& mAdapter;
+ std::function<void(bool)> mPowerStateCb;
+ inline MsgReportLocation(GnssAdapter& adapter,
+ std::function<void(bool)> powerStateCb) :
+ LocMsg(),
+ mAdapter(adapter),
+ mPowerStateCb(powerStateCb) {}
+ inline virtual void proc() const {
+ mAdapter.savePowerStateCallback(mPowerStateCb);
+ mPowerStateCb(mAdapter.getPowerState());
+ }
+ };
+
+ sendMsg(new MsgReportLocation(*this, powerStateCb));
+}
+
+void
+GnssAdapter::saveTrackingSession(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& options)
+{
+ LocationSessionKey key(client, sessionId);
+ if ((options.minDistance > 0) &&
+ ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING)) {
+ mDistanceBasedTrackingSessions[key] = options;
+ } else {
+ mTimeBasedTrackingSessions[key] = options;
+ }
+ reportPowerStateIfChanged();
+}
+
+void
+GnssAdapter::eraseTrackingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ auto it = mTimeBasedTrackingSessions.find(key);
+ if (it != mTimeBasedTrackingSessions.end()) {
+ mTimeBasedTrackingSessions.erase(it);
+ } else {
+ auto itr = mDistanceBasedTrackingSessions.find(key);
+ if (itr != mDistanceBasedTrackingSessions.end()) {
+ mDistanceBasedTrackingSessions.erase(itr);
+ }
+ }
+ reportPowerStateIfChanged();
+}
+
+
+bool GnssAdapter::setLocPositionMode(const LocPosMode& mode) {
+ if (!mLocPositionMode.equals(mode)) {
+ mLocPositionMode = mode;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void
+GnssAdapter::reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId)
+{
+ LOC_LOGD("%s]: client %p id %u err %u", __func__, client, sessionId, err);
+
+ auto it = mClientData.find(client);
+ if (it != mClientData.end() && it->second.responseCb != nullptr) {
+ it->second.responseCb(err, sessionId);
+ } else {
+ LOC_LOGW("%s]: client %p id %u not found in data", __func__, client, sessionId);
+ }
+}
+
+void
+GnssAdapter::reportResponse(LocationError err, uint32_t sessionId)
+{
+ LOC_LOGD("%s]: id %u err %u", __func__, sessionId, err);
+
+ if (mControlCallbacks.size > 0 && mControlCallbacks.responseCb != nullptr) {
+ mControlCallbacks.responseCb(err, sessionId);
+ } else {
+ LOC_LOGW("%s]: control client response callback not found", __func__);
+ }
+}
+
+void
+GnssAdapter::reportResponse(size_t count, LocationError* errs, uint32_t* ids)
+{
+ IF_LOC_LOGD {
+ std::string idsString = "[";
+ std::string errsString = "[";
+ if (NULL != ids && NULL != errs) {
+ for (size_t i=0; i < count; ++i) {
+ idsString += std::to_string(ids[i]) + " ";
+ errsString += std::to_string(errs[i]) + " ";
+ }
+ }
+ idsString += "]";
+ errsString += "]";
+
+ LOC_LOGD("%s]: ids %s errs %s",
+ __func__, idsString.c_str(), errsString.c_str());
+ }
+
+ if (mControlCallbacks.size > 0 && mControlCallbacks.collectiveResponseCb != nullptr) {
+ mControlCallbacks.collectiveResponseCb(count, errs, ids);
+ } else {
+ LOC_LOGW("%s]: control client callback not found", __func__);
+ }
+}
+
+uint32_t
+GnssAdapter::startTrackingCommand(LocationAPI* client, TrackingOptions& options)
+{
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGD("%s]: client %p id %u minInterval %u minDistance %u mode %u powermode %u tbm %u",
+ __func__, client, sessionId, options.minInterval, options.minDistance, options.mode,
+ options.powerMode, options.tbm);
+
+ struct MsgStartTracking : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ mutable TrackingOptions mOptions;
+ inline MsgStartTracking(GnssAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId,
+ TrackingOptions options) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId),
+ mOptions(options) {}
+ inline virtual void proc() const {
+ // distance based tracking will need to know engine capabilities before it can start
+ if (!mAdapter.isEngineCapabilitiesKnown() && mOptions.minDistance > 0) {
+ mAdapter.mPendingMsgs.push_back(new MsgStartTracking(*this));
+ return;
+ }
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (!mAdapter.hasCallbacksToStartTracking(mClient)) {
+ err = LOCATION_ERROR_CALLBACK_MISSING;
+ } else if (0 == mOptions.size) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ } else {
+ if (mOptions.minInterval < MIN_TRACKING_INTERVAL) {
+ mOptions.minInterval = MIN_TRACKING_INTERVAL;
+ }
+ if (mOptions.minDistance > 0 &&
+ ContextBase::isMessageSupported(
+ LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING)) {
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+ mApi.startDistanceBasedTracking(mSessionId, mOptions,
+ new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient]
+ (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ mAdapter.eraseTrackingSession(mClient, mSessionId);
+ }
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }));
+ } else {
+ if (GNSS_POWER_MODE_M4 == mOptions.powerMode &&
+ mOptions.tbm > TRACKING_TBM_THRESHOLD_MILLIS) {
+ LOC_LOGd("TBM (%d) > %d Falling back to M2 power mode",
+ mOptions.tbm, TRACKING_TBM_THRESHOLD_MILLIS);
+ mOptions.powerMode = GNSS_POWER_MODE_M2;
+ }
+ // Api doesn't support multiple clients for time based tracking, so mutiplex
+ bool reportToClientWithNoWait =
+ mAdapter.startTimeBasedTrackingMultiplex(mClient, mSessionId, mOptions);
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+
+ if (reportToClientWithNoWait) {
+ mAdapter.reportResponse(mClient, LOCATION_ERROR_SUCCESS, mSessionId);
+ }
+ }
+ }
+ }
+ };
+
+ sendMsg(new MsgStartTracking(*this, *mLocApi, client, sessionId, options));
+ return sessionId;
+
+}
+
+bool
+GnssAdapter::startTimeBasedTrackingMultiplex(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& options)
+{
+ bool reportToClientWithNoWait = true;
+
+ if (mTimeBasedTrackingSessions.empty()) {
+ startTimeBasedTracking(client, sessionId, options);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
+ } else {
+ // find the smallest interval and powerMode
+ TrackingOptions multiplexedOptions = {}; // size is 0 until set for the first time
+ GnssPowerMode multiplexedPowerMode = GNSS_POWER_MODE_INVALID;
+ memset(&multiplexedOptions, 0, sizeof(multiplexedOptions));
+ for (auto it = mTimeBasedTrackingSessions.begin(); it != mTimeBasedTrackingSessions.end(); ++it) {
+ // if not set or there is a new smallest interval, then set the new interval
+ if (0 == multiplexedOptions.size ||
+ it->second.minInterval < multiplexedOptions.minInterval) {
+ multiplexedOptions = it->second;
+ }
+ // if session is not the one we are updating and either powerMode
+ // is not set or there is a new smallest powerMode, then set the new powerMode
+ if (GNSS_POWER_MODE_INVALID == multiplexedPowerMode ||
+ it->second.powerMode < multiplexedPowerMode) {
+ multiplexedPowerMode = it->second.powerMode;
+ }
+ }
+ bool updateOptions = false;
+ // if session we are starting has smaller interval then next smallest
+ if (options.minInterval < multiplexedOptions.minInterval) {
+ multiplexedOptions.minInterval = options.minInterval;
+ updateOptions = true;
+ }
+
+ // if session we are starting has smaller powerMode then next smallest
+ if (options.powerMode < multiplexedPowerMode) {
+ multiplexedOptions.powerMode = options.powerMode;
+ updateOptions = true;
+ }
+ if (updateOptions) {
+ // restart time based tracking with the newly updated options
+
+ startTimeBasedTracking(client, sessionId, multiplexedOptions);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
+ }
+ // else part: no QMI call is made, need to report back to client right away
+ }
+
+ return reportToClientWithNoWait;
+}
+
+void
+GnssAdapter::startTimeBasedTracking(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& trackingOptions)
+{
+ LOC_LOGd("minInterval %u minDistance %u mode %u powermode %u tbm %u",
+ trackingOptions.minInterval, trackingOptions.minDistance,
+ trackingOptions.mode, trackingOptions.powerMode, trackingOptions.tbm);
+
+ LocPosMode locPosMode = {};
+ convertOptions(locPosMode, trackingOptions);
+
+ // inform engine hub that GNSS session is about to start
+ mEngHubProxy->gnssSetFixMode(locPosMode);
+ mEngHubProxy->gnssStartFix();
+
+ // want to run SPE session at a fixed min interval in some automotive scenarios
+ // use a local copy of TrackingOptions as the TBF may get modified in the
+ // checkAndSetSPEToRunforNHz function
+ TrackingOptions tempOptions(trackingOptions);
+ if (!checkAndSetSPEToRunforNHz(tempOptions)) {
+ mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(),
+ [this, client, sessionId] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ eraseTrackingSession(client, sessionId);
+ }
+
+ reportResponse(client, err, sessionId);
+ }
+ ));
+ } else {
+ reportResponse(client, LOCATION_ERROR_SUCCESS, sessionId);
+ }
+
+}
+
+void
+GnssAdapter::updateTracking(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& updatedOptions, const TrackingOptions& oldOptions)
+{
+ LocPosMode locPosMode = {};
+ convertOptions(locPosMode, updatedOptions);
+
+ // inform engine hub that GNSS session is about to start
+ mEngHubProxy->gnssSetFixMode(locPosMode);
+ mEngHubProxy->gnssStartFix();
+
+ // want to run SPE session at a fixed min interval in some automotive scenarios
+ // use a local copy of TrackingOptions as the TBF may get modified in the
+ // checkAndSetSPEToRunforNHz function
+ TrackingOptions tempOptions(updatedOptions);
+ if(!checkAndSetSPEToRunforNHz(tempOptions)) {
+ mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(),
+ [this, client, sessionId, oldOptions] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ // restore the old LocationOptions
+ saveTrackingSession(client, sessionId, oldOptions);
+ }
+ reportResponse(client, err, sessionId);
+ }
+ ));
+ } else {
+ reportResponse(client, LOCATION_ERROR_SUCCESS, sessionId);
+ }
+}
+
+void
+GnssAdapter::updateTrackingOptionsCommand(LocationAPI* client, uint32_t id,
+ TrackingOptions& options)
+{
+ LOC_LOGD("%s]: client %p id %u minInterval %u mode %u",
+ __func__, client, id, options.minInterval, options.mode);
+
+ struct MsgUpdateTracking : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ mutable TrackingOptions mOptions;
+ inline MsgUpdateTracking(GnssAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId,
+ TrackingOptions options) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId),
+ mOptions(options) {}
+ inline virtual void proc() const {
+ // distance based tracking will need to know engine capabilities before it can start
+ if (!mAdapter.isEngineCapabilitiesKnown() && mOptions.minDistance > 0) {
+ mAdapter.mPendingMsgs.push_back(new MsgUpdateTracking(*this));
+ return;
+ }
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ bool isTimeBased = mAdapter.isTimeBasedTrackingSession(mClient, mSessionId);
+ bool isDistanceBased = mAdapter.isDistanceBasedTrackingSession(mClient, mSessionId);
+ if (!isTimeBased && !isDistanceBased) {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ } else if (0 == mOptions.size) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ }
+ if (LOCATION_ERROR_SUCCESS != err) {
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ } else {
+ if (GNSS_POWER_MODE_M4 == mOptions.powerMode &&
+ mOptions.tbm > TRACKING_TBM_THRESHOLD_MILLIS) {
+ LOC_LOGd("TBM (%d) > %d Falling back to M2 power mode",
+ mOptions.tbm, TRACKING_TBM_THRESHOLD_MILLIS);
+ mOptions.powerMode = GNSS_POWER_MODE_M2;
+ }
+ if (mOptions.minInterval < MIN_TRACKING_INTERVAL) {
+ mOptions.minInterval = MIN_TRACKING_INTERVAL;
+ }
+ // Now update session as required
+ if (isTimeBased && mOptions.minDistance > 0) {
+ // switch from time based to distance based
+ // Api doesn't support multiple clients for time based tracking, so mutiplex
+ bool reportToClientWithNoWait =
+ mAdapter.stopTimeBasedTrackingMultiplex(mClient, mSessionId);
+ // erases the time based Session
+ mAdapter.eraseTrackingSession(mClient, mSessionId);
+ if (reportToClientWithNoWait) {
+ mAdapter.reportResponse(mClient, LOCATION_ERROR_SUCCESS, mSessionId);
+ }
+ // saves as distance based Session
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+ mApi.startDistanceBasedTracking(mSessionId, mOptions,
+ new LocApiResponse(*mAdapter.getContext(),
+ [] (LocationError /*err*/) {}));
+ } else if (isDistanceBased && mOptions.minDistance == 0) {
+ // switch from distance based to time based
+ mAdapter.eraseTrackingSession(mClient, mSessionId);
+ mApi.stopDistanceBasedTracking(mSessionId, new LocApiResponse(
+ *mAdapter.getContext(),
+ [&mAdapter = mAdapter, mSessionId = mSessionId, mOptions = mOptions,
+ mClient = mClient] (LocationError /*err*/) {
+ // Api doesn't support multiple clients for time based tracking,
+ // so mutiplex
+ bool reportToClientWithNoWait =
+ mAdapter.startTimeBasedTrackingMultiplex(mClient, mSessionId,
+ mOptions);
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+
+ if (reportToClientWithNoWait) {
+ mAdapter.reportResponse(mClient, LOCATION_ERROR_SUCCESS, mSessionId);
+ }
+ }));
+ } else if (isTimeBased) {
+ // update time based tracking
+ // Api doesn't support multiple clients for time based tracking, so mutiplex
+ bool reportToClientWithNoWait =
+ mAdapter.updateTrackingMultiplex(mClient, mSessionId, mOptions);
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+
+ if (reportToClientWithNoWait) {
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }
+ } else if (isDistanceBased) {
+ // restart distance based tracking
+ mApi.stopDistanceBasedTracking(mSessionId, new LocApiResponse(
+ *mAdapter.getContext(),
+ [&mAdapter = mAdapter, mSessionId = mSessionId, mOptions = mOptions,
+ mClient = mClient, &mApi = mApi] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mApi.startDistanceBasedTracking(mSessionId, mOptions,
+ new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter, mClient, mSessionId, mOptions]
+ (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+ }
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }));
+ }
+ }));
+ }
+ }
+ }
+ };
+
+ sendMsg(new MsgUpdateTracking(*this, *mLocApi, client, id, options));
+}
+
+bool
+GnssAdapter::updateTrackingMultiplex(LocationAPI* client, uint32_t id,
+ const TrackingOptions& trackingOptions)
+{
+ bool reportToClientWithNoWait = true;
+
+ LocationSessionKey key(client, id);
+ // get the session we are updating
+ auto it = mTimeBasedTrackingSessions.find(key);
+
+ // cache the clients existing LocationOptions
+ TrackingOptions oldOptions = it->second;
+
+ // if session we are updating exists and the minInterval or powerMode has changed
+ if (it != mTimeBasedTrackingSessions.end() &&
+ (it->second.minInterval != trackingOptions.minInterval ||
+ it->second.powerMode != trackingOptions.powerMode)) {
+ // find the smallest interval and powerMode, other than the session we are updating
+ TrackingOptions multiplexedOptions = {}; // size is 0 until set for the first time
+ GnssPowerMode multiplexedPowerMode = GNSS_POWER_MODE_INVALID;
+ memset(&multiplexedOptions, 0, sizeof(multiplexedOptions));
+ for (auto it2 = mTimeBasedTrackingSessions.begin();
+ it2 != mTimeBasedTrackingSessions.end(); ++it2) {
+ // if session is not the one we are updating and either interval
+ // is not set or there is a new smallest interval, then set the new interval
+ if (it2->first != key && (0 == multiplexedOptions.size ||
+ it2->second.minInterval < multiplexedOptions.minInterval)) {
+ multiplexedOptions = it2->second;
+ }
+ // if session is not the one we are updating and either powerMode
+ // is not set or there is a new smallest powerMode, then set the new powerMode
+ if (it2->first != key && (GNSS_POWER_MODE_INVALID == multiplexedPowerMode ||
+ it2->second.powerMode < multiplexedPowerMode)) {
+ multiplexedPowerMode = it2->second.powerMode;
+ }
+ // else part: no QMI call is made, need to report back to client right away
+ }
+ bool updateOptions = false;
+ // if session we are updating has smaller interval then next smallest
+ if (trackingOptions.minInterval < multiplexedOptions.minInterval) {
+ multiplexedOptions.minInterval = trackingOptions.minInterval;
+ updateOptions = true;
+ }
+ // if session we are updating has smaller powerMode then next smallest
+ if (trackingOptions.powerMode < multiplexedPowerMode) {
+ multiplexedOptions.powerMode = trackingOptions.powerMode;
+ updateOptions = true;
+ }
+ // if only one session exists, then tracking should be updated with it
+ if (1 == mTimeBasedTrackingSessions.size()) {
+ multiplexedOptions = trackingOptions;
+ updateOptions = true;
+ }
+ if (updateOptions) {
+ // restart time based tracking with the newly updated options
+ updateTracking(client, id, multiplexedOptions, oldOptions);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
+ }
+ }
+
+ return reportToClientWithNoWait;
+}
+
+void
+GnssAdapter::stopTrackingCommand(LocationAPI* client, uint32_t id)
+{
+ LOC_LOGD("%s]: client %p id %u", __func__, client, id);
+
+ struct MsgStopTracking : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ inline MsgStopTracking(GnssAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId) {}
+ inline virtual void proc() const {
+ bool isTimeBased = mAdapter.isTimeBasedTrackingSession(mClient, mSessionId);
+ bool isDistanceBased = mAdapter.isDistanceBasedTrackingSession(mClient, mSessionId);
+ if (isTimeBased || isDistanceBased) {
+ if (isTimeBased) {
+ // Api doesn't support multiple clients for time based tracking, so mutiplex
+ bool reportToClientWithNoWait =
+ mAdapter.stopTimeBasedTrackingMultiplex(mClient, mSessionId);
+ mAdapter.eraseTrackingSession(mClient, mSessionId);
+
+ if (reportToClientWithNoWait) {
+ mAdapter.reportResponse(mClient, LOCATION_ERROR_SUCCESS, mSessionId);
+ }
+ } else if (isDistanceBased) {
+ mApi.stopDistanceBasedTracking(mSessionId, new LocApiResponse(
+ *mAdapter.getContext(),
+ [&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient]
+ (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.eraseTrackingSession(mClient, mSessionId);
+ }
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }));
+ }
+ } else {
+ mAdapter.reportResponse(mClient, LOCATION_ERROR_ID_UNKNOWN, mSessionId);
+ }
+
+ }
+ };
+
+ sendMsg(new MsgStopTracking(*this, *mLocApi, client, id));
+}
+
+bool
+GnssAdapter::stopTimeBasedTrackingMultiplex(LocationAPI* client, uint32_t id)
+{
+ bool reportToClientWithNoWait = true;
+
+ if (1 == mTimeBasedTrackingSessions.size()) {
+ stopTracking(client, id);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
+ } else {
+ LocationSessionKey key(client, id);
+
+ // get the session we are stopping
+ auto it = mTimeBasedTrackingSessions.find(key);
+ if (it != mTimeBasedTrackingSessions.end()) {
+ // find the smallest interval and powerMode, other than the session we are stopping
+ TrackingOptions multiplexedOptions = {}; // size is 0 until set for the first time
+ GnssPowerMode multiplexedPowerMode = GNSS_POWER_MODE_INVALID;
+ memset(&multiplexedOptions, 0, sizeof(multiplexedOptions));
+ for (auto it2 = mTimeBasedTrackingSessions.begin();
+ it2 != mTimeBasedTrackingSessions.end(); ++it2) {
+ // if session is not the one we are stopping and either interval
+ // is not set or there is a new smallest interval, then set the new interval
+ if (it2->first != key && (0 == multiplexedOptions.size ||
+ it2->second.minInterval < multiplexedOptions.minInterval)) {
+ multiplexedOptions = it2->second;
+ }
+ // if session is not the one we are stopping and either powerMode
+ // is not set or there is a new smallest powerMode, then set the new powerMode
+ if (it2->first != key && (GNSS_POWER_MODE_INVALID == multiplexedPowerMode ||
+ it2->second.powerMode < multiplexedPowerMode)) {
+ multiplexedPowerMode = it2->second.powerMode;
+ }
+ }
+ // if session we are stopping has smaller interval then next smallest or
+ // if session we are stopping has smaller powerMode then next smallest
+ if (it->second.minInterval < multiplexedOptions.minInterval ||
+ it->second.powerMode < multiplexedPowerMode) {
+ multiplexedOptions.powerMode = multiplexedPowerMode;
+ // restart time based tracking with the newly updated options
+ startTimeBasedTracking(client, id, multiplexedOptions);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
+ }
+ // else part: no QMI call is made, need to report back to client right away
+ }
+ }
+
+ return reportToClientWithNoWait;
+}
+
+void
+GnssAdapter::stopTracking(LocationAPI* client, uint32_t id)
+{
+ // inform engine hub that GNSS session has stopped
+ mEngHubProxy->gnssStopFix();
+
+ mLocApi->stopFix(new LocApiResponse(*getContext(),
+ [this, client, id] (LocationError err) {
+ reportResponse(client, err, id);
+ }));
+
+ mSPEAlreadyRunningAtHighestInterval = false;
+}
+
+bool
+GnssAdapter::hasNiNotifyCallback(LocationAPI* client)
+{
+ auto it = mClientData.find(client);
+ return (it != mClientData.end() && it->second.gnssNiCb);
+}
+
+void
+GnssAdapter::gnssNiResponseCommand(LocationAPI* client,
+ uint32_t id,
+ GnssNiResponse response)
+{
+ LOC_LOGD("%s]: client %p id %u response %u", __func__, client, id, response);
+
+ struct MsgGnssNiResponse : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ GnssNiResponse mResponse;
+ inline MsgGnssNiResponse(GnssAdapter& adapter,
+ LocationAPI* client,
+ uint32_t sessionId,
+ GnssNiResponse response) :
+ LocMsg(),
+ mAdapter(adapter),
+ mClient(client),
+ mSessionId(sessionId),
+ mResponse(response) {}
+ inline virtual void proc() const {
+ NiData& niData = mAdapter.getNiData();
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (!mAdapter.hasNiNotifyCallback(mClient)) {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ } else {
+ NiSession* pSession = NULL;
+ if (mSessionId == niData.sessionEs.reqID &&
+ NULL != niData.sessionEs.rawRequest) {
+ pSession = &niData.sessionEs;
+ // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
+ if (mResponse == GNSS_NI_RESPONSE_ACCEPT &&
+ NULL != niData.session.rawRequest) {
+ pthread_mutex_lock(&niData.session.tLock);
+ niData.session.resp = GNSS_NI_RESPONSE_IGNORE;
+ niData.session.respRecvd = true;
+ pthread_cond_signal(&niData.session.tCond);
+ pthread_mutex_unlock(&niData.session.tLock);
+ }
+ } else if (mSessionId == niData.session.reqID &&
+ NULL != niData.session.rawRequest) {
+ pSession = &niData.session;
+ }
+
+ if (pSession) {
+ LOC_LOGI("%s]: gnssNiResponseCommand: send user mResponse %u for id %u",
+ __func__, mResponse, mSessionId);
+ pthread_mutex_lock(&pSession->tLock);
+ pSession->resp = mResponse;
+ pSession->respRecvd = true;
+ pthread_cond_signal(&pSession->tCond);
+ pthread_mutex_unlock(&pSession->tLock);
+ } else {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ LOC_LOGE("%s]: gnssNiResponseCommand: id %u not an active session",
+ __func__, mSessionId);
+ }
+ }
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }
+ };
+
+ sendMsg(new MsgGnssNiResponse(*this, client, id, response));
+
+}
+
+void
+GnssAdapter::gnssNiResponseCommand(GnssNiResponse response, void* rawRequest)
+{
+ LOC_LOGD("%s]: response %u", __func__, response);
+
+ struct MsgGnssNiResponse : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ const GnssNiResponse mResponse;
+ const void* mPayload;
+ inline MsgGnssNiResponse(GnssAdapter& adapter,
+ LocApiBase& api,
+ const GnssNiResponse response,
+ const void* rawRequest) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mResponse(response),
+ mPayload(rawRequest) {}
+ inline virtual ~MsgGnssNiResponse() {
+ }
+ inline virtual void proc() const {
+ mApi.informNiResponse(mResponse, mPayload);
+ }
+ };
+
+ sendMsg(new MsgGnssNiResponse(*this, *mLocApi, response, rawRequest));
+
+}
+
+uint32_t
+GnssAdapter::enableCommand(LocationTechnologyType techType)
+{
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGD("%s]: id %u techType %u", __func__, sessionId, techType);
+
+ struct MsgEnableGnss : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ ContextBase& mContext;
+ uint32_t mSessionId;
+ LocationTechnologyType mTechType;
+ inline MsgEnableGnss(GnssAdapter& adapter,
+ LocApiBase& api,
+ ContextBase& context,
+ uint32_t sessionId,
+ LocationTechnologyType techType) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mContext(context),
+ mSessionId(sessionId),
+ mTechType(techType) {}
+ inline virtual void proc() const {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ uint32_t afwControlId = mAdapter.getAfwControlId();
+ if (mTechType != LOCATION_TECHNOLOGY_TYPE_GNSS) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ } else if (afwControlId > 0) {
+ err = LOCATION_ERROR_ALREADY_STARTED;
+ } else {
+ mContext.modemPowerVote(true);
+ mAdapter.setAfwControlId(mSessionId);
+
+ GnssConfigGpsLock gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
+ if (mAdapter.mSupportNfwControl) {
+ ContextBase::mGps_conf.GPS_LOCK &= GNSS_CONFIG_GPS_LOCK_NI;
+ gpsLock = ContextBase::mGps_conf.GPS_LOCK;
+ }
+ mApi.sendMsg(new LocApiMsg([&mApi = mApi, gpsLock]() {
+ mApi.setGpsLockSync(gpsLock);
+ }));
+ mAdapter.mXtraObserver.updateLockStatus(gpsLock);
+ }
+ mAdapter.reportResponse(err, mSessionId);
+ }
+ };
+
+ if (mContext != NULL) {
+ sendMsg(new MsgEnableGnss(*this, *mLocApi, *mContext, sessionId, techType));
+ } else {
+ LOC_LOGE("%s]: Context is NULL", __func__);
+ }
+
+ return sessionId;
+}
+
+void
+GnssAdapter::disableCommand(uint32_t id)
+{
+ LOC_LOGD("%s]: id %u", __func__, id);
+
+ struct MsgDisableGnss : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ ContextBase& mContext;
+ uint32_t mSessionId;
+ inline MsgDisableGnss(GnssAdapter& adapter,
+ LocApiBase& api,
+ ContextBase& context,
+ uint32_t sessionId) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mContext(context),
+ mSessionId(sessionId) {}
+ inline virtual void proc() const {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ uint32_t afwControlId = mAdapter.getAfwControlId();
+ if (afwControlId != mSessionId) {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ } else {
+ mContext.modemPowerVote(false);
+ mAdapter.setAfwControlId(0);
+
+ if (mAdapter.mSupportNfwControl) {
+ /* We need to disable MO (AFW) */
+ ContextBase::mGps_conf.GPS_LOCK |= GNSS_CONFIG_GPS_LOCK_MO;
+ }
+ GnssConfigGpsLock gpsLock = ContextBase::mGps_conf.GPS_LOCK;
+ mApi.sendMsg(new LocApiMsg([&mApi = mApi, gpsLock]() {
+ mApi.setGpsLockSync(gpsLock);
+ }));
+ mAdapter.mXtraObserver.updateLockStatus(gpsLock);
+ }
+ mAdapter.reportResponse(err, mSessionId);
+ }
+ };
+
+ if (mContext != NULL) {
+ sendMsg(new MsgDisableGnss(*this, *mLocApi, *mContext, id));
+ }
+
+}
+
+void
+GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask techMask,
+ GnssDataNotification* pDataNotify,
+ int msInWeek)
+{
+ // this position is from QMI LOC API, then send report to engine hub
+ // also, send out SPE fix promptly to the clients that have registered
+ // with SPE report
+ LOC_LOGd("reportPositionEvent, eng type: %d, unpro %d, sess status %d",
+ locationExtended.locOutputEngType, ulpLocation.unpropagatedPosition,
+ status);
+
+ if (true == initEngHubProxy()){
+ // send the SPE fix to engine hub
+ mEngHubProxy->gnssReportPosition(ulpLocation, locationExtended, status);
+ // report out all SPE fix if it is not propagated, even for failed fix
+ if (false == ulpLocation.unpropagatedPosition) {
+ EngineLocationInfo engLocationInfo = {};
+ engLocationInfo.location = ulpLocation;
+ engLocationInfo.locationExtended = locationExtended;
+ engLocationInfo.sessionStatus = status;
+ reportEnginePositionsEvent(1, &engLocationInfo);
+ }
+ return;
+ }
+
+ // unpropagated report: is only for engine hub to consume and no need
+ // to send out to the clients
+ if (true == ulpLocation.unpropagatedPosition) {
+ return;
+ }
+
+ // Fix is from QMI, and it is not an unpropagated position and engine hub
+ // is not loaded, queue the message when message is processed, the position
+ // can be dispatched to requesting client that registers for SPE report
+ struct MsgReportPosition : public LocMsg {
+ GnssAdapter& mAdapter;
+ const UlpLocation mUlpLocation;
+ const GpsLocationExtended mLocationExtended;
+ loc_sess_status mStatus;
+ LocPosTechMask mTechMask;
+ GnssDataNotification mDataNotify;
+ int mMsInWeek;
+ bool mbIsDataValid;
+ inline MsgReportPosition(GnssAdapter& adapter,
+ const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ loc_sess_status status,
+ LocPosTechMask techMask,
+ GnssDataNotification* pDataNotify,
+ int msInWeek) :
+ LocMsg(),
+ mAdapter(adapter),
+ mUlpLocation(ulpLocation),
+ mLocationExtended(locationExtended),
+ mStatus(status),
+ mTechMask(techMask),
+ mMsInWeek(msInWeek) {
+ memset(&mDataNotify, 0, sizeof(mDataNotify));
+ if (pDataNotify != nullptr) {
+ mDataNotify = *pDataNotify;
+ mbIsDataValid = true;
+ } else {
+ mbIsDataValid = false;
+ }
+ }
+ 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) || (LOC_SESS_INTERMEDIATE == mStatus))){
+ s->eventPosition(mUlpLocation, mLocationExtended);
+ }
+ mAdapter.reportPosition(mUlpLocation, mLocationExtended, mStatus, mTechMask);
+ if (true == mbIsDataValid) {
+ if (-1 != mMsInWeek) {
+ mAdapter.getDataInformation((GnssDataNotification&)mDataNotify,
+ mMsInWeek);
+ }
+ mAdapter.reportData((GnssDataNotification&)mDataNotify);
+ }
+ }
+ };
+
+ sendMsg(new MsgReportPosition(*this, ulpLocation, locationExtended,
+ status, techMask,
+ pDataNotify, msInWeek));
+}
+
+void
+GnssAdapter::reportEnginePositionsEvent(unsigned int count,
+ EngineLocationInfo* locationArr)
+{
+ struct MsgReportEnginePositions : public LocMsg {
+ GnssAdapter& mAdapter;
+ unsigned int mCount;
+ EngineLocationInfo mEngLocInfo[LOC_OUTPUT_ENGINE_COUNT];
+ inline MsgReportEnginePositions(GnssAdapter& adapter,
+ unsigned int count,
+ EngineLocationInfo* locationArr) :
+ LocMsg(),
+ mAdapter(adapter),
+ mCount(count) {
+ if (mCount > LOC_OUTPUT_ENGINE_COUNT) {
+ mCount = LOC_OUTPUT_ENGINE_COUNT;
+ }
+ if (mCount > 0) {
+ memcpy(mEngLocInfo, locationArr, sizeof(EngineLocationInfo)*mCount);
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter.reportEnginePositions(mCount, mEngLocInfo);
+ }
+ };
+
+ sendMsg(new MsgReportEnginePositions(*this, count, locationArr));
+}
+
+bool
+GnssAdapter::needReportForGnssClient(const UlpLocation& ulpLocation,
+ enum loc_sess_status status,
+ LocPosTechMask techMask) {
+ bool reported = false;
+
+ // if engine hub is enabled, aka, any of the engine services is enabled,
+ // then always output position reported by engine hub to requesting client
+ if (true == initEngHubProxy()) {
+ reported = true;
+ } else {
+ reported = LocApiBase::needReport(ulpLocation, status, techMask);
+ }
+ return reported;
+}
+
+bool
+GnssAdapter::needReportForFlpClient(enum loc_sess_status status,
+ LocPosTechMask techMask) {
+ if (((LOC_SESS_INTERMEDIATE == status) && !(techMask & LOC_POS_TECH_MASK_SENSORS) &&
+ (!getAllowFlpNetworkFixes())) ||
+ (LOC_SESS_FAILURE == status)) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+bool
+GnssAdapter::isFlpClient(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.gnssLocationInfoCb == nullptr &&
+ locationCallbacks.gnssSvCb == nullptr &&
+ locationCallbacks.gnssNmeaCb == nullptr &&
+ locationCallbacks.gnssDataCb == nullptr &&
+ locationCallbacks.gnssMeasurementsCb == nullptr);
+}
+
+void
+GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask techMask)
+{
+ bool reportToGnssClient = needReportForGnssClient(ulpLocation, status, techMask);
+ bool reportToFlpClient = needReportForFlpClient(status, techMask);
+
+ if (reportToGnssClient || reportToFlpClient) {
+ GnssLocationInfoNotification locationInfo = {};
+ convertLocationInfo(locationInfo, locationExtended);
+ convertLocation(locationInfo.location, ulpLocation, locationExtended, techMask);
+
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if ((reportToFlpClient && isFlpClient(it->second)) ||
+ (reportToGnssClient && !isFlpClient(it->second))) {
+ if (nullptr != it->second.gnssLocationInfoCb) {
+ it->second.gnssLocationInfoCb(locationInfo);
+ } else if ((nullptr != it->second.engineLocationsInfoCb) &&
+ (false == initEngHubProxy())) {
+ // if engine hub is disabled, this is SPE fix from modem
+ // we need to mark one copy marked as fused and one copy marked as PPE
+ // and dispatch it to the engineLocationsInfoCb
+ GnssLocationInfoNotification engLocationsInfo[2];
+ engLocationsInfo[0] = locationInfo;
+ engLocationsInfo[0].locOutputEngType = LOC_OUTPUT_ENGINE_FUSED;
+ engLocationsInfo[0].flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT;
+ engLocationsInfo[1] = locationInfo;
+ it->second.engineLocationsInfoCb(2, engLocationsInfo);
+ } else if (nullptr != it->second.trackingCb) {
+ it->second.trackingCb(locationInfo.location);
+ }
+ }
+ }
+
+ mGnssSvIdUsedInPosAvail = false;
+ mGnssMbSvIdUsedInPosAvail = false;
+ if (reportToGnssClient) {
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA) {
+ mGnssSvIdUsedInPosAvail = true;
+ mGnssSvIdUsedInPosition = locationExtended.gnss_sv_used_ids;
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_MULTIBAND) {
+ mGnssMbSvIdUsedInPosAvail = true;
+ mGnssMbSvIdUsedInPosition = locationExtended.gnss_mb_sv_used_ids;
+ }
+ }
+
+ // if PACE is enabled
+ if ((true == mLocConfigInfo.paceConfigInfo.isValid) &&
+ (true == mLocConfigInfo.paceConfigInfo.enable)) {
+ // If fix has sensor contribution, and it is fused fix with DRE engine
+ // contributing to the fix, inject to modem
+ if ((LOC_POS_TECH_MASK_SENSORS & techMask) &&
+ (locationInfo.flags & GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT) &&
+ (locationInfo.locOutputEngType == LOC_OUTPUT_ENGINE_FUSED) &&
+ (locationInfo.flags & GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT) &&
+ (locationInfo.locOutputEngMask & DEAD_RECKONING_ENGINE)) {
+ mLocApi->injectPosition(locationInfo, false);
+ }
+ }
+ }
+ }
+
+ if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER &&
+ !mTimeBasedTrackingSessions.empty()) {
+ /*Only BlankNMEA sentence needs to be processed and sent, if both lat, long is 0 &
+ horReliability is not set. */
+ bool blank_fix = ((0 == ulpLocation.gpsLocation.latitude) &&
+ (0 == ulpLocation.gpsLocation.longitude) &&
+ (LOC_RELIABILITY_NOT_SET == locationExtended.horizontal_reliability));
+ uint8_t generate_nmea = (reportToGnssClient && status != LOC_SESS_FAILURE && !blank_fix);
+ bool custom_nmea_gga = (1 == ContextBase::mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED);
+ std::vector<std::string> nmeaArraystr;
+ loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo,
+ generate_nmea, custom_nmea_gga, nmeaArraystr);
+ stringstream ss;
+ for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
+ ss << *itor;
+ }
+ string s = ss.str();
+ reportNmea(s.c_str(), s.length());
+ }
+}
+
+void
+GnssAdapter::reportEnginePositions(unsigned int count,
+ const EngineLocationInfo* locationArr)
+{
+ bool needReportEnginePositions = false;
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.engineLocationsInfoCb) {
+ needReportEnginePositions = true;
+ break;
+ }
+ }
+
+ GnssLocationInfoNotification locationInfo[LOC_OUTPUT_ENGINE_COUNT] = {};
+ for (unsigned int i = 0; i < count; i++) {
+ const EngineLocationInfo* engLocation = (locationArr+i);
+ // if it is fused/default location, call reportPosition maintain legacy behavior
+ if ((GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE & engLocation->locationExtended.flags) &&
+ (LOC_OUTPUT_ENGINE_FUSED == engLocation->locationExtended.locOutputEngType)) {
+ reportPosition(engLocation->location,
+ engLocation->locationExtended,
+ engLocation->sessionStatus,
+ engLocation->location.tech_mask);
+ }
+
+ if (needReportEnginePositions) {
+ convertLocationInfo(locationInfo[i], engLocation->locationExtended);
+ convertLocation(locationInfo[i].location,
+ engLocation->location,
+ engLocation->locationExtended,
+ engLocation->location.tech_mask);
+ }
+ }
+
+ if (needReportEnginePositions) {
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.engineLocationsInfoCb) {
+ it->second.engineLocationsInfoCb(count, locationInfo);
+ }
+ }
+ }
+}
+
+void
+GnssAdapter::reportSvEvent(const GnssSvNotification& svNotify,
+ bool fromEngineHub)
+{
+ if (!fromEngineHub) {
+ mEngHubProxy->gnssReportSv(svNotify);
+ if (true == initEngHubProxy()){
+ return;
+ }
+ }
+
+ struct MsgReportSv : public LocMsg {
+ GnssAdapter& mAdapter;
+ const GnssSvNotification mSvNotify;
+ inline MsgReportSv(GnssAdapter& adapter,
+ const GnssSvNotification& svNotify) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSvNotify(svNotify) {}
+ inline virtual void proc() const {
+ mAdapter.reportSv((GnssSvNotification&)mSvNotify);
+ }
+ };
+
+ sendMsg(new MsgReportSv(*this, svNotify));
+}
+
+void
+GnssAdapter::reportSv(GnssSvNotification& svNotify)
+{
+ int numSv = svNotify.count;
+ uint16_t gnssSvId = 0;
+ uint64_t svUsedIdMask = 0;
+ for (int i=0; i < numSv; i++) {
+ svUsedIdMask = 0;
+ gnssSvId = svNotify.gnssSvs[i].svId;
+ GnssSignalTypeMask signalTypeMask = svNotify.gnssSvs[i].gnssSignalTypeMask;
+ switch (svNotify.gnssSvs[i].type) {
+ case GNSS_SV_TYPE_GPS:
+ if (mGnssSvIdUsedInPosAvail) {
+ if (mGnssMbSvIdUsedInPosAvail) {
+ switch (signalTypeMask) {
+ case GNSS_SIGNAL_GPS_L1CA:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.gps_l1ca_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_GPS_L1C:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.gps_l1c_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_GPS_L2:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.gps_l2_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_GPS_L5:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.gps_l5_sv_used_ids_mask;
+ break;
+ }
+ } else {
+ svUsedIdMask = mGnssSvIdUsedInPosition.gps_sv_used_ids_mask;
+ }
+ }
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ if (mGnssSvIdUsedInPosAvail) {
+ if (mGnssMbSvIdUsedInPosAvail) {
+ switch (signalTypeMask) {
+ case GNSS_SIGNAL_GLONASS_G1:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.glo_g1_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_GLONASS_G2:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.glo_g2_sv_used_ids_mask;
+ break;
+ }
+ } else {
+ svUsedIdMask = mGnssSvIdUsedInPosition.glo_sv_used_ids_mask;
+ }
+ }
+ // map the svid to respective constellation range 1..xx
+ // then repective constellation svUsedIdMask map correctly to svid
+ gnssSvId = gnssSvId - GLO_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ if (mGnssSvIdUsedInPosAvail) {
+ if (mGnssMbSvIdUsedInPosAvail) {
+ switch (signalTypeMask) {
+ case GNSS_SIGNAL_BEIDOU_B1I:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.bds_b1i_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B1C:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.bds_b1c_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B2I:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.bds_b2i_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B2AI:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.bds_b2ai_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B2AQ:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.bds_b2aq_sv_used_ids_mask;
+ break;
+ }
+ } else {
+ svUsedIdMask = mGnssSvIdUsedInPosition.bds_sv_used_ids_mask;
+ }
+ }
+ gnssSvId = gnssSvId - BDS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ if (mGnssSvIdUsedInPosAvail) {
+ if (mGnssMbSvIdUsedInPosAvail) {
+ switch (signalTypeMask) {
+ case GNSS_SIGNAL_GALILEO_E1:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.gal_e1_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_GALILEO_E5A:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.gal_e5a_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_GALILEO_E5B:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.gal_e5b_sv_used_ids_mask;
+ break;
+ }
+ } else {
+ svUsedIdMask = mGnssSvIdUsedInPosition.gal_sv_used_ids_mask;
+ }
+ }
+ gnssSvId = gnssSvId - GAL_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ if (mGnssSvIdUsedInPosAvail) {
+ if (mGnssMbSvIdUsedInPosAvail) {
+ switch (signalTypeMask) {
+ case GNSS_SIGNAL_QZSS_L1CA:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.qzss_l1ca_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_QZSS_L1S:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.qzss_l1s_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_QZSS_L2:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.qzss_l2_sv_used_ids_mask;
+ break;
+ case GNSS_SIGNAL_QZSS_L5:
+ svUsedIdMask = mGnssMbSvIdUsedInPosition.qzss_l5_sv_used_ids_mask;
+ break;
+ }
+ } else {
+ svUsedIdMask = mGnssSvIdUsedInPosition.qzss_sv_used_ids_mask;
+ }
+ }
+ gnssSvId = gnssSvId - QZSS_SV_PRN_MIN + 1;
+ break;
+ case GNSS_SV_TYPE_NAVIC:
+ if (mGnssSvIdUsedInPosAvail) {
+ svUsedIdMask = mGnssSvIdUsedInPosition.navic_sv_used_ids_mask;
+ }
+ gnssSvId = gnssSvId - NAVIC_SV_PRN_MIN + 1;
+ break;
+ default:
+ svUsedIdMask = 0;
+ break;
+ }
+
+ // If SV ID was used in previous position fix, then set USED_IN_FIX
+ // flag, else clear the USED_IN_FIX flag.
+ if (svFitsMask(svUsedIdMask, gnssSvId) && (svUsedIdMask & (1ULL << (gnssSvId - 1)))) {
+ svNotify.gnssSvs[i].gnssSvOptionsMask |= GNSS_SV_OPTIONS_USED_IN_FIX_BIT;
+ }
+ }
+
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.gnssSvCb) {
+ it->second.gnssSvCb(svNotify);
+ }
+ }
+
+ if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER &&
+ !mTimeBasedTrackingSessions.empty()) {
+ std::vector<std::string> nmeaArraystr;
+ loc_nmea_generate_sv(svNotify, nmeaArraystr);
+ stringstream ss;
+ for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
+ ss << *itor;
+ }
+ string s = ss.str();
+ reportNmea(s.c_str(), s.length());
+ }
+
+ mGnssSvIdUsedInPosAvail = false;
+ mGnssMbSvIdUsedInPosAvail = false;
+}
+
+void
+GnssAdapter::reportNmeaEvent(const char* nmea, size_t length)
+{
+ if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER &&
+ !loc_nmea_is_debug(nmea, length)) {
+ return;
+ }
+
+ struct MsgReportNmea : public LocMsg {
+ GnssAdapter& mAdapter;
+ const char* mNmea;
+ size_t mLength;
+ inline MsgReportNmea(GnssAdapter& adapter,
+ const char* nmea,
+ size_t length) :
+ LocMsg(),
+ mAdapter(adapter),
+ mNmea(new char[length+1]),
+ mLength(length) {
+ if (mNmea == nullptr) {
+ LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
+ return;
+ }
+ strlcpy((char*)mNmea, nmea, length+1);
+ }
+ inline virtual ~MsgReportNmea()
+ {
+ delete[] mNmea;
+ }
+ inline virtual void proc() const {
+ // extract bug report info - this returns true if consumed by systemstatus
+ bool ret = false;
+ SystemStatus* s = mAdapter.getSystemStatus();
+ if (nullptr != s) {
+ ret = s->setNmeaString(mNmea, mLength);
+ }
+ if (false == ret) {
+ // forward NMEA message to upper layer
+ mAdapter.reportNmea(mNmea, mLength);
+ }
+ }
+ };
+
+ sendMsg(new MsgReportNmea(*this, nmea, length));
+}
+
+void
+GnssAdapter::reportNmea(const char* nmea, size_t length)
+{
+ GnssNmeaNotification nmeaNotification = {};
+ nmeaNotification.size = sizeof(GnssNmeaNotification);
+
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ nmeaNotification.timestamp = now;
+ nmeaNotification.nmea = nmea;
+ nmeaNotification.length = length;
+
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.gnssNmeaCb) {
+ it->second.gnssNmeaCb(nmeaNotification);
+ }
+ }
+
+ if (isNMEAPrintEnabled()) {
+ LOC_LOGd("[%" PRId64 ", %zu] %s", now, length, nmea);
+ }
+}
+
+void
+GnssAdapter::reportDataEvent(const GnssDataNotification& dataNotify,
+ int msInWeek)
+{
+ struct MsgReportData : public LocMsg {
+ GnssAdapter& mAdapter;
+ GnssDataNotification mDataNotify;
+ int mMsInWeek;
+ inline MsgReportData(GnssAdapter& adapter,
+ const GnssDataNotification& dataNotify,
+ int msInWeek) :
+ LocMsg(),
+ mAdapter(adapter),
+ mDataNotify(dataNotify),
+ mMsInWeek(msInWeek) {
+ }
+ inline virtual void proc() const {
+ if (-1 != mMsInWeek) {
+ mAdapter.getDataInformation((GnssDataNotification&)mDataNotify,
+ mMsInWeek);
+ }
+ mAdapter.reportData((GnssDataNotification&)mDataNotify);
+ }
+ };
+
+ sendMsg(new MsgReportData(*this, dataNotify, msInWeek));
+}
+
+void
+GnssAdapter::reportData(GnssDataNotification& dataNotify)
+{
+ for (int sig = 0; sig < GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES; sig++) {
+ if (GNSS_LOC_DATA_JAMMER_IND_BIT ==
+ (dataNotify.gnssDataMask[sig] & GNSS_LOC_DATA_JAMMER_IND_BIT)) {
+ LOC_LOGv("jammerInd[%d]=%f", sig, dataNotify.jammerInd[sig]);
+ }
+ if (GNSS_LOC_DATA_AGC_BIT ==
+ (dataNotify.gnssDataMask[sig] & GNSS_LOC_DATA_AGC_BIT)) {
+ LOC_LOGv("agc[%d]=%f", sig, dataNotify.agc[sig]);
+ }
+ }
+ for (auto it = mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.gnssDataCb) {
+ it->second.gnssDataCb(dataNotify);
+ }
+ }
+}
+
+bool
+GnssAdapter::requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data,
+ const LocInEmergency emergencyState)
+{
+ LOC_LOGI("%s]: notif_type: %d, timeout: %d, default_resp: %d"
+ "requestor_id: %s (encoding: %d) text: %s text (encoding: %d) extras: %s",
+ __func__, notify.type, notify.timeout, notify.timeoutResponse,
+ notify.requestor, notify.requestorEncoding,
+ notify.message, notify.messageEncoding, notify.extras);
+
+ struct MsgReportNiNotify : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ const GnssNiNotification mNotify;
+ const void* mData;
+ const LocInEmergency mEmergencyState;
+ inline MsgReportNiNotify(GnssAdapter& adapter,
+ LocApiBase& api,
+ const GnssNiNotification& notify,
+ const void* data,
+ const LocInEmergency emergencyState) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mNotify(notify),
+ mData(data),
+ mEmergencyState(emergencyState) {}
+ inline virtual void proc() const {
+ bool bIsInEmergency = false;
+ bool bInformNiAccept = false;
+
+ bIsInEmergency = ((LOC_IN_EMERGENCY_UNKNOWN == mEmergencyState) &&
+ mAdapter.getE911State()) || // older modems
+ (LOC_IN_EMERGENCY_SET == mEmergencyState); // newer modems
+
+ if ((mAdapter.mSupportNfwControl || 0 == mAdapter.getAfwControlId()) &&
+ (GNSS_NI_TYPE_SUPL == mNotify.type || GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type)
+ && !bIsInEmergency &&
+ !(GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT & mNotify.options) &&
+ (GNSS_CONFIG_GPS_LOCK_NI & ContextBase::mGps_conf.GPS_LOCK) &&
+ 1 == ContextBase::mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED) {
+ /* If all these conditions are TRUE, then deny the NI Request:
+ -'Q' Lock behavior OR 'P' Lock behavior and GNSS is Locked
+ -NI SUPL Request type or NI SUPL Emergency Request type
+ -NOT in an Emergency Call Session
+ -NOT Privacy Override option
+ -NFW is locked and config item NI_SUPL_DENY_ON_NFW_LOCKED = 1 */
+ mApi.informNiResponse(GNSS_NI_RESPONSE_DENY, mData);
+ } else if (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type) {
+ bInformNiAccept = bIsInEmergency ||
+ (GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO == ContextBase::mGps_conf.SUPL_ES);
+
+ if (bInformNiAccept) {
+ mAdapter.requestNiNotify(mNotify, mData, bInformNiAccept);
+ } else {
+ mApi.informNiResponse(GNSS_NI_RESPONSE_DENY, mData);
+ }
+ } else if (GNSS_NI_TYPE_CONTROL_PLANE == mNotify.type) {
+ if (bIsInEmergency && (1 == ContextBase::mGps_conf.CP_MTLR_ES)) {
+ mApi.informNiResponse(GNSS_NI_RESPONSE_ACCEPT, mData);
+ }
+ else {
+ mAdapter.requestNiNotify(mNotify, mData, false);
+ }
+ } else {
+ mAdapter.requestNiNotify(mNotify, mData, false);
+ }
+ }
+ };
+
+ sendMsg(new MsgReportNiNotify(*this, *mLocApi, notify, data, emergencyState));
+
+ return true;
+}
+
+void
+GnssAdapter::reportLocationSystemInfoEvent(const LocationSystemInfo & locationSystemInfo) {
+
+ // send system info to engine hub
+ mEngHubProxy->gnssReportSystemInfo(locationSystemInfo);
+
+ struct MsgLocationSystemInfo : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocationSystemInfo mSystemInfo;
+ inline MsgLocationSystemInfo(GnssAdapter& adapter,
+ const LocationSystemInfo& systemInfo) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSystemInfo(systemInfo) {}
+ inline virtual void proc() const {
+ mAdapter.reportLocationSystemInfo(mSystemInfo);
+ }
+ };
+
+ sendMsg(new MsgLocationSystemInfo(*this, locationSystemInfo));
+}
+
+void
+GnssAdapter::reportLocationSystemInfo(const LocationSystemInfo & locationSystemInfo) {
+ // save the info into the master copy piece by piece, as other system info
+ // may come at different time
+ if (locationSystemInfo.systemInfoMask & LOCATION_SYS_INFO_LEAP_SECOND) {
+ mLocSystemInfo.systemInfoMask |= LOCATION_SYS_INFO_LEAP_SECOND;
+
+ const LeapSecondSystemInfo &srcLeapSecondSysInfo = locationSystemInfo.leapSecondSysInfo;
+ LeapSecondSystemInfo &dstLeapSecondSysInfo = mLocSystemInfo.leapSecondSysInfo;
+ if (srcLeapSecondSysInfo.leapSecondInfoMask &
+ LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT) {
+ dstLeapSecondSysInfo.leapSecondInfoMask |=
+ LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT;
+ dstLeapSecondSysInfo.leapSecondCurrent = srcLeapSecondSysInfo.leapSecondCurrent;
+ }
+ // once leap second change event is complete, modem may send up event invalidate the leap
+ // second change info while AP is still processing report during leap second transition
+ // so, we choose to keep this info around even though it is old
+ if (srcLeapSecondSysInfo.leapSecondInfoMask & LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT) {
+ dstLeapSecondSysInfo.leapSecondInfoMask |= LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT;
+ dstLeapSecondSysInfo.leapSecondChangeInfo = srcLeapSecondSysInfo.leapSecondChangeInfo;
+ }
+ }
+
+ // we received new info, inform client of the newly received info
+ if (locationSystemInfo.systemInfoMask) {
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (it->second.locationSystemInfoCb != nullptr) {
+ it->second.locationSystemInfoCb(locationSystemInfo);
+ }
+ }
+ }
+}
+
+static void* niThreadProc(void *args)
+{
+ NiSession* pSession = (NiSession*)args;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timespec present_time;
+ struct timespec expire_time;
+
+ pthread_mutex_lock(&pSession->tLock);
+ /* Calculate absolute expire time */
+ clock_gettime(CLOCK_MONOTONIC, &present_time);
+ expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
+ 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);
+
+ while (!pSession->respRecvd) {
+ rc = pthread_cond_timedwait(&pSession->tCond,
+ &pSession->tLock,
+ &expire_time);
+ if (rc == ETIMEDOUT) {
+ pSession->resp = GNSS_NI_RESPONSE_NO_RESPONSE;
+ LOC_LOGD("%s]: time out after valting for specified time. Ret Val %d",
+ __func__, rc);
+ break;
+ }
+ }
+ LOC_LOGD("%s]: Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d pSession->resp is %u", __func__, rc, pSession->resp);
+ pSession->respRecvd = false; /* Reset the user response flag for the next session*/
+
+ // adding this check to support modem restart, in which case, we need the thread
+ // to exit without calling sending data. We made sure that rawRequest is NULL in
+ // loc_eng_ni_reset_on_engine_restart()
+ GnssAdapter* adapter = pSession->adapter;
+ GnssNiResponse resp;
+ void* rawRequest = NULL;
+ bool sendResponse = false;
+
+ if (NULL != pSession->rawRequest) {
+ if (pSession->resp != GNSS_NI_RESPONSE_IGNORE) {
+ resp = pSession->resp;
+ rawRequest = pSession->rawRequest;
+ sendResponse = true;
+ } else {
+ free(pSession->rawRequest);
+ }
+ pSession->rawRequest = NULL;
+ }
+ pthread_mutex_unlock(&pSession->tLock);
+
+ pSession->respTimeLeft = 0;
+ pSession->reqID = 0;
+
+ if (sendResponse) {
+ adapter->gnssNiResponseCommand(resp, rawRequest);
+ }
+
+ return NULL;
+}
+
+bool
+GnssAdapter::requestNiNotify(const GnssNiNotification& notify, const void* data,
+ const bool bInformNiAccept)
+{
+ NiSession* pSession = NULL;
+ gnssNiCallback gnssNiCb = nullptr;
+
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.gnssNiCb) {
+ gnssNiCb = it->second.gnssNiCb;
+ break;
+ }
+ }
+ if (nullptr == gnssNiCb) {
+ if (GNSS_NI_TYPE_EMERGENCY_SUPL == notify.type) {
+ if (bInformNiAccept) {
+ mLocApi->informNiResponse(GNSS_NI_RESPONSE_ACCEPT, data);
+ NiData& niData = getNiData();
+ // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
+ if (NULL != niData.session.rawRequest) {
+ pthread_mutex_lock(&niData.session.tLock);
+ niData.session.resp = GNSS_NI_RESPONSE_IGNORE;
+ niData.session.respRecvd = true;
+ pthread_cond_signal(&niData.session.tCond);
+ pthread_mutex_unlock(&niData.session.tLock);
+ }
+ }
+ }
+ EXIT_LOG(%s, "no clients with gnssNiCb.");
+ return false;
+ }
+
+ if (notify.type == GNSS_NI_TYPE_EMERGENCY_SUPL) {
+ if (NULL != mNiData.sessionEs.rawRequest) {
+ LOC_LOGI("%s]: supl es NI in progress, new supl es NI ignored, type: %d",
+ __func__, notify.type);
+ if (NULL != data) {
+ free((void*)data);
+ }
+ } else {
+ pSession = &mNiData.sessionEs;
+ }
+ } else {
+ if (NULL != mNiData.session.rawRequest ||
+ NULL != mNiData.sessionEs.rawRequest) {
+ LOC_LOGI("%s]: supl NI in progress, new supl NI ignored, type: %d",
+ __func__, notify.type);
+ if (NULL != data) {
+ free((void*)data);
+ }
+ } else {
+ pSession = &mNiData.session;
+ }
+ }
+
+ if (pSession) {
+ /* Save request */
+ pSession->rawRequest = (void*)data;
+ pSession->reqID = ++mNiData.reqIDCounter;
+ pSession->adapter = this;
+
+ int sessionId = pSession->reqID;
+
+ /* For robustness, spawn a thread at this point to timeout to clear up the notification
+ * status, even though the OEM layer in java does not do so.
+ **/
+ pSession->respTimeLeft =
+ 5 + (notify.timeout != 0 ? notify.timeout : LOC_NI_NO_RESPONSE_TIME);
+
+ int rc = 0;
+ rc = pthread_create(&pSession->thread, NULL, niThreadProc, pSession);
+ if (rc) {
+ LOC_LOGE("%s]: Loc NI thread is not created.", __func__);
+ }
+ rc = pthread_detach(pSession->thread);
+ if (rc) {
+ LOC_LOGE("%s]: Loc NI thread is not detached.", __func__);
+ }
+
+ if (nullptr != gnssNiCb) {
+ gnssNiCb(sessionId, notify);
+ }
+ }
+
+ return true;
+}
+
+void
+GnssAdapter::reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurements,
+ int msInWeek)
+{
+ LOC_LOGD("%s]: msInWeek=%d", __func__, msInWeek);
+
+ if (0 != gnssMeasurements.gnssMeasNotification.count) {
+ struct MsgReportGnssMeasurementData : public LocMsg {
+ GnssAdapter& mAdapter;
+ GnssMeasurements mGnssMeasurements;
+ GnssMeasurementsNotification mMeasurementsNotify;
+ inline MsgReportGnssMeasurementData(GnssAdapter& adapter,
+ const GnssMeasurements& gnssMeasurements,
+ int msInWeek) :
+ LocMsg(),
+ mAdapter(adapter),
+ mMeasurementsNotify(gnssMeasurements.gnssMeasNotification) {
+ if (-1 != msInWeek) {
+ mAdapter.getAgcInformation(mMeasurementsNotify, msInWeek);
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter.reportGnssMeasurementData(mMeasurementsNotify);
+ }
+ };
+
+ sendMsg(new MsgReportGnssMeasurementData(*this, gnssMeasurements, msInWeek));
+ }
+ mEngHubProxy->gnssReportSvMeasurement(gnssMeasurements.gnssSvMeasurementSet);
+}
+
+void
+GnssAdapter::reportGnssMeasurementData(const GnssMeasurementsNotification& measurements)
+{
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.gnssMeasurementsCb) {
+ it->second.gnssMeasurementsCb(measurements);
+ }
+ }
+}
+
+void
+GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
+{
+ LOC_LOGD("%s]: ", __func__);
+ mEngHubProxy->gnssReportSvPolynomial(svPolynomial);
+}
+
+void
+GnssAdapter::reportSvEphemerisEvent(GnssSvEphemerisReport & svEphemeris)
+{
+ LOC_LOGD("%s]:", __func__);
+ mEngHubProxy->gnssReportSvEphemeris(svEphemeris);
+}
+
+
+bool
+GnssAdapter::requestOdcpiEvent(OdcpiRequestInfo& request)
+{
+ struct MsgRequestOdcpi : public LocMsg {
+ GnssAdapter& mAdapter;
+ OdcpiRequestInfo mOdcpiRequest;
+ inline MsgRequestOdcpi(GnssAdapter& adapter, OdcpiRequestInfo& request) :
+ LocMsg(),
+ mAdapter(adapter),
+ mOdcpiRequest(request) {}
+ inline virtual void proc() const {
+ mAdapter.requestOdcpi(mOdcpiRequest);
+ }
+ };
+
+ sendMsg(new MsgRequestOdcpi(*this, request));
+ return true;
+}
+
+void GnssAdapter::requestOdcpi(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 if (ODCPI_REQUEST_TYPE_STOP == request.type) {
+ LOC_LOGd("request: type %d, isEmergency %d", request.type, request.isEmergencyMode);
+ mOdcpiRequestCb(request);
+ mOdcpiRequestActive = false;
+ } else {
+ LOC_LOGE("Invalid ODCPI request type..");
+ }
+ } else {
+ LOC_LOGw("ODCPI request not supported");
+ }
+}
+
+bool GnssAdapter::reportDeleteAidingDataEvent(GnssAidingData& aidingData)
+{
+ LOC_LOGD("%s]:", __func__);
+ mEngHubProxy->gnssDeleteAidingData(aidingData);
+ return true;
+}
+
+bool GnssAdapter::reportKlobucharIonoModelEvent(GnssKlobucharIonoModel & ionoModel)
+{
+ LOC_LOGD("%s]:", __func__);
+ mEngHubProxy->gnssReportKlobucharIonoModel(ionoModel);
+ return true;
+}
+
+bool GnssAdapter::reportGnssAdditionalSystemInfoEvent(
+ GnssAdditionalSystemInfo & additionalSystemInfo)
+{
+ LOC_LOGD("%s]:", __func__);
+ mEngHubProxy->gnssReportAdditionalSystemInfo(additionalSystemInfo);
+ return true;
+}
+
+void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback,
+ OdcpiPrioritytype priority)
+{
+ struct MsgInitOdcpi : public LocMsg {
+ GnssAdapter& mAdapter;
+ OdcpiRequestCallback mOdcpiCb;
+ OdcpiPrioritytype mPriority;
+ inline MsgInitOdcpi(GnssAdapter& adapter,
+ const OdcpiRequestCallback& callback,
+ OdcpiPrioritytype priority) :
+ LocMsg(),
+ mAdapter(adapter),
+ mOdcpiCb(callback), mPriority(priority){}
+ inline virtual void proc() const {
+ mAdapter.initOdcpi(mOdcpiCb, mPriority);
+ }
+ };
+
+ sendMsg(new MsgInitOdcpi(*this, callback, priority));
+}
+
+void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback,
+ OdcpiPrioritytype priority)
+{
+ LOC_LOGd("In priority: %d, Curr priority: %d", priority, mCallbackPriority);
+ if (priority >= mCallbackPriority) {
+ mOdcpiRequestCb = callback;
+ mCallbackPriority = priority;
+ /* 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);
+
+ mLocApi->injectPosition(location, true);
+}
+
+// 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::invokeGnssEnergyConsumedCallback(uint64_t energyConsumedSinceFirstBoot) {
+ if (mGnssEnergyConsumedCb) {
+ mGnssEnergyConsumedCb(energyConsumedSinceFirstBoot);
+ mGnssEnergyConsumedCb = nullptr;
+ }
+}
+
+bool
+GnssAdapter::reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot){
+ LOC_LOGD("%s]: %" PRIu64 " ", __func__, energyConsumedSinceFirstBoot);
+
+ struct MsgReportGnssGnssEngEnergyConsumed : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint64_t mGnssEnergyConsumedSinceFirstBoot;
+ inline MsgReportGnssGnssEngEnergyConsumed(GnssAdapter& adapter,
+ uint64_t energyConsumed) :
+ LocMsg(),
+ mAdapter(adapter),
+ mGnssEnergyConsumedSinceFirstBoot(energyConsumed) {}
+ inline virtual void proc() const {
+ mAdapter.invokeGnssEnergyConsumedCallback(mGnssEnergyConsumedSinceFirstBoot);
+ }
+ };
+
+ sendMsg(new MsgReportGnssGnssEngEnergyConsumed(*this, energyConsumedSinceFirstBoot));
+ return true;
+}
+
+void GnssAdapter::initDefaultAgps() {
+ LOC_LOGD("%s]: ", __func__);
+
+ void *handle = nullptr;
+ if ((handle = dlopen("libloc_net_iface.so", RTLD_NOW)) == nullptr) {
+ LOC_LOGD("%s]: libloc_net_iface.so not found !", __func__);
+ return;
+ }
+
+ LocAgpsGetAgpsCbInfo getAgpsCbInfo = (LocAgpsGetAgpsCbInfo)
+ dlsym(handle, "LocNetIfaceAgps_getAgpsCbInfo");
+ if (getAgpsCbInfo == nullptr) {
+ LOC_LOGE("%s]: Failed to get method LocNetIfaceAgps_getStatusCb", __func__);
+ dlclose(handle);
+ return;
+ }
+
+ AgpsCbInfo& cbInfo = getAgpsCbInfo(agpsOpenResultCb, agpsCloseResultCb, this);
+
+ if (cbInfo.statusV4Cb == nullptr) {
+ LOC_LOGE("%s]: statusV4Cb is nullptr!", __func__);
+ dlclose(handle);
+ return;
+ }
+
+ initAgps(cbInfo);
+}
+
+void GnssAdapter::initDefaultAgpsCommand() {
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgInitDefaultAgps : public LocMsg {
+ GnssAdapter& mAdapter;
+ inline MsgInitDefaultAgps(GnssAdapter& adapter) :
+ LocMsg(),
+ mAdapter(adapter) {
+ }
+ inline virtual void proc() const {
+ mAdapter.initDefaultAgps();
+ }
+ };
+
+ sendMsg(new MsgInitDefaultAgps(*this));
+}
+
+/* INIT LOC AGPS MANAGER */
+
+void GnssAdapter::initAgps(const AgpsCbInfo& cbInfo) {
+ LOC_LOGD("%s]:cbInfo.atlType - %d", __func__, cbInfo.atlType);
+
+ if (!((ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB) ||
+ (ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA))) {
+ return;
+ }
+
+ mAgpsManager.createAgpsStateMachines(cbInfo);
+ /* Register for AGPS event mask */
+ updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST,
+ LOC_REGISTRATION_MASK_ENABLED);
+}
+
+void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
+ LOC_LOGI("GnssAdapter::initAgpsCommand");
+
+ /* Message to initialize AGPS module */
+ struct AgpsMsgInit: public LocMsg {
+ const AgpsCbInfo mCbInfo;
+ GnssAdapter& mAdapter;
+
+ inline AgpsMsgInit(const AgpsCbInfo& cbInfo,
+ GnssAdapter& adapter) :
+ LocMsg(), mCbInfo(cbInfo), mAdapter(adapter) {
+ LOC_LOGV("AgpsMsgInit");
+ }
+
+ inline virtual void proc() const {
+ LOC_LOGV("AgpsMsgInit::proc()");
+ mAdapter.initAgps(mCbInfo);
+ }
+ };
+
+ /* Send message to initialize AGPS Manager */
+ sendMsg(new AgpsMsgInit(cbInfo, *this));
+}
+
+void GnssAdapter::initNfwCommand(const NfwCbInfo& cbInfo) {
+ LOC_LOGi("GnssAdapter::initNfwCommand");
+
+ /* Message to initialize NFW */
+ struct MsgInitNfw : public LocMsg {
+ const NfwCbInfo mCbInfo;
+ GnssAdapter& mAdapter;
+
+ inline MsgInitNfw(const NfwCbInfo& cbInfo,
+ GnssAdapter& adapter) :
+ LocMsg(), mCbInfo(cbInfo), mAdapter(adapter) {
+ LOC_LOGv("MsgInitNfw");
+ }
+
+ inline virtual void proc() const {
+ LOC_LOGv("MsgInitNfw::proc()");
+ mAdapter.initNfw(mCbInfo);
+ }
+ };
+
+ /* Send message to initialize NFW */
+ sendMsg(new MsgInitNfw(cbInfo, *this));
+}
+
+void GnssAdapter::reportNfwNotificationEvent(GnssNfwNotification& notification) {
+ LOC_LOGi("GnssAdapter::reportNfwNotificationEvent");
+
+ struct MsgReportNfwNotification : public LocMsg {
+ const GnssNfwNotification mNotification;
+ GnssAdapter& mAdapter;
+
+ inline MsgReportNfwNotification(const GnssNfwNotification& notification,
+ GnssAdapter& adapter) :
+ LocMsg(), mNotification(notification), mAdapter(adapter) {
+ LOC_LOGv("MsgReportNfwNotification");
+ }
+
+ inline virtual void proc() const {
+ LOC_LOGv("MsgReportNfwNotification::proc()");
+ mAdapter.reportNfwNotification(mNotification);
+ }
+ };
+
+ sendMsg(new MsgReportNfwNotification(notification, *this));
+}
+
+/* GnssAdapter::requestATL
+ * Method triggered in QMI thread as part of handling below message:
+ * eQMI_LOC_SERVER_REQUEST_OPEN_V02
+ * Triggers the AGPS state machine to setup AGPS call for below WWAN types:
+ * eQMI_LOC_WWAN_TYPE_INTERNET_V02
+ * eQMI_LOC_WWAN_TYPE_AGNSS_V02
+ * eQMI_LOC_WWAN_TYPE_AGNSS_EMERGENCY_V02 */
+bool GnssAdapter::requestATL(int connHandle, LocAGpsType agpsType,
+ LocApnTypeMask apnTypeMask){
+
+ LOC_LOGI("GnssAdapter::requestATL handle=%d agpsType=0x%X apnTypeMask=0x%X",
+ connHandle, agpsType, apnTypeMask);
+
+ sendMsg( new AgpsMsgRequestATL(
+ &mAgpsManager, connHandle, (AGpsExtType)agpsType,
+ apnTypeMask));
+
+ return true;
+}
+
+/* GnssAdapter::releaseATL
+ * Method triggered in QMI thread as part of handling below message:
+ * eQMI_LOC_SERVER_REQUEST_CLOSE_V02
+ * Triggers teardown of an existing AGPS call */
+bool GnssAdapter::releaseATL(int connHandle){
+
+ LOC_LOGI("GnssAdapter::releaseATL");
+
+ /* Release SUPL/INTERNET/SUPL_ES ATL */
+ struct AgpsMsgReleaseATL: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+ int mConnHandle;
+
+ inline AgpsMsgReleaseATL(AgpsManager* agpsManager, int connHandle) :
+ LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle) {
+
+ LOC_LOGV("AgpsMsgReleaseATL");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgReleaseATL::proc()");
+ mAgpsManager->releaseATL(mConnHandle);
+ }
+ };
+
+ sendMsg( new AgpsMsgReleaseATL(&mAgpsManager, connHandle));
+
+ return true;
+}
+
+void GnssAdapter::dataConnOpenCommand(
+ AGpsExtType agpsType,
+ const char* apnName, int apnLen, AGpsBearerType bearerType){
+
+ LOC_LOGI("GnssAdapter::frameworkDataConnOpen");
+
+ struct AgpsMsgAtlOpenSuccess: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+ AGpsExtType mAgpsType;
+ char* mApnName;
+ int mApnLen;
+ AGpsBearerType mBearerType;
+
+ inline AgpsMsgAtlOpenSuccess(AgpsManager* agpsManager, AGpsExtType agpsType,
+ const char* apnName, int apnLen, AGpsBearerType bearerType) :
+ LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType), mApnName(
+ new char[apnLen + 1]), mApnLen(apnLen), mBearerType(bearerType) {
+
+ LOC_LOGV("AgpsMsgAtlOpenSuccess");
+ if (mApnName == nullptr) {
+ LOC_LOGE("%s] new allocation failed, fatal error.", __func__);
+ // Reporting the failure here
+ mAgpsManager->reportAtlClosed(mAgpsType);
+ return;
+ }
+ memcpy(mApnName, apnName, apnLen);
+ mApnName[apnLen] = 0;
+ }
+
+ inline ~AgpsMsgAtlOpenSuccess() {
+ delete[] mApnName;
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgAtlOpenSuccess::proc()");
+ mAgpsManager->reportAtlOpenSuccess(mAgpsType, mApnName, mApnLen, mBearerType);
+ }
+ };
+ // Added inital length checks for apnlen check to avoid security issues
+ // In case of failure reporting the same
+ if (NULL == apnName || apnLen <= 0 || apnLen > MAX_APN_LEN || (strlen(apnName) != apnLen)) {
+ LOC_LOGe("%s]: incorrect apnlen length or incorrect apnName", __func__);
+ mAgpsManager.reportAtlClosed(agpsType);
+ } else {
+ sendMsg( new AgpsMsgAtlOpenSuccess(
+ &mAgpsManager, agpsType, apnName, apnLen, bearerType));
+ }
+}
+
+void GnssAdapter::dataConnClosedCommand(AGpsExtType agpsType){
+
+ LOC_LOGI("GnssAdapter::frameworkDataConnClosed");
+
+ struct AgpsMsgAtlClosed: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+ AGpsExtType mAgpsType;
+
+ inline AgpsMsgAtlClosed(AgpsManager* agpsManager, AGpsExtType agpsType) :
+ LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType) {
+
+ LOC_LOGV("AgpsMsgAtlClosed");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgAtlClosed::proc()");
+ mAgpsManager->reportAtlClosed(mAgpsType);
+ }
+ };
+
+ sendMsg( new AgpsMsgAtlClosed(&mAgpsManager, (AGpsExtType)agpsType));
+}
+
+void GnssAdapter::dataConnFailedCommand(AGpsExtType agpsType){
+
+ LOC_LOGI("GnssAdapter::frameworkDataConnFailed");
+
+ struct AgpsMsgAtlOpenFailed: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+ AGpsExtType mAgpsType;
+
+ inline AgpsMsgAtlOpenFailed(AgpsManager* agpsManager, AGpsExtType agpsType) :
+ LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType) {
+
+ LOC_LOGV("AgpsMsgAtlOpenFailed");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgAtlOpenFailed::proc()");
+ mAgpsManager->reportAtlOpenFailed(mAgpsType);
+ }
+ };
+
+ sendMsg( new AgpsMsgAtlOpenFailed(&mAgpsManager, (AGpsExtType)agpsType));
+}
+
+void GnssAdapter::convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
+ const GnssSvType& in_constellation,
+ const SystemStatusReports& in)
+{
+ uint64_t sv_mask = 0ULL;
+ uint32_t svid_min = 0;
+ uint32_t svid_num = 0;
+ uint32_t svid_idx = 0;
+
+ uint64_t eph_health_good_mask = 0ULL;
+ uint64_t eph_health_bad_mask = 0ULL;
+ uint64_t server_perdiction_available_mask = 0ULL;
+ float server_perdiction_age = 0.0f;
+
+ // set constellationi based parameters
+ switch (in_constellation) {
+ case GNSS_SV_TYPE_GPS:
+ svid_min = GNSS_BUGREPORT_GPS_MIN;
+ svid_num = GPS_NUM;
+ svid_idx = 0;
+ if (!in.mSvHealth.empty()) {
+ eph_health_good_mask = in.mSvHealth.back().mGpsGoodMask;
+ eph_health_bad_mask = in.mSvHealth.back().mGpsBadMask;
+ }
+ if (!in.mXtra.empty()) {
+ server_perdiction_available_mask = in.mXtra.back().mGpsXtraValid;
+ server_perdiction_age = (float)(in.mXtra.back().mGpsXtraAge);
+ }
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ svid_min = GNSS_BUGREPORT_GLO_MIN;
+ svid_num = GLO_NUM;
+ svid_idx = GPS_NUM;
+ if (!in.mSvHealth.empty()) {
+ eph_health_good_mask = in.mSvHealth.back().mGloGoodMask;
+ eph_health_bad_mask = in.mSvHealth.back().mGloBadMask;
+ }
+ if (!in.mXtra.empty()) {
+ server_perdiction_available_mask = in.mXtra.back().mGloXtraValid;
+ server_perdiction_age = (float)(in.mXtra.back().mGloXtraAge);
+ }
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ svid_min = GNSS_BUGREPORT_QZSS_MIN;
+ svid_num = QZSS_NUM;
+ svid_idx = GPS_NUM+GLO_NUM+BDS_NUM+GAL_NUM;
+ if (!in.mSvHealth.empty()) {
+ eph_health_good_mask = in.mSvHealth.back().mQzssGoodMask;
+ eph_health_bad_mask = in.mSvHealth.back().mQzssBadMask;
+ }
+ if (!in.mXtra.empty()) {
+ server_perdiction_available_mask = in.mXtra.back().mQzssXtraValid;
+ server_perdiction_age = (float)(in.mXtra.back().mQzssXtraAge);
+ }
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ svid_min = GNSS_BUGREPORT_BDS_MIN;
+ svid_num = BDS_NUM;
+ svid_idx = GPS_NUM+GLO_NUM;
+ if (!in.mSvHealth.empty()) {
+ eph_health_good_mask = in.mSvHealth.back().mBdsGoodMask;
+ eph_health_bad_mask = in.mSvHealth.back().mBdsBadMask;
+ }
+ if (!in.mXtra.empty()) {
+ server_perdiction_available_mask = in.mXtra.back().mBdsXtraValid;
+ server_perdiction_age = (float)(in.mXtra.back().mBdsXtraAge);
+ }
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ svid_min = GNSS_BUGREPORT_GAL_MIN;
+ svid_num = GAL_NUM;
+ svid_idx = GPS_NUM+GLO_NUM+BDS_NUM;
+ if (!in.mSvHealth.empty()) {
+ eph_health_good_mask = in.mSvHealth.back().mGalGoodMask;
+ eph_health_bad_mask = in.mSvHealth.back().mGalBadMask;
+ }
+ if (!in.mXtra.empty()) {
+ server_perdiction_available_mask = in.mXtra.back().mGalXtraValid;
+ server_perdiction_age = (float)(in.mXtra.back().mGalXtraAge);
+ }
+ break;
+ case GNSS_SV_TYPE_NAVIC:
+ svid_min = GNSS_BUGREPORT_NAVIC_MIN;
+ svid_num = NAVIC_NUM;
+ svid_idx = GPS_NUM+GLO_NUM+QZSS_NUM+BDS_NUM+GAL_NUM;
+ if (!in.mSvHealth.empty()) {
+ eph_health_good_mask = in.mSvHealth.back().mNavicGoodMask;
+ eph_health_bad_mask = in.mSvHealth.back().mNavicBadMask;
+ }
+ if (!in.mXtra.empty()) {
+ server_perdiction_available_mask = in.mXtra.back().mNavicXtraValid;
+ server_perdiction_age = (float)(in.mXtra.back().mNavicXtraAge);
+ }
+ break;
+ default:
+ return;
+ }
+
+ // extract each sv info from systemstatus report
+ for(uint32_t i=0; i<svid_num && (svid_idx+i)<SV_ALL_NUM; i++) {
+
+ GnssDebugSatelliteInfo s = {};
+ s.size = sizeof(s);
+ s.svid = i + svid_min;
+ s.constellation = in_constellation;
+
+ if (!in.mNavData.empty()) {
+ s.mEphemerisType = in.mNavData.back().mNav[svid_idx+i].mType;
+ s.mEphemerisSource = in.mNavData.back().mNav[svid_idx+i].mSource;
+ }
+ else {
+ s.mEphemerisType = GNSS_EPH_TYPE_UNKNOWN;
+ s.mEphemerisSource = GNSS_EPH_SOURCE_UNKNOWN;
+ }
+
+ sv_mask = 0x1ULL << i;
+ if (eph_health_good_mask & sv_mask) {
+ s.mEphemerisHealth = GNSS_EPH_HEALTH_GOOD;
+ }
+ else if (eph_health_bad_mask & sv_mask) {
+ s.mEphemerisHealth = GNSS_EPH_HEALTH_BAD;
+ }
+ else {
+ s.mEphemerisHealth = GNSS_EPH_HEALTH_UNKNOWN;
+ }
+
+ if (!in.mNavData.empty()) {
+ s.ephemerisAgeSeconds =
+ (float)(in.mNavData.back().mNav[svid_idx+i].mAgeSec);
+ }
+ else {
+ s.ephemerisAgeSeconds = 0.0f;
+ }
+
+ if (server_perdiction_available_mask & sv_mask) {
+ s.serverPredictionIsAvailable = true;
+ }
+ else {
+ s.serverPredictionIsAvailable = false;
+ }
+
+ s.serverPredictionAgeSeconds = server_perdiction_age;
+ out.push_back(s);
+ }
+
+ return;
+}
+
+bool GnssAdapter::getDebugReport(GnssDebugReport& r)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ SystemStatus* systemstatus = getSystemStatus();
+ if (nullptr == systemstatus) {
+ return false;
+ }
+
+ SystemStatusReports reports = {};
+ systemstatus->getReport(reports, true);
+
+ r.size = sizeof(r);
+
+ // location block
+ r.mLocation.size = sizeof(r.mLocation);
+ if(!reports.mLocation.empty() && reports.mLocation.back().mValid) {
+ r.mLocation.mValid = true;
+ r.mLocation.mLocation.latitude =
+ reports.mLocation.back().mLocation.gpsLocation.latitude;
+ r.mLocation.mLocation.longitude =
+ reports.mLocation.back().mLocation.gpsLocation.longitude;
+ r.mLocation.mLocation.altitude =
+ reports.mLocation.back().mLocation.gpsLocation.altitude;
+ r.mLocation.mLocation.speed =
+ (double)(reports.mLocation.back().mLocation.gpsLocation.speed);
+ r.mLocation.mLocation.bearing =
+ (double)(reports.mLocation.back().mLocation.gpsLocation.bearing);
+ r.mLocation.mLocation.accuracy =
+ (double)(reports.mLocation.back().mLocation.gpsLocation.accuracy);
+
+ r.mLocation.verticalAccuracyMeters =
+ reports.mLocation.back().mLocationEx.vert_unc;
+ r.mLocation.speedAccuracyMetersPerSecond =
+ reports.mLocation.back().mLocationEx.speed_unc;
+ r.mLocation.bearingAccuracyDegrees =
+ reports.mLocation.back().mLocationEx.bearing_unc;
+
+ r.mLocation.mUtcReported =
+ reports.mLocation.back().mUtcReported;
+ }
+ else if(!reports.mBestPosition.empty() && reports.mBestPosition.back().mValid) {
+ r.mLocation.mValid = true;
+ r.mLocation.mLocation.latitude =
+ (double)(reports.mBestPosition.back().mBestLat) * RAD2DEG;
+ 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 {
+ r.mLocation.mValid = false;
+ }
+
+ if (r.mLocation.mValid) {
+ LOC_LOGV("getDebugReport - lat=%f lon=%f alt=%f speed=%f",
+ r.mLocation.mLocation.latitude,
+ r.mLocation.mLocation.longitude,
+ r.mLocation.mLocation.altitude,
+ r.mLocation.mLocation.speed);
+ }
+
+ // time block
+ r.mTime.size = sizeof(r.mTime);
+ if(!reports.mTimeAndClock.empty() && reports.mTimeAndClock.back().mTimeValid) {
+ r.mTime.mValid = true;
+ r.mTime.timeEstimate =
+ (((int64_t)(reports.mTimeAndClock.back().mGpsWeek)*7 +
+ GNSS_UTC_TIME_OFFSET)*24*60*60 -
+ (int64_t)(reports.mTimeAndClock.back().mLeapSeconds))*1000ULL +
+ (int64_t)(reports.mTimeAndClock.back().mGpsTowMs);
+
+ if (reports.mTimeAndClock.back().mTimeUncNs > 0) {
+ // TimeUncNs value is available
+ r.mTime.timeUncertaintyNs =
+ (float)(reports.mTimeAndClock.back().mLeapSecUnc)*1000.0f +
+ (float)(reports.mTimeAndClock.back().mTimeUncNs);
+ } else {
+ // fall back to legacy TimeUnc
+ r.mTime.timeUncertaintyNs =
+ ((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",
+ r.mTime.timeEstimate,
+ r.mTime.timeUncertaintyNs, r.mTime.frequencyUncertaintyNsPerSec);
+ }
+ else {
+ r.mTime.mValid = false;
+ }
+
+ // satellite info block
+ convertSatelliteInfo(r.mSatelliteInfo, GNSS_SV_TYPE_GPS, reports);
+ convertSatelliteInfo(r.mSatelliteInfo, GNSS_SV_TYPE_GLONASS, reports);
+ convertSatelliteInfo(r.mSatelliteInfo, GNSS_SV_TYPE_QZSS, reports);
+ convertSatelliteInfo(r.mSatelliteInfo, GNSS_SV_TYPE_BEIDOU, reports);
+ convertSatelliteInfo(r.mSatelliteInfo, GNSS_SV_TYPE_GALILEO, reports);
+ convertSatelliteInfo(r.mSatelliteInfo, GNSS_SV_TYPE_NAVIC, reports);
+ LOC_LOGV("getDebugReport - satellite=%zu", r.mSatelliteInfo.size());
+
+ return true;
+}
+
+/* get AGC information from system status and fill it */
+void
+GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int msInWeek)
+{
+ SystemStatus* systemstatus = getSystemStatus();
+
+ if (nullptr != systemstatus) {
+ SystemStatusReports reports = {};
+ systemstatus->getReport(reports, true);
+
+ if ((!reports.mRfAndParams.empty()) && (!reports.mTimeAndClock.empty()) &&
+ (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 |=
+ GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
+ break;
+
+ case GNSS_SV_TYPE_GALILEO:
+ measurements.measurements[i].agcLevelDb =
+ reports.mRfAndParams.back().mAgcGal;
+ measurements.measurements[i].flags |=
+ GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
+ break;
+
+ case GNSS_SV_TYPE_GLONASS:
+ measurements.measurements[i].agcLevelDb =
+ reports.mRfAndParams.back().mAgcGlo;
+ measurements.measurements[i].flags |=
+ GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
+ break;
+
+ case GNSS_SV_TYPE_BEIDOU:
+ measurements.measurements[i].agcLevelDb =
+ reports.mRfAndParams.back().mAgcBds;
+ measurements.measurements[i].flags |=
+ GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
+ break;
+
+ case GNSS_SV_TYPE_SBAS:
+ case GNSS_SV_TYPE_UNKNOWN:
+ default:
+ break;
+ }
+ }
+ }
+ }
+}
+
+/* get Data information from system status and fill it */
+void
+GnssAdapter::getDataInformation(GnssDataNotification& data, int msInWeek)
+{
+ SystemStatus* systemstatus = getSystemStatus();
+
+ LOC_LOGV("%s]: msInWeek=%d", __func__, msInWeek);
+ if (nullptr != systemstatus) {
+ SystemStatusReports reports = {};
+ systemstatus->getReport(reports, true);
+
+ if ((!reports.mRfAndParams.empty()) && (!reports.mTimeAndClock.empty()) &&
+ (abs(msInWeek - (int)reports.mTimeAndClock.back().mGpsTowMs) < 2000)) {
+
+ for (int sig = GNSS_LOC_SIGNAL_TYPE_GPS_L1CA;
+ sig < GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES; sig++) {
+ data.gnssDataMask[sig] = 0;
+ data.jammerInd[sig] = 0.0;
+ data.agc[sig] = 0.0;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mAgcGps) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA] |=
+ GNSS_LOC_DATA_AGC_BIT;
+ data.agc[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA] =
+ reports.mRfAndParams.back().mAgcGps;
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA] |=
+ GNSS_LOC_DATA_AGC_BIT;
+ data.agc[GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA] =
+ reports.mRfAndParams.back().mAgcGps;
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA] |=
+ GNSS_LOC_DATA_AGC_BIT;
+ data.agc[GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA] =
+ reports.mRfAndParams.back().mAgcGps;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mJammerGps) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA] |=
+ GNSS_LOC_DATA_JAMMER_IND_BIT;
+ data.jammerInd[GNSS_LOC_SIGNAL_TYPE_GPS_L1CA] =
+ (double)reports.mRfAndParams.back().mJammerGps;
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA] |=
+ GNSS_LOC_DATA_JAMMER_IND_BIT;
+ data.jammerInd[GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA] =
+ (double)reports.mRfAndParams.back().mJammerGps;
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA] |=
+ GNSS_LOC_DATA_JAMMER_IND_BIT;
+ data.jammerInd[GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA] =
+ (double)reports.mRfAndParams.back().mJammerGps;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mAgcGlo) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1] |=
+ GNSS_LOC_DATA_AGC_BIT;
+ data.agc[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1] =
+ reports.mRfAndParams.back().mAgcGlo;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mJammerGlo) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1] |=
+ GNSS_LOC_DATA_JAMMER_IND_BIT;
+ data.jammerInd[GNSS_LOC_SIGNAL_TYPE_GLONASS_G1] =
+ (double)reports.mRfAndParams.back().mJammerGlo;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mAgcBds) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I] |=
+ GNSS_LOC_DATA_AGC_BIT;
+ data.agc[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I] =
+ reports.mRfAndParams.back().mAgcBds;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mJammerBds) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I] |=
+ GNSS_LOC_DATA_JAMMER_IND_BIT;
+ data.jammerInd[GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I] =
+ (double)reports.mRfAndParams.back().mJammerBds;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mAgcGal) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C] |=
+ GNSS_LOC_DATA_AGC_BIT;
+ data.agc[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C] =
+ reports.mRfAndParams.back().mAgcGal;
+ }
+ if (GNSS_INVALID_JAMMER_IND != reports.mRfAndParams.back().mJammerGal) {
+ data.gnssDataMask[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C] |=
+ GNSS_LOC_DATA_JAMMER_IND_BIT;
+ data.jammerInd[GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C] =
+ (double)reports.mRfAndParams.back().mJammerGal;
+ }
+ }
+ }
+}
+
+/* Callbacks registered with loc_net_iface library */
+static void agpsOpenResultCb (bool isSuccess, AGpsExtType agpsType, const char* apn,
+ AGpsBearerType bearerType, void* userDataPtr) {
+ LOC_LOGD("%s]: ", __func__);
+ if (userDataPtr == nullptr) {
+ LOC_LOGE("%s]: userDataPtr is nullptr.", __func__);
+ return;
+ }
+ if (apn == nullptr) {
+ LOC_LOGE("%s]: apn is nullptr.", __func__);
+ return;
+ }
+ GnssAdapter* adapter = (GnssAdapter*)userDataPtr;
+ if (isSuccess) {
+ adapter->dataConnOpenCommand(agpsType, apn, strlen(apn), bearerType);
+ } else {
+ adapter->dataConnFailedCommand(agpsType);
+ }
+}
+
+static void agpsCloseResultCb (bool isSuccess, AGpsExtType agpsType, void* userDataPtr) {
+ LOC_LOGD("%s]: ", __func__);
+ if (userDataPtr == nullptr) {
+ LOC_LOGE("%s]: userDataPtr is nullptr.", __func__);
+ return;
+ }
+ GnssAdapter* adapter = (GnssAdapter*)userDataPtr;
+ if (isSuccess) {
+ adapter->dataConnClosedCommand(agpsType);
+ } else {
+ adapter->dataConnFailedCommand(agpsType);
+ }
+}
+
+void
+GnssAdapter::saveGnssEnergyConsumedCallback(GnssEnergyConsumedCallback energyConsumedCb) {
+ mGnssEnergyConsumedCb = energyConsumedCb;
+}
+
+void
+GnssAdapter::getGnssEnergyConsumedCommand(GnssEnergyConsumedCallback energyConsumedCb) {
+ struct MsgGetGnssEnergyConsumed : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ GnssEnergyConsumedCallback mEnergyConsumedCb;
+ inline MsgGetGnssEnergyConsumed(GnssAdapter& adapter, LocApiBase& api,
+ GnssEnergyConsumedCallback energyConsumedCb) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mEnergyConsumedCb(energyConsumedCb){}
+ inline virtual void proc() const {
+ mAdapter.saveGnssEnergyConsumedCallback(mEnergyConsumedCb);
+ mApi.getGnssEnergyConsumed();
+ }
+ };
+
+ sendMsg(new MsgGetGnssEnergyConsumed(*this, *mLocApi, energyConsumedCb));
+}
+
+void
+GnssAdapter::nfwControlCommand(bool enable) {
+ struct MsgControlNfwLocationAccess : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ bool mEnable;
+ inline MsgControlNfwLocationAccess(GnssAdapter& adapter, LocApiBase& api,
+ bool enable) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mEnable(enable) {}
+ inline virtual void proc() const {
+ GnssConfigGpsLock gpsLock;
+
+ gpsLock = ContextBase::mGps_conf.GPS_LOCK;
+ if (mEnable) {
+ gpsLock &= ~GNSS_CONFIG_GPS_LOCK_NI;
+ } else {
+ gpsLock |= GNSS_CONFIG_GPS_LOCK_NI;
+ }
+ ContextBase::mGps_conf.GPS_LOCK = gpsLock;
+ mApi.sendMsg(new LocApiMsg([&mApi = mApi, gpsLock]() {
+ mApi.setGpsLockSync((GnssConfigGpsLock)gpsLock);
+ }));
+ }
+ };
+
+ if (mSupportNfwControl) {
+ sendMsg(new MsgControlNfwLocationAccess(*this, *mLocApi, enable));
+ } else {
+ LOC_LOGw("NFW control is not supported, do not use this for NFW");
+ }
+}
+
+// Set tunc constrained mode, use 0 session id to indicate
+// that no callback is needed. Session id 0 is used for calls that
+// are not invoked from the integration api, e.g.: initial configuration
+// from the configure file
+void
+GnssAdapter::setConstrainedTunc(bool enable, float tuncConstraint,
+ uint32_t energyBudget, uint32_t sessionId) {
+
+ mLocConfigInfo.tuncConfigInfo.isValid = true;
+ mLocConfigInfo.tuncConfigInfo.enable = enable;
+ mLocConfigInfo.tuncConfigInfo.tuncThresholdMs = tuncConstraint;
+ mLocConfigInfo.tuncConfigInfo.energyBudget = energyBudget;
+
+ LocApiResponse* locApiResponse = nullptr;
+ if (sessionId != 0) {
+ locApiResponse =
+ new LocApiResponse(*getContext(),
+ [this, sessionId] (LocationError err) {
+ reportResponse(err, sessionId);});
+ if (!locApiResponse) {
+ LOC_LOGe("memory alloc failed");
+ }
+ }
+ mLocApi->setConstrainedTuncMode(
+ enable, tuncConstraint, energyBudget, locApiResponse);
+}
+
+uint32_t
+GnssAdapter::setConstrainedTuncCommand (bool enable, float tuncConstraint,
+ uint32_t energyBudget) {
+ // generated session id will be none-zero
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGd("session id %u", sessionId);
+
+ struct MsgEnableTUNC : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+ bool mEnable;
+ float mTuncConstraint;
+ uint32_t mEnergyBudget;
+
+ inline MsgEnableTUNC(GnssAdapter& adapter,
+ uint32_t sessionId,
+ bool enable,
+ float tuncConstraint,
+ uint32_t energyBudget) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId),
+ mEnable(enable),
+ mTuncConstraint(tuncConstraint),
+ mEnergyBudget(energyBudget) {}
+ inline virtual void proc() const {
+ mAdapter.setConstrainedTunc(mEnable, mTuncConstraint,
+ mEnergyBudget, mSessionId);
+ }
+ };
+
+ sendMsg(new MsgEnableTUNC(*this, sessionId, enable,
+ tuncConstraint, energyBudget));
+
+ return sessionId;
+}
+
+// Set position assisted clock estimator, use 0 session id to indicate
+// that no callback is needed. Session id 0 is used for calls that are
+// not invoked from the integration api, e.g.: initial configuration
+// from the configure file.
+void
+GnssAdapter::setPositionAssistedClockEstimator(bool enable,
+ uint32_t sessionId) {
+
+ mLocConfigInfo.paceConfigInfo.isValid = true;
+ mLocConfigInfo.paceConfigInfo.enable = enable;
+ LocApiResponse* locApiResponse = nullptr;
+ if (sessionId != 0) {
+ locApiResponse =
+ new LocApiResponse(*getContext(),
+ [this, sessionId] (LocationError err) {
+ reportResponse(err, sessionId);});
+ if (!locApiResponse) {
+ LOC_LOGe("memory alloc failed");
+ }
+ }
+ mLocApi->setPositionAssistedClockEstimatorMode(enable, locApiResponse);
+}
+
+uint32_t
+GnssAdapter::setPositionAssistedClockEstimatorCommand(bool enable) {
+ // generated session id will be none-zero
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGd("session id %u", sessionId);
+
+ struct MsgEnablePACE : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+ bool mEnable;
+ inline MsgEnablePACE(GnssAdapter& adapter,
+ uint32_t sessionId, bool enable) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId),
+ mEnable(enable){}
+ inline virtual void proc() const {
+ mAdapter.setPositionAssistedClockEstimator(mEnable, mSessionId);
+ }
+ };
+
+ sendMsg(new MsgEnablePACE(*this, sessionId, enable));
+ return sessionId;
+}
+
+void
+GnssAdapter::updateSvConfig(uint32_t sessionId,
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) {
+
+ // check whether if any constellation is removed from the new config
+ GnssSvTypesMask enabledRemoved = mGnssSvTypeConfig.enabledSvTypesMask &
+ (mGnssSvTypeConfig.enabledSvTypesMask ^ svTypeConfig.enabledSvTypesMask);
+ // Send reset if any constellation is removed from the enabled list
+ if (enabledRemoved != 0) {
+ mLocApi->resetConstellationControl();
+ }
+
+ mGnssSvTypeConfig = svTypeConfig;
+ mGnssSvIdConfig = svIdConfig;
+ mBlacklistedSvIds.clear();
+ convertFromGnssSvIdConfig(svIdConfig, mBlacklistedSvIds);
+
+ // Send blacklist info
+ mLocApi->setBlacklistSv(mGnssSvIdConfig);
+
+ // Send only enabled constellation config
+ GnssSvTypeConfig svTypeConfigCopy = {sizeof(GnssSvTypeConfig), 0, 0};
+ svTypeConfigCopy.enabledSvTypesMask = mGnssSvTypeConfig.enabledSvTypesMask;
+ LocApiResponse* locApiResponse = new LocApiResponse(*getContext(),
+ [this, sessionId] (LocationError err) {
+ reportResponse(err, sessionId);});
+ if (!locApiResponse) {
+ LOC_LOGe("memory alloc failed");
+ }
+ mLocApi->setConstellationControl(svTypeConfigCopy, locApiResponse);
+}
+
+uint32_t GnssAdapter::gnssUpdateSvConfigCommand(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) {
+
+ // generated session id will be none-zero
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGd("session id %u", sessionId);
+
+ struct MsgUpdateSvConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+ GnssSvTypeConfig mSvTypeConfig;
+ GnssSvIdConfig mSvIdConfig;
+
+ inline MsgUpdateSvConfig(GnssAdapter& adapter,
+ uint32_t sessionId,
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId),
+ mSvTypeConfig(svTypeConfig),
+ mSvIdConfig(svIdConfig) {}
+ inline virtual void proc() const {
+ mAdapter.updateSvConfig(mSessionId, mSvTypeConfig, mSvIdConfig);
+ }
+ };
+
+ if (sessionId != 0) {
+ sendMsg(new MsgUpdateSvConfig(*this, sessionId,
+ svTypeConfig, svIdConfig));
+ }
+ return sessionId;
+}
+
+void
+GnssAdapter::resetSvConfig(uint32_t sessionId) {
+
+ // Clear blacklisting
+ memset(&mGnssSvIdConfig, 0, sizeof(GnssSvIdConfig));
+ mGnssSvIdConfig.size = sizeof(mGnssSvIdConfig);
+ mBlacklistedSvIds.clear();
+ gnssSvIdConfigUpdate();
+
+ // Reset constellation config, including mGnssSvTypeConfig
+ // when size is set to 0, upon subsequent modem restart, sv type
+ // config will not be sent down to modem
+ gnssSetSvTypeConfig({sizeof(GnssSvTypeConfig), 0, 0});
+
+ LocApiResponse* locApiResponse = nullptr;
+ if (sessionId != 0) {
+ locApiResponse =
+ new LocApiResponse(*getContext(),
+ [this, sessionId] (LocationError err) {
+ reportResponse(err, sessionId);});
+ if (!locApiResponse) {
+ LOC_LOGe("memory alloc failed");
+ }
+ }
+ mLocApi->resetConstellationControl(locApiResponse);
+}
+
+uint32_t GnssAdapter::gnssResetSvConfigCommand() {
+
+ // generated session id will be none-zero
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGd("session id %u", sessionId);
+
+ struct MsgResetSvConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+
+ inline MsgResetSvConfig(GnssAdapter& adapter,
+ uint32_t sessionId) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId) {}
+ inline virtual void proc() const {
+ mAdapter.resetSvConfig(mSessionId);
+ }
+ };
+
+ sendMsg(new MsgResetSvConfig(*this, sessionId));
+ return sessionId;
+}
+
+void
+GnssAdapter::configLeverArm(uint32_t sessionId,
+ const LeverArmConfigInfo& configInfo) {
+
+ LocationError err = LOCATION_ERROR_NOT_SUPPORTED;
+ if (true == mEngHubProxy->configLeverArm(configInfo)) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ reportResponse(err, sessionId);
+}
+
+uint32_t
+GnssAdapter::configLeverArmCommand(const LeverArmConfigInfo& configInfo) {
+
+ // generated session id will be none-zero
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGd("session id %u", sessionId);
+
+ struct MsgConfigLeverArm : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+ LeverArmConfigInfo mConfigInfo;
+
+ inline MsgConfigLeverArm(GnssAdapter& adapter,
+ uint32_t sessionId,
+ const LeverArmConfigInfo& configInfo) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId),
+ mConfigInfo(configInfo) {}
+ inline virtual void proc() const {
+ mAdapter.configLeverArm(mSessionId, mConfigInfo);
+ }
+ };
+
+ sendMsg(new MsgConfigLeverArm(*this, sessionId, configInfo));
+ return sessionId;
+}
+
+
+void
+GnssAdapter::configRobustLocation(uint32_t sessionId,
+ bool enable, bool enableForE911) {
+
+ mLocConfigInfo.robustLocationConfigInfo.isValid = true;
+ mLocConfigInfo.robustLocationConfigInfo.enable = enable;
+ mLocConfigInfo.robustLocationConfigInfo.enableFor911 = enableForE911;
+
+ // suspend all tracking sessions so modem can take the E911 configure
+ suspendSessions();
+
+ LocApiResponse* locApiResponse = nullptr;
+ if (sessionId != 0) {
+ locApiResponse =
+ new LocApiResponse(*getContext(),
+ [this, sessionId] (LocationError err) {
+ reportResponse(err, sessionId);});
+ if (!locApiResponse) {
+ LOC_LOGe("memory alloc failed");
+ }
+ }
+ mLocApi->configRobustLocation(enable, enableForE911, locApiResponse);
+
+ // resume all tracking sessions after the E911 configure
+ restartSessions(false);
+}
+
+uint32_t GnssAdapter::configRobustLocationCommand(
+ bool enable, bool enableForE911) {
+
+ // generated session id will be none-zero
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGd("session id %u", sessionId);
+
+ struct MsgConfigRobustLocation : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+ bool mEnable;
+ bool mEnableForE911;
+
+ inline MsgConfigRobustLocation(GnssAdapter& adapter,
+ uint32_t sessionId,
+ bool enable,
+ bool enableForE911) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId),
+ mEnable(enable),
+ mEnableForE911(enableForE911) {}
+ inline virtual void proc() const {
+ mAdapter.configRobustLocation(mSessionId, mEnable, mEnableForE911);
+ }
+ };
+
+ sendMsg(new MsgConfigRobustLocation(*this, sessionId, enable, enableForE911));
+ return sessionId;
+}
+
+void GnssAdapter::reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig)
+{
+ struct MsgReportGnssConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ uint32_t mSessionId;
+ mutable GnssConfig mGnssConfig;
+ inline MsgReportGnssConfig(GnssAdapter& adapter,
+ uint32_t sessionId,
+ const GnssConfig& gnssConfig) :
+ LocMsg(),
+ mAdapter(adapter),
+ mSessionId(sessionId),
+ mGnssConfig(gnssConfig) {}
+ inline virtual void proc() const {
+ // Invoke control clients config callback
+ if (nullptr != mAdapter.mControlCallbacks.gnssConfigCb) {
+ mAdapter.mControlCallbacks.gnssConfigCb(mSessionId, mGnssConfig);
+ } else {
+ LOC_LOGe("Failed to report, callback not registered");
+ }
+ }
+ };
+
+ sendMsg(new MsgReportGnssConfig(*this, sessionId, gnssConfig));
+}
+
+/* ==== Eng Hub Proxy ================================================================= */
+/* ======== UTILITIES ================================================================= */
+void
+GnssAdapter::initEngHubProxyCommand() {
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgInitEngHubProxy : public LocMsg {
+ GnssAdapter* mAdapter;
+ inline MsgInitEngHubProxy(GnssAdapter* adapter) :
+ LocMsg(),
+ mAdapter(adapter) {}
+ inline virtual void proc() const {
+ mAdapter->initEngHubProxy();
+ }
+ };
+
+ sendMsg(new MsgInitEngHubProxy(this));
+}
+
+bool
+GnssAdapter::initEngHubProxy() {
+ static bool firstTime = true;
+ static bool engHubLoadSuccessful = false;
+
+ const char *error = nullptr;
+ unsigned int processListLength = 0;
+ loc_process_info_s_type* processInfoList = nullptr;
+
+ do {
+ // load eng hub only once
+ if (firstTime == false) {
+ break;
+ }
+
+ int rc = loc_read_process_conf(LOC_PATH_IZAT_CONF, &processListLength,
+ &processInfoList);
+ if (rc != 0) {
+ LOC_LOGE("%s]: failed to parse conf file", __func__);
+ break;
+ }
+
+ bool pluginDaemonEnabled = false;
+ // go over the conf table to see whether any plugin daemon is enabled
+ for (unsigned int i = 0; i < processListLength; i++) {
+ if ((strncmp(processInfoList[i].name[0], PROCESS_NAME_ENGINE_SERVICE,
+ strlen(PROCESS_NAME_ENGINE_SERVICE)) == 0) &&
+ (processInfoList[i].proc_status == ENABLED)) {
+ pluginDaemonEnabled = true;
+ break;
+ }
+ }
+
+ // no plugin daemon is enabled for this platform, no need to load eng hub .so
+ if (pluginDaemonEnabled == false) {
+ break;
+ }
+
+ // load the engine hub .so, if the .so is not present
+ // all EngHubProxyBase calls will turn into no-op.
+ void *handle = nullptr;
+ if ((handle = dlopen("libloc_eng_hub.so", RTLD_NOW)) == nullptr) {
+ if ((error = dlerror()) != nullptr) {
+ LOC_LOGE("%s]: libloc_eng_hub.so not found %s !", __func__, error);
+ }
+ break;
+ }
+
+ // prepare the callback functions
+ // callback function for engine hub to report back position event
+ GnssAdapterReportEnginePositionsEventCb reportPositionEventCb =
+ [this](int count, EngineLocationInfo* locationArr) {
+ // report from engine hub on behalf of PPE will be treated as fromUlp
+ reportEnginePositionsEvent(count, locationArr);
+ };
+
+ // callback function for engine hub to report back sv event
+ GnssAdapterReportSvEventCb reportSvEventCb =
+ [this](const GnssSvNotification& svNotify, bool fromEngineHub) {
+ reportSvEvent(svNotify, fromEngineHub);
+ };
+
+ // callback function for engine hub to request for complete aiding data
+ GnssAdapterReqAidingDataCb reqAidingDataCb =
+ [this] (const GnssAidingDataSvMask& svDataMask) {
+ mLocApi->requestForAidingData(svDataMask);
+ };
+
+ GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb =
+ [this] (bool nHzNeeded, bool nHzMeasNeeded) {
+
+ if (nHzMeasNeeded &&
+ (!checkMask(LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT))) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT,
+ LOC_REGISTRATION_MASK_ENABLED);
+ } else if (checkMask(LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT)) {
+ updateEvtMask(LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT,
+ LOC_REGISTRATION_MASK_DISABLED);
+ }
+
+ if (mNHzNeeded != nHzNeeded) {
+ mNHzNeeded = nHzNeeded;
+ checkAndRestartTimeBasedSession();
+ }
+ };
+
+ getEngHubProxyFn* getter = (getEngHubProxyFn*) dlsym(handle, "getEngHubProxy");
+ if(getter != nullptr) {
+ EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mSystemStatus->getOsObserver(),
+ reportPositionEventCb,
+ reportSvEventCb, reqAidingDataCb,
+ updateNHzRequirementCb);
+ if (hubProxy != nullptr) {
+ mEngHubProxy = hubProxy;
+ engHubLoadSuccessful = true;
+ }
+ }
+ else {
+ LOC_LOGD("%s]: entered, did not find function", __func__);
+ }
+
+ LOC_LOGD("%s]: first time initialization %d, returned %d",
+ __func__, firstTime, engHubLoadSuccessful);
+
+ } while (0);
+
+ if (processInfoList != nullptr) {
+ free (processInfoList);
+ processInfoList = nullptr;
+ }
+
+ firstTime = false;
+ return engHubLoadSuccessful;
+}
diff --git a/gps/gnss/GnssAdapter.h b/gps/gnss/GnssAdapter.h
new file mode 100644
index 0000000..a999e17
--- /dev/null
+++ b/gps/gnss/GnssAdapter.h
@@ -0,0 +1,533 @@
+/* Copyright (c) 2017-2020, 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 GNSS_ADAPTER_H
+#define GNSS_ADAPTER_H
+
+#include <LocAdapterBase.h>
+#include <LocContext.h>
+#include <IOsObserver.h>
+#include <EngineHubProxyBase.h>
+#include <LocationAPI.h>
+#include <Agps.h>
+#include <SystemStatus.h>
+#include <XtraSystemStatusObserver.h>
+#include <map>
+#include <functional>
+
+#define MAX_URL_LEN 256
+#define NMEA_SENTENCE_MAX_LENGTH 200
+#define GLONASS_SV_ID_OFFSET 64
+#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
+#define IS_SS5_HW_ENABLED (1)
+
+class GnssAdapter;
+
+typedef std::map<LocationSessionKey, LocationOptions> LocationSessionMap;
+typedef std::map<LocationSessionKey, TrackingOptions> TrackingOptionsMap;
+
+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 */
+ bool respRecvd; /* NI User reponse received or not from Java layer*/
+ void* rawRequest;
+ uint32_t reqID; /* ID to check against response */
+ GnssNiResponse resp;
+ pthread_cond_t tCond;
+ pthread_mutex_t tLock;
+ GnssAdapter* adapter;
+} NiSession;
+typedef struct {
+ NiSession session; /* SUPL NI Session */
+ NiSession sessionEs; /* Emergency SUPL NI Session */
+ uint32_t reqIDCounter;
+} NiData;
+
+typedef enum {
+ NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
+ NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
+} NmeaProviderType;
+typedef struct {
+ GnssSvType svType;
+ const char* talker;
+ uint64_t mask;
+ uint32_t svIdOffset;
+} NmeaSvMeta;
+
+typedef struct {
+ double latitude;
+ double longitude;
+ float accuracy;
+ // the CPI will be blocked until the boot time
+ // specified in blockedTillTsMs
+ int64_t blockedTillTsMs;
+ // CPIs whose both latitude and longitude differ
+ // no more than latLonThreshold will be blocked
+ // in units of degree
+ double latLonDiffThreshold;
+} BlockCPIInfo;
+
+typedef struct {
+ bool isValid;
+ bool enable;
+ float tuncThresholdMs; // need to be specified if enable is true
+ uint32_t energyBudget; // need to be specified if enable is true
+} TuncConfigInfo;
+
+typedef struct {
+ bool isValid;
+ bool enable;
+} PaceConfigInfo;
+
+typedef struct {
+ bool isValid;
+ bool enable;
+ bool enableFor911;
+} RobustLocationConfigInfo;
+
+typedef struct {
+ TuncConfigInfo tuncConfigInfo;
+ PaceConfigInfo paceConfigInfo;
+ RobustLocationConfigInfo robustLocationConfigInfo;
+} LocIntegrationConfigInfo;
+
+using namespace loc_core;
+
+namespace loc_core {
+ class SystemStatus;
+}
+
+typedef std::function<void(
+ uint64_t gnssEnergyConsumedFromFirstBoot
+)> GnssEnergyConsumedCallback;
+
+class GnssAdapter : public LocAdapterBase {
+
+ /* ==== Engine Hub ===================================================================== */
+ EngineHubProxyBase* mEngHubProxy;
+ bool mNHzNeeded;
+ bool mSPEAlreadyRunningAtHighestInterval;
+
+ /* ==== TRACKING ======================================================================= */
+ TrackingOptionsMap mTimeBasedTrackingSessions;
+ LocationSessionMap mDistanceBasedTrackingSessions;
+ LocPosMode mLocPositionMode;
+ GnssSvUsedInPosition mGnssSvIdUsedInPosition;
+ bool mGnssSvIdUsedInPosAvail;
+ GnssSvMbUsedInPosition mGnssMbSvIdUsedInPosition;
+ bool mGnssMbSvIdUsedInPosAvail;
+
+ /* ==== CONTROL ======================================================================== */
+ LocationControlCallbacks mControlCallbacks;
+ uint32_t mAfwControlId;
+ uint32_t mNmeaMask;
+ GnssSvIdConfig mGnssSvIdConfig;
+ GnssSvTypeConfig mGnssSvTypeConfig;
+ GnssSvTypeConfigCallback mGnssSvTypeConfigCb;
+ bool mSupportNfwControl;
+ LocIntegrationConfigInfo mLocConfigInfo;
+
+ /* ==== NI ============================================================================= */
+ NiData mNiData;
+
+ /* ==== AGPS =========================================================================== */
+ // This must be initialized via initAgps()
+ AgpsManager mAgpsManager;
+ void initAgps(const AgpsCbInfo& cbInfo);
+
+ /* ==== NFW =========================================================================== */
+ NfwStatusCb mNfwCb;
+ IsInEmergencySession mIsE911Session;
+ inline void initNfw(const NfwCbInfo& cbInfo) {
+ mNfwCb = (NfwStatusCb)cbInfo.visibilityControlCb;
+ mIsE911Session = (IsInEmergencySession)cbInfo.isInEmergencySession;
+ }
+
+ /* ==== ODCPI ========================================================================== */
+ OdcpiRequestCallback mOdcpiRequestCb;
+ bool mOdcpiRequestActive;
+ OdcpiPrioritytype mCallbackPriority;
+ OdcpiTimer mOdcpiTimer;
+ OdcpiRequestInfo mOdcpiRequest;
+ void odcpiTimerExpire();
+
+ /* === SystemStatus ===================================================================== */
+ SystemStatus* mSystemStatus;
+ std::string mServerUrl;
+ std::string mMoServerUrl;
+ XtraSystemStatusObserver mXtraObserver;
+ LocationSystemInfo mLocSystemInfo;
+ std::vector<GnssSvIdSource> mBlacklistedSvIds;
+ PowerStateType mSystemPowerState;
+
+ /* === Misc ===================================================================== */
+ BlockCPIInfo mBlockCPIInfo;
+ bool mPowerOn;
+ uint32_t mAllowFlpNetworkFixes;
+
+ /* === Misc callback from QMI LOC API ============================================== */
+ GnssEnergyConsumedCallback mGnssEnergyConsumedCb;
+ std::function<void(bool)> mPowerStateCb;
+
+ /*==== CONVERSION ===================================================================*/
+ static void convertOptions(LocPosMode& out, const TrackingOptions& trackingOptions);
+ static void convertLocation(Location& out, const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ const LocPosTechMask techMask);
+ static void convertLocationInfo(GnssLocationInfoNotification& out,
+ const GpsLocationExtended& locationExtended);
+ static uint16_t getNumSvUsed(uint64_t svUsedIdsMask,
+ int totalSvCntInThisConstellation);
+
+ /* ======== UTILITIES ================================================================== */
+ inline void initOdcpi(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
+ inline void injectOdcpi(const Location& location);
+ static bool isFlpClient(LocationCallbacks& locationCallbacks);
+
+protected:
+
+ /* ==== CLIENT ========================================================================= */
+ virtual void updateClientsEventMask();
+ virtual void stopClientSessions(LocationAPI* client);
+
+public:
+
+ GnssAdapter();
+ virtual inline ~GnssAdapter() { }
+
+ /* ==== SSR ============================================================================ */
+ /* ======== EVENTS ====(Called from QMI Thread)========================================= */
+ virtual void handleEngineUpEvent();
+ /* ======== UTILITIES ================================================================== */
+ void restartSessions(bool modemSSR = false);
+ void checkAndRestartTimeBasedSession();
+ void suspendSessions();
+
+ /* ==== CLIENT ========================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ virtual void addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks);
+
+ /* ==== TRACKING ======================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ uint32_t startTrackingCommand(
+ LocationAPI* client, TrackingOptions& trackingOptions);
+ void updateTrackingOptionsCommand(
+ LocationAPI* client, uint32_t id, TrackingOptions& trackingOptions);
+ void stopTrackingCommand(LocationAPI* client, uint32_t id);
+ /* ======== RESPONSES ================================================================== */
+ void reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId);
+ /* ======== UTILITIES ================================================================== */
+ bool isTimeBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
+ bool isDistanceBasedTrackingSession(LocationAPI* client, uint32_t sessionId);
+ bool hasCallbacksToStartTracking(LocationAPI* client);
+ bool isTrackingSession(LocationAPI* client, uint32_t sessionId);
+ void saveTrackingSession(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& trackingOptions);
+ void eraseTrackingSession(LocationAPI* client, uint32_t sessionId);
+
+ bool setLocPositionMode(const LocPosMode& mode);
+ LocPosMode& getLocPositionMode() { return mLocPositionMode; }
+
+ bool startTimeBasedTrackingMultiplex(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& trackingOptions);
+ void startTimeBasedTracking(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& trackingOptions);
+ bool stopTimeBasedTrackingMultiplex(LocationAPI* client, uint32_t id);
+ void stopTracking(LocationAPI* client, uint32_t id);
+ bool updateTrackingMultiplex(LocationAPI* client, uint32_t id,
+ const TrackingOptions& trackingOptions);
+ void updateTracking(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& updatedOptions, const TrackingOptions& oldOptions);
+ bool checkAndSetSPEToRunforNHz(TrackingOptions & out);
+
+ void setConstrainedTunc(bool enable, float tuncConstraint,
+ uint32_t energyBudget, uint32_t sessionId);
+ void setPositionAssistedClockEstimator(bool enable, uint32_t sessionId);
+ void updateSvConfig(uint32_t sessionId, const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig);
+ void resetSvConfig(uint32_t sessionId);
+ void configLeverArm(uint32_t sessionId, const LeverArmConfigInfo& configInfo);
+ void configRobustLocation(uint32_t sessionId, bool enable, bool enableForE911);
+ inline bool isSS5HWEnabled()
+ { return ((mContext != NULL) && (IS_SS5_HW_ENABLED == mContext->mGps_conf.GNSS_DEPLOYMENT)); }
+
+ /* ==== NI ============================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ void gnssNiResponseCommand(LocationAPI* client, uint32_t id, GnssNiResponse response);
+ /* ======================(Called from NI Thread)======================================== */
+ void gnssNiResponseCommand(GnssNiResponse response, void* rawRequest);
+ /* ======== UTILITIES ================================================================== */
+ bool hasNiNotifyCallback(LocationAPI* client);
+ NiData& getNiData() { return mNiData; }
+
+ /* ==== CONTROL CLIENT ================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ uint32_t enableCommand(LocationTechnologyType techType);
+ void disableCommand(uint32_t id);
+ void setControlCallbacksCommand(LocationControlCallbacks& controlCallbacks);
+ void readConfigCommand();
+ void requestUlpCommand();
+ void initEngHubProxyCommand();
+ uint32_t* gnssUpdateConfigCommand(GnssConfig config);
+ uint32_t* gnssGetConfigCommand(GnssConfigFlagsMask mask);
+ uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
+ void deleteAidingData(const GnssAidingData &data, uint32_t sessionId);
+ void gnssUpdateXtraThrottleCommand(const bool enabled);
+ std::vector<LocationError> gnssUpdateConfig(const std::string& oldMoServerUrl,
+ GnssConfig& gnssConfigRequested,
+ GnssConfig& gnssConfigNeedEngineUpdate, size_t count = 0);
+
+ /* ==== GNSS SV TYPE CONFIG ============================================================ */
+ /* ==== COMMANDS ====(Called from Client Thread)======================================== */
+ /* ==== These commands are received directly from client bypassing Location API ======== */
+ void gnssUpdateSvTypeConfigCommand(GnssSvTypeConfig config);
+ void gnssGetSvTypeConfigCommand(GnssSvTypeConfigCallback callback);
+ void gnssResetSvTypeConfigCommand();
+
+ /* ==== UTILITIES ====================================================================== */
+ LocationError gnssSvIdConfigUpdateSync(const std::vector<GnssSvIdSource>& blacklistedSvIds);
+ LocationError gnssSvIdConfigUpdateSync();
+ void gnssSvIdConfigUpdate(const std::vector<GnssSvIdSource>& blacklistedSvIds);
+ void gnssSvIdConfigUpdate();
+ void gnssSvTypeConfigUpdate(const GnssSvTypeConfig& config);
+ void gnssSvTypeConfigUpdate(bool sendReset = false);
+ inline void gnssSetSvTypeConfig(const GnssSvTypeConfig& config)
+ { mGnssSvTypeConfig = config; }
+ inline void gnssSetSvTypeConfigCallback(GnssSvTypeConfigCallback callback)
+ { mGnssSvTypeConfigCb = callback; }
+ inline GnssSvTypeConfigCallback gnssGetSvTypeConfigCallback()
+ { return mGnssSvTypeConfigCb; }
+ void setConfig();
+
+ /* ========= AGPS ====================================================================== */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ void initDefaultAgpsCommand();
+ void initAgpsCommand(const AgpsCbInfo& cbInfo);
+ void initNfwCommand(const NfwCbInfo& cbInfo);
+ void dataConnOpenCommand(AGpsExtType agpsType,
+ const char* apnName, int apnLen, AGpsBearerType bearerType);
+ void dataConnClosedCommand(AGpsExtType agpsType);
+ void dataConnFailedCommand(AGpsExtType agpsType);
+ void getGnssEnergyConsumedCommand(GnssEnergyConsumedCallback energyConsumedCb);
+ void nfwControlCommand(bool enable);
+ uint32_t setConstrainedTuncCommand (bool enable, float tuncConstraint,
+ uint32_t energyBudget);
+ uint32_t setPositionAssistedClockEstimatorCommand (bool enable);
+ uint32_t gnssUpdateSvConfigCommand(const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig);
+ uint32_t gnssResetSvConfigCommand();
+ uint32_t configLeverArmCommand(const LeverArmConfigInfo& configInfo);
+ uint32_t configRobustLocationCommand(bool enable, bool enableForE911);
+
+ /* ========= ODCPI ===================================================================== */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ void initOdcpiCommand(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
+ void injectOdcpiCommand(const Location& location);
+ /* ======== RESPONSES ================================================================== */
+ void reportResponse(LocationError err, uint32_t sessionId);
+ void reportResponse(size_t count, LocationError* errs, uint32_t* ids);
+ /* ======== UTILITIES ================================================================== */
+ LocationControlCallbacks& getControlCallbacks() { return mControlCallbacks; }
+ void setControlCallbacks(const LocationControlCallbacks& controlCallbacks)
+ { mControlCallbacks = controlCallbacks; }
+ void setAfwControlId(uint32_t id) { mAfwControlId = id; }
+ uint32_t getAfwControlId() { return mAfwControlId; }
+ virtual bool isInSession() { return !mTimeBasedTrackingSessions.empty(); }
+ void initDefaultAgps();
+ bool initEngHubProxy();
+ void odcpiTimerExpireEvent();
+
+ /* ==== REPORTS ======================================================================== */
+ /* ======== EVENTS ====(Called from QMI/EngineHub Thread)===================================== */
+ virtual void reportPositionEvent(const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask techMask,
+ GnssDataNotification* pDataNotify = nullptr,
+ int msInWeek = -1);
+ virtual void reportEnginePositionsEvent(unsigned int count,
+ EngineLocationInfo* locationArr);
+
+ virtual void reportSvEvent(const GnssSvNotification& svNotify,
+ bool fromEngineHub=false);
+ virtual void reportNmeaEvent(const char* nmea, size_t length);
+ virtual void reportDataEvent(const GnssDataNotification& dataNotify, int msInWeek);
+ virtual bool requestNiNotifyEvent(const GnssNiNotification& notify, const void* data,
+ const LocInEmergency emergencyState);
+ virtual void reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurements,
+ int msInWeek);
+ virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
+ virtual void reportSvEphemerisEvent(GnssSvEphemerisReport & svEphemeris);
+ virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
+ virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
+ virtual void reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig);
+ virtual bool reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
+ virtual void reportLocationSystemInfoEvent(const LocationSystemInfo& locationSystemInfo);
+
+ virtual bool requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask apn_type_mask);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
+ virtual bool reportDeleteAidingDataEvent(GnssAidingData& aidingData);
+ virtual bool reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& ionoModel);
+ virtual bool reportGnssAdditionalSystemInfoEvent(
+ GnssAdditionalSystemInfo& additionalSystemInfo);
+ virtual void reportNfwNotificationEvent(GnssNfwNotification& notification);
+
+ /* ======== UTILITIES ================================================================= */
+ bool needReportForGnssClient(const UlpLocation& ulpLocation,
+ enum loc_sess_status status, LocPosTechMask techMask);
+ bool needReportForFlpClient(enum loc_sess_status status, LocPosTechMask techMask);
+ void reportPosition(const UlpLocation &ulpLocation,
+ const GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask techMask);
+ void reportEnginePositions(unsigned int count,
+ const EngineLocationInfo* locationArr);
+ void reportSv(GnssSvNotification& svNotify);
+ void reportNmea(const char* nmea, size_t length);
+ void reportData(GnssDataNotification& dataNotify);
+ bool requestNiNotify(const GnssNiNotification& notify, const void* data,
+ const bool bInformNiAccept);
+ void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements);
+ void reportGnssSvIdConfig(const GnssSvIdConfig& config);
+ void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);
+ void requestOdcpi(const OdcpiRequestInfo& request);
+ void invokeGnssEnergyConsumedCallback(uint64_t energyConsumedSinceFirstBoot);
+ void saveGnssEnergyConsumedCallback(GnssEnergyConsumedCallback energyConsumedCb);
+ void reportLocationSystemInfo(const LocationSystemInfo & locationSystemInfo);
+ inline void reportNfwNotification(const GnssNfwNotification& notification) {
+ if (NULL != mNfwCb) {
+ mNfwCb(notification);
+ }
+ }
+ inline bool getE911State(void) {
+ if (NULL != mIsE911Session) {
+ return mIsE911Session();
+ }
+ return false;
+ }
+
+ void updateSystemPowerState(PowerStateType systemPowerState);
+ void reportSvPolynomial(const GnssSvPolynomial &svPolynomial);
+
+
+
+ /*======== GNSSDEBUG ================================================================*/
+ bool getDebugReport(GnssDebugReport& report);
+ /* get AGC information from system status and fill it */
+ void getAgcInformation(GnssMeasurementsNotification& measurements, int msInWeek);
+ /* get Data information from system status and fill it */
+ void getDataInformation(GnssDataNotification& data, int msInWeek);
+
+ /*==== SYSTEM STATUS ================================================================*/
+ inline SystemStatus* getSystemStatus(void) { return mSystemStatus; }
+ std::string& getServerUrl(void) { return mServerUrl; }
+ std::string& getMoServerUrl(void) { return mMoServerUrl; }
+
+ /*==== CONVERSION ===================================================================*/
+ static uint32_t convertSuplVersion(const GnssConfigSuplVersion suplVersion);
+ static uint32_t convertLppProfile(const GnssConfigLppProfile lppProfile);
+ static uint32_t convertEP4ES(const GnssConfigEmergencyPdnForEmergencySupl);
+ static uint32_t convertSuplEs(const GnssConfigSuplEmergencyServices suplEmergencyServices);
+ static uint32_t convertLppeCp(const GnssConfigLppeControlPlaneMask lppeControlPlaneMask);
+ static uint32_t convertLppeUp(const GnssConfigLppeUserPlaneMask lppeUserPlaneMask);
+ static uint32_t convertAGloProt(const GnssConfigAGlonassPositionProtocolMask);
+ static uint32_t convertSuplMode(const GnssConfigSuplModeMask suplModeMask);
+ static void convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
+ const GnssSvType& in_constellation,
+ const SystemStatusReports& in);
+ static bool convertToGnssSvIdConfig(
+ const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config);
+ static void convertFromGnssSvIdConfig(
+ const GnssSvIdConfig& svConfig, std::vector<GnssSvIdSource>& blacklistedSvIds);
+ static void convertGnssSvIdMaskToList(
+ uint64_t svIdMask, std::vector<GnssSvIdSource>& svIds,
+ GnssSvId initialSvId, GnssSvType svType);
+
+ void injectLocationCommand(double latitude, double longitude, float accuracy);
+ void injectLocationExtCommand(const GnssLocationInfoNotification &locationInfo);
+
+ void injectTimeCommand(int64_t time, int64_t timeReference, int32_t uncertainty);
+ void blockCPICommand(double latitude, double longitude, float accuracy,
+ int blockDurationMsec, double latLonDiffThreshold);
+
+ /* ==== MISCELLANEOUS ================================================================== */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ void getPowerStateChangesCommand(std::function<void(bool)> powerStateCb);
+ /* ======== UTILITIES ================================================================== */
+ void reportPowerStateIfChanged();
+ void savePowerStateCallback(std::function<void(bool)> powerStateCb){
+ mPowerStateCb = powerStateCb; }
+ bool getPowerState() { return mPowerOn; }
+ inline PowerStateType getSystemPowerState() { return mSystemPowerState; }
+
+ void setAllowFlpNetworkFixes(uint32_t allow) { mAllowFlpNetworkFixes = allow; }
+ uint32_t getAllowFlpNetworkFixes() { return mAllowFlpNetworkFixes; }
+ void setSuplHostServer(const char* server, int port, LocServerType type);
+ void notifyClientOfCachedLocationSystemInfo(LocationAPI* client,
+ const LocationCallbacks& callbacks);
+ void updateSystemPowerStateCommand(PowerStateType systemPowerState);
+ inline bool isNMEAPrintEnabled() {
+ return (((mContext != NULL) && (0 != mContext->mGps_conf.ENABLE_NMEA_PRINT)) ?
+ (true) : (false));
+ }
+};
+
+#endif //GNSS_ADAPTER_H
diff --git a/gps/gnss/Makefile.am b/gps/gnss/Makefile.am
new file mode 100644
index 0000000..db20c15
--- /dev/null
+++ b/gps/gnss/Makefile.am
@@ -0,0 +1,31 @@
+AM_CFLAGS = \
+ $(LOCPLA_CFLAGS) \
+ $(LOCHAL_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ $(LOCCORE_CFLAGS) \
+ -I./ \
+ -I../utils \
+ -I$(WORKSPACE)/hardware/qcom/gps/core/data-items \
+ -I../location \
+ -std=c++1y
+
+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++ -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 = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libgnss_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgnss_la_LIBADD = -lstdc++ -ldl $(GPSUTILS_LIBS) $(LOCCORE_LIBS)
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgnss.la
diff --git a/gps/gnss/XtraSystemStatusObserver.cpp b/gps/gnss/XtraSystemStatusObserver.cpp
new file mode 100644
index 0000000..a58f735
--- /dev/null
+++ b/gps/gnss/XtraSystemStatusObserver.cpp
@@ -0,0 +1,329 @@
+/* Copyright (c) 2017, 2019, 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.
+ *
+ */
+#define LOG_TAG "LocSvc_XtraSystemStatusObs"
+
+#include <sys/stat.h>
+#include <sys/un.h>
+#include <errno.h>
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <math.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string>
+#include <loc_log.h>
+#include <loc_nmea.h>
+#include <SystemStatus.h>
+#include <vector>
+#include <sstream>
+#include <XtraSystemStatusObserver.h>
+#include <LocAdapterBase.h>
+#include <DataItemId.h>
+#include <DataItemsFactoryProxy.h>
+#include <DataItemConcreteTypesBase.h>
+
+using namespace loc_util;
+using namespace loc_core;
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LocSvc_XSSO"
+
+class XtraIpcListener : public ILocIpcListener {
+ IOsObserver* mSystemStatusObsrvr;
+ const MsgTask* mMsgTask;
+ XtraSystemStatusObserver& mXSSO;
+public:
+ inline XtraIpcListener(IOsObserver* observer, const MsgTask* msgTask,
+ XtraSystemStatusObserver& xsso) :
+ mSystemStatusObsrvr(observer), mMsgTask(msgTask), mXSSO(xsso) {}
+ virtual void onReceive(const char* data, uint32_t length,
+ const LocIpcRecver* recver) override {
+#define STRNCMP(str, constStr) strncmp(str, constStr, sizeof(constStr)-1)
+ if (!STRNCMP(data, "ping")) {
+ LOC_LOGd("ping received");
+#ifdef USE_GLIB
+ } else if (!STRNCMP(data, "connectBackhaul")) {
+ mSystemStatusObsrvr->connectBackhaul();
+ } else if (!STRNCMP(data, "disconnectBackhaul")) {
+ mSystemStatusObsrvr->disconnectBackhaul();
+#endif
+ } else if (!STRNCMP(data, "requestStatus")) {
+ int32_t xtraStatusUpdated = 0;
+ sscanf(data, "%*s %d", &xtraStatusUpdated);
+
+ 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 HandleStatusRequestMsg(mXSSO, xtraStatusUpdated));
+ } else {
+ LOC_LOGw("unknown event: %s", data);
+ }
+ }
+};
+
+XtraSystemStatusObserver::XtraSystemStatusObserver(IOsObserver* sysStatObs,
+ const MsgTask* msgTask) :
+ mSystemStatusObsrvr(sysStatObs), mMsgTask(msgTask),
+ mGpsLock(-1), mConnections(~0), mXtraThrottle(true),
+ mReqStatusReceived(false),
+ mIsConnectivityStatusKnown(false),
+ mSender(LocIpc::getLocIpcLocalSender(LOC_IPC_XTRA)),
+ mDelayLocTimer(*mSender) {
+ subscribe(true);
+ auto recver = LocIpc::getLocIpcLocalRecver(
+ make_shared<XtraIpcListener>(sysStatObs, msgTask, *this),
+ LOC_IPC_HAL);
+ mIpc.startNonBlockingListening(recver);
+ mDelayLocTimer.start(100 /*.1 sec*/, false);
+}
+
+bool XtraSystemStatusObserver::updateLockStatus(GnssConfigGpsLock lock) {
+ // mask NI(NFW bit) since from XTRA's standpoint GPS is enabled if
+ // MO(AFW bit) is enabled and disabled when MO is disabled
+ mGpsLock = lock & ~GNSS_CONFIG_GPS_LOCK_NI;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
+ stringstream ss;
+ ss << "gpslock";
+ ss << " " << mGpsLock;
+ string s = ss.str();
+ return ( LocIpc::send(*mSender, (const uint8_t*)s.data(), s.size()) );
+}
+
+bool XtraSystemStatusObserver::updateConnections(uint64_t allConnections,
+ NetworkInfoType* networkHandleInfo) {
+ mIsConnectivityStatusKnown = true;
+ mConnections = allConnections;
+
+ LOC_LOGd("updateConnections mConnections:%" PRIx64, mConnections);
+ for (uint8_t i = 0; i < MAX_NETWORK_HANDLES; ++i) {
+ mNetworkHandle[i] = networkHandleInfo[i];
+ LOC_LOGd("updateConnections [%d] networkHandle:%" PRIx64 " networkType:%u",
+ i, mNetworkHandle[i].networkHandle, mNetworkHandle[i].networkType);
+ }
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
+ stringstream ss;
+ ss << "connection" << endl << mConnections << endl
+ << mNetworkHandle[0].toString() << endl
+ << mNetworkHandle[1].toString() << endl
+ << mNetworkHandle[2].toString() << endl
+ << mNetworkHandle[3].toString() << endl
+ << mNetworkHandle[4].toString() << endl
+ << mNetworkHandle[5].toString() << endl
+ << mNetworkHandle[6].toString() << endl
+ << mNetworkHandle[7].toString() << endl
+ << mNetworkHandle[8].toString() << endl
+ << mNetworkHandle[MAX_NETWORK_HANDLES-1].toString();
+ string s = ss.str();
+ return ( LocIpc::send(*mSender, (const uint8_t*)s.data(), s.size()) );
+}
+
+bool XtraSystemStatusObserver::updateTac(const string& tac) {
+ mTac = tac;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
+ stringstream ss;
+ ss << "tac";
+ ss << " " << tac.c_str();
+ string s = ss.str();
+ return ( LocIpc::send(*mSender, (const uint8_t*)s.data(), s.size()) );
+}
+
+bool XtraSystemStatusObserver::updateMccMnc(const string& mccmnc) {
+ mMccmnc = mccmnc;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
+ stringstream ss;
+ ss << "mncmcc";
+ ss << " " << mccmnc.c_str();
+ string s = ss.str();
+ return ( LocIpc::send(*mSender, (const uint8_t*)s.data(), s.size()) );
+}
+
+bool XtraSystemStatusObserver::updateXtraThrottle(const bool enabled) {
+ mXtraThrottle = enabled;
+
+ if (!mReqStatusReceived) {
+ return true;
+ }
+
+ stringstream ss;
+ ss << "xtrathrottle";
+ ss << " " << (enabled ? 1 : 0);
+ string s = ss.str();
+ return ( LocIpc::send(*mSender, (const uint8_t*)s.data(), s.size()) );
+}
+
+inline bool XtraSystemStatusObserver::onStatusRequested(int32_t xtraStatusUpdated) {
+ mReqStatusReceived = true;
+
+ if (xtraStatusUpdated) {
+ return true;
+ }
+
+ stringstream ss;
+
+ ss << "respondStatus" << endl;
+ (mGpsLock == -1 ? ss : ss << mGpsLock) << endl;
+ (mConnections == (uint64_t)~0 ? ss : ss << mConnections) << endl
+ << mNetworkHandle[0].toString() << endl
+ << mNetworkHandle[1].toString() << endl
+ << mNetworkHandle[2].toString() << endl
+ << mNetworkHandle[3].toString() << endl
+ << mNetworkHandle[4].toString() << endl
+ << mNetworkHandle[5].toString() << endl
+ << mNetworkHandle[6].toString() << endl
+ << mNetworkHandle[7].toString() << endl
+ << mNetworkHandle[8].toString() << endl
+ << mNetworkHandle[MAX_NETWORK_HANDLES-1].toString() << endl
+ << mTac << endl << mMccmnc << endl << mIsConnectivityStatusKnown;
+
+ string s = ss.str();
+ return ( LocIpc::send(*mSender, (const uint8_t*)s.data(), s.size()) );
+}
+
+void XtraSystemStatusObserver::subscribe(bool yes)
+{
+ // Subscription data list
+ list<DataItemId> subItemIdList;
+ subItemIdList.push_back(NETWORKINFO_DATA_ITEM_ID);
+ subItemIdList.push_back(MCCMNC_DATA_ITEM_ID);
+
+ if (yes) {
+ mSystemStatusObsrvr->subscribe(subItemIdList, this);
+
+ list<DataItemId> reqItemIdList;
+ reqItemIdList.push_back(TAC_DATA_ITEM_ID);
+
+ mSystemStatusObsrvr->requestData(reqItemIdList, this);
+
+ } else {
+ mSystemStatusObsrvr->unsubscribe(subItemIdList, this);
+ }
+}
+
+// IDataItemObserver overrides
+void XtraSystemStatusObserver::getName(string& name)
+{
+ name = "XtraSystemStatusObserver";
+}
+
+void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
+{
+ struct HandleOsObserverUpdateMsg : public LocMsg {
+ XtraSystemStatusObserver* mXtraSysStatObj;
+ list <IDataItemCore*> mDataItemList;
+
+ inline HandleOsObserverUpdateMsg(XtraSystemStatusObserver* xtraSysStatObs,
+ const list<IDataItemCore*>& dataItemList) :
+ mXtraSysStatObj(xtraSysStatObs) {
+ for (auto eachItem : dataItemList) {
+ IDataItemCore* dataitem = DataItemsFactoryProxy::createNewDataItem(
+ eachItem->getId());
+ if (NULL == dataitem) {
+ break;
+ }
+ // Copy the contents of the data item
+ dataitem->copy(eachItem);
+
+ mDataItemList.push_back(dataitem);
+ }
+ }
+
+ inline ~HandleOsObserverUpdateMsg() {
+ for (auto itor = mDataItemList.begin(); itor != mDataItemList.end(); ++itor) {
+ if (*itor != nullptr) {
+ delete *itor;
+ *itor = nullptr;
+ }
+ }
+ }
+
+ inline void proc() const {
+ for (auto each : mDataItemList) {
+ switch (each->getId())
+ {
+ case NETWORKINFO_DATA_ITEM_ID:
+ {
+ NetworkInfoDataItemBase* networkInfo =
+ static_cast<NetworkInfoDataItemBase*>(each);
+ NetworkInfoType* networkHandleInfo =
+ static_cast<NetworkInfoType*>(networkInfo->getNetworkHandle());
+ mXtraSysStatObj->updateConnections(networkInfo->getAllTypes(),
+ networkHandleInfo);
+ }
+ break;
+
+ case TAC_DATA_ITEM_ID:
+ {
+ TacDataItemBase* tac =
+ static_cast<TacDataItemBase*>(each);
+ mXtraSysStatObj->updateTac(tac->mValue);
+ }
+ break;
+
+ case MCCMNC_DATA_ITEM_ID:
+ {
+ MccmncDataItemBase* mccmnc =
+ static_cast<MccmncDataItemBase*>(each);
+ mXtraSysStatObj->updateMccMnc(mccmnc->mValue);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ };
+ mMsgTask->sendMsg(new (nothrow) HandleOsObserverUpdateMsg(this, dlist));
+}
diff --git a/gps/gnss/XtraSystemStatusObserver.h b/gps/gnss/XtraSystemStatusObserver.h
new file mode 100644
index 0000000..3a5259d
--- /dev/null
+++ b/gps/gnss/XtraSystemStatusObserver.h
@@ -0,0 +1,90 @@
+/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef XTRA_SYSTEM_STATUS_OBS_H
+#define XTRA_SYSTEM_STATUS_OBS_H
+
+#include <cinttypes>
+#include <MsgTask.h>
+#include <LocIpc.h>
+#include <LocTimer.h>
+
+using namespace std;
+using namespace loc_util;
+using loc_core::IOsObserver;
+using loc_core::IDataItemObserver;
+using loc_core::IDataItemCore;
+
+class XtraSystemStatusObserver : public IDataItemObserver {
+public :
+ // constructor & destructor
+ XtraSystemStatusObserver(IOsObserver* sysStatObs, const MsgTask* msgTask);
+ inline virtual ~XtraSystemStatusObserver() {
+ subscribe(false);
+ mIpc.stopNonBlockingListening();
+ }
+
+ // IDataItemObserver overrides
+ inline virtual void getName(string& name);
+ virtual void notify(const list<IDataItemCore*>& dlist);
+
+ bool updateLockStatus(GnssConfigGpsLock lock);
+ bool updateConnections(uint64_t allConnections,
+ loc_core::NetworkInfoType* networkHandleInfo);
+ 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);
+ bool onStatusRequested(int32_t xtraStatusUpdated);
+
+private:
+ IOsObserver* mSystemStatusObsrvr;
+ const MsgTask* mMsgTask;
+ GnssConfigGpsLock mGpsLock;
+ LocIpc mIpc;
+ uint64_t mConnections;
+ loc_core::NetworkInfoType mNetworkHandle[MAX_NETWORK_HANDLES];
+ string mTac;
+ string mMccmnc;
+ bool mXtraThrottle;
+ bool mReqStatusReceived;
+ bool mIsConnectivityStatusKnown;
+ shared_ptr<LocIpcSender> mSender;
+
+ class DelayLocTimer : public LocTimer {
+ LocIpcSender& mSender;
+ public:
+ DelayLocTimer(LocIpcSender& sender) : mSender(sender) {}
+ void timeOutCallback() override {
+ LocIpc::send(mSender, (const uint8_t*)"halinit", sizeof("halinit"));
+ }
+ } mDelayLocTimer;
+};
+
+#endif
diff --git a/gps/gnss/location_gnss.cpp b/gps/gnss/location_gnss.cpp
new file mode 100644
index 0000000..adaa588
--- /dev/null
+++ b/gps/gnss/location_gnss.cpp
@@ -0,0 +1,476 @@
+/* Copyright (c) 2017-2020, 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 "GnssAdapter.h"
+#include "location_interface.h"
+
+static GnssAdapter* gGnssAdapter = NULL;
+
+static void initialize();
+static void deinitialize();
+
+static void addClient(LocationAPI* client, const LocationCallbacks& callbacks);
+static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb);
+static void requestCapabilities(LocationAPI* client);
+
+static uint32_t startTracking(LocationAPI* client, TrackingOptions&);
+static void updateTrackingOptions(LocationAPI* client, uint32_t id, TrackingOptions&);
+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);
+static void disable(uint32_t id);
+static uint32_t* gnssUpdateConfig(GnssConfig config);
+static uint32_t* gnssGetConfig(GnssConfigFlagsMask mask);
+
+static void gnssUpdateSvTypeConfig(GnssSvTypeConfig& config);
+static void gnssGetSvTypeConfig(GnssSvTypeConfigCallback& callback);
+static void gnssResetSvTypeConfig();
+
+static void injectLocation(double latitude, double longitude, float accuracy);
+static void injectLocationExt(const GnssLocationInfoNotification &locationInfo);
+static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty);
+
+static void agpsInit(const AgpsCbInfo& cbInfo);
+static void agpsDataConnOpen(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType);
+static void agpsDataConnClosed(AGpsExtType agpsType);
+static void agpsDataConnFailed(AGpsExtType agpsType);
+static void getDebugReport(GnssDebugReport& report);
+static void updateConnectionStatus(bool connected, int8_t type, bool roaming = false,
+ NetworkHandle networkHandle = NETWORK_HANDLE_UNKNOWN);
+static void getGnssEnergyConsumed(GnssEnergyConsumedCallback energyConsumedCb);
+static void enableNfwLocationAccess(bool enable);
+static void nfwInit(const NfwCbInfo& cbInfo);
+static void getPowerStateChanges(std::function<void(bool)> powerStateCb);
+
+static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
+static void odcpiInject(const Location& location);
+
+static void blockCPI(double latitude, double longitude, float accuracy,
+ int blockDurationMsec, double latLonDiffThreshold);
+static void updateBatteryStatus(bool charging);
+static void updateSystemPowerState(PowerStateType systemPowerState);
+static uint32_t setConstrainedTunc (bool enable, float tuncConstraint,
+ uint32_t energyBudget);
+static uint32_t setPositionAssistedClockEstimator(bool enable);
+static uint32_t gnssUpdateSvConfig(const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig);
+static uint32_t gnssResetSvConfig();
+static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo);
+static uint32_t configRobustLocation(bool enable, bool enableForE911);
+static bool isSS5HWEnabled();
+
+static const GnssInterface gGnssInterface = {
+ sizeof(GnssInterface),
+ initialize,
+ deinitialize,
+ addClient,
+ removeClient,
+ requestCapabilities,
+ startTracking,
+ updateTrackingOptions,
+ stopTracking,
+ gnssNiResponse,
+ setControlCallbacks,
+ enable,
+ disable,
+ gnssUpdateConfig,
+ gnssGetConfig,
+ gnssUpdateSvTypeConfig,
+ gnssGetSvTypeConfig,
+ gnssResetSvTypeConfig,
+ gnssDeleteAidingData,
+ gnssUpdateXtraThrottle,
+ injectLocation,
+ injectTime,
+ agpsInit,
+ agpsDataConnOpen,
+ agpsDataConnClosed,
+ agpsDataConnFailed,
+ getDebugReport,
+ updateConnectionStatus,
+ odcpiInit,
+ odcpiInject,
+ blockCPI,
+ getGnssEnergyConsumed,
+ enableNfwLocationAccess,
+ nfwInit,
+ getPowerStateChanges,
+ injectLocationExt,
+ updateBatteryStatus,
+ updateSystemPowerState,
+ setConstrainedTunc,
+ setPositionAssistedClockEstimator,
+ gnssUpdateSvConfig,
+ gnssResetSvConfig,
+ configLeverArm,
+ configRobustLocation,
+ isSS5HWEnabled,
+};
+
+#ifndef DEBUG_X86
+extern "C" const GnssInterface* getGnssInterface()
+#else
+const GnssInterface* getGnssInterface()
+#endif // DEBUG_X86
+{
+ gGnssInterface.initialize();
+ return &gGnssInterface;
+}
+
+static void initialize()
+{
+ if (NULL == gGnssAdapter) {
+ gGnssAdapter = new GnssAdapter();
+ }
+}
+
+static void deinitialize()
+{
+ if (NULL != gGnssAdapter) {
+ delete gGnssAdapter;
+ gGnssAdapter = NULL;
+ }
+}
+
+static void addClient(LocationAPI* client, const LocationCallbacks& callbacks)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->addClientCommand(client, callbacks);
+ }
+}
+
+static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->removeClientCommand(client, rmClientCb);
+ }
+}
+
+static void requestCapabilities(LocationAPI* client)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->requestCapabilitiesCommand(client);
+ }
+}
+
+static uint32_t startTracking(
+ LocationAPI* client, TrackingOptions& trackingOptions)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->startTrackingCommand(client, trackingOptions);
+ } else {
+ return 0;
+ }
+}
+
+static void updateTrackingOptions(
+ LocationAPI* client, uint32_t id, TrackingOptions& trackingOptions)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->updateTrackingOptionsCommand(
+ client, id, trackingOptions);
+ }
+}
+
+static void stopTracking(LocationAPI* client, uint32_t id)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->stopTrackingCommand(client, id);
+ }
+}
+
+static void gnssNiResponse(LocationAPI* client, uint32_t id, GnssNiResponse response)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->gnssNiResponseCommand(client, id, response);
+ }
+}
+
+static void setControlCallbacks(LocationControlCallbacks& controlCallbacks)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->setControlCallbacksCommand(controlCallbacks);
+ }
+}
+
+static uint32_t enable(LocationTechnologyType techType)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->enableCommand(techType);
+ } else {
+ return 0;
+ }
+}
+
+static void disable(uint32_t id)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->disableCommand(id);
+ }
+}
+
+static uint32_t* gnssUpdateConfig(GnssConfig config)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->gnssUpdateConfigCommand(config);
+ } else {
+ return NULL;
+ }
+}
+
+static uint32_t* gnssGetConfig(GnssConfigFlagsMask mask)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->gnssGetConfigCommand(mask);
+ } else {
+ return NULL;
+ }
+}
+
+static void gnssUpdateSvTypeConfig(GnssSvTypeConfig& config)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->gnssUpdateSvTypeConfigCommand(config);
+ }
+}
+
+static void gnssGetSvTypeConfig(GnssSvTypeConfigCallback& callback)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->gnssGetSvTypeConfigCommand(callback);
+ }
+}
+
+static void gnssResetSvTypeConfig()
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->gnssResetSvTypeConfigCommand();
+ }
+}
+
+static uint32_t gnssDeleteAidingData(GnssAidingData& data)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->gnssDeleteAidingDataCommand(data);
+ } else {
+ return 0;
+ }
+}
+
+static void gnssUpdateXtraThrottle(const bool enabled)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->gnssUpdateXtraThrottleCommand(enabled);
+ }
+}
+
+static void injectLocation(double latitude, double longitude, float accuracy)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->injectLocationCommand(latitude, longitude, accuracy);
+ }
+}
+
+static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->injectTimeCommand(time, timeReference, uncertainty);
+ }
+}
+
+static void agpsInit(const AgpsCbInfo& cbInfo) {
+
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->initAgpsCommand(cbInfo);
+ }
+}
+static void agpsDataConnOpen(
+ AGpsExtType agpsType, const char* apnName, int apnLen, int ipType) {
+
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->dataConnOpenCommand(
+ agpsType, apnName, apnLen, (AGpsBearerType)ipType);
+ }
+}
+static void agpsDataConnClosed(AGpsExtType agpsType) {
+
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->dataConnClosedCommand(agpsType);
+ }
+}
+static void agpsDataConnFailed(AGpsExtType agpsType) {
+
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->dataConnFailedCommand(agpsType);
+ }
+}
+
+static void getDebugReport(GnssDebugReport& report) {
+
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->getDebugReport(report);
+ }
+}
+
+static void updateConnectionStatus(bool connected, int8_t type,
+ bool roaming, NetworkHandle networkHandle) {
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->getSystemStatus()->eventConnectionStatus(
+ connected, type, roaming, networkHandle);
+ }
+}
+
+static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->initOdcpiCommand(callback, priority);
+ }
+}
+
+static void odcpiInject(const Location& location)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->injectOdcpiCommand(location);
+ }
+}
+
+static void blockCPI(double latitude, double longitude, float accuracy,
+ int blockDurationMsec, double latLonDiffThreshold) {
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->blockCPICommand(latitude, longitude, accuracy,
+ blockDurationMsec, latLonDiffThreshold);
+ }
+}
+
+static void getGnssEnergyConsumed(GnssEnergyConsumedCallback energyConsumedCb) {
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->getGnssEnergyConsumedCommand(energyConsumedCb);
+ }
+}
+
+static void enableNfwLocationAccess(bool enable) {
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->nfwControlCommand(enable);
+ }
+}
+
+static void nfwInit(const NfwCbInfo& cbInfo) {
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->initNfwCommand(cbInfo);
+ }
+}
+
+static void getPowerStateChanges(std::function<void(bool)> powerStateCb)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->getPowerStateChangesCommand(powerStateCb);
+ }
+}
+
+static void injectLocationExt(const GnssLocationInfoNotification &locationInfo)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->injectLocationExtCommand(locationInfo);
+ }
+}
+
+static void updateBatteryStatus(bool charging) {
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->getSystemStatus()->updatePowerConnectState(charging);
+ }
+}
+
+static void updateSystemPowerState(PowerStateType systemPowerState) {
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->updateSystemPowerStateCommand(systemPowerState);
+ }
+}
+
+static uint32_t setConstrainedTunc (bool enable, float tuncConstraint, uint32_t energyBudget) {
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->setConstrainedTuncCommand(enable, tuncConstraint, energyBudget);
+ } else {
+ return 0;
+ }
+}
+
+static uint32_t setPositionAssistedClockEstimator(bool enable) {
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->setPositionAssistedClockEstimatorCommand(enable);
+ } else {
+ return 0;
+ }
+}
+
+static uint32_t gnssUpdateSvConfig(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) {
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->gnssUpdateSvConfigCommand(
+ svTypeConfig, svIdConfig);
+ } else {
+ return 0;
+ }
+}
+
+static uint32_t gnssResetSvConfig() {
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->gnssResetSvConfigCommand();
+ } else {
+ return 0;
+ }
+}
+
+static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo){
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->configLeverArmCommand(configInfo);
+ } else {
+ return 0;
+ }
+}
+
+static bool isSS5HWEnabled() {
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->isSS5HWEnabled();
+ }
+ return false;
+}
+
+static uint32_t configRobustLocation(bool enable, bool enableForE911){
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->configRobustLocationCommand(enable, enableForE911);
+ } else {
+ return 0;
+ }
+}
diff --git a/gps/gps_vendor_board.mk b/gps/gps_vendor_board.mk
new file mode 100644
index 0000000..e1915ea
--- /dev/null
+++ b/gps/gps_vendor_board.mk
@@ -0,0 +1,7 @@
+# Flags from BoardConfigVendor.mk
+ifneq ($(TARGET_USES_QMAA),true)
+BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := default
+else ifneq ($(TARGET_USES_QMAA_OVERRIDE_GPS),false)
+BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := default
+endif
+
diff --git a/gps/gps_vendor_product.mk b/gps/gps_vendor_product.mk
new file mode 100644
index 0000000..6e938b3
--- /dev/null
+++ b/gps/gps_vendor_product.mk
@@ -0,0 +1,14 @@
+# HAL packages
+PRODUCT_PACKAGES += android.hardware.gnss@1.0-impl-qti
+PRODUCT_PACKAGES += android.hardware.gnss@1.0-service-qti
+PRODUCT_PACKAGES += android.hardware.gnss@1.1-impl-qti
+PRODUCT_PACKAGES += android.hardware.gnss@1.1-service-qti
+PRODUCT_PACKAGES += android.hardware.gnss@2.0-impl-qti
+PRODUCT_PACKAGES += android.hardware.gnss@2.0-service-qti
+PRODUCT_PACKAGES += gps.conf
+PRODUCT_PACKAGES += libloc_core
+PRODUCT_PACKAGES += libgnss
+PRODUCT_PACKAGES += liblocation_api
+PRODUCT_PACKAGES += libgps.utils
+PRODUCT_PACKAGES += libbatching
+PRODUCT_PACKAGES += libgeofencing
diff --git a/gps/loc-hal.pc.in b/gps/loc-hal.pc.in
new file mode 100644
index 0000000..22d174b
--- /dev/null
+++ b/gps/loc-hal.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-hal
+Description: QTI GPS Loc HAL
+Version: @VERSION
+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
new file mode 100644
index 0000000..2a59541
--- /dev/null
+++ b/gps/location/Android.mk
@@ -0,0 +1,44 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := liblocation_api
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libgps.utils \
+ libdl \
+ liblog
+
+LOCAL_SRC_FILES += \
+ LocationAPI.cpp \
+ LocationAPIClientBase.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums
+
+LOCAL_HEADER_LIBRARIES := \
+ libloc_pla_headers \
+ libgps.utils_headers
+
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := liblocation_api_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/location/ILocationAPI.h b/gps/location/ILocationAPI.h
new file mode 100644
index 0000000..b53e41e
--- /dev/null
+++ b/gps/location/ILocationAPI.h
@@ -0,0 +1,328 @@
+/* Copyright (c) 2018-2020 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 ILOCATIONAPI_H
+#define ILOCATIONAPI_H
+
+#include "LocationDataTypes.h"
+
+class ILocationAPI
+{
+public:
+ virtual ~ILocationAPI(){};
+
+ /** @brief Updates/changes the callbacks that will be called.
+ mandatory callbacks must be present for callbacks to be successfully updated
+ no return value */
+ virtual void updateCallbacks(LocationCallbacks&) = 0;
+
+ /* ================================== TRACKING ================================== */
+
+ /** @brief Starts a tracking session, which returns a session id that will be
+ used by the other tracking APIs and also in the responseCallback to match command
+ with response. locations are reported on the registered trackingCallback
+ periodically according to LocationOptions.
+ @return session id
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successfully started
+ LOCATION_ERROR_ALREADY_STARTED if a startTracking session is already in progress
+ LOCATION_ERROR_CALLBACK_MISSING if no trackingCallback was passed
+ LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameter is invalid */
+ virtual uint32_t startTracking(TrackingOptions&) = 0;
+
+ /** @brief Stops a tracking session associated with id parameter.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
+ virtual void stopTracking(uint32_t id) = 0;
+
+ /** @brief Changes the LocationOptions of a tracking session associated with id.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameters are invalid
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
+ virtual void updateTrackingOptions(uint32_t id, TrackingOptions&) = 0;
+
+ /* ================================== BATCHING ================================== */
+
+ /** @brief starts a batching session, which returns a session id that will be
+ used by the other batching APIs and also in the responseCallback to match command
+ with response. locations are reported on the batchingCallback passed in createInstance
+ periodically according to LocationOptions. A batching session starts tracking on
+ the low power processor and delivers them in batches by the batchingCallback when
+ the batch is full or when getBatchedLocations is called. This allows for the processor
+ that calls this API to sleep when the low power processor can batch locations in the
+ backgroup and wake up the processor calling the API only when the batch is full, thus
+ saving power.
+ @return session id
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_ALREADY_STARTED if a startBatching session is already in progress
+ LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback
+ LOCATION_ERROR_INVALID_PARAMETER if a parameter is invalid
+ LOCATION_ERROR_NOT_SUPPORTED if batching is not supported */
+ virtual uint32_t startBatching(BatchingOptions&) = 0;
+
+ /** @brief Stops a batching session associated with id parameter.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with batching session */
+ virtual void stopBatching(uint32_t id) = 0;
+
+ /** @brief Changes the LocationOptions of a batching session associated with id.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameters are invalid
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
+ virtual void updateBatchingOptions(uint32_t id, BatchingOptions&) = 0;
+
+ /** @brief Gets a number of locations that are currently stored/batched
+ on the low power processor, delivered by the batchingCallback passed in createInstance.
+ Location are then deleted from the batch stored on the low power processor.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful, will be followed by batchingCallback call
+ LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
+ virtual void getBatchedLocations(uint32_t id, size_t count) = 0;
+
+ /* ================================== GEOFENCE ================================== */
+
+ /** @brief Adds any number of geofences and returns an array of geofence ids that
+ will be used by the other geofence APIs and also in the collectiveResponseCallback to
+ match command with response. The geofenceBreachCallback will deliver the status of each
+ geofence according to the GeofenceOption for each. The geofence id array returned will
+ be valid until the collectiveResponseCallback is called and has returned.
+ @return id array
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_CALLBACK_MISSING if no geofenceBreachCallback
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ LOCATION_ERROR_NOT_SUPPORTED if geofence is not supported */
+ virtual uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*) = 0;
+
+ /** @brief Removes any number of geofences. Caller should delete ids array after
+ removeGeofences returneds.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+ virtual void removeGeofences(size_t count, uint32_t* ids) = 0;
+
+ /** @brief Modifies any number of geofences. Caller should delete ids array after
+ modifyGeofences returns.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid */
+ virtual void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options) = 0;
+
+ /** @brief Pauses any number of geofences, which is similar to removeGeofences,
+ only that they can be resumed at any time. Caller should delete ids array after
+ pauseGeofences returns.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+ virtual void pauseGeofences(size_t count, uint32_t* ids) = 0;
+
+ /** @brief Resumes any number of geofences that are currently paused. Caller should
+ delete ids array after resumeGeofences returns.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+ virtual void resumeGeofences(size_t count, uint32_t* ids) = 0;
+
+ /* ================================== GNSS ====================================== */
+
+ /** @brief gnssNiResponse is called in response to a gnssNiCallback.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters in GnssNiResponse are invalid
+ LOCATION_ERROR_ID_UNKNOWN if id does not match a gnssNiCallback */
+ virtual void gnssNiResponse(uint32_t id, GnssNiResponse response) = 0;
+};
+
+class ILocationControlAPI
+{
+public:
+ virtual ~ILocationControlAPI(){};
+
+ /** @brief Updates the gnss specific configuration, which returns a session id array
+ with an id for each of the bits set in GnssConfig.flags, order from low bits to high bits.
+ The response for each config that is set will be returned in collectiveResponseCallback.
+ The session id array returned will be valid until the collectiveResponseCallback is called
+ and has returned. This effect is global for all clients of ILocationAPI.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_INVALID_PARAMETER if any other parameters are invalid
+ LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */
+ virtual uint32_t* gnssUpdateConfig(GnssConfig config) = 0;
+
+ /** @brief Delete specific gnss aiding data for testing, which returns a session id
+ that will be returned in responseCallback to match command with response.
+ Only allowed in userdebug builds. This effect is global for all clients of ILocationAPI.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
+ virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) = 0;
+
+ /** @brief
+ Reset the constellation settings to modem default.
+
+ @param
+ None
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t resetConstellationConfig() = 0;
+
+ /** @brief
+ Configure the constellation to be used by the GNSS engine on
+ modem.
+
+ @param
+ constellationConfig: specify the constellation configuration
+ used by GNSS engine.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) = 0;
+
+ /** @brief
+ Enable or disable the constrained time uncertainty feature.
+
+ @param
+ enable: true to enable the constrained time uncertainty
+ feature and false to disable the constrainted time
+ uncertainty feature.
+
+ @param
+ tuncThreshold: this specifies the time uncertainty threshold
+ that gps engine need to maintain, in units of milli-seconds.
+ Default is 0.0 meaning that modem default value of time
+ uncertainty threshold will be used. This parameter is
+ ignored when requesting to disable this feature.
+
+ @param
+ energyBudget: this specifies the power budget that gps
+ engine is allowed to spend to maintain the time uncertainty.
+ Default is 0 meaning that GPS engine is not constained by
+ power budget and can spend as much power as needed. The
+ parameter need to be specified in units of 0.1 milli watt
+ second. This parameter is ignored requesting to disable this
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters
+ are invalid
+ */
+ virtual uint32_t configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold = 0.0,
+ uint32_t energyBudget = 0) = 0;
+
+ /** @brief
+ Enable or disable position assisted clock estimator feature.
+
+ @param
+ enable: true to enable position assisted clock estimator and
+ false to disable the position assisted clock estimator
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configPositionAssistedClockEstimator(bool enable) = 0;
+
+ /** @brief
+ Sets the lever arm parameters for the vehicle.
+
+ @param
+ configInfo: lever arm configuration info regarding below two
+ types of lever arm info:
+ a: GNSS Antenna w.r.t the origin at the IMU e.g.: inertial
+ measurement unit.
+ b: lever arm parameters regarding the OPF (output frame)
+ w.r.t the origin (at the GPS Antenna). Vehicle manufacturers
+ prefer the position output to be tied to a specific point in
+ the vehicle rather than where the antenna is placed
+ (midpoint of the rear axle is typical).
+
+ Caller can choose types of lever arm info to configure via the
+ leverMarkTypeMask.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) = 0;
+
+ /** @brief
+ Configure the robust location setting.
+
+ @param
+ enable: true to enable robust location and false to disable
+ robust location.
+
+ @param
+ enableForE911: true to enable robust location when device is on
+ E911 session and false to disable on E911 session.
+ This parameter is only valid if robust location is enabled.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configRobustLocation(bool enable, bool enableForE911) = 0;
+};
+
+#endif /* ILOCATIONAPI_H */
diff --git a/gps/location/LocationAPI.cpp b/gps/location/LocationAPI.cpp
new file mode 100644
index 0000000..c591223
--- /dev/null
+++ b/gps/location/LocationAPI.cpp
@@ -0,0 +1,816 @@
+/* Copyright (c) 2017-2020 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.
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_LocationAPI"
+
+#include <location_interface.h>
+#include <dlfcn.h>
+#include <loc_pla.h>
+#include <log_util.h>
+#include <pthread.h>
+#include <map>
+#include <loc_misc_utils.h>
+
+typedef const GnssInterface* (getGnssInterface)();
+typedef const GeofenceInterface* (getGeofenceInterface)();
+typedef const BatchingInterface* (getBatchingInterface)();
+
+typedef struct {
+ // bit mask of the adpaters that we need to wait for the removeClientCompleteCallback
+ // before we invoke the registered locationApiDestroyCompleteCallback
+ LocationAdapterTypeMask waitAdapterMask;
+ locationApiDestroyCompleteCallback destroyCompleteCb;
+} LocationAPIDestroyCbData;
+
+// This is the map for the client that has requested destroy with
+// destroy callback provided.
+typedef std::map<LocationAPI*, LocationAPIDestroyCbData>
+ LocationClientDestroyCbMap;
+
+typedef std::map<LocationAPI*, LocationCallbacks> LocationClientMap;
+typedef struct {
+ LocationClientMap clientData;
+ LocationClientDestroyCbMap destroyClientData;
+ LocationControlAPI* controlAPI;
+ LocationControlCallbacks controlCallbacks;
+ GnssInterface* gnssInterface;
+ GeofenceInterface* geofenceInterface;
+ BatchingInterface* batchingInterface;
+} LocationAPIData;
+
+static LocationAPIData gData = {};
+static pthread_mutex_t gDataMutex = PTHREAD_MUTEX_INITIALIZER;
+static bool gGnssLoadFailed = false;
+static bool gBatchingLoadFailed = false;
+static bool gGeofenceLoadFailed = false;
+
+template <typename T1, typename T2>
+static const T1* loadLocationInterface(const char* library, const char* name) {
+ void* libhandle = nullptr;
+ T2* getter = (T2*)dlGetSymFromLib(libhandle, library, name);
+ if (nullptr == getter) {
+ return (const T1*) getter;
+ }else {
+ return (*getter)();
+ }
+}
+
+static bool isGnssClient(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.gnssNiCb != nullptr ||
+ locationCallbacks.trackingCb != nullptr ||
+ locationCallbacks.gnssLocationInfoCb != nullptr ||
+ locationCallbacks.engineLocationsInfoCb != nullptr ||
+ locationCallbacks.gnssMeasurementsCb != nullptr ||
+ locationCallbacks.locationSystemInfoCb != nullptr);
+}
+
+static bool isBatchingClient(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.batchingCb != nullptr);
+}
+
+static bool isGeofenceClient(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.geofenceBreachCb != nullptr ||
+ locationCallbacks.geofenceStatusCb != nullptr);
+}
+
+
+void LocationAPI::onRemoveClientCompleteCb (LocationAdapterTypeMask adapterType)
+{
+ bool invokeCallback = false;
+ locationApiDestroyCompleteCallback destroyCompleteCb;
+ LOC_LOGd("adatper type %x", adapterType);
+ pthread_mutex_lock(&gDataMutex);
+ auto it = gData.destroyClientData.find(this);
+ if (it != gData.destroyClientData.end()) {
+ it->second.waitAdapterMask &= ~adapterType;
+ if (it->second.waitAdapterMask == 0) {
+ invokeCallback = true;
+ destroyCompleteCb = it->second.destroyCompleteCb;
+ gData.destroyClientData.erase(it);
+ }
+ }
+ pthread_mutex_unlock(&gDataMutex);
+
+ if (invokeCallback) {
+ LOC_LOGd("invoke client destroy cb");
+ if (!destroyCompleteCb) {
+ (destroyCompleteCb) ();
+ }
+
+ delete this;
+ }
+}
+
+void onGnssRemoveClientCompleteCb (LocationAPI* client)
+{
+ client->onRemoveClientCompleteCb (LOCATION_ADAPTER_GNSS_TYPE_BIT);
+}
+
+void onBatchingRemoveClientCompleteCb (LocationAPI* client)
+{
+ client->onRemoveClientCompleteCb (LOCATION_ADAPTER_BATCHING_TYPE_BIT);
+}
+
+void onGeofenceRemoveClientCompleteCb (LocationAPI* client)
+{
+ client->onRemoveClientCompleteCb (LOCATION_ADAPTER_GEOFENCE_TYPE_BIT);
+}
+
+LocationAPI*
+LocationAPI::createInstance (LocationCallbacks& locationCallbacks)
+{
+ if (nullptr == locationCallbacks.capabilitiesCb ||
+ nullptr == locationCallbacks.responseCb ||
+ nullptr == locationCallbacks.collectiveResponseCb) {
+ return NULL;
+ }
+
+ LocationAPI* newLocationAPI = new LocationAPI();
+ bool requestedCapabilities = false;
+
+ pthread_mutex_lock(&gDataMutex);
+
+ if (isGnssClient(locationCallbacks)) {
+ if (NULL == gData.gnssInterface && !gGnssLoadFailed) {
+ gData.gnssInterface =
+ (GnssInterface*)loadLocationInterface<GnssInterface,
+ getGnssInterface>("libgnss.so", "getGnssInterface");
+ if (NULL == gData.gnssInterface) {
+ gGnssLoadFailed = true;
+ LOC_LOGW("%s:%d]: No gnss interface available", __func__, __LINE__);
+ } else {
+ gData.gnssInterface->initialize();
+ }
+ }
+ if (NULL != gData.gnssInterface) {
+ gData.gnssInterface->addClient(newLocationAPI, locationCallbacks);
+ if (!requestedCapabilities) {
+ gData.gnssInterface->requestCapabilities(newLocationAPI);
+ requestedCapabilities = true;
+ }
+ }
+ }
+
+ if (isBatchingClient(locationCallbacks)) {
+ if (NULL == gData.batchingInterface && !gBatchingLoadFailed) {
+ gData.batchingInterface =
+ (BatchingInterface*)loadLocationInterface<BatchingInterface,
+ getBatchingInterface>("libbatching.so", "getBatchingInterface");
+ if (NULL == gData.batchingInterface) {
+ gBatchingLoadFailed = true;
+ LOC_LOGW("%s:%d]: No batching interface available", __func__, __LINE__);
+ } else {
+ gData.batchingInterface->initialize();
+ }
+ }
+ if (NULL != gData.batchingInterface) {
+ gData.batchingInterface->addClient(newLocationAPI, locationCallbacks);
+ if (!requestedCapabilities) {
+ gData.batchingInterface->requestCapabilities(newLocationAPI);
+ requestedCapabilities = true;
+ }
+ }
+ }
+
+ if (isGeofenceClient(locationCallbacks)) {
+ if (NULL == gData.geofenceInterface && !gGeofenceLoadFailed) {
+ gData.geofenceInterface =
+ (GeofenceInterface*)loadLocationInterface<GeofenceInterface,
+ getGeofenceInterface>("libgeofencing.so", "getGeofenceInterface");
+ if (NULL == gData.geofenceInterface) {
+ gGeofenceLoadFailed = true;
+ LOC_LOGW("%s:%d]: No geofence interface available", __func__, __LINE__);
+ } else {
+ gData.geofenceInterface->initialize();
+ }
+ }
+ if (NULL != gData.geofenceInterface) {
+ gData.geofenceInterface->addClient(newLocationAPI, locationCallbacks);
+ if (!requestedCapabilities) {
+ gData.geofenceInterface->requestCapabilities(newLocationAPI);
+ requestedCapabilities = true;
+ }
+ }
+ }
+
+ gData.clientData[newLocationAPI] = locationCallbacks;
+
+ pthread_mutex_unlock(&gDataMutex);
+
+ return newLocationAPI;
+}
+
+void
+LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb)
+{
+ bool invokeDestroyCb = false;
+
+ pthread_mutex_lock(&gDataMutex);
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ bool removeFromGnssInf = (NULL != gData.gnssInterface);
+ bool removeFromBatchingInf = (NULL != gData.batchingInterface);
+ bool removeFromGeofenceInf = (NULL != gData.geofenceInterface);
+ bool needToWait = (removeFromGnssInf || removeFromBatchingInf || removeFromGeofenceInf);
+ LOC_LOGe("removeFromGnssInf: %d, removeFromBatchingInf: %d, removeFromGeofenceInf: %d,"
+ "needToWait: %d", removeFromGnssInf, removeFromBatchingInf, removeFromGeofenceInf,
+ needToWait);
+
+ if ((NULL != destroyCompleteCb) && (true == needToWait)) {
+ LocationAPIDestroyCbData destroyCbData = {};
+ destroyCbData.destroyCompleteCb = destroyCompleteCb;
+ // record down from which adapter we need to wait for the destroy complete callback
+ // only when we have received all the needed callbacks from all the associated stacks,
+ // we shall notify the client.
+ destroyCbData.waitAdapterMask =
+ (removeFromGnssInf ? LOCATION_ADAPTER_GNSS_TYPE_BIT : 0);
+ destroyCbData.waitAdapterMask |=
+ (removeFromBatchingInf ? LOCATION_ADAPTER_BATCHING_TYPE_BIT : 0);
+ destroyCbData.waitAdapterMask |=
+ (removeFromGeofenceInf ? LOCATION_ADAPTER_GEOFENCE_TYPE_BIT : 0);
+ gData.destroyClientData[this] = destroyCbData;
+ LOC_LOGi("destroy data stored in the map: 0x%x", destroyCbData.waitAdapterMask);
+ }
+
+ if (removeFromGnssInf) {
+ gData.gnssInterface->removeClient(it->first,
+ onGnssRemoveClientCompleteCb);
+ }
+ if (removeFromBatchingInf) {
+ gData.batchingInterface->removeClient(it->first,
+ onBatchingRemoveClientCompleteCb);
+ }
+ if (removeFromGeofenceInf) {
+ gData.geofenceInterface->removeClient(it->first,
+ onGeofenceRemoveClientCompleteCb);
+ }
+
+ gData.clientData.erase(it);
+
+ if (!needToWait) {
+ invokeDestroyCb = true;
+ }
+ } else {
+ LOC_LOGE("%s:%d]: Location API client %p not found in client data",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ if (invokeDestroyCb) {
+ if (!destroyCompleteCb) {
+ (destroyCompleteCb) ();
+ }
+ delete this;
+ }
+}
+
+LocationAPI::LocationAPI()
+{
+ LOC_LOGD("LOCATION API CONSTRUCTOR");
+}
+
+// private destructor
+LocationAPI::~LocationAPI()
+{
+ LOC_LOGD("LOCATION API DESTRUCTOR");
+}
+
+void
+LocationAPI::updateCallbacks(LocationCallbacks& locationCallbacks)
+{
+ if (nullptr == locationCallbacks.capabilitiesCb ||
+ nullptr == locationCallbacks.responseCb ||
+ nullptr == locationCallbacks.collectiveResponseCb) {
+ return;
+ }
+
+ pthread_mutex_lock(&gDataMutex);
+
+ if (isGnssClient(locationCallbacks)) {
+ if (NULL == gData.gnssInterface && !gGnssLoadFailed) {
+ gData.gnssInterface =
+ (GnssInterface*)loadLocationInterface<GnssInterface,
+ getGnssInterface>("libgnss.so", "getGnssInterface");
+ if (NULL == gData.gnssInterface) {
+ gGnssLoadFailed = true;
+ LOC_LOGW("%s:%d]: No gnss interface available", __func__, __LINE__);
+ } else {
+ gData.gnssInterface->initialize();
+ }
+ }
+ if (NULL != gData.gnssInterface) {
+ // either adds new Client or updates existing Client
+ gData.gnssInterface->addClient(this, locationCallbacks);
+ }
+ }
+
+ if (isBatchingClient(locationCallbacks)) {
+ if (NULL == gData.batchingInterface && !gBatchingLoadFailed) {
+ gData.batchingInterface =
+ (BatchingInterface*)loadLocationInterface<BatchingInterface,
+ getBatchingInterface>("libbatching.so", "getBatchingInterface");
+ if (NULL == gData.batchingInterface) {
+ gBatchingLoadFailed = true;
+ LOC_LOGW("%s:%d]: No batching interface available", __func__, __LINE__);
+ } else {
+ gData.batchingInterface->initialize();
+ }
+ }
+ if (NULL != gData.batchingInterface) {
+ // either adds new Client or updates existing Client
+ gData.batchingInterface->addClient(this, locationCallbacks);
+ }
+ }
+
+ if (isGeofenceClient(locationCallbacks)) {
+ if (NULL == gData.geofenceInterface && !gGeofenceLoadFailed) {
+ gData.geofenceInterface =
+ (GeofenceInterface*)loadLocationInterface<GeofenceInterface,
+ getGeofenceInterface>("libgeofencing.so", "getGeofenceInterface");
+ if (NULL == gData.geofenceInterface) {
+ gGeofenceLoadFailed = true;
+ LOC_LOGW("%s:%d]: No geofence interface available", __func__, __LINE__);
+ } else {
+ gData.geofenceInterface->initialize();
+ }
+ }
+ if (NULL != gData.geofenceInterface) {
+ // either adds new Client or updates existing Client
+ gData.geofenceInterface->addClient(this, locationCallbacks);
+ }
+ }
+
+ gData.clientData[this] = locationCallbacks;
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+uint32_t
+LocationAPI::startTracking(TrackingOptions& trackingOptions)
+{
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ if (NULL != gData.gnssInterface) {
+ id = gData.gnssInterface->startTracking(this, trackingOptions);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+ } else {
+ LOC_LOGE("%s:%d]: Location API client %p not found in client data",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+void
+LocationAPI::stopTracking(uint32_t id)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ if (gData.gnssInterface != NULL) {
+ gData.gnssInterface->stopTracking(this, id);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+ } else {
+ LOC_LOGE("%s:%d]: Location API client %p not found in client data",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::updateTrackingOptions(
+ uint32_t id, TrackingOptions& trackingOptions)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ if (gData.gnssInterface != NULL) {
+ gData.gnssInterface->updateTrackingOptions(this, id, trackingOptions);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+ } else {
+ LOC_LOGE("%s:%d]: Location API client %p not found in client data",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+uint32_t
+LocationAPI::startBatching(BatchingOptions &batchingOptions)
+{
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (NULL != gData.batchingInterface) {
+ id = gData.batchingInterface->startBatching(this, batchingOptions);
+ } else {
+ LOC_LOGE("%s:%d]: No batching interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+void
+LocationAPI::stopBatching(uint32_t id)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (NULL != gData.batchingInterface) {
+ gData.batchingInterface->stopBatching(this, id);
+ } else {
+ LOC_LOGE("%s:%d]: No batching interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::updateBatchingOptions(uint32_t id, BatchingOptions& batchOptions)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (NULL != gData.batchingInterface) {
+ gData.batchingInterface->updateBatchingOptions(this, id, batchOptions);
+ } else {
+ LOC_LOGE("%s:%d]: No batching interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::getBatchedLocations(uint32_t id, size_t count)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.batchingInterface != NULL) {
+ gData.batchingInterface->getBatchedLocations(this, id, count);
+ } else {
+ LOC_LOGE("%s:%d]: No batching interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+uint32_t*
+LocationAPI::addGeofences(size_t count, GeofenceOption* options, GeofenceInfo* info)
+{
+ uint32_t* ids = NULL;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.geofenceInterface != NULL) {
+ ids = gData.geofenceInterface->addGeofences(this, count, options, info);
+ } else {
+ LOC_LOGE("%s:%d]: No geofence interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return ids;
+}
+
+void
+LocationAPI::removeGeofences(size_t count, uint32_t* ids)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.geofenceInterface != NULL) {
+ gData.geofenceInterface->removeGeofences(this, count, ids);
+ } else {
+ LOC_LOGE("%s:%d]: No geofence interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.geofenceInterface != NULL) {
+ gData.geofenceInterface->modifyGeofences(this, count, ids, options);
+ } else {
+ LOC_LOGE("%s:%d]: No geofence interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::pauseGeofences(size_t count, uint32_t* ids)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.geofenceInterface != NULL) {
+ gData.geofenceInterface->pauseGeofences(this, count, ids);
+ } else {
+ LOC_LOGE("%s:%d]: No geofence interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::resumeGeofences(size_t count, uint32_t* ids)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.geofenceInterface != NULL) {
+ gData.geofenceInterface->resumeGeofences(this, count, ids);
+ } else {
+ LOC_LOGE("%s:%d]: No geofence interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::gnssNiResponse(uint32_t id, GnssNiResponse response)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ gData.gnssInterface->gnssNiResponse(this, id, response);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+LocationControlAPI*
+LocationControlAPI::createInstance(LocationControlCallbacks& locationControlCallbacks)
+{
+ LocationControlAPI* controlAPI = NULL;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (nullptr != locationControlCallbacks.responseCb && NULL == gData.controlAPI) {
+ if (NULL == gData.gnssInterface && !gGnssLoadFailed) {
+ gData.gnssInterface =
+ (GnssInterface*)loadLocationInterface<GnssInterface,
+ getGnssInterface>("libgnss.so", "getGnssInterface");
+ if (NULL == gData.gnssInterface) {
+ gGnssLoadFailed = true;
+ LOC_LOGW("%s:%d]: No gnss interface available", __func__, __LINE__);
+ } else {
+ gData.gnssInterface->initialize();
+ }
+ }
+ if (NULL != gData.gnssInterface) {
+ gData.controlAPI = new LocationControlAPI();
+ gData.controlCallbacks = locationControlCallbacks;
+ gData.gnssInterface->setControlCallbacks(locationControlCallbacks);
+ controlAPI = gData.controlAPI;
+ }
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return controlAPI;
+}
+
+void
+LocationControlAPI::destroy()
+{
+ delete this;
+}
+
+LocationControlAPI::LocationControlAPI()
+{
+ LOC_LOGD("LOCATION CONTROL API CONSTRUCTOR");
+}
+
+LocationControlAPI::~LocationControlAPI()
+{
+ LOC_LOGD("LOCATION CONTROL API DESTRUCTOR");
+ pthread_mutex_lock(&gDataMutex);
+
+ gData.controlAPI = NULL;
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+uint32_t
+LocationControlAPI::enable(LocationTechnologyType techType)
+{
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->enable(techType);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location Control API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+void
+LocationControlAPI::disable(uint32_t id)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ gData.gnssInterface->disable(id);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location Control API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+uint32_t*
+LocationControlAPI::gnssUpdateConfig(GnssConfig config)
+{
+ uint32_t* ids = NULL;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ ids = gData.gnssInterface->gnssUpdateConfig(config);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location Control API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return ids;
+}
+
+uint32_t* LocationControlAPI::gnssGetConfig(GnssConfigFlagsMask mask) {
+
+ uint32_t* ids = NULL;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (NULL != gData.gnssInterface) {
+ ids = gData.gnssInterface->gnssGetConfig(mask);
+ } else {
+ LOC_LOGe("No gnss interface available for Control API client %p", this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return ids;
+}
+
+uint32_t
+LocationControlAPI::gnssDeleteAidingData(GnssAidingData& data)
+{
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->gnssDeleteAidingData(data);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss interface available for Location Control API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::resetConstellationConfig() {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->gnssResetSvConfig();
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->gnssUpdateSvConfig(
+ svTypeConfig, svIdConfig);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold, uint32_t energyBudget) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->setConstrainedTunc(enable,
+ tuncThreshold,
+ energyBudget);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configPositionAssistedClockEstimator(bool enable) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->setPositionAssistedClockEstimator(enable);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configLeverArm(const LeverArmConfigInfo& configInfo) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->configLeverArm(configInfo);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configRobustLocation(bool enable, bool enableForE911) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->configRobustLocation(enable, enableForE911);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
diff --git a/gps/location/LocationAPI.h b/gps/location/LocationAPI.h
new file mode 100644
index 0000000..c949fcc
--- /dev/null
+++ b/gps/location/LocationAPI.h
@@ -0,0 +1,400 @@
+/* Copyright (c) 2017-2020 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 LOCATIONAPI_H
+#define LOCATIONAPI_H
+
+#include "ILocationAPI.h"
+
+class LocationAPI : public ILocationAPI
+{
+private:
+ LocationAPI();
+ ~LocationAPI();
+
+public:
+ /* creates an instance to LocationAPI object.
+ Will return NULL if mandatory parameters are invalid or if the maximum number
+ of instances have been reached */
+ static LocationAPI* createInstance(LocationCallbacks&);
+
+ /* destroy/cleans up the instance, which should be called when LocationControlAPI object is
+ no longer needed. LocationControlAPI* returned from createInstance will no longer valid
+ after destroy is called.
+ If the caller allocates the memory for LocationControlCallbacks used in
+ LocationControlAPI::createInstance, then the caller must ensure that the memory still remains
+ valid until destroyCompleteCb is invoked.
+ */
+ void destroy(locationApiDestroyCompleteCallback destroyCompleteCb=nullptr);
+
+ void onRemoveClientCompleteCb (LocationAdapterTypeMask adapterType);
+
+ /* updates/changes the callbacks that will be called.
+ mandatory callbacks must be present for callbacks to be successfully updated
+ no return value */
+ virtual void updateCallbacks(LocationCallbacks&) override;
+
+ /* ================================== TRACKING ================================== */
+
+ /* startTracking starts a tracking session, which returns a session id that will be
+ used by the other tracking APIs and also in the responseCallback to match command
+ with response. locations are reported on the trackingCallback passed in createInstance
+ periodically according to LocationOptions.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successfully started
+ LOCATION_ERROR_ALREADY_STARTED if a startTracking session is already in progress
+ LOCATION_ERROR_CALLBACK_MISSING if no trackingCallback was passed in createInstance
+ LOCATION_ERROR_INVALID_PARAMETER if TrackingOptions parameter is invalid */
+ virtual uint32_t startTracking(TrackingOptions&) override;
+
+ /* stopTracking stops a tracking session associated with id parameter.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
+ virtual void stopTracking(uint32_t id) override;
+
+ /* updateTrackingOptions changes the TrackingOptions of a tracking session associated with id
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if TrackingOptions parameters are invalid
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */
+ virtual void updateTrackingOptions(uint32_t id, TrackingOptions&) override;
+
+ /* ================================== BATCHING ================================== */
+
+ /* startBatching starts a batching session, which returns a session id that will be
+ used by the other batching APIs and also in the responseCallback to match command
+ with response. locations are reported on the batchingCallback passed in createInstance
+ periodically according to LocationOptions. A batching session starts tracking on
+ the low power processor and delivers them in batches by the batchingCallback when
+ the batch is full or when getBatchedLocations is called. This allows for the processor
+ that calls this API to sleep when the low power processor can batch locations in the
+ backgroup and wake up the processor calling the API only when the batch is full, thus
+ saving power
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_ALREADY_STARTED if a startBatching session is already in progress
+ LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback was passed in createInstance
+ LOCATION_ERROR_INVALID_PARAMETER if a parameter is invalid
+ LOCATION_ERROR_NOT_SUPPORTED if batching is not supported */
+ virtual uint32_t startBatching(BatchingOptions&) override;
+
+ /* stopBatching stops a batching session associated with id parameter.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with batching session */
+ virtual void stopBatching(uint32_t id) override;
+
+ /* updateBatchingOptions changes the BatchingOptions of a batching session associated with id
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if BatchingOptions parameters are invalid
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
+ virtual void updateBatchingOptions(uint32_t id, BatchingOptions&) override;
+
+ /* getBatchedLocations gets a number of locations that are currently stored/batched
+ on the low power processor, delivered by the batchingCallback passed in createInstance.
+ Location are then deleted from the batch stored on the low power processor.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful, will be followed by batchingCallback call
+ LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback was passed in createInstance
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */
+ virtual void getBatchedLocations(uint32_t id, size_t count) override;
+
+ /* ================================== GEOFENCE ================================== */
+
+ /* addGeofences adds any number of geofences and returns an array of geofence ids that
+ will be used by the other geofence APIs and also in the collectiveResponseCallback to
+ match command with response. The geofenceBreachCallback will deliver the status of each
+ geofence according to the GeofenceOption for each. The geofence id array returned will
+ be valid until the collectiveResponseCallback is called and has returned.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_CALLBACK_MISSING if no geofenceBreachCallback
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ LOCATION_ERROR_NOT_SUPPORTED if geofence is not supported */
+ virtual uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*) override;
+
+ /* removeGeofences removes any number of geofences. Caller should delete ids array after
+ removeGeofences returneds.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+ virtual void removeGeofences(size_t count, uint32_t* ids) override;
+
+ /* modifyGeofences modifies any number of geofences. Caller should delete ids array after
+ modifyGeofences returns.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid */
+ virtual void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options) override;
+
+ /* pauseGeofences pauses any number of geofences, which is similar to removeGeofences,
+ only that they can be resumed at any time. Caller should delete ids array after
+ pauseGeofences returns.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+ virtual void pauseGeofences(size_t count, uint32_t* ids) override;
+
+ /* resumeGeofences resumes any number of geofences that are currently paused. Caller should
+ delete ids array after resumeGeofences returns.
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */
+ virtual void resumeGeofences(size_t count, uint32_t* ids) override;
+
+ /* ================================== GNSS ====================================== */
+
+ /* gnssNiResponse is called in response to a gnssNiCallback.
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters in GnssNiResponse are invalid
+ LOCATION_ERROR_ID_UNKNOWN if id does not match a gnssNiCallback */
+ virtual void gnssNiResponse(uint32_t id, GnssNiResponse response) override;
+};
+
+typedef struct {
+ size_t size; // set to sizeof(LocationControlCallbacks)
+ responseCallback responseCb; // mandatory
+ collectiveResponseCallback collectiveResponseCb; // mandatory
+ gnssConfigCallback gnssConfigCb; // optional
+} LocationControlCallbacks;
+
+class LocationControlAPI : public ILocationControlAPI
+{
+private:
+ LocationControlAPI();
+ ~LocationControlAPI();
+
+public:
+ /* creates an instance to LocationControlAPI object.
+ Will return NULL if mandatory parameters are invalid or if the maximum number
+ of instances have been reached. Only once instance allowed */
+ static LocationControlAPI* createInstance(LocationControlCallbacks&);
+
+ /* destroy/cleans up the instance, which should be called when LocationControlAPI object is
+ no longer needed. LocationControlAPI* returned from createInstance will no longer valid
+ after destroy is called */
+ void destroy();
+
+ /* enable will enable specific location technology to be used for calculation locations and
+ will effectively start a control session if call is successful, which returns a session id
+ that will be returned in responseCallback to match command with response. The session id is
+ also needed to call the disable command.
+ This effect is global for all clients of LocationAPI
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ALREADY_STARTED if an enable was already called for this techType
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */
+ uint32_t enable(LocationTechnologyType techType);
+
+ /* disable will disable specific location technology to be used for calculation locations and
+ effectively ends the control session if call is successful.
+ id parameter is the session id that was returned in enable responseCallback for techType.
+ The session id is no longer valid after disable's responseCallback returns success.
+ This effect is global for all clients of LocationAPI
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_ID_UNKNOWN if id was not returned from responseCallback from enable
+ LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */
+ void disable(uint32_t id);
+
+ /* gnssUpdateConfig updates the gnss specific configuration, which returns a session id array
+ with an id for each of the bits set in GnssConfig.flags, order from low bits to high bits.
+ The response for each config that is set will be returned in collectiveResponseCallback.
+ The session id array returned will be valid until the collectiveResponseCallback is called
+ and has returned. This effect is global for all clients of LocationAPI
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_INVALID_PARAMETER if any other parameters are invalid
+ LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */
+ virtual uint32_t* gnssUpdateConfig(GnssConfig config) override;
+
+ /* gnssGetConfig fetches the current constellation and SV configuration
+ on the GNSS engine.
+ Returns a session id array with an id for each of the bits set in
+ the mask parameter, order from low bits to high bits.
+ Response is sent via the registered gnssConfigCallback.
+ This effect is global for all clients of LocationAPI
+ collectiveResponseCallback returns:
+ LOCATION_ERROR_SUCCESS if session was successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameter is invalid
+ LOCATION_ERROR_CALLBACK_MISSING If no gnssConfigCallback
+ was passed in createInstance
+ LOCATION_ERROR_NOT_SUPPORTED If read of requested configuration
+ is not supported */
+ uint32_t* gnssGetConfig(GnssConfigFlagsMask mask);
+
+ /* delete specific gnss aiding data for testing, which returns a session id
+ that will be returned in responseCallback to match command with response.
+ Only allowed in userdebug builds. This effect is global for all clients of LocationAPI
+ responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
+ virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) override;
+
+ /** @brief
+ Reset the constellation settings to modem default.
+
+ @param
+ None
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t resetConstellationConfig() override;
+
+ /** @brief
+ Configure the constellation to be used by the GNSS engine on
+ modem.
+
+ @param
+ constellationConfig: specify the constellation configuration
+ used by GNSS engine.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) override;
+
+ /** @brief
+ Enable or disable the constrained time uncertainty feature.
+
+ @param
+ enable: true to enable the constrained time uncertainty
+ feature and false to disable the constrainted time
+ uncertainty feature.
+
+ @param
+ tuncThreshold: this specifies the time uncertainty threshold
+ that gps engine need to maintain, in units of milli-seconds.
+ Default is 0.0 meaning that modem default value of time
+ uncertainty threshold will be used. This parameter is
+ ignored when requesting to disable this feature.
+
+ @param
+ energyBudget: this specifies the power budget that gps
+ engine is allowed to spend to maintain the time uncertainty.
+ Default is 0 meaning that GPS engine is not constained by
+ power budget and can spend as much power as needed. The
+ parameter need to be specified in units of 0.1 milli watt
+ second. This parameter is ignored requesting to disable this
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters
+ are invalid
+ */
+ virtual uint32_t configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold = 0.0,
+ uint32_t energyBudget = 0) override;
+
+ /** @brief
+ Enable or disable position assisted clock estimator feature.
+
+ @param
+ enable: true to enable position assisted clock estimator and
+ false to disable the position assisted clock estimator
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configPositionAssistedClockEstimator(bool enable) override;
+
+ /** @brief
+ Sets the lever arm parameters for the vehicle.
+
+ @param
+ configInfo: lever arm configuration info regarding below two
+ types of lever arm info:
+ a: GNSS Antenna w.r.t the origin at the IMU e.g.: inertial
+ measurement unit.
+ b: lever arm parameters regarding the OPF (output frame)
+ w.r.t the origin (at the GPS Antenna). Vehicle manufacturers
+ prefer the position output to be tied to a specific point in
+ the vehicle rather than where the antenna is placed
+ (midpoint of the rear axle is typical).
+
+ Caller can choose types of lever arm info to configure via the
+ leverMarkTypeMask.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) override;
+
+ /** @brief
+ Configure the robust location setting.
+
+ @param
+ enable: true to enable robust location and false to disable
+ robust location.
+
+ @param
+ enableForE911: true to enable robust location when device is
+ on E911 session and false to disable on E911 session.
+ This parameter is only valid if robust location is enabled.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configRobustLocation(bool enable, bool enableForE911) override;
+};
+
+#endif /* LOCATIONAPI_H */
diff --git a/gps/location/LocationAPIClientBase.cpp b/gps/location/LocationAPIClientBase.cpp
new file mode 100644
index 0000000..c241660
--- /dev/null
+++ b/gps/location/LocationAPIClientBase.cpp
@@ -0,0 +1,973 @@
+/* Copyright (c) 2017-2020 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.
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_APIClientBase"
+
+#include <loc_pla.h>
+#include <log_util.h>
+#include <inttypes.h>
+#include <loc_cfg.h>
+#include "LocationAPIClientBase.h"
+
+#define GEOFENCE_SESSION_ID 0xFFFFFFFF
+#define CONFIG_SESSION_ID 0xFFFFFFFF
+
+// LocationAPIControlClient
+LocationAPIControlClient::LocationAPIControlClient() :
+ mEnabled(false)
+{
+ pthread_mutex_init(&mMutex, nullptr);
+
+ for (int i = 0; i < CTRL_REQUEST_MAX; i++) {
+ mRequestQueues[i].reset((uint32_t)0);
+ }
+
+ memset(&mConfig, 0, sizeof(GnssConfig));
+
+ LocationControlCallbacks locationControlCallbacks;
+ locationControlCallbacks.size = sizeof(LocationControlCallbacks);
+
+ locationControlCallbacks.responseCb =
+ [this](LocationError error, uint32_t id) {
+ onCtrlResponseCb(error, id);
+ };
+ locationControlCallbacks.collectiveResponseCb =
+ [this](size_t count, LocationError* errors, uint32_t* ids) {
+ onCtrlCollectiveResponseCb(count, errors, ids);
+ };
+
+ mLocationControlAPI = LocationControlAPI::createInstance(locationControlCallbacks);
+}
+
+LocationAPIControlClient::~LocationAPIControlClient()
+{
+ pthread_mutex_lock(&mMutex);
+
+ if (mLocationControlAPI) {
+ mLocationControlAPI->destroy();
+ mLocationControlAPI = nullptr;
+ }
+
+ for (int i = 0; i < CTRL_REQUEST_MAX; i++) {
+ mRequestQueues[i].reset((uint32_t)0);
+ }
+
+ pthread_mutex_unlock(&mMutex);
+
+ pthread_mutex_destroy(&mMutex);
+}
+
+uint32_t LocationAPIControlClient::locAPIGnssDeleteAidingData(GnssAidingData& data)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationControlAPI) {
+ uint32_t session = mLocationControlAPI->gnssDeleteAidingData(data);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, session);
+ mRequestQueues[CTRL_REQUEST_DELETEAIDINGDATA].reset(session);
+ mRequestQueues[CTRL_REQUEST_DELETEAIDINGDATA].push(new GnssDeleteAidingDataRequest(*this));
+
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+uint32_t LocationAPIControlClient::locAPIEnable(LocationTechnologyType techType)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mEnabled) {
+ // just return success if already enabled
+ retVal = LOCATION_ERROR_SUCCESS;
+ } else if (mLocationControlAPI) {
+ uint32_t session = mLocationControlAPI->enable(techType);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, session);
+ mRequestQueues[CTRL_REQUEST_CONTROL].reset(session);
+ mRequestQueues[CTRL_REQUEST_CONTROL].push(new EnableRequest(*this));
+ retVal = LOCATION_ERROR_SUCCESS;
+ mEnabled = true;
+ } else {
+ LOC_LOGE("%s:%d] failed.", __FUNCTION__, __LINE__);
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+void LocationAPIControlClient::locAPIDisable()
+{
+ pthread_mutex_lock(&mMutex);
+ if (mEnabled && mLocationControlAPI) {
+ uint32_t session = 0;
+ session = mRequestQueues[CTRL_REQUEST_CONTROL].getSession();
+ if (session > 0) {
+ mRequestQueues[CTRL_REQUEST_CONTROL].push(new DisableRequest(*this));
+ mLocationControlAPI->disable(session);
+ mEnabled = false;
+ } else {
+ LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, session);
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+uint32_t LocationAPIControlClient::locAPIGnssUpdateConfig(GnssConfig config)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+
+ pthread_mutex_lock(&mMutex);
+ if (mLocationControlAPI) {
+ if (mConfig.equals(config)) {
+ LOC_LOGv("GnssConfig is identical to previous call");
+ retVal = LOCATION_ERROR_SUCCESS;
+ } else {
+ mConfig = config;
+ uint32_t* idArray = mLocationControlAPI->gnssUpdateConfig(config);
+ LOC_LOGv("gnssUpdateConfig return array: %p", idArray);
+ if (nullptr != idArray) {
+ if (nullptr != mRequestQueues[CTRL_REQUEST_CONFIG_UPDATE].getSessionArrayPtr()) {
+ mRequestQueues[CTRL_REQUEST_CONFIG_UPDATE].reset(idArray);
+ }
+ mRequestQueues[CTRL_REQUEST_CONFIG_UPDATE].push(new GnssUpdateConfigRequest(*this));
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+ return retVal;
+}
+
+uint32_t LocationAPIControlClient::locAPIGnssGetConfig(GnssConfigFlagsMask mask)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+
+ pthread_mutex_lock(&mMutex);
+ if (mLocationControlAPI) {
+
+ uint32_t* idArray = mLocationControlAPI->gnssGetConfig(mask);
+ LOC_LOGv("gnssGetConfig return array: %p", idArray);
+ if (nullptr != idArray) {
+ if (nullptr != mRequestQueues[CTRL_REQUEST_CONFIG_GET].getSessionArrayPtr()) {
+ mRequestQueues[CTRL_REQUEST_CONFIG_GET].reset(idArray);
+ }
+ mRequestQueues[CTRL_REQUEST_CONFIG_GET].push(new GnssGetConfigRequest(*this));
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+ return retVal;
+}
+
+void LocationAPIControlClient::onCtrlResponseCb(LocationError error, uint32_t id)
+{
+ if (error != LOCATION_ERROR_SUCCESS) {
+ LOC_LOGE("%s:%d] ERROR: %d ID: %d", __FUNCTION__, __LINE__, error, id);
+ } else {
+ LOC_LOGV("%s:%d] SUCCESS: %d id: %d", __FUNCTION__, __LINE__, error, id);
+ }
+ LocationAPIRequest* request = getRequestBySession(id);
+ if (request) {
+ request->onResponse(error, id);
+ delete request;
+ }
+}
+
+void LocationAPIControlClient::onCtrlCollectiveResponseCb(
+ size_t count, LocationError* errors, uint32_t* ids)
+{
+ for (size_t i = 0; i < count; i++) {
+ if (errors[i] != LOCATION_ERROR_SUCCESS) {
+ LOC_LOGE("%s:%d] ERROR: %d ID: %d", __FUNCTION__, __LINE__, errors[i], ids[i]);
+ } else {
+ LOC_LOGV("%s:%d] SUCCESS: %d id: %d", __FUNCTION__, __LINE__, errors[i], ids[i]);
+ }
+ }
+ LocationAPIRequest* request = getRequestBySessionArrayPtr(ids);
+ if (request) {
+ request->onCollectiveResponse(count, errors, ids);
+ delete request;
+ }
+}
+
+LocationAPIRequest* LocationAPIControlClient::getRequestBySession(uint32_t session)
+{
+ pthread_mutex_lock(&mMutex);
+ LocationAPIRequest* request = nullptr;
+
+ if (mRequestQueues[CTRL_REQUEST_DELETEAIDINGDATA].getSession() == session) {
+ request = mRequestQueues[CTRL_REQUEST_DELETEAIDINGDATA].pop();
+ } else if (mRequestQueues[CTRL_REQUEST_CONTROL].getSession() == session) {
+ request = mRequestQueues[CTRL_REQUEST_CONTROL].pop();
+ }
+
+ pthread_mutex_unlock(&mMutex);
+ return request;
+}
+
+LocationAPIRequest*
+LocationAPIControlClient::getRequestBySessionArrayPtr(
+ uint32_t* sessionArrayPtr)
+{
+ pthread_mutex_lock(&mMutex);
+ LocationAPIRequest* request = nullptr;
+
+ if (mRequestQueues[CTRL_REQUEST_CONFIG_UPDATE].getSessionArrayPtr() == sessionArrayPtr) {
+ request = mRequestQueues[CTRL_REQUEST_CONFIG_UPDATE].pop();
+ } else if (mRequestQueues[CTRL_REQUEST_CONFIG_GET].getSessionArrayPtr() == sessionArrayPtr) {
+ request = mRequestQueues[CTRL_REQUEST_CONFIG_GET].pop();
+ }
+
+ pthread_mutex_unlock(&mMutex);
+ return request;
+}
+
+// LocationAPIClientBase
+LocationAPIClientBase::LocationAPIClientBase() :
+ mGeofenceBreachCallback(nullptr),
+ mBatchingStatusCallback(nullptr),
+ mLocationAPI(nullptr),
+ mBatchSize(-1),
+ mTracking(false)
+{
+
+ // use recursive mutex, in case callback come from the same thread
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&mMutex, &attr);
+
+ for (int i = 0; i < REQUEST_MAX; i++) {
+ mRequestQueues[i].reset((uint32_t)0);
+ }
+}
+
+void LocationAPIClientBase::locAPISetCallbacks(LocationCallbacks& locationCallbacks)
+{
+ pthread_mutex_lock(&mMutex);
+
+ if (locationCallbacks.geofenceBreachCb != nullptr) {
+ mGeofenceBreachCallback = locationCallbacks.geofenceBreachCb;
+ locationCallbacks.geofenceBreachCb =
+ [this](GeofenceBreachNotification geofenceBreachNotification) {
+ beforeGeofenceBreachCb(geofenceBreachNotification);
+ };
+ }
+
+ locationCallbacks.capabilitiesCb =
+ [this](LocationCapabilitiesMask capabilitiesMask) {
+ onCapabilitiesCb(capabilitiesMask);
+ };
+ locationCallbacks.responseCb = [this](LocationError error, uint32_t id) {
+ onResponseCb(error, id);
+ };
+ locationCallbacks.collectiveResponseCb =
+ [this](size_t count, LocationError* errors, uint32_t* ids) {
+ onCollectiveResponseCb(count, errors, ids);
+ };
+
+ if (locationCallbacks.batchingStatusCb != nullptr) {
+ mBatchingStatusCallback = locationCallbacks.batchingStatusCb;
+ locationCallbacks.batchingStatusCb =
+ [this](BatchingStatusInfo batchStatus, std::list<uint32_t> & tripCompletedList) {
+ beforeBatchingStatusCb(batchStatus, tripCompletedList);
+ };
+ }
+
+ if (mLocationAPI == nullptr ) {
+ mLocationAPI = LocationAPI::createInstance(locationCallbacks);
+ } else {
+ mLocationAPI->updateCallbacks(locationCallbacks);
+ }
+
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::destroy()
+{
+ LOC_LOGD("LocationAPIClientBase::destroy()");
+
+ pthread_mutex_lock(&mMutex);
+
+ mGeofenceBreachCallback = nullptr;
+
+ for (int i = 0; i < REQUEST_MAX; i++) {
+ mRequestQueues[i].reset((uint32_t)0);
+ }
+
+ LocationAPI* localHandle = nullptr;
+ if (nullptr != mLocationAPI) {
+ localHandle = mLocationAPI;
+ mLocationAPI = nullptr;
+ }
+
+ pthread_mutex_unlock(&mMutex);
+
+ // Invoking destroy has the possibility of destroy complete callback
+ // being invoked right away in the same context, hence no instance
+ // member must be accessed after the destroy call.
+ if (nullptr != localHandle) {
+ localHandle->destroy([this]() {onLocationApiDestroyCompleteCb();});
+ }
+}
+
+LocationAPIClientBase::~LocationAPIClientBase()
+{
+ pthread_mutex_destroy(&mMutex);
+}
+void LocationAPIClientBase::onLocationApiDestroyCompleteCb()
+{
+ LOC_LOGD("LocationAPIClientBase::onLocationApiDestroyCompleteCb()");
+ delete this;
+}
+
+uint32_t LocationAPIClientBase::locAPIStartTracking(TrackingOptions& options)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ if (mTracking) {
+ LOC_LOGW("%s:%d] Existing tracking session present", __FUNCTION__, __LINE__);
+ } else {
+ uint32_t session = mLocationAPI->startTracking(options);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, session);
+ // onResponseCb might be called from other thread immediately after
+ // startTracking returns, so we are not going to unlock mutex
+ // until StartTrackingRequest is pushed into mRequestQueues[REQUEST_TRACKING]
+ mRequestQueues[REQUEST_TRACKING].reset(session);
+ mRequestQueues[REQUEST_TRACKING].push(new StartTrackingRequest(*this));
+ mTracking = true;
+ }
+
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+void LocationAPIClientBase::locAPIStopTracking()
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t session = 0;
+ session = mRequestQueues[REQUEST_TRACKING].getSession();
+ if (session > 0) {
+ mRequestQueues[REQUEST_TRACKING].push(new StopTrackingRequest(*this));
+ mLocationAPI->stopTracking(session);
+ mTracking = false;
+ } else {
+ LOC_LOGD("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, session);
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIUpdateTrackingOptions(TrackingOptions& options)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t session = 0;
+ session = mRequestQueues[REQUEST_TRACKING].getSession();
+ // Not allowing to update the tracking options for stopped session
+ if (session > 0 && mTracking) {
+ mRequestQueues[REQUEST_TRACKING].push(new UpdateTrackingOptionsRequest(*this));
+ mLocationAPI->updateTrackingOptions(session, options);
+ } else {
+ LOC_LOGe("invalid or stopped session: %d.", session);
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+int32_t LocationAPIClientBase::locAPIGetBatchSize()
+{
+ if (mBatchSize == -1) {
+ const loc_param_s_type flp_conf_param_table[] =
+ {
+ {"BATCH_SIZE", &mBatchSize, nullptr, 'n'},
+ };
+ 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;
+ }
+ }
+ return mBatchSize;
+}
+
+uint32_t LocationAPIClientBase::locAPIStartSession(
+ uint32_t id, uint32_t sessionMode, TrackingOptions&& options)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+
+ if (mSessionBiDict.hasId(id)) {
+ LOC_LOGE("%s:%d] session %d has already started.", __FUNCTION__, __LINE__, id);
+ retVal = LOCATION_ERROR_ALREADY_STARTED;
+ } else {
+ uint32_t trackingSession = 0;
+ uint32_t batchingSession = 0;
+
+ if (sessionMode == SESSION_MODE_ON_FIX) {
+ trackingSession = mLocationAPI->startTracking(options);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, trackingSession);
+ mRequestQueues[REQUEST_SESSION].push(new StartTrackingRequest(*this));
+ } else {
+ // Fill in the batch mode
+ BatchingOptions batchOptions = {};
+ batchOptions.size = sizeof(BatchingOptions);
+ switch (sessionMode) {
+ case SESSION_MODE_ON_FULL:
+ batchOptions.batchingMode = BATCHING_MODE_ROUTINE;
+ break;
+ case SESSION_MODE_ON_TRIP_COMPLETED:
+ batchOptions.batchingMode = BATCHING_MODE_TRIP;
+ break;
+ default:
+ batchOptions.batchingMode = BATCHING_MODE_NO_AUTO_REPORT;
+ break;
+ }
+
+ // Populate location option values
+ batchOptions.minDistance = options.minDistance;
+ batchOptions.minInterval = options.minInterval;
+ batchOptions.mode = options.mode;
+
+ batchingSession = mLocationAPI->startBatching(batchOptions);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, batchingSession);
+ mRequestQueues[REQUEST_SESSION].setSession(batchingSession);
+ mRequestQueues[REQUEST_SESSION].push(new StartBatchingRequest(*this));
+ }
+
+ uint32_t session = ((sessionMode != SESSION_MODE_ON_FIX) ?
+ batchingSession : trackingSession);
+
+ SessionEntity entity;
+ entity.id = id;
+ entity.trackingSession = trackingSession;
+ entity.batchingSession = batchingSession;
+ entity.sessionMode = sessionMode;
+ mSessionBiDict.set(id, session, entity);
+
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+uint32_t LocationAPIClientBase::locAPIStopSession(uint32_t id)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+
+ if (mSessionBiDict.hasId(id)) {
+ SessionEntity entity = mSessionBiDict.getExtById(id);
+
+ uint32_t trackingSession = entity.trackingSession;
+ uint32_t batchingSession = entity.batchingSession;
+ uint32_t sMode = entity.sessionMode;
+
+ if (sMode == SESSION_MODE_ON_FIX) {
+ mRequestQueues[REQUEST_SESSION].push(new StopTrackingRequest(*this));
+ mLocationAPI->stopTracking(trackingSession);
+ } else {
+ mRequestQueues[REQUEST_SESSION].push(new StopBatchingRequest(*this));
+ mLocationAPI->stopBatching(batchingSession);
+ }
+
+ retVal = LOCATION_ERROR_SUCCESS;
+ } else {
+ retVal = LOCATION_ERROR_ID_UNKNOWN;
+ LOC_LOGE("%s:%d] session %d is not exist.", __FUNCTION__, __LINE__, id);
+ }
+
+ }
+ pthread_mutex_unlock(&mMutex);
+ return retVal;
+}
+
+uint32_t LocationAPIClientBase::locAPIUpdateSessionOptions(
+ uint32_t id, uint32_t sessionMode, TrackingOptions&& options)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+
+ if (mSessionBiDict.hasId(id)) {
+ SessionEntity entity = mSessionBiDict.getExtById(id);
+
+ uint32_t trackingSession = entity.trackingSession;
+ uint32_t batchingSession = entity.batchingSession;
+ uint32_t sMode = entity.sessionMode;
+
+ if (sessionMode == SESSION_MODE_ON_FIX) {
+ // we only add an UpdateTrackingOptionsRequest to mRequestQueues[REQUEST_SESSION],
+ // even if this update request will stop batching and then start tracking.
+ mRequestQueues[REQUEST_SESSION].push(new UpdateTrackingOptionsRequest(*this));
+ if (sMode == SESSION_MODE_ON_FIX) {
+ mLocationAPI->updateTrackingOptions(trackingSession, options);
+ } else {
+ // stop batching
+ // batchingSession will be removed from mSessionBiDict soon,
+ // so we don't need to add a new request to mRequestQueues[REQUEST_SESSION].
+ mLocationAPI->stopBatching(batchingSession);
+ batchingSession = 0;
+ mRequestQueues[REQUEST_SESSION].setSession(batchingSession);
+
+ // start tracking
+ trackingSession = mLocationAPI->startTracking(options);
+ LOC_LOGI("%s:%d] start new session: %d",
+ __FUNCTION__, __LINE__, trackingSession);
+ }
+ } else {
+ // we only add an UpdateBatchingOptionsRequest to mRequestQueues[REQUEST_SESSION],
+ // even if this update request will stop tracking and then start batching.
+ mRequestQueues[REQUEST_SESSION].push(new UpdateBatchingOptionsRequest(*this));
+ BatchingOptions batchOptions = {};
+ batchOptions.size = sizeof(BatchingOptions);
+ switch (sessionMode) {
+ case SESSION_MODE_ON_FULL:
+ batchOptions.batchingMode = BATCHING_MODE_ROUTINE;
+ break;
+ case SESSION_MODE_ON_TRIP_COMPLETED:
+ batchOptions.batchingMode = BATCHING_MODE_TRIP;
+ break;
+ default:
+ batchOptions.batchingMode = BATCHING_MODE_NO_AUTO_REPORT;
+ break;
+ }
+
+ if (sMode == SESSION_MODE_ON_FIX) {
+ // stop tracking
+ // trackingSession will be removed from mSessionBiDict soon,
+ // so we don't need to add a new request to mRequestQueues[REQUEST_SESSION].
+ mLocationAPI->stopTracking(trackingSession);
+ trackingSession = 0;
+
+ // Populate location option values
+ batchOptions.minDistance = options.minDistance;
+ batchOptions.minInterval = options.minInterval;
+ batchOptions.mode = options.mode;
+
+ // start batching
+ batchingSession = mLocationAPI->startBatching(batchOptions);
+ LOC_LOGI("%s:%d] start new session: %d",
+ __FUNCTION__, __LINE__, batchingSession);
+ mRequestQueues[REQUEST_SESSION].setSession(batchingSession);
+ } else {
+ mLocationAPI->updateBatchingOptions(batchingSession, batchOptions);
+ }
+
+ }
+
+ uint32_t session = ((sessionMode != SESSION_MODE_ON_FIX) ?
+ batchingSession : trackingSession);
+
+ entity.trackingSession = trackingSession;
+ entity.batchingSession = batchingSession;
+ entity.sessionMode = sessionMode;
+ // remove the old values from mSessionBiDict before we add a new one.
+ mSessionBiDict.rmById(id);
+ mSessionBiDict.set(id, session, entity);
+
+ retVal = LOCATION_ERROR_SUCCESS;
+ } else {
+ retVal = LOCATION_ERROR_ID_UNKNOWN;
+ LOC_LOGE("%s:%d] session %d is not exist.", __FUNCTION__, __LINE__, id);
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+ return retVal;
+}
+
+uint32_t LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t count)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ if (mSessionBiDict.hasId(id)) {
+ SessionEntity entity = mSessionBiDict.getExtById(id);
+ 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);
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+uint32_t LocationAPIClientBase::locAPIAddGeofences(
+ size_t count, uint32_t* ids, GeofenceOption* options, GeofenceInfo* data)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ if (mRequestQueues[REQUEST_GEOFENCE].getSession() != GEOFENCE_SESSION_ID) {
+ mRequestQueues[REQUEST_GEOFENCE].reset(GEOFENCE_SESSION_ID);
+ }
+ uint32_t* sessions = mLocationAPI->addGeofences(count, options, data);
+ if (sessions) {
+ LOC_LOGI("%s:%d] start new sessions: %p", __FUNCTION__, __LINE__, sessions);
+ mRequestQueues[REQUEST_GEOFENCE].push(new AddGeofencesRequest(*this));
+
+ for (size_t i = 0; i < count; i++) {
+ mGeofenceBiDict.set(ids[i], sessions[i], options[i].breachTypeMask);
+ }
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+void LocationAPIClientBase::locAPIRemoveGeofences(size_t count, uint32_t* ids)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ if (sessions == NULL) {
+ LOC_LOGE("%s:%d] Failed to allocate %zu bytes !",
+ __FUNCTION__, __LINE__, sizeof(uint32_t) * count);
+ pthread_mutex_unlock(&mMutex);
+ return;
+ }
+
+ if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
+ BiDict<GeofenceBreachTypeMask>* removedGeofenceBiDict =
+ new BiDict<GeofenceBreachTypeMask>();
+ size_t j = 0;
+ for (size_t i = 0; i < count; i++) {
+ sessions[j] = mGeofenceBiDict.getSession(ids[i]);
+ if (sessions[j] > 0) {
+ GeofenceBreachTypeMask type = mGeofenceBiDict.getExtBySession(sessions[j]);
+ mGeofenceBiDict.rmBySession(sessions[j]);
+ removedGeofenceBiDict->set(ids[i], sessions[j], type);
+ j++;
+ }
+ }
+ if (j > 0) {
+ 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__,
+ mRequestQueues[REQUEST_GEOFENCE].getSession());
+ }
+
+ free(sessions);
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIModifyGeofences(
+ size_t count, uint32_t* ids, GeofenceOption* options)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ if (sessions == NULL) {
+ LOC_LOGE("%s:%d] Failed to allocate %zu bytes !",
+ __FUNCTION__, __LINE__, sizeof(uint32_t) * count);
+ pthread_mutex_unlock(&mMutex);
+ return;
+ }
+
+ if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
+ size_t j = 0;
+ for (size_t i = 0; i < count; i++) {
+ sessions[j] = mGeofenceBiDict.getSession(ids[i]);
+ if (sessions[j] > 0) {
+ mGeofenceBiDict.set(ids[i], sessions[j], options[i].breachTypeMask);
+ j++;
+ }
+ }
+ if (j > 0) {
+ mRequestQueues[REQUEST_GEOFENCE].push(new ModifyGeofencesRequest(*this));
+ mLocationAPI->modifyGeofences(j, sessions, options);
+ }
+ } else {
+ LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__,
+ mRequestQueues[REQUEST_GEOFENCE].getSession());
+ }
+
+ free(sessions);
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIPauseGeofences(size_t count, uint32_t* ids)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ if (sessions == NULL) {
+ LOC_LOGE("%s:%d] Failed to allocate %zu bytes !",
+ __FUNCTION__, __LINE__, sizeof(uint32_t) * count);
+ pthread_mutex_unlock(&mMutex);
+ return;
+ }
+
+ if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
+ size_t j = 0;
+ for (size_t i = 0; i < count; i++) {
+ sessions[j] = mGeofenceBiDict.getSession(ids[i]);
+ if (sessions[j] > 0) {
+ j++;
+ }
+ }
+ if (j > 0) {
+ mRequestQueues[REQUEST_GEOFENCE].push(new PauseGeofencesRequest(*this));
+ mLocationAPI->pauseGeofences(j, sessions);
+ }
+ } else {
+ LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__,
+ mRequestQueues[REQUEST_GEOFENCE].getSession());
+ }
+
+ free(sessions);
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIResumeGeofences(
+ size_t count, uint32_t* ids, GeofenceBreachTypeMask* mask)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ if (sessions == NULL) {
+ LOC_LOGE("%s:%d] Failed to allocate %zu bytes !",
+ __FUNCTION__, __LINE__, sizeof(uint32_t) * count);
+ pthread_mutex_unlock(&mMutex);
+ return;
+ }
+
+ if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
+ size_t j = 0;
+ for (size_t i = 0; i < count; i++) {
+ sessions[j] = mGeofenceBiDict.getSession(ids[i]);
+ if (sessions[j] > 0) {
+ if (mask) {
+ mGeofenceBiDict.set(ids[i], sessions[j], mask[i]);
+ }
+ j++;
+ }
+ }
+ if (j > 0) {
+ mRequestQueues[REQUEST_GEOFENCE].push(new ResumeGeofencesRequest(*this));
+ mLocationAPI->resumeGeofences(j, sessions);
+ }
+ } else {
+ LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__,
+ mRequestQueues[REQUEST_GEOFENCE].getSession());
+ }
+
+ free(sessions);
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIRemoveAllGeofences()
+{
+ std::vector<uint32_t> sessionsVec = mGeofenceBiDict.getAllSessions();
+ locAPIRemoveGeofences(sessionsVec.size(), &sessionsVec[0]);
+}
+
+void LocationAPIClientBase::locAPIGnssNiResponse(uint32_t id, GnssNiResponse response)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t session = id;
+ mLocationAPI->gnssNiResponse(id, response);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, session);
+ mRequestQueues[REQUEST_NIRESPONSE].reset(session);
+ mRequestQueues[REQUEST_NIRESPONSE].push(new GnssNiResponseRequest(*this));
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::beforeGeofenceBreachCb(
+ GeofenceBreachNotification geofenceBreachNotification)
+{
+ uint32_t* ids = (uint32_t*)malloc(sizeof(uint32_t) * geofenceBreachNotification.count);
+ uint32_t* backup = geofenceBreachNotification.ids;
+ size_t n = geofenceBreachNotification.count;
+ geofenceBreachCallback genfenceCallback = nullptr;
+
+ if (ids == NULL) {
+ LOC_LOGE("%s:%d] Failed to alloc %zu bytes",
+ __FUNCTION__, __LINE__,
+ sizeof(uint32_t) * geofenceBreachNotification.count);
+ return;
+ }
+
+ pthread_mutex_lock(&mMutex);
+ if (mGeofenceBreachCallback != nullptr) {
+ size_t count = 0;
+ for (size_t i = 0; i < n; i++) {
+ uint32_t id = mGeofenceBiDict.getId(geofenceBreachNotification.ids[i]);
+ GeofenceBreachTypeMask type =
+ mGeofenceBiDict.getExtBySession(geofenceBreachNotification.ids[i]);
+ // if type == 0, we will not head into the fllowing block anyway.
+ // so we don't need to check id and type
+ if ((geofenceBreachNotification.type == GEOFENCE_BREACH_ENTER &&
+ (type & GEOFENCE_BREACH_ENTER_BIT)) ||
+ (geofenceBreachNotification.type == GEOFENCE_BREACH_EXIT &&
+ (type & GEOFENCE_BREACH_EXIT_BIT))
+ ) {
+ ids[count] = id;
+ count++;
+ }
+ }
+ geofenceBreachNotification.count = count;
+ geofenceBreachNotification.ids = ids;
+
+ genfenceCallback = mGeofenceBreachCallback;
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ if (genfenceCallback != nullptr) {
+ genfenceCallback(geofenceBreachNotification);
+ }
+
+ // restore ids
+ geofenceBreachNotification.ids = backup;
+ geofenceBreachNotification.count = n;
+ free(ids);
+}
+
+void LocationAPIClientBase::beforeBatchingStatusCb(BatchingStatusInfo batchStatus,
+ std::list<uint32_t> & tripCompletedList) {
+
+ // map the trip ids to the client ids
+ std::list<uint32_t> tripCompletedClientIdList;
+ tripCompletedClientIdList.clear();
+
+ if (batchStatus.batchingStatus == BATCHING_STATUS_TRIP_COMPLETED) {
+ for (auto itt = tripCompletedList.begin(); itt != tripCompletedList.end(); itt++) {
+ if (mSessionBiDict.hasSession(*itt)) {
+ SessionEntity sessEntity = mSessionBiDict.getExtBySession(*itt);
+
+ if (sessEntity.sessionMode == SESSION_MODE_ON_TRIP_COMPLETED) {
+ tripCompletedClientIdList.push_back(sessEntity.id);
+ mSessionBiDict.rmBySession(*itt);
+ }
+ }
+ }
+ }
+
+ mBatchingStatusCallback(batchStatus, tripCompletedClientIdList);
+}
+
+void LocationAPIClientBase::onResponseCb(LocationError error, uint32_t id)
+{
+ if (error != LOCATION_ERROR_SUCCESS) {
+ LOC_LOGE("%s:%d] ERROR: %d ID: %d", __FUNCTION__, __LINE__, error, id);
+ } else {
+ LOC_LOGV("%s:%d] SUCCESS: %d id: %d", __FUNCTION__, __LINE__, error, id);
+ }
+ LocationAPIRequest* request = getRequestBySession(id);
+ if (request) {
+ request->onResponse(error, id);
+ delete request;
+ }
+}
+
+void LocationAPIClientBase::onCollectiveResponseCb(
+ size_t count, LocationError* errors, uint32_t* ids)
+{
+ for (size_t i = 0; i < count; i++) {
+ if (errors[i] != LOCATION_ERROR_SUCCESS) {
+ LOC_LOGE("%s:%d] ERROR: %d ID: %d", __FUNCTION__, __LINE__, errors[i], ids[i]);
+ } else {
+ LOC_LOGV("%s:%d] SUCCESS: %d id: %d", __FUNCTION__, __LINE__, errors[i], ids[i]);
+ }
+ }
+ LocationAPIRequest* request = nullptr;
+ pthread_mutex_lock(&mMutex);
+ if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) {
+ request = mRequestQueues[REQUEST_GEOFENCE].pop();
+ }
+ pthread_mutex_unlock(&mMutex);
+ if (request) {
+ request->onCollectiveResponse(count, errors, ids);
+ delete request;
+ }
+}
+
+void LocationAPIClientBase::removeSession(uint32_t session) {
+ if (mSessionBiDict.hasSession(session)) {
+ mSessionBiDict.rmBySession(session);
+ }
+}
+
+LocationAPIRequest* LocationAPIClientBase::getRequestBySession(uint32_t session)
+{
+ pthread_mutex_lock(&mMutex);
+ LocationAPIRequest* request = nullptr;
+ for (int i = 0; i < REQUEST_MAX; i++) {
+ if (i != REQUEST_GEOFENCE &&
+ i != REQUEST_SESSION &&
+ mRequestQueues[i].getSession() == session) {
+ request = mRequestQueues[i].pop();
+ break;
+ }
+ }
+ if (request == nullptr) {
+ // Can't find a request with correct session,
+ // try to find it from mSessionBiDict
+ if (mSessionBiDict.hasSession(session)) {
+ request = mRequestQueues[REQUEST_SESSION].pop();
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+ return request;
+}
diff --git a/gps/location/LocationAPIClientBase.h b/gps/location/LocationAPIClientBase.h
new file mode 100644
index 0000000..591775a
--- /dev/null
+++ b/gps/location/LocationAPIClientBase.h
@@ -0,0 +1,592 @@
+/* Copyright (c) 2017-2020 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 LOCATION_API_CLINET_BASE_H
+#define LOCATION_API_CLINET_BASE_H
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <queue>
+#include <map>
+
+#include "LocationAPI.h"
+#include <loc_pla.h>
+#include <log_util.h>
+
+enum SESSION_MODE {
+ SESSION_MODE_NONE = 0,
+ SESSION_MODE_ON_FULL,
+ SESSION_MODE_ON_FIX,
+ SESSION_MODE_ON_TRIP_COMPLETED
+};
+
+enum REQUEST_TYPE {
+ REQUEST_TRACKING = 0,
+ REQUEST_SESSION,
+ REQUEST_GEOFENCE,
+ REQUEST_NIRESPONSE,
+ REQUEST_MAX,
+};
+
+enum CTRL_REQUEST_TYPE {
+ CTRL_REQUEST_DELETEAIDINGDATA = 0,
+ CTRL_REQUEST_CONTROL,
+ CTRL_REQUEST_CONFIG_UPDATE,
+ CTRL_REQUEST_CONFIG_GET,
+ CTRL_REQUEST_MAX,
+};
+
+class LocationAPIClientBase;
+
+class LocationAPIRequest {
+public:
+ LocationAPIRequest() {}
+ virtual ~LocationAPIRequest() {}
+ virtual void onResponse(LocationError /*error*/, uint32_t /*id*/) {}
+ virtual void onCollectiveResponse(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+};
+
+class RequestQueue {
+public:
+ RequestQueue(): mSession(0), mSessionArrayPtr(nullptr) {
+ }
+ virtual ~RequestQueue() {
+ reset((uint32_t)0);
+ }
+ void inline setSession(uint32_t session) { mSession = session; }
+ void inline setSessionArrayPtr(uint32_t* ptr) { mSessionArrayPtr = ptr; }
+ void reset(uint32_t session) {
+ LocationAPIRequest* request = nullptr;
+ while (!mQueue.empty()) {
+ request = mQueue.front();
+ mQueue.pop();
+ delete request;
+ }
+ mSession = session;
+ }
+ void reset(uint32_t* sessionArrayPtr) {
+ reset((uint32_t)0);
+ mSessionArrayPtr = sessionArrayPtr;
+ }
+ void push(LocationAPIRequest* request) {
+ mQueue.push(request);
+ }
+ LocationAPIRequest* pop() {
+ LocationAPIRequest* request = nullptr;
+ if (!mQueue.empty()) {
+ request = mQueue.front();
+ mQueue.pop();
+ }
+ return request;
+ }
+ uint32_t getSession() { return mSession; }
+ uint32_t* getSessionArrayPtr() { return mSessionArrayPtr; }
+private:
+ uint32_t mSession;
+ uint32_t* mSessionArrayPtr;
+ std::queue<LocationAPIRequest*> mQueue;
+};
+
+class LocationAPIControlClient {
+public:
+ LocationAPIControlClient();
+ virtual ~LocationAPIControlClient();
+ LocationAPIControlClient(const LocationAPIControlClient&) = delete;
+ LocationAPIControlClient& operator=(const LocationAPIControlClient&) = delete;
+
+ LocationAPIRequest* getRequestBySession(uint32_t session);
+ LocationAPIRequest* getRequestBySessionArrayPtr(uint32_t* sessionArrayPtr);
+
+ // LocationControlAPI
+ uint32_t locAPIGnssDeleteAidingData(GnssAidingData& data);
+ uint32_t locAPIEnable(LocationTechnologyType techType);
+ void locAPIDisable();
+ uint32_t locAPIGnssUpdateConfig(GnssConfig config);
+ uint32_t locAPIGnssGetConfig(GnssConfigFlagsMask config);
+ inline LocationControlAPI* getControlAPI() { return mLocationControlAPI; }
+
+ // callbacks
+ void onCtrlResponseCb(LocationError error, uint32_t id);
+ void onCtrlCollectiveResponseCb(size_t count, LocationError* errors, uint32_t* ids);
+
+ inline virtual void onGnssDeleteAidingDataCb(LocationError /*error*/) {}
+ inline virtual void onEnableCb(LocationError /*error*/) {}
+ inline virtual void onDisableCb(LocationError /*error*/) {}
+ inline virtual void onGnssUpdateConfigCb(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+ inline virtual void onGnssGetConfigCb(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+
+ class GnssDeleteAidingDataRequest : public LocationAPIRequest {
+ public:
+ GnssDeleteAidingDataRequest(LocationAPIControlClient& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t /*id*/) {
+ mAPI.onGnssDeleteAidingDataCb(error);
+ }
+ LocationAPIControlClient& mAPI;
+ };
+
+ class EnableRequest : public LocationAPIRequest {
+ public:
+ EnableRequest(LocationAPIControlClient& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t /*id*/) {
+ mAPI.onEnableCb(error);
+ }
+ LocationAPIControlClient& mAPI;
+ };
+
+ class DisableRequest : public LocationAPIRequest {
+ public:
+ DisableRequest(LocationAPIControlClient& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t /*id*/) {
+ mAPI.onDisableCb(error);
+ }
+ LocationAPIControlClient& mAPI;
+ };
+
+ class GnssUpdateConfigRequest : public LocationAPIRequest {
+ public:
+ GnssUpdateConfigRequest(LocationAPIControlClient& API) : mAPI(API) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* ids) {
+ mAPI.onGnssUpdateConfigCb(count, errors, ids);
+ }
+ LocationAPIControlClient& mAPI;
+ };
+
+ class GnssGetConfigRequest : public LocationAPIRequest {
+ public:
+ GnssGetConfigRequest(LocationAPIControlClient& API) : mAPI(API) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* ids) {
+ mAPI.onGnssGetConfigCb(count, errors, ids);
+ }
+ LocationAPIControlClient& mAPI;
+ };
+
+private:
+ pthread_mutex_t mMutex;
+ LocationControlAPI* mLocationControlAPI;
+ RequestQueue mRequestQueues[CTRL_REQUEST_MAX];
+ bool mEnabled;
+ GnssConfig mConfig;
+};
+
+class LocationAPIClientBase {
+public:
+ LocationAPIClientBase();
+ LocationAPIClientBase(const LocationAPIClientBase&) = delete;
+ LocationAPIClientBase& operator=(const LocationAPIClientBase&) = delete;
+
+ void destroy();
+ void onLocationApiDestroyCompleteCb();
+
+ void locAPISetCallbacks(LocationCallbacks& locationCallbacks);
+ void removeSession(uint32_t session);
+ LocationAPIRequest* getRequestBySession(uint32_t session);
+
+ // LocationAPI
+ uint32_t locAPIStartTracking(TrackingOptions& trackingOptions);
+ void locAPIStopTracking();
+ void locAPIUpdateTrackingOptions(TrackingOptions& trackingOptions);
+
+ int32_t locAPIGetBatchSize();
+ uint32_t locAPIStartSession(
+ uint32_t id, uint32_t sessionMode, TrackingOptions&& trackingOptions);
+ uint32_t locAPIStopSession(uint32_t id);
+ uint32_t locAPIUpdateSessionOptions(
+ uint32_t id, uint32_t sessionMode, TrackingOptions&& trackingOptions);
+ uint32_t locAPIGetBatchedLocations(uint32_t id, size_t count);
+
+ uint32_t locAPIAddGeofences(size_t count, uint32_t* ids,
+ GeofenceOption* options, GeofenceInfo* data);
+ void locAPIRemoveGeofences(size_t count, uint32_t* ids);
+ void locAPIModifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options);
+ void locAPIPauseGeofences(size_t count, uint32_t* ids);
+ void locAPIResumeGeofences(size_t count, uint32_t* ids, GeofenceBreachTypeMask* mask);
+ void locAPIRemoveAllGeofences();
+
+ void locAPIGnssNiResponse(uint32_t id, GnssNiResponse response);
+
+ // callbacks
+ void onResponseCb(LocationError error, uint32_t id);
+ void onCollectiveResponseCb(size_t count, LocationError* errors, uint32_t* ids);
+
+ void beforeGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification);
+
+ inline virtual void onCapabilitiesCb(LocationCapabilitiesMask /*capabilitiesMask*/) {}
+ inline virtual void onGnssNmeaCb(GnssNmeaNotification /*gnssNmeaNotification*/) {}
+ inline virtual void onGnssDataCb(GnssDataNotification /*gnssDataNotification*/) {}
+ inline virtual void onGnssMeasurementsCb(
+ GnssMeasurementsNotification /*gnssMeasurementsNotification*/) {}
+
+ inline virtual void onTrackingCb(Location /*location*/) {}
+ inline virtual void onGnssSvCb(GnssSvNotification /*gnssSvNotification*/) {}
+ inline virtual void onStartTrackingCb(LocationError /*error*/) {}
+ inline virtual void onStopTrackingCb(LocationError /*error*/) {}
+ inline virtual void onUpdateTrackingOptionsCb(LocationError /*error*/) {}
+
+ inline virtual void onGnssLocationInfoCb(
+ GnssLocationInfoNotification /*gnssLocationInfoNotification*/) {}
+
+ inline virtual void onBatchingCb(size_t /*count*/, Location* /*location*/,
+ BatchingOptions /*batchingOptions*/) {}
+ inline virtual void onBatchingStatusCb(BatchingStatusInfo /*batchingStatus*/,
+ std::list<uint32_t> &/*listOfCompletedTrips*/) {}
+ void beforeBatchingStatusCb(BatchingStatusInfo batchStatus,
+ std::list<uint32_t> & tripCompletedList);
+ inline virtual void onStartBatchingCb(LocationError /*error*/) {}
+ inline virtual void onStopBatchingCb(LocationError /*error*/) {}
+ inline virtual void onUpdateBatchingOptionsCb(LocationError /*error*/) {}
+ inline virtual void onGetBatchedLocationsCb(LocationError /*error*/) {}
+
+ inline virtual void onGeofenceBreachCb(
+ GeofenceBreachNotification /*geofenceBreachNotification*/) {}
+ inline virtual void onGeofenceStatusCb(
+ GeofenceStatusNotification /*geofenceStatusNotification*/) {}
+ inline virtual void onAddGeofencesCb(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+ inline virtual void onRemoveGeofencesCb(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+ inline virtual void onModifyGeofencesCb(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+ inline virtual void onPauseGeofencesCb(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+ inline virtual void onResumeGeofencesCb(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {}
+
+ inline virtual void onGnssNiCb(uint32_t /*id*/, GnssNiNotification /*gnssNiNotification*/) {}
+ inline virtual void onGnssNiResponseCb(LocationError /*error*/) {}
+
+ inline virtual void onLocationSystemInfoCb(LocationSystemInfo /*locationSystemInfo*/) {}
+
+protected:
+ virtual ~LocationAPIClientBase();
+
+private:
+ // private inner classes
+ typedef struct {
+ uint32_t id;
+ uint32_t trackingSession;
+ uint32_t batchingSession;
+ uint32_t sessionMode;
+ } SessionEntity;
+
+ template<typename T>
+ class BiDict {
+ public:
+ BiDict() {
+ pthread_mutex_init(&mBiDictMutex, nullptr);
+ }
+ virtual ~BiDict() {
+ pthread_mutex_destroy(&mBiDictMutex);
+ }
+ bool hasId(uint32_t id) {
+ pthread_mutex_lock(&mBiDictMutex);
+ bool ret = (mForwardMap.find(id) != mForwardMap.end());
+ pthread_mutex_unlock(&mBiDictMutex);
+ return ret;
+ }
+ bool hasSession(uint32_t session) {
+ pthread_mutex_lock(&mBiDictMutex);
+ bool ret = (mBackwardMap.find(session) != mBackwardMap.end());
+ pthread_mutex_unlock(&mBiDictMutex);
+ return ret;
+ }
+ void set(uint32_t id, uint32_t session, T& ext) {
+ pthread_mutex_lock(&mBiDictMutex);
+ mForwardMap[id] = session;
+ mBackwardMap[session] = id;
+ mExtMap[session] = ext;
+ pthread_mutex_unlock(&mBiDictMutex);
+ }
+ void clear() {
+ pthread_mutex_lock(&mBiDictMutex);
+ mForwardMap.clear();
+ mBackwardMap.clear();
+ mExtMap.clear();
+ pthread_mutex_unlock(&mBiDictMutex);
+ }
+ void rmById(uint32_t id) {
+ pthread_mutex_lock(&mBiDictMutex);
+ mBackwardMap.erase(mForwardMap[id]);
+ mExtMap.erase(mForwardMap[id]);
+ mForwardMap.erase(id);
+ pthread_mutex_unlock(&mBiDictMutex);
+ }
+ void rmBySession(uint32_t session) {
+ pthread_mutex_lock(&mBiDictMutex);
+ mForwardMap.erase(mBackwardMap[session]);
+ mBackwardMap.erase(session);
+ mExtMap.erase(session);
+ pthread_mutex_unlock(&mBiDictMutex);
+ }
+ uint32_t getId(uint32_t session) {
+ pthread_mutex_lock(&mBiDictMutex);
+ uint32_t ret = 0;
+ auto it = mBackwardMap.find(session);
+ if (it != mBackwardMap.end()) {
+ ret = it->second;
+ }
+ pthread_mutex_unlock(&mBiDictMutex);
+ return ret;
+ }
+ uint32_t getSession(uint32_t id) {
+ pthread_mutex_lock(&mBiDictMutex);
+ uint32_t ret = 0;
+ auto it = mForwardMap.find(id);
+ if (it != mForwardMap.end()) {
+ ret = it->second;
+ }
+ pthread_mutex_unlock(&mBiDictMutex);
+ return ret;
+ }
+ T getExtById(uint32_t id) {
+ pthread_mutex_lock(&mBiDictMutex);
+ T ret;
+ memset(&ret, 0, sizeof(T));
+ uint32_t session = mForwardMap[id];
+ if (session > 0) {
+ auto it = mExtMap.find(session);
+ if (it != mExtMap.end()) {
+ ret = it->second;
+ }
+ }
+ pthread_mutex_unlock(&mBiDictMutex);
+ return ret;
+ }
+ T getExtBySession(uint32_t session) {
+ pthread_mutex_lock(&mBiDictMutex);
+ T ret;
+ memset(&ret, 0, sizeof(T));
+ auto it = mExtMap.find(session);
+ if (it != mExtMap.end()) {
+ ret = it->second;
+ }
+ pthread_mutex_unlock(&mBiDictMutex);
+ return ret;
+ }
+ std::vector<uint32_t> getAllSessions() {
+ std::vector<uint32_t> ret;
+ pthread_mutex_lock(&mBiDictMutex);
+ for (auto it = mBackwardMap.begin(); it != mBackwardMap.end(); it++) {
+ ret.push_back(it->first);
+ }
+ pthread_mutex_unlock(&mBiDictMutex);
+ return ret;
+ }
+ private:
+ pthread_mutex_t mBiDictMutex;
+ // mForwarMap mapping id->session
+ std::map<uint32_t, uint32_t> mForwardMap;
+ // mBackwardMap mapping session->id
+ std::map<uint32_t, uint32_t> mBackwardMap;
+ // mExtMap mapping session->ext
+ std::map<uint32_t, T> mExtMap;
+ };
+
+ class StartTrackingRequest : public LocationAPIRequest {
+ public:
+ StartTrackingRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t id) {
+ if (error != LOCATION_ERROR_SUCCESS) {
+ mAPI.removeSession(id);
+ }
+ mAPI.onStartTrackingCb(error);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class StopTrackingRequest : public LocationAPIRequest {
+ public:
+ StopTrackingRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t id) {
+ if (error == LOCATION_ERROR_SUCCESS) {
+ mAPI.removeSession(id);
+ }
+ mAPI.onStopTrackingCb(error);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class UpdateTrackingOptionsRequest : public LocationAPIRequest {
+ public:
+ UpdateTrackingOptionsRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t /*id*/) {
+ mAPI.onUpdateTrackingOptionsCb(error);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class StartBatchingRequest : public LocationAPIRequest {
+ public:
+ StartBatchingRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t id) {
+ if (error != LOCATION_ERROR_SUCCESS) {
+ mAPI.removeSession(id);
+ }
+ mAPI.onStartBatchingCb(error);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class StopBatchingRequest : public LocationAPIRequest {
+ public:
+ StopBatchingRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t id) {
+ mAPI.onStopBatchingCb(error);
+ if (error == LOCATION_ERROR_SUCCESS) {
+ mAPI.removeSession(id);
+ }
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class UpdateBatchingOptionsRequest : public LocationAPIRequest {
+ public:
+ UpdateBatchingOptionsRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t /*id*/) {
+ mAPI.onUpdateBatchingOptionsCb(error);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class GetBatchedLocationsRequest : public LocationAPIRequest {
+ public:
+ GetBatchedLocationsRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t /*id*/) {
+ mAPI.onGetBatchedLocationsCb(error);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class AddGeofencesRequest : public LocationAPIRequest {
+ public:
+ AddGeofencesRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) {
+ uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (size_t i = 0; i < count; i++) {
+ ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
+ }
+ LOC_LOGD("%s:]Returned geofence-id: %d in add geofence", __FUNCTION__, *ids);
+ mAPI.onAddGeofencesCb(count, errors, ids);
+ free(ids);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class RemoveGeofencesRequest : public LocationAPIRequest {
+ public:
+ RemoveGeofencesRequest(LocationAPIClientBase& API,
+ BiDict<GeofenceBreachTypeMask>* removedGeofenceBiDict) :
+ mAPI(API), mRemovedGeofenceBiDict(removedGeofenceBiDict) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) {
+ 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]);
+ }
+ LOC_LOGD("%s:]Returned geofence-id: %d in remove geofence", __FUNCTION__, *ids);
+ 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 {
+ public:
+ ModifyGeofencesRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) {
+ uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (size_t i = 0; i < count; i++) {
+ ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
+ }
+ mAPI.onModifyGeofencesCb(count, errors, ids);
+ free(ids);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class PauseGeofencesRequest : public LocationAPIRequest {
+ public:
+ PauseGeofencesRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) {
+ uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (size_t i = 0; i < count; i++) {
+ ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
+ }
+ mAPI.onPauseGeofencesCb(count, errors, ids);
+ free(ids);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class ResumeGeofencesRequest : public LocationAPIRequest {
+ public:
+ ResumeGeofencesRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* sessions) {
+ uint32_t *ids = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (size_t i = 0; i < count; i++) {
+ ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
+ }
+ mAPI.onResumeGeofencesCb(count, errors, ids);
+ free(ids);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+ class GnssNiResponseRequest : public LocationAPIRequest {
+ public:
+ GnssNiResponseRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ inline void onResponse(LocationError error, uint32_t /*id*/) {
+ mAPI.onGnssNiResponseCb(error);
+ }
+ LocationAPIClientBase& mAPI;
+ };
+
+private:
+ pthread_mutex_t mMutex;
+
+ geofenceBreachCallback mGeofenceBreachCallback;
+ batchingStatusCallback mBatchingStatusCallback;
+
+ LocationAPI* mLocationAPI;
+
+ RequestQueue mRequestQueues[REQUEST_MAX];
+ BiDict<GeofenceBreachTypeMask> mGeofenceBiDict;
+ BiDict<SessionEntity> mSessionBiDict;
+ int32_t mBatchSize;
+ bool mTracking;
+};
+
+#endif /* LOCATION_API_CLINET_BASE_H */
diff --git a/gps/location/LocationDataTypes.h b/gps/location/LocationDataTypes.h
new file mode 100644
index 0000000..646a138
--- /dev/null
+++ b/gps/location/LocationDataTypes.h
@@ -0,0 +1,1622 @@
+/* Copyright (c) 2018-2020 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 LOCATIONDATATYPES_H
+#define LOCATIONDATATYPES_H
+
+#include <vector>
+#include <stdint.h>
+#include <functional>
+#include <list>
+#include <string.h>
+
+#define GNSS_NI_REQUESTOR_MAX (256)
+#define GNSS_NI_MESSAGE_ID_MAX (2048)
+#define GNSS_SV_MAX (128)
+#define GNSS_MEASUREMENTS_MAX (128)
+#define GNSS_UTC_TIME_OFFSET (3657)
+
+#define GNSS_BUGREPORT_GPS_MIN (1)
+#define GNSS_BUGREPORT_SBAS_MIN (120)
+#define GNSS_BUGREPORT_GLO_MIN (1)
+#define GNSS_BUGREPORT_QZSS_MIN (193)
+#define GNSS_BUGREPORT_BDS_MIN (1)
+#define GNSS_BUGREPORT_GAL_MIN (1)
+#define GNSS_BUGREPORT_NAVIC_MIN (1)
+
+#define GNSS_MAX_NAME_LENGTH (8)
+
+typedef enum {
+ LOCATION_ERROR_SUCCESS = 0,
+ LOCATION_ERROR_GENERAL_FAILURE,
+ LOCATION_ERROR_CALLBACK_MISSING,
+ LOCATION_ERROR_INVALID_PARAMETER,
+ LOCATION_ERROR_ID_EXISTS,
+ LOCATION_ERROR_ID_UNKNOWN,
+ LOCATION_ERROR_ALREADY_STARTED,
+ LOCATION_ERROR_GEOFENCES_AT_MAX,
+ LOCATION_ERROR_NOT_SUPPORTED
+} LocationError;
+
+// Flags to indicate which values are valid in a Location
+typedef uint16_t LocationFlagsMask;
+typedef enum {
+ LOCATION_HAS_LAT_LONG_BIT = (1<<0), // location has valid latitude and longitude
+ LOCATION_HAS_ALTITUDE_BIT = (1<<1), // location has valid altitude
+ LOCATION_HAS_SPEED_BIT = (1<<2), // location has valid speed
+ LOCATION_HAS_BEARING_BIT = (1<<3), // location has valid bearing
+ LOCATION_HAS_ACCURACY_BIT = (1<<4), // location has valid accuracy
+ LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy
+ LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy
+ LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy
+ LOCATION_HAS_SPOOF_MASK = (1<<8), // location has valid spoof mask
+ LOCATION_HAS_ELAPSED_REAL_TIME = (1<<9), // location has valid elapsed real time
+} LocationFlagsBits;
+
+typedef uint16_t LocationTechnologyMask;
+typedef enum {
+ LOCATION_TECHNOLOGY_GNSS_BIT = (1<<0), // location was calculated using GNSS
+ LOCATION_TECHNOLOGY_CELL_BIT = (1<<1), // location was calculated using Cell
+ LOCATION_TECHNOLOGY_WIFI_BIT = (1<<2), // location was calculated using WiFi
+ LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3), // location was calculated using Sensors
+} LocationTechnologyBits;
+
+typedef uint32_t LocationSpoofMask;
+typedef enum {
+ LOCATION_POSTION_SPOOFED = (1<<0), // location position spoofed
+ LOCATION_TIME_SPOOFED = (1<<1), // location time spoofed
+ LOCATION_NAVIGATION_DATA_SPOOFED = (1<<2), // location navigation data spoofed
+} LocationSpoofBits;
+
+typedef enum {
+ LOCATION_RELIABILITY_NOT_SET = 0,
+ LOCATION_RELIABILITY_VERY_LOW,
+ LOCATION_RELIABILITY_LOW,
+ LOCATION_RELIABILITY_MEDIUM,
+ LOCATION_RELIABILITY_HIGH,
+} LocationReliability;
+
+typedef uint32_t GnssLocationNavSolutionMask;
+typedef enum {
+ LOCATION_SBAS_CORRECTION_IONO_BIT = (1<<0), // SBAS ionospheric correction is used
+ LOCATION_SBAS_CORRECTION_FAST_BIT = (1<<1), // SBAS fast correction is used
+ LOCATION_SBAS_CORRECTION_LONG_BIT = (1<<2), // SBAS long-tem correction is used
+ LOCATION_SBAS_INTEGRITY_BIT = (1<<3), // SBAS integrity information is used
+ LOCATION_NAV_CORRECTION_DGNSS_BIT = (1<<4), // Position Report is DGNSS corrected
+ LOCATION_NAV_CORRECTION_RTK_BIT = (1<<5), // Position Report is RTK corrected
+ LOCATION_NAV_CORRECTION_PPP_BIT = (1<<6) // Position Report is PPP corrected
+} GnssLocationNavSolutionBits;
+
+typedef uint32_t GnssLocationPosTechMask;
+typedef enum {
+ LOCATION_POS_TECH_DEFAULT_BIT = 0,
+ LOCATION_POS_TECH_SATELLITE_BIT = (1<<0),
+ LOCATION_POS_TECH_CELLID_BIT = (1<<1),
+ LOCATION_POS_TECH_WIFI_BIT = (1<<2),
+ LOCATION_POS_TECH_SENSORS_BIT = (1<<3),
+ LOCATION_POS_TECH_REFERENCE_LOCATION_BIT = (1<<4),
+ LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5),
+ LOCATION_POS_TECH_AFLT_BIT = (1<<6),
+ LOCATION_POS_TECH_HYBRID_BIT = (1<<7),
+ LOCATION_POS_TECH_PPE_BIT = (1<<8)
+} GnssLocationPosTechBits;
+
+typedef uint32_t GnssLocationPosDataMask;
+typedef enum {
+ LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT = (1<<0), // Navigation data has Forward Acceleration
+ LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT = (1<<1), // Navigation data has Sideward Acceleration
+ LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT = (1<<2), // Navigation data has Vertical Acceleration
+ LOCATION_NAV_DATA_HAS_YAW_RATE_BIT = (1<<3), // Navigation data has Heading Rate
+ LOCATION_NAV_DATA_HAS_PITCH_BIT = (1<<4), // Navigation data has Body pitch
+ // Navigation data has Forward Acceleration uncertainty
+ LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT = (1<<5),
+ // Navigation data has Sideward Acceleration uncertainty
+ LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT = (1<<6),
+ // Navigation data has Vertical Acceleration uncertainty
+ LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT = (1<<7),
+ // Navigation data has Heading Rate uncertainty
+ LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT = (1<<8),
+ // Navigation data has Body pitch uncertainty
+ LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT = (1<<9)
+} GnssLocationPosDataBits;
+
+typedef uint32_t GnssLocationInfoFlagMask;
+typedef enum {
+ GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT = (1<<0), // valid altitude mean sea level
+ GNSS_LOCATION_INFO_DOP_BIT = (1<<1), // valid pdop, hdop, and vdop
+ GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT = (1<<2), // valid magnetic deviation
+ GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT = (1<<3), // valid horizontal reliability
+ GNSS_LOCATION_INFO_VER_RELIABILITY_BIT = (1<<4), // valid vertical reliability
+ GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major
+ GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor
+ GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7), // valid accuracy elipsode azimuth
+ GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8), // valid svUsedInPosition,
+ // numOfMeasReceived
+ // and measUsageInfo
+ GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT = (1<<9), // valid navSolutionMask
+ GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),// valid LocPosTechMask
+ GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),// valid LocSvInfoSource
+ GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT = (1<<12),// valid position dynamics data
+ GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<13),// valid gdop, tdop
+ GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT = (1<<14),// valid North standard deviation
+ GNSS_LOCATION_INFO_EAST_STD_DEV_BIT = (1<<15),// valid East standard deviation
+ GNSS_LOCATION_INFO_NORTH_VEL_BIT = (1<<16),// valid North Velocity
+ GNSS_LOCATION_INFO_EAST_VEL_BIT = (1<<17),// valid East Velocity
+ GNSS_LOCATION_INFO_UP_VEL_BIT = (1<<18),// valid Up Velocity
+ GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT = (1<<19),// valid North Velocity Uncertainty
+ GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT = (1<<20),// valid East Velocity Uncertainty
+ GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),// valid Up Velocity Uncertainty
+ GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),// valid leap seconds
+ GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23),// valid time uncertainty
+ GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24), // number of SV used in position
+ GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_BIT = (1<<25), // valid sensor cal confidence
+ GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT = (1<<26), // valid sensor cal status
+ GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT = (1<<27), // valid output engine type
+ GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT = (1<<28), // valid output engine mask
+ GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT = (1<<29), // valid conformity index
+} GnssLocationInfoFlagBits;
+
+typedef enum {
+ GEOFENCE_BREACH_ENTER = 0,
+ GEOFENCE_BREACH_EXIT,
+ GEOFENCE_BREACH_DWELL_IN,
+ GEOFENCE_BREACH_DWELL_OUT,
+ GEOFENCE_BREACH_UNKNOWN,
+} GeofenceBreachType;
+
+typedef uint16_t GeofenceBreachTypeMask;
+typedef enum {
+ GEOFENCE_BREACH_ENTER_BIT = (1<<0),
+ GEOFENCE_BREACH_EXIT_BIT = (1<<1),
+ GEOFENCE_BREACH_DWELL_IN_BIT = (1<<2),
+ GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3),
+} GeofenceBreachTypeBits;
+
+typedef enum {
+ GEOFENCE_STATUS_AVAILABILE_NO = 0,
+ GEOFENCE_STATUS_AVAILABILE_YES,
+} GeofenceStatusAvailable;
+
+typedef uint32_t LocationCapabilitiesMask;
+typedef enum {
+ // supports startTracking API with minInterval param
+ LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1<<0),
+ // supports startBatching API with minInterval param
+ LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT = (1<<1),
+ // supports startTracking API with minDistance param
+ LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT = (1<<2),
+ // supports startBatching API with minDistance param
+ LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT = (1<<3),
+ // supports addGeofences API
+ LOCATION_CAPABILITIES_GEOFENCE_BIT = (1<<4),
+ // supports GnssMeasurementsCallback
+ LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT = (1<<5),
+ // supports startTracking/startBatching API with LocationOptions.mode of MSB (Ms Based)
+ LOCATION_CAPABILITIES_GNSS_MSB_BIT = (1<<6),
+ // supports startTracking/startBatching API with LocationOptions.mode of MSA (MS Assisted)
+ LOCATION_CAPABILITIES_GNSS_MSA_BIT = (1<<7),
+ // supports debug nmea sentences in the debugNmeaCallback
+ LOCATION_CAPABILITIES_DEBUG_NMEA_BIT = (1<<8),
+ // support outdoor trip batching
+ LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT = (1<<9),
+ // support constellation enablement
+ LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT = (1<<10),
+ // support agpm
+ LOCATION_CAPABILITIES_AGPM_BIT = (1<<11),
+ // support location privacy
+ LOCATION_CAPABILITIES_PRIVACY_BIT = (1<<12),
+} LocationCapabilitiesBits;
+
+typedef enum {
+ LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
+} LocationTechnologyType;
+
+// Configures how GPS is locked when GPS is disabled (through GnssDisable)
+enum {
+ GNSS_CONFIG_GPS_LOCK_NONE = 0, // gps is not locked when GPS is disabled (GnssDisable)
+ GNSS_CONFIG_GPS_LOCK_MO, // gps mobile originated (MO) is locked when GPS is disabled
+ GNSS_CONFIG_GPS_LOCK_NI, // gps network initiated (NI) is locked when GPS is disabled
+ GNSS_CONFIG_GPS_LOCK_MO_AND_NI,// gps MO and NI is locked when GPS is disabled
+};
+typedef int32_t GnssConfigGpsLock;
+
+// SUPL version
+typedef enum {
+ GNSS_CONFIG_SUPL_VERSION_1_0_0 = 1,
+ GNSS_CONFIG_SUPL_VERSION_2_0_0,
+ GNSS_CONFIG_SUPL_VERSION_2_0_2,
+ GNSS_CONFIG_SUPL_VERSION_2_0_4,
+} GnssConfigSuplVersion;
+
+// LTE Positioning Profile
+typedef enum {
+ GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE = 0, // RRLP on LTE (Default)
+ GNSS_CONFIG_LPP_PROFILE_USER_PLANE, // LPP User Plane (UP) on LTE
+ GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE, // LPP_Control_Plane (CP)
+ GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE, // Both LPP UP and CP
+} GnssConfigLppProfile;
+
+// Technology for LPPe Control Plane
+typedef uint16_t GnssConfigLppeControlPlaneMask;
+typedef enum {
+ GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT = (1<<0), // DBH
+ GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
+ GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
+ GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
+ // SENSOR_BARO_MEASUREMENTS
+} GnssConfigLppeControlPlaneBits;
+
+// Technology for LPPe User Plane
+typedef uint16_t GnssConfigLppeUserPlaneMask;
+typedef enum {
+ GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT = (1<<0), // DBH
+ GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
+ GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
+ GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
+ // SENSOR_BARO_MEASUREMENTS
+} GnssConfigLppeUserPlaneBits;
+
+// Positioning Protocol on A-GLONASS system
+typedef uint16_t GnssConfigAGlonassPositionProtocolMask;
+typedef enum {
+ GNSS_CONFIG_RRC_CONTROL_PLANE_BIT = (1<<0), // RRC Control Plane
+ GNSS_CONFIG_RRLP_USER_PLANE_BIT = (1<<1), // RRLP User Plane
+ GNSS_CONFIG_LLP_USER_PLANE_BIT = (1<<2), // LPP User Plane
+ GNSS_CONFIG_LLP_CONTROL_PLANE_BIT = (1<<3), // LPP Control Plane
+} GnssConfigAGlonassPositionProtocolBits;
+
+typedef enum {
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO = 0,
+ GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES,
+} GnssConfigEmergencyPdnForEmergencySupl;
+
+typedef enum {
+ GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO = 0,
+ GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES,
+} GnssConfigSuplEmergencyServices;
+
+typedef uint16_t GnssConfigSuplModeMask;
+typedef enum {
+ GNSS_CONFIG_SUPL_MODE_MSB_BIT = (1<<0),
+ GNSS_CONFIG_SUPL_MODE_MSA_BIT = (1<<1),
+} GnssConfigSuplModeBits;
+
+typedef uint32_t GnssConfigFlagsMask;
+typedef enum {
+ GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT = (1<<0),
+ GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT = (1<<1),
+ GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT = (1<<2),
+ GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT = (1<<3),
+ GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT = (1<<4),
+ GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT = (1<<5),
+ GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT = (1<<6),
+ GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT = (1<<7),
+ GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT = (1<<8),
+ GNSS_CONFIG_FLAGS_SUPL_MODE_BIT = (1<<9),
+ GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT = (1<<10),
+ GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT = (1<<11),
+ GNSS_CONFIG_FLAGS_ROBUST_LOCATION_BIT = (1<<12),
+} GnssConfigFlagsBits;
+
+typedef enum {
+ GNSS_NI_ENCODING_TYPE_NONE = 0,
+ GNSS_NI_ENCODING_TYPE_GSM_DEFAULT,
+ GNSS_NI_ENCODING_TYPE_UTF8,
+ GNSS_NI_ENCODING_TYPE_UCS2,
+} GnssNiEncodingType;
+
+typedef enum {
+ GNSS_NI_TYPE_VOICE = 0,
+ GNSS_NI_TYPE_SUPL,
+ GNSS_NI_TYPE_CONTROL_PLANE,
+ GNSS_NI_TYPE_EMERGENCY_SUPL
+} GnssNiType;
+
+typedef uint16_t GnssNiOptionsMask;
+typedef enum {
+ GNSS_NI_OPTIONS_NOTIFICATION_BIT = (1<<0),
+ GNSS_NI_OPTIONS_VERIFICATION_BIT = (1<<1),
+ GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT = (1<<2),
+} GnssNiOptionsBits;
+
+typedef enum {
+ GNSS_NI_RESPONSE_ACCEPT = 1,
+ GNSS_NI_RESPONSE_DENY,
+ GNSS_NI_RESPONSE_NO_RESPONSE,
+ GNSS_NI_RESPONSE_IGNORE,
+} GnssNiResponse;
+
+typedef enum {
+ GNSS_SV_TYPE_UNKNOWN = 0,
+ GNSS_SV_TYPE_GPS,
+ GNSS_SV_TYPE_SBAS,
+ GNSS_SV_TYPE_GLONASS,
+ GNSS_SV_TYPE_QZSS,
+ GNSS_SV_TYPE_BEIDOU,
+ GNSS_SV_TYPE_GALILEO,
+ GNSS_SV_TYPE_NAVIC,
+} GnssSvType;
+
+typedef enum {
+ GNSS_EPH_TYPE_UNKNOWN = 0,
+ GNSS_EPH_TYPE_EPHEMERIS,
+ GNSS_EPH_TYPE_ALMANAC,
+} GnssEphemerisType;
+
+typedef enum {
+ GNSS_EPH_SOURCE_UNKNOWN = 0,
+ GNSS_EPH_SOURCE_DEMODULATED,
+ GNSS_EPH_SOURCE_SUPL_PROVIDED,
+ GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED,
+ GNSS_EPH_SOURCE_LOCAL,
+} GnssEphemerisSource;
+
+typedef enum {
+ GNSS_EPH_HEALTH_UNKNOWN = 0,
+ GNSS_EPH_HEALTH_GOOD,
+ GNSS_EPH_HEALTH_BAD,
+} GnssEphemerisHealth;
+
+typedef uint16_t GnssSvOptionsMask;
+typedef enum {
+ GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0),
+ GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1),
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2),
+ GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3),
+ GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT = (1<<4)
+} GnssSvOptionsBits;
+
+typedef enum {
+ GNSS_ASSISTANCE_TYPE_SUPL = 0,
+ GNSS_ASSISTANCE_TYPE_C2K,
+ GNSS_ASSISTANCE_TYPE_SUPL_EIMS,
+ GNSS_ASSISTANCE_TYPE_SUPL_IMS,
+} GnssAssistanceType;
+
+typedef enum {
+ GNSS_SUPL_MODE_STANDALONE = 0,
+ GNSS_SUPL_MODE_MSB,
+ GNSS_SUPL_MODE_MSA,
+} GnssSuplMode;
+
+typedef enum {
+ BATCHING_MODE_ROUTINE = 0, // positions are reported when batched positions memory is full
+ BATCHING_MODE_TRIP, // positions are reported when a certain distance is covered
+ BATCHING_MODE_NO_AUTO_REPORT // no report of positions automatically, instead queried on demand
+} BatchingMode;
+
+typedef enum {
+ BATCHING_STATUS_TRIP_COMPLETED = 0,
+ BATCHING_STATUS_POSITION_AVAILABE,
+ BATCHING_STATUS_POSITION_UNAVAILABLE
+} BatchingStatus;
+
+typedef uint16_t GnssMeasurementsAdrStateMask;
+typedef enum {
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN = 0,
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT = (1<<0),
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT = (1<<1),
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT = (1<<2),
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT = (1<<3),
+} GnssMeasurementsAdrStateBits;
+
+typedef enum {
+ GNSS_MEASUREMENTS_CODE_TYPE_A = 0,
+ GNSS_MEASUREMENTS_CODE_TYPE_B = 1,
+ GNSS_MEASUREMENTS_CODE_TYPE_C = 2,
+ GNSS_MEASUREMENTS_CODE_TYPE_I = 3,
+ GNSS_MEASUREMENTS_CODE_TYPE_L = 4,
+ GNSS_MEASUREMENTS_CODE_TYPE_M = 5,
+ GNSS_MEASUREMENTS_CODE_TYPE_P = 6,
+ GNSS_MEASUREMENTS_CODE_TYPE_Q = 7,
+ GNSS_MEASUREMENTS_CODE_TYPE_S = 8,
+ GNSS_MEASUREMENTS_CODE_TYPE_W = 9,
+ GNSS_MEASUREMENTS_CODE_TYPE_X = 10,
+ GNSS_MEASUREMENTS_CODE_TYPE_Y = 11,
+ GNSS_MEASUREMENTS_CODE_TYPE_Z = 12,
+ GNSS_MEASUREMENTS_CODE_TYPE_N = 13,
+ GNSS_MEASUREMENTS_CODE_TYPE_OTHER = 255,
+} GnssMeasurementsCodeType;
+
+typedef uint32_t GnssMeasurementsDataFlagsMask;
+typedef enum {
+ GNSS_MEASUREMENTS_DATA_SV_ID_BIT = (1<<0),
+ GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT = (1<<1),
+ GNSS_MEASUREMENTS_DATA_STATE_BIT = (1<<2),
+ GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT = (1<<3),
+ GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4),
+ GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT = (1<<5),
+ GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT = (1<<6),
+ GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7),
+ GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT = (1<<8),
+ GNSS_MEASUREMENTS_DATA_ADR_BIT = (1<<9),
+ GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT = (1<<10),
+ GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT = (1<<11),
+ GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT = (1<<12),
+ GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT = (1<<13),
+ GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT = (1<<14),
+ GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT = (1<<15),
+ GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT = (1<<16),
+ GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT = (1<<17),
+} GnssMeasurementsDataFlagsBits;
+
+typedef uint32_t GnssMeasurementsStateMask;
+typedef enum {
+ GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT = 0,
+ GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT = (1<<0),
+ GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT = (1<<1),
+ GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT = (1<<2),
+ GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT = (1<<3),
+ GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT = (1<<4),
+ GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT = (1<<5),
+ GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT = (1<<6),
+ GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT = (1<<7),
+ GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT = (1<<8),
+ GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT = (1<<9),
+ GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT = (1<<10),
+ GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11),
+ GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT = (1<<12),
+ GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT = (1<<13),
+ GNSS_MEASUREMENTS_STATE_TOW_KNOWN_BIT = (1<<14),
+ GNSS_MEASUREMENTS_STATE_GLO_TOD_KNOWN_BIT = (1<<15),
+ GNSS_MEASUREMENTS_STATE_2ND_CODE_LOCK_BIT = (1<<16),
+} GnssMeasurementsStateBits;
+
+typedef enum {
+ GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0,
+ GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT,
+ GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT,
+} GnssMeasurementsMultipathIndicator;
+
+typedef uint32_t GnssMeasurementsClockFlagsMask;
+typedef enum {
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT = (1<<0),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT = (1<<1),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT = (1<<2),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT = (1<<3),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT = (1<<4),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT = (1<<5),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT = (1<<6),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT = (1<<7),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8),
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT = (1<<9),
+} GnssMeasurementsClockFlagsBits;
+
+typedef uint32_t GnssAidingDataSvMask;
+typedef enum {
+ GNSS_AIDING_DATA_SV_EPHEMERIS_BIT = (1<<0), // ephemeris
+ GNSS_AIDING_DATA_SV_ALMANAC_BIT = (1<<1), // almanac
+ GNSS_AIDING_DATA_SV_HEALTH_BIT = (1<<2), // health
+ GNSS_AIDING_DATA_SV_DIRECTION_BIT = (1<<3), // direction
+ GNSS_AIDING_DATA_SV_STEER_BIT = (1<<4), // steer
+ GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT = (1<<5), // almanac correction
+ GNSS_AIDING_DATA_SV_BLACKLIST_BIT = (1<<6), // blacklist SVs
+ GNSS_AIDING_DATA_SV_SA_DATA_BIT = (1<<7), // sensitivity assistance data
+ GNSS_AIDING_DATA_SV_NO_EXIST_BIT = (1<<8), // SV does not exist
+ GNSS_AIDING_DATA_SV_IONOSPHERE_BIT = (1<<9), // ionosphere correction
+ GNSS_AIDING_DATA_SV_TIME_BIT = (1<<10),// reset satellite time
+ GNSS_AIDING_DATA_SV_MB_DATA = (1<<11),// delete multiband data
+ GNSS_AIDING_DATA_SV_POLY_BIT = (1<<12),// poly
+} GnssAidingDataSvBits;
+
+typedef uint32_t GnssAidingDataSvTypeMask;
+typedef enum {
+ GNSS_AIDING_DATA_SV_TYPE_GPS_BIT = (1<<0),
+ GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT = (1<<1),
+ GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT = (1<<2),
+ GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT = (1<<3),
+ GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT = (1<<4),
+ GNSS_AIDING_DATA_SV_TYPE_NAVIC_BIT = (1<<5),
+} GnssAidingDataSvTypeBits;
+
+/* Gnss constellation type mask */
+typedef uint16_t GnssConstellationTypeMask;
+typedef enum {
+ GNSS_CONSTELLATION_TYPE_GPS_BIT = (1<<0),
+ GNSS_CONSTELLATION_TYPE_GLONASS_BIT = (1<<1),
+ GNSS_CONSTELLATION_TYPE_QZSS_BIT = (1<<2),
+ GNSS_CONSTELLATION_TYPE_BEIDOU_BIT = (1<<3),
+ GNSS_CONSTELLATION_TYPE_GALILEO_BIT = (1<<4),
+ GNSS_CONSTELLATION_TYPE_SBAS_BIT = (1<<5),
+ GNSS_CONSTELLATION_TYPE_NAVIC_BIT = (1<<6),
+} GnssConstellationTypeBits;
+
+#define GNSS_CONSTELLATION_TYPE_MASK_ALL\
+ (GNSS_CONSTELLATION_TYPE_GPS_BIT | GNSS_CONSTELLATION_TYPE_GLONASS_BIT |\
+ GNSS_CONSTELLATION_TYPE_QZSS_BIT | GNSS_CONSTELLATION_TYPE_BEIDOU_BIT |\
+ GNSS_CONSTELLATION_TYPE_GALILEO_BIT | GNSS_CONSTELLATION_TYPE_SBAS_BIT |\
+ GNSS_CONSTELLATION_TYPE_NAVIC_BIT)
+
+/** GNSS Signal Type and RF Band */
+typedef uint32_t GnssSignalTypeMask;
+typedef enum {
+ /** GPS L1CA Signal */
+ GNSS_SIGNAL_GPS_L1CA = (1<<0),
+ /** GPS L1C Signal */
+ GNSS_SIGNAL_GPS_L1C = (1<<1),
+ /** GPS L2 RF Band */
+ GNSS_SIGNAL_GPS_L2 = (1<<2),
+ /** GPS L5 RF Band */
+ GNSS_SIGNAL_GPS_L5 = (1<<3),
+ /** GLONASS G1 (L1OF) RF Band */
+ GNSS_SIGNAL_GLONASS_G1 = (1<<4),
+ /** GLONASS G2 (L2OF) RF Band */
+ GNSS_SIGNAL_GLONASS_G2 = (1<<5),
+ /** GALILEO E1 RF Band */
+ GNSS_SIGNAL_GALILEO_E1 = (1<<6),
+ /** GALILEO E5A RF Band */
+ GNSS_SIGNAL_GALILEO_E5A = (1<<7),
+ /** GALILEO E5B RF Band */
+ GNSS_SIGNAL_GALILEO_E5B = (1<<8),
+ /** BEIDOU B1 RF Band */
+ GNSS_SIGNAL_BEIDOU_B1 = (1<<9),
+ /** BEIDOU B2 RF Band */
+ GNSS_SIGNAL_BEIDOU_B2 = (1<<10),
+ /** QZSS L1CA RF Band */
+ GNSS_SIGNAL_QZSS_L1CA = (1<<11),
+ /** QZSS L1S RF Band */
+ GNSS_SIGNAL_QZSS_L1S = (1<<12),
+ /** QZSS L2 RF Band */
+ GNSS_SIGNAL_QZSS_L2 = (1<<13),
+ /** QZSS L5 RF Band */
+ GNSS_SIGNAL_QZSS_L5 = (1<<14),
+ /** SBAS L1 RF Band */
+ GNSS_SIGNAL_SBAS_L1 = (1<<15),
+ /** BEIDOU B1I RF Band */
+ GNSS_SIGNAL_BEIDOU_B1I = (1<<16),
+ /** BEIDOU B1C RF Band */
+ GNSS_SIGNAL_BEIDOU_B1C = (1<<17),
+ /** BEIDOU B2I RF Band */
+ GNSS_SIGNAL_BEIDOU_B2I = (1<<18),
+ /** BEIDOU B2AI RF Band */
+ GNSS_SIGNAL_BEIDOU_B2AI = (1<<19),
+ /** NAVIC L5 RF Band */
+ GNSS_SIGNAL_NAVIC_L5 = (1<<20),
+ /** BEIDOU B2A_Q RF Band */
+ GNSS_SIGNAL_BEIDOU_B2AQ = (1<<21),
+} GnssSignalTypeBits;
+
+#define GNSS_SIGNAL_TYPE_MASK_ALL\
+ (GNSS_SIGNAL_GPS_L1CA | GNSS_SIGNAL_GPS_L1C | GNSS_SIGNAL_GPS_L2 |\
+ GNSS_SIGNAL_GPS_L5| GNSS_SIGNAL_GLONASS_G1 | GNSS_SIGNAL_GLONASS_G2 |\
+ GNSS_SIGNAL_GALILEO_E1 | GNSS_SIGNAL_GALILEO_E5A | GNSS_SIGNAL_GALILEO_E5B |\
+ GNSS_SIGNAL_BEIDOU_B1I | GNSS_SIGNAL_BEIDOU_B1C | GNSS_SIGNAL_BEIDOU_B2I|\
+ GNSS_SIGNAL_BEIDOU_B2AI | GNSS_SIGNAL_QZSS_L1CA | GNSS_SIGNAL_QZSS_L1S |\
+ GNSS_SIGNAL_QZSS_L2| GNSS_SIGNAL_QZSS_L5 | GNSS_SIGNAL_SBAS_L1 |\
+ GNSS_SIGNAL_NAVIC_L5 | GNSS_SIGNAL_BEIDOU_B2AQ)
+
+typedef enum
+{
+ GNSS_LOC_SV_SYSTEM_UNKNOWN = 0,
+ /** unknown sv system. */
+ GNSS_LOC_SV_SYSTEM_MIN = 1,
+ /**< Min enum of valid SV system. */
+ GNSS_LOC_SV_SYSTEM_GPS = 1,
+ /**< GPS satellite. */
+ GNSS_LOC_SV_SYSTEM_GALILEO = 2,
+ /**< GALILEO satellite. */
+ GNSS_LOC_SV_SYSTEM_SBAS = 3,
+ /**< SBAS satellite. */
+ GNSS_LOC_SV_SYSTEM_GLONASS = 4,
+ /**< GLONASS satellite. */
+ GNSS_LOC_SV_SYSTEM_BDS = 5,
+ /**< BDS satellite. */
+ GNSS_LOC_SV_SYSTEM_QZSS = 6,
+ /**< QZSS satellite. */
+ GNSS_LOC_SV_SYSTEM_NAVIC = 7,
+ /**< NAVIC satellite. */
+ GNSS_LOC_SV_SYSTEM_MAX = 7,
+ /**< Max enum of valid SV system. */
+} Gnss_LocSvSystemEnumType;
+
+typedef enum {
+ GNSS_LOC_SIGNAL_TYPE_GPS_L1CA = 0, /**< GPS L1CA Signal */
+ GNSS_LOC_SIGNAL_TYPE_GPS_L1C = 1, /**< GPS L1C Signal */
+ GNSS_LOC_SIGNAL_TYPE_GPS_L2C_L = 2, /**< GPS L2C_L RF Band */
+ GNSS_LOC_SIGNAL_TYPE_GPS_L5_Q = 3, /**< GPS L5_Q RF Band */
+ GNSS_LOC_SIGNAL_TYPE_GLONASS_G1 = 4, /**< GLONASS G1 (L1OF) RF Band */
+ GNSS_LOC_SIGNAL_TYPE_GLONASS_G2 = 5, /**< GLONASS G2 (L2OF) RF Band */
+ GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C = 6, /**< GALILEO E1_C RF Band */
+ GNSS_LOC_SIGNAL_TYPE_GALILEO_E5A_Q = 7, /**< GALILEO E5A_Q RF Band */
+ GNSS_LOC_SIGNAL_TYPE_GALILEO_E5B_Q = 8, /**< GALILEO E5B_Q RF Band */
+ GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I = 9, /**< BEIDOU B1_I RF Band */
+ GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1C = 10, /**< BEIDOU B1C RF Band */
+ GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2_I = 11, /**< BEIDOU B2_I RF Band */
+ GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2A_I = 12, /**< BEIDOU B2A_I RF Band */
+ GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA = 13, /**< QZSS L1CA RF Band */
+ GNSS_LOC_SIGNAL_TYPE_QZSS_L1S = 14, /**< QZSS L1S RF Band */
+ GNSS_LOC_SIGNAL_TYPE_QZSS_L2C_L = 15, /**< QZSS L2C_L RF Band */
+ GNSS_LOC_SIGNAL_TYPE_QZSS_L5_Q = 16, /**< QZSS L5_Q RF Band */
+ GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA = 17, /**< SBAS L1_CA RF Band */
+ GNSS_LOC_SIGNAL_TYPE_NAVIC_L5 = 18, /**< NAVIC L5 RF Band */
+ GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2A_Q = 19, /**< BEIDOU B2A_Q RF Band */
+ GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES = 20 /**< Maximum number of signal types */
+} Gnss_LocSignalEnumType;
+
+typedef uint32_t PositioningEngineMask;
+typedef enum {
+ STANDARD_POSITIONING_ENGINE = (1 << 0),
+ DEAD_RECKONING_ENGINE = (1 << 1),
+ PRECISE_POSITIONING_ENGINE = (1 << 2)
+} PositioningEngineBits;
+#define POSITION_ENGINE_MASK_ALL \
+ (STANDARD_POSITIONING_ENGINE|DEAD_RECKONING_ENGINE|PRECISE_POSITIONING_ENGINE)
+
+typedef uint64_t GnssDataMask;
+typedef enum {
+ // Jammer Indicator is available
+ GNSS_LOC_DATA_JAMMER_IND_BIT = (1ULL << 0),
+ // AGC is available
+ GNSS_LOC_DATA_AGC_BIT = (1ULL << 1)
+} GnssDataBits;
+
+typedef uint32_t GnssSystemTimeStructTypeFlags;
+typedef enum {
+ GNSS_SYSTEM_TIME_WEEK_VALID = (1 << 0),
+ GNSS_SYSTEM_TIME_WEEK_MS_VALID = (1 << 1),
+ GNSS_SYSTEM_CLK_TIME_BIAS_VALID = (1 << 2),
+ GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
+ GNSS_SYSTEM_REF_FCOUNT_VALID = (1 << 4),
+ GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID = (1 << 5)
+} GnssSystemTimeTypeBits;
+
+typedef uint32_t GnssGloTimeStructTypeFlags;
+typedef enum {
+ GNSS_CLO_DAYS_VALID = (1 << 0),
+ GNSS_GLO_MSEC_VALID = (1 << 1),
+ GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2),
+ GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
+ GNSS_GLO_REF_FCOUNT_VALID = (1 << 4),
+ GNSS_GLO_NUM_CLOCK_RESETS_VALID = (1 << 5),
+ GNSS_GLO_FOUR_YEAR_VALID = (1 << 6)
+} GnssGloTimeTypeBits;
+
+typedef struct {
+ GnssAidingDataSvMask svMask; // bitwise OR of GnssAidingDataSvBits
+ GnssAidingDataSvTypeMask svTypeMask; // bitwise OR of GnssAidingDataSvTypeBits
+} GnssAidingDataSv;
+
+typedef uint32_t GnssAidingDataCommonMask;
+typedef enum {
+ GNSS_AIDING_DATA_COMMON_POSITION_BIT = (1<<0), // position estimate
+ GNSS_AIDING_DATA_COMMON_TIME_BIT = (1<<1), // reset all clock values
+ GNSS_AIDING_DATA_COMMON_UTC_BIT = (1<<2), // UTC estimate
+ GNSS_AIDING_DATA_COMMON_RTI_BIT = (1<<3), // RTI
+ GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT = (1<<4), // frequency bias estimate
+ GNSS_AIDING_DATA_COMMON_CELLDB_BIT = (1<<5), // all celldb info
+} GnssAidingDataCommonBits;
+
+typedef struct {
+ GnssAidingDataCommonMask mask; // bitwise OR of GnssAidingDataCommonBits
+} GnssAidingDataCommon;
+
+typedef struct {
+ bool deleteAll; // if true, delete all aiding data and ignore other params
+ GnssAidingDataSv sv; // SV specific aiding data
+ GnssAidingDataCommon common; // common aiding data
+ PositioningEngineMask posEngineMask; // engines to perform the delete operation on.
+} GnssAidingData;
+
+typedef uint16_t DrCalibrationStatusMask;
+typedef enum {
+ // Indicate that roll calibration is needed. Need to take more turns on level ground
+ DR_ROLL_CALIBRATION_NEEDED = (1<<0),
+ // Indicate that pitch calibration is needed. Need to take more turns on level ground
+ DR_PITCH_CALIBRATION_NEEDED = (1<<1),
+ // Indicate that yaw calibration is needed. Need to accelerate in a straight line
+ DR_YAW_CALIBRATION_NEEDED = (1<<2),
+ // Indicate that odo calibration is needed. Need to accelerate in a straight line
+ DR_ODO_CALIBRATION_NEEDED = (1<<3),
+ // Indicate that gyro calibration is needed. Need to take more turns on level ground
+ DR_GYRO_CALIBRATION_NEEDED = (1<<4)
+} DrCalibrationStatusBits;
+
+typedef struct {
+ uint32_t size; // set to sizeof(Location)
+ LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid
+ uint64_t timestamp; // UTC timestamp for location fix, milliseconds since January 1, 1970
+ double latitude; // in degrees
+ double longitude; // in degrees
+ double altitude; // in meters above the WGS 84 reference ellipsoid
+ float speed; // in meters per second
+ float bearing; // in degrees; range [0, 360)
+ float accuracy; // in meters
+ float verticalAccuracy; // in meters
+ float speedAccuracy; // in meters/second
+ float bearingAccuracy; // in degrees (0 to 359.999)
+ LocationTechnologyMask techMask;
+ LocationSpoofMask spoofMask;
+ uint64_t elapsedRealTime; // in ns
+ uint64_t elapsedRealTimeUnc; // in ns
+} Location;
+
+typedef enum {
+ LOC_REQ_ENGINE_FUSED_BIT = (1<<0),
+ LOC_REQ_ENGINE_SPE_BIT = (1<<1),
+ LOC_REQ_ENGINE_PPE_BIT = (1<<2),
+} LocReqEngineTypeMask;
+
+typedef enum {
+ LOC_OUTPUT_ENGINE_FUSED = 0,
+ /** This is the GNSS fix from modem */
+ LOC_OUTPUT_ENGINE_SPE = 1,
+ /** This is the GNSS fix with correction PPP/RTK correction */
+ LOC_OUTPUT_ENGINE_PPE = 2,
+ LOC_OUTPUT_ENGINE_COUNT,
+} LocOutputEngineType;
+
+struct LocationOptions {
+ uint32_t size; // set to sizeof(LocationOptions)
+ uint32_t minInterval; // in milliseconds
+ uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/
+ // gnssMeasurementsCallback may not be called
+ GnssSuplMode mode; // Standalone/MS-Based/MS-Assisted
+ // behavior when this field is 0:
+ // if engine hub is running, this will be fused fix,
+ // if engine hub is not running, this will be SPE fix
+ LocReqEngineTypeMask locReqEngTypeMask;
+
+ inline LocationOptions() :
+ size(0), minInterval(0), minDistance(0), mode(GNSS_SUPL_MODE_STANDALONE),
+ locReqEngTypeMask((LocReqEngineTypeMask)0) {}
+};
+
+typedef enum {
+ GNSS_POWER_MODE_INVALID = 0,
+ GNSS_POWER_MODE_M1, /* Improved Accuracy Mode */
+ GNSS_POWER_MODE_M2, /* Normal Mode */
+ GNSS_POWER_MODE_M3, /* Background Mode */
+ GNSS_POWER_MODE_M4, /* Background Mode */
+ GNSS_POWER_MODE_M5 /* Background Mode */
+} GnssPowerMode;
+
+struct TrackingOptions : LocationOptions {
+ GnssPowerMode powerMode; /* Power Mode to be used for time based tracking
+ sessions */
+ uint32_t tbm; /* Time interval between measurements specified in millis.
+ Applicable to background power modes */
+
+ inline TrackingOptions() :
+ LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
+ inline TrackingOptions(uint32_t s, GnssPowerMode m, uint32_t t) :
+ LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; }
+ inline TrackingOptions(const LocationOptions& options) :
+ LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
+ inline void setLocationOptions(const LocationOptions& options) {
+ size = sizeof(TrackingOptions);
+ minInterval = options.minInterval;
+ minDistance = options.minDistance;
+ mode = options.mode;
+ locReqEngTypeMask = options.locReqEngTypeMask;
+ }
+ inline LocationOptions getLocationOptions() {
+ LocationOptions locOption;
+ locOption.size = sizeof(locOption);
+ locOption.minDistance = minDistance;
+ locOption.minInterval = minInterval;
+ locOption.mode = mode;
+ locOption.locReqEngTypeMask = locReqEngTypeMask;
+ return locOption;
+ }
+};
+
+struct BatchingOptions : LocationOptions {
+ BatchingMode batchingMode;
+
+ inline BatchingOptions() :
+ LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {}
+ inline BatchingOptions(uint32_t s, BatchingMode m) :
+ LocationOptions(), batchingMode(m) { LocationOptions::size = s; }
+ inline BatchingOptions(const LocationOptions& options) :
+ LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {}
+ inline void setLocationOptions(const LocationOptions& options) {
+ minInterval = options.minInterval;
+ minDistance = options.minDistance;
+ mode = options.mode;
+ }
+};
+
+typedef struct {
+ uint32_t size;
+ BatchingStatus batchingStatus;
+} BatchingStatusInfo;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GeofenceOption)
+ GeofenceBreachTypeMask breachTypeMask; // bitwise OR of GeofenceBreachTypeBits
+ uint32_t responsiveness; // in milliseconds
+ uint32_t dwellTime; // in seconds
+} GeofenceOption;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GeofenceInfo)
+ double latitude; // in degrees
+ double longitude; // in degrees
+ double radius; // in meters
+} GeofenceInfo;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GeofenceBreachNotification)
+ uint32_t count; // number of ids in array
+ uint32_t* ids; // array of ids that have breached
+ Location location; // location associated with breach
+ GeofenceBreachType type; // type of breach
+ uint64_t timestamp; // timestamp of breach
+} GeofenceBreachNotification;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GeofenceBreachNotification)
+ GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES
+ LocationTechnologyType techType; // GNSS
+} GeofenceStatusNotification;
+
+typedef struct {
+ uint64_t gpsSvUsedIdsMask;
+ uint64_t gloSvUsedIdsMask;
+ uint64_t galSvUsedIdsMask;
+ uint64_t bdsSvUsedIdsMask;
+ uint64_t qzssSvUsedIdsMask;
+ uint64_t navicSvUsedIdsMask;
+} GnssLocationSvUsedInPosition;
+
+typedef struct {
+ /** GnssSignalType mask */
+ GnssSignalTypeMask gnssSignalType;
+ /** Specifies GNSS Constellation Type */
+ Gnss_LocSvSystemEnumType gnssConstellation;
+ /** Unique SV Identifier.
+ * For SV Range of supported constellation, please refer to
+ * the comment section of svId in GnssSv.
+ * For GLONASS: When slot-number to SV ID mapping is unknown, set as 255.
+ */
+ uint16_t gnssSvId;
+} GnssMeasUsageInfo;
+
+/** @struct
+ Body Frame parameters
+*/
+typedef struct {
+ GnssLocationPosDataMask bodyFrameDataMask; // Contains Body frame LocPosDataMask bits
+ float longAccel; // Forward Acceleration in body frame (m/s2)
+ float latAccel; // Sideward Acceleration in body frame (m/s2)
+ float vertAccel; // Vertical Acceleration in body frame (m/s2)
+ float yawRate; // Heading Rate (Radians/second)
+ float pitch; // Body pitch (Radians)
+ float longAccelUnc; // Uncertainty of Forward Acceleration in body frame
+ float latAccelUnc; // Uncertainty of Side-ward Acceleration in body frame
+ float vertAccelUnc; // Uncertainty of Vertical Acceleration in body frame
+ float yawRateUnc; // Uncertainty of Heading Rate
+ float pitchUnc; // Uncertainty of Body pitch
+} GnssLocationPositionDynamics;
+
+typedef struct {
+ /** Validity mask for below fields */
+ GnssSystemTimeStructTypeFlags validityMask;
+ /** Extended week number at reference tick.
+ Unit: Week.
+ Set to 65535 if week number is unknown.
+ For GPS:
+ Calculated from midnight, Jan. 6, 1980.
+ OTA decoded 10 bit GPS week is extended to map between:
+ [NV6264 to (NV6264 + 1023)].
+ NV6264: Minimum GPS week number configuration.
+ Default value of NV6264: 1738
+ For BDS:
+ Calculated from 00:00:00 on January 1, 2006 of Coordinated Universal Time (UTC).
+ For GAL:
+ Calculated from 00:00 UT on Sunday August 22, 1999 (midnight between August 21 and August 22).
+ */
+ uint16_t systemWeek;
+ /** Time in to the current week at reference tick.
+ Unit: Millisecond. Range: 0 to 604799999.
+ Check for systemClkTimeUncMs before use */
+ uint32_t systemMsec;
+ /** System clock time bias (sub-millisecond)
+ Units: Millisecond
+ Note: System time (TOW Millisecond) = systemMsec - systemClkTimeBias.
+ Check for systemClkTimeUncMs before use. */
+ float systemClkTimeBias;
+ /** Single sided maximum time bias uncertainty
+ Units: Millisecond */
+ float systemClkTimeUncMs;
+ /** FCount (free running HW timer) value. Don't use for relative time purpose
+ due to possible discontinuities.
+ Unit: Millisecond */
+ uint32_t refFCount;
+ /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */
+ uint32_t numClockResets;
+} GnssSystemTimeStructType;
+
+typedef struct {
+ /** GLONASS day number in four years. Refer to GLONASS ICD.
+ Applicable only for GLONASS and shall be ignored for other constellations.
+ If unknown shall be set to 65535 */
+ uint16_t gloDays;
+ /** Validity mask for below fields */
+ GnssGloTimeStructTypeFlags validityMask;
+ /** GLONASS time of day in Millisecond. Refer to GLONASS ICD.
+ Units: Millisecond
+ Check for gloClkTimeUncMs before use */
+ uint32_t gloMsec;
+ /** GLONASS clock time bias (sub-millisecond)
+ Units: Millisecond
+ Note: GLO time (TOD Millisecond) = gloMsec - gloClkTimeBias.
+ Check for gloClkTimeUncMs before use. */
+ float gloClkTimeBias;
+ /** Single sided maximum time bias uncertainty
+ Units: Millisecond */
+ float gloClkTimeUncMs;
+ /** FCount (free running HW timer) value. Don't use for relative time purpose
+ due to possible discontinuities.
+ Unit: Millisecond */
+ uint32_t refFCount;
+ /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */
+ uint32_t numClockResets;
+ /** GLONASS four year number from 1996. Refer to GLONASS ICD.
+ Applicable only for GLONASS and shall be ignored for other constellations.
+ If unknown shall be set to 255 */
+ uint8_t gloFourYear;
+} GnssGloTimeStructType;
+
+typedef union {
+ GnssSystemTimeStructType gpsSystemTime;
+ GnssSystemTimeStructType galSystemTime;
+ GnssSystemTimeStructType bdsSystemTime;
+ GnssSystemTimeStructType qzssSystemTime;
+ GnssGloTimeStructType gloSystemTime;
+ GnssSystemTimeStructType navicSystemTime;
+} SystemTimeStructUnion;
+ /** Time applicability of PVT report */
+typedef struct {
+ /** Specifies GNSS system time reported. Mandatory field */
+ Gnss_LocSvSystemEnumType gnssSystemTimeSrc;
+ /** Reporting of GPS system time is recommended.
+ If GPS time is unknown & other satellite system time is known,
+ it should be reported.
+ Mandatory field
+ */
+ SystemTimeStructUnion u;
+} GnssSystemTime;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssLocationInfo)
+ Location location; // basic locaiton info, latitude, longitude, and etc
+ GnssLocationInfoFlagMask flags; // bitwise OR of GnssLocationInfoBits for param validity
+ float altitudeMeanSeaLevel; // altitude wrt mean sea level
+ float pdop; // position dilusion of precision
+ float hdop; // horizontal dilusion of precision
+ float vdop; // vertical dilusion of precision
+ float gdop; // geometric dilution of precision
+ float tdop; // time dilution of precision
+ float magneticDeviation; // magnetic deviation
+ LocationReliability horReliability; // horizontal reliability
+ LocationReliability verReliability; // vertical reliability
+ float horUncEllipseSemiMajor; // horizontal elliptical accuracy semi-major axis
+ float horUncEllipseSemiMinor; // horizontal elliptical accuracy semi-minor axis
+ float horUncEllipseOrientAzimuth; // horizontal elliptical accuracy azimuth
+ float northStdDeviation; // North standard deviation Unit: Meters
+ float eastStdDeviation; // East standard deviation. Unit: Meters
+ float northVelocity; // North Velocity.Unit: Meters/sec
+ float eastVelocity; // East Velocity Unit Meters/sec
+ float upVelocity; // Up Velocity. Unit Meters/sec
+ float northVelocityStdDeviation;
+ float eastVelocityStdDeviation;
+ float upVelocityStdDeviation;
+ uint16_t numSvUsedInPosition;
+ GnssLocationSvUsedInPosition svUsedInPosition;// Gnss sv used in position data
+ GnssLocationNavSolutionMask navSolutionMask; // Nav solution mask to indicate sbas corrections
+ GnssLocationPosTechMask posTechMask; // Position technology used in computing this fix
+ GnssLocationPositionDynamics bodyFrameData; // Body Frame Dynamics: 4wayAcceleration and
+ // pitch set with validity
+ GnssSystemTime gnssSystemTime; // GNSS System Time
+ uint8_t numOfMeasReceived; // Number of measurements received for use in fix.
+ GnssMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; // GNSS Measurement Usage info
+ uint8_t leapSeconds; // leap second
+ float timeUncMs; // Time uncertainty in milliseconds
+ uint8_t calibrationConfidence; // Sensor calibration confidence percent,
+ // in range of [0, 100]
+ DrCalibrationStatusMask calibrationStatus; // Sensor calibration status
+ // location engine type. When the fix. when the type is set to
+ // LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
+ // reports from all engines running on the system (e.g.:
+ // DR/SPE/PPE). To check which location engine contributes to
+ // the fused output, check for locOutputEngMask.
+ LocOutputEngineType locOutputEngType;
+ // when loc output eng type is set to fused, this field
+ // indicates the set of engines contribute to the fix.
+ PositioningEngineMask locOutputEngMask;
+ /* When robust location is enabled, this field
+ * will how well the various input data considered for
+ * navigation solution conform to expectations.
+ * Range: 0 (least conforming) to 1 (most conforming) */
+ float conformityIndex;
+} GnssLocationInfoNotification;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssNiNotification)
+ GnssNiType type; // type of NI (Voice, SUPL, Control Plane)
+ GnssNiOptionsMask options; // bitwise OR of GnssNiOptionsBits
+ uint32_t timeout; // time (seconds) to wait for user input
+ GnssNiResponse timeoutResponse; // the response that should be sent when timeout expires
+ char requestor[GNSS_NI_REQUESTOR_MAX]; // the requestor that is making the request
+ GnssNiEncodingType requestorEncoding; // the encoding type for requestor
+ char message[GNSS_NI_MESSAGE_ID_MAX]; // the message to show user
+ GnssNiEncodingType messageEncoding; // the encoding type for message
+ char extras[GNSS_NI_MESSAGE_ID_MAX];
+} GnssNiNotification;
+
+// carrier frequency of the signal tracked
+#define GPS_L1CA_CARRIER_FREQUENCY (1575420000.0)
+#define GPS_L1C_CARRIER_FREQUENCY (1575420000.0)
+#define GPS_L2C_L_CARRIER_FREQUENCY (1227600000.0)
+#define GPS_L5_Q_CARRIER_FREQUENCY (1176450000.0)
+#define GLONASS_G1_CARRIER_FREQUENCY (1602000000.0)
+#define GLONASS_G2_CARRIER_FREQUENCY (1246000000.0)
+#define GALILEO_E1_C_CARRIER_FREQUENCY (1575420000.0)
+#define GALILEO_E5A_Q_CARRIER_FREQUENCY (1176450000.0)
+#define GALILEO_E5B_Q_CARRIER_FREQUENCY (1207140000.0)
+#define BEIDOU_B1_I_CARRIER_FREQUENCY (1561098000.0)
+#define BEIDOU_B1C_CARRIER_FREQUENCY (1575420000.0)
+#define BEIDOU_B2_I_CARRIER_FREQUENCY (1207140000.0)
+#define BEIDOU_B2A_I_CARRIER_FREQUENCY (1176450000.0)
+#define BEIDOU_B2A_Q_CARRIER_FREQUENCY (1176450000.0)
+#define QZSS_L1CA_CARRIER_FREQUENCY (1575420000.0)
+#define QZSS_L1S_CARRIER_FREQUENCY (1575420000.0)
+#define QZSS_L2C_L_CARRIER_FREQUENCY (1227600000.0)
+#define QZSS_L5_Q_CARRIER_FREQUENCY (1176450000.0)
+#define SBAS_L1_CA_CARRIER_FREQUENCY (1575420000.0)
+#define NAVIC_L5_CARRIER_FREQUENCY (1176450000.0)
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssSv)
+ // Unique SV Identifier.
+ // SV Range for supported constellation is specified as below:
+ // - For GPS: 1 to 32
+ // - For GLONASS: 65 to 96
+ // - For SBAS: 120 to 158 and 183 to 191
+ // - For QZSS: 193 to 197
+ // - For BDS: 201 to 237
+ // - For GAL: 301 to 336
+ // - For NAVIC: 401 to 41
+ uint16_t svId;
+ GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO)
+ float cN0Dbhz; // signal strength
+ float elevation; // elevation of SV (in degrees)
+ float azimuth; // azimuth of SV (in degrees)
+ GnssSvOptionsMask gnssSvOptionsMask; // Bitwise OR of GnssSvOptionsBits
+ float carrierFrequencyHz; // carrier frequency of the signal tracked
+ GnssSignalTypeMask gnssSignalTypeMask; // Specifies GNSS signal type
+} GnssSv;
+
+struct GnssConfigSetAssistanceServer {
+ uint32_t size; // set to sizeof(GnssConfigSetAssistanceServer)
+ GnssAssistanceType type; // SUPL or C2K
+ const char* hostName; // null terminated string
+ uint32_t port; // port of server
+
+ inline bool equals(const GnssConfigSetAssistanceServer& config) {
+ if (config.type == type && config.port == port &&
+ ((NULL == config.hostName && NULL == hostName) ||
+ (NULL != config.hostName && NULL != hostName &&
+ 0 == strcmp(config.hostName, hostName)))) {
+ return true;
+ }
+ return false;
+ }
+};
+
+typedef struct {
+ // set to sizeof(GnssMeasurementsData)
+ uint32_t size;
+ // bitwise OR of GnssMeasurementsDataFlagsBits
+ GnssMeasurementsDataFlagsMask flags;
+ // Unique SV Identifier
+ // For SV Range of supported constellation,
+ // please refer to the comment section of svId in GnssSv.
+ int16_t svId;
+ GnssSvType svType;
+ double timeOffsetNs;
+ GnssMeasurementsStateMask stateMask; // bitwise OR of GnssMeasurementsStateBits
+ int64_t receivedSvTimeNs;
+ int64_t receivedSvTimeUncertaintyNs;
+ double carrierToNoiseDbHz;
+ double pseudorangeRateMps;
+ double pseudorangeRateUncertaintyMps;
+ GnssMeasurementsAdrStateMask adrStateMask; // bitwise OR of GnssMeasurementsAdrStateBits
+ double adrMeters;
+ double adrUncertaintyMeters;
+ float carrierFrequencyHz;
+ int64_t carrierCycles;
+ double carrierPhase;
+ double carrierPhaseUncertainty;
+ GnssMeasurementsMultipathIndicator multipathIndicator;
+ double signalToNoiseRatioDb;
+ double agcLevelDb;
+ GnssMeasurementsCodeType codeType;
+ char otherCodeTypeName[GNSS_MAX_NAME_LENGTH];
+ int16_t gloFrequency;
+} GnssMeasurementsData;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssMeasurementsClock)
+ GnssMeasurementsClockFlagsMask flags; // bitwise OR of GnssMeasurementsClockFlagsBits
+ int16_t leapSecond;
+ int64_t timeNs;
+ double timeUncertaintyNs;
+ int64_t fullBiasNs;
+ double biasNs;
+ double biasUncertaintyNs;
+ double driftNsps;
+ double driftUncertaintyNsps;
+ uint32_t hwClockDiscontinuityCount;
+ uint64_t elapsedRealTime; // in ns
+ uint64_t elapsedRealTimeUnc; // in ns
+} GnssMeasurementsClock;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssSvNotification)
+ uint32_t count; // number of SVs in the GnssSv array
+ bool gnssSignalTypeMaskValid;
+ GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs
+} GnssSvNotification;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssNmeaNotification)
+ uint64_t timestamp; // timestamp
+ const char* nmea; // nmea text
+ uint32_t length; // length of the nmea text
+} GnssNmeaNotification;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssDataNotification)
+ GnssDataMask gnssDataMask[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // bitwise OR of GnssDataBits
+ double jammerInd[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Jammer Indication
+ double agc[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Automatic gain control
+} GnssDataNotification;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssMeasurementsNotification)
+ uint32_t count; // number of items in GnssMeasurements array
+ GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX];
+ GnssMeasurementsClock clock; // clock
+} GnssMeasurementsNotification;
+
+typedef uint32_t GnssSvId;
+
+struct GnssSvIdSource{
+ uint32_t size; // set to sizeof(GnssSvIdSource)
+ GnssSvType constellation; // constellation for the sv to blacklist
+ GnssSvId svId; // Unique SV Identifier,
+ // For SV Range of supported constellation,
+ // please refer to the comment section of svId in GnssSv.
+};
+inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) {
+ return left.size == right.size &&
+ left.constellation == right.constellation && left.svId == right.svId;
+}
+
+#define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF)
+typedef struct {
+ uint32_t size; // set to sizeof(GnssSvIdConfig)
+
+ // GLONASS - SV 65 maps to bit 0
+#define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65
+ uint64_t gloBlacklistSvMask;
+
+ // BEIDOU - SV 201 maps to bit 0
+#define GNSS_SV_CONFIG_BDS_INITIAL_SV_ID 201
+ uint64_t bdsBlacklistSvMask;
+
+ // QZSS - SV 193 maps to bit 0
+#define GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID 193
+ uint64_t qzssBlacklistSvMask;
+
+ // GAL - SV 301 maps to bit 0
+#define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301
+ uint64_t galBlacklistSvMask;
+
+ // SBAS - SV 120 to 158, maps to 0 to 38
+ // SV 183 to 191, maps to 39 to 47
+#define GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID 120
+#define GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH 39
+#define GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID 183
+ uint64_t sbasBlacklistSvMask;
+} GnssSvIdConfig;
+
+// Specify the valid mask for robust location configure that
+// will be returned via LocConfigGetMinGpsWeekCb when invoking
+// getRobustLocationConfig. */
+enum GnssConfigRobustLocationValidMask {
+ // GnssConfigRobustLocation has valid enabled field.
+ GNSS_CONFIG_ROBUST_LOCATION_ENABLED_VALID_BIT = (1<<0),
+ // GnssConfigRobustLocation has valid enabledForE911 field.
+ GNSS_CONFIG_ROBUST_LOCATION_ENABLED_FOR_E911_VALID_BIT = (1<<1),
+};
+
+// specify the robust location configuration used by modem GNSS engine
+struct GnssConfigRobustLocation {
+ GnssConfigRobustLocationValidMask validMask;
+ bool enabled;
+ bool enabledForE911;
+
+ inline bool equals(const GnssConfigRobustLocation& config) const {
+ if (config.validMask == validMask &&
+ config.enabled == enabled &&
+ config.enabledForE911 == enabledForE911) {
+ return true;
+ }
+ return false;
+ }
+};
+
+struct GnssConfig{
+ uint32_t size; // set to sizeof(GnssConfig)
+ GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid
+ GnssConfigGpsLock gpsLock;
+ GnssConfigSuplVersion suplVersion;
+ GnssConfigSetAssistanceServer assistanceServer;
+ GnssConfigLppProfile lppProfile;
+ GnssConfigLppeControlPlaneMask lppeControlPlaneMask;
+ GnssConfigLppeUserPlaneMask lppeUserPlaneMask;
+ GnssConfigAGlonassPositionProtocolMask aGlonassPositionProtocolMask;
+ GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl;
+ GnssConfigSuplEmergencyServices suplEmergencyServices;
+ GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits
+ std::vector<GnssSvIdSource> blacklistedSvIds;
+ uint32_t emergencyExtensionSeconds;
+ GnssConfigRobustLocation robustLocationConfig;
+
+ inline bool equals(const GnssConfig& config) {
+ if (flags == config.flags &&
+ gpsLock == config.gpsLock &&
+ suplVersion == config.suplVersion &&
+ assistanceServer.equals(config.assistanceServer) &&
+ lppProfile == config.lppProfile &&
+ lppeControlPlaneMask == config.lppeControlPlaneMask &&
+ lppeUserPlaneMask == config.lppeUserPlaneMask &&
+ aGlonassPositionProtocolMask == config.aGlonassPositionProtocolMask &&
+ emergencyPdnForEmergencySupl == config.emergencyPdnForEmergencySupl &&
+ suplEmergencyServices == config.suplEmergencyServices &&
+ suplModeMask == config.suplModeMask &&
+ blacklistedSvIds == config.blacklistedSvIds &&
+ emergencyExtensionSeconds == config.emergencyExtensionSeconds &&
+ robustLocationConfig.equals(config.robustLocationConfig)) {
+ return true;
+ }
+ return false;
+ }
+};
+
+typedef struct {
+ uint32_t size; // set to sizeof
+ bool mValid;
+ Location mLocation;
+ double verticalAccuracyMeters;
+ double speedAccuracyMetersPerSecond;
+ double bearingAccuracyDegrees;
+ timespec mUtcReported;
+} GnssDebugLocation;
+
+typedef struct {
+ uint32_t size; // set to sizeof
+ bool mValid;
+ int64_t timeEstimate;
+ float timeUncertaintyNs;
+ float frequencyUncertaintyNsPerSec;
+} GnssDebugTime;
+
+typedef struct {
+ // set to sizeof
+ uint32_t size;
+ // Unique SV Identifier
+ // For SV Range of supported constellation,
+ // please refer to the comment section of svId in GnssSv.
+ uint32_t svid;
+ GnssSvType constellation;
+ GnssEphemerisType mEphemerisType;
+ GnssEphemerisSource mEphemerisSource;
+ GnssEphemerisHealth mEphemerisHealth;
+ float ephemerisAgeSeconds;
+ bool serverPredictionIsAvailable;
+ float serverPredictionAgeSeconds;
+} GnssDebugSatelliteInfo;
+
+typedef struct {
+ uint32_t size; // set to sizeof
+ GnssDebugLocation mLocation;
+ GnssDebugTime mTime;
+ std::vector<GnssDebugSatelliteInfo> mSatelliteInfo;
+} GnssDebugReport;
+
+typedef uint32_t LeapSecondSysInfoMask;
+typedef enum {
+ // current leap second info is available. This info will only
+ // be available if the leap second change info is not available.
+ //
+ // If leap second change info is avaiable, to figure out
+ // the current leap second info, compare current gps time with
+ // the gps timestamp of leap second change to know whether to choose
+ // leapSecondBefore or leapSecondAfter as current leap second.
+ LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT = (1ULL << 0),
+ // the last known leap change event is available.
+ // The info can be available on two scenario:
+ // 1: this leap second change event has been scheduled and yet to happen
+ // 2: this leap second change event has already happened and next
+ // leap second change event has not yet been scheduled.
+ LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT = (1ULL << 1),
+} LeapSecondSysInfoDataBits;
+
+struct LeapSecondChangeInfo {
+ // GPS timestamp that corrresponds to the last known
+ // leap second change event.
+ //
+ // The info can be available on two scenario:
+ // 1: this leap second change event has been scheduled and yet to happen
+ // 2: this leap second change event has already happened and next
+ // leap second change event has not yet been scheduled.
+ GnssSystemTimeStructType gpsTimestampLsChange;
+ // Number of leap seconds prior to the leap second change event
+ // that corresponds to the timestamp at gpsTimestampLsChange.
+ uint8_t leapSecondsBeforeChange;
+ // Number of leap seconds after the leap second change event
+ // that corresponds to the timestamp at gpsTimestampLsChange.
+ uint8_t leapSecondsAfterChange;
+};
+
+struct LeapSecondSystemInfo {
+ LeapSecondSysInfoMask leapSecondInfoMask;
+ uint8_t leapSecondCurrent;
+ LeapSecondChangeInfo leapSecondChangeInfo;
+};
+
+typedef uint32_t LocationSystemInfoMask;
+typedef enum {
+ // contains current leap second or leap second change info
+ LOCATION_SYS_INFO_LEAP_SECOND = (1ULL << 0),
+} LocationSystemInfoDataBits;
+
+struct LocationSystemInfo {
+ LocationSystemInfoMask systemInfoMask;
+ LeapSecondSystemInfo leapSecondSysInfo;
+};
+
+/* Mask indicating enabled or disabled constellations */
+typedef uint64_t GnssSvTypesMask;
+typedef enum {
+ GNSS_SV_TYPES_MASK_GLO_BIT = (1<<0),
+ GNSS_SV_TYPES_MASK_BDS_BIT = (1<<1),
+ GNSS_SV_TYPES_MASK_QZSS_BIT = (1<<2),
+ GNSS_SV_TYPES_MASK_GAL_BIT = (1<<3),
+ GNSS_SV_TYPES_MASK_NAVIC_BIT = (1<<4),
+} GnssSvTypesMaskBits;
+
+/* This SV Type config is injected directly to GNSS Adapter
+ * bypassing Location API */
+typedef struct {
+ uint32_t size; // set to sizeof(GnssSvTypeConfig)
+ // Enabled Constellations
+ GnssSvTypesMask enabledSvTypesMask;
+ // Disabled Constellations
+ GnssSvTypesMask blacklistedSvTypesMask;
+} GnssSvTypeConfig;
+
+// Specify parameters related to lever arm
+struct LeverArmParams {
+ // Offset along the vehicle forward axis
+ float forwardOffsetMeters;
+ // Offset along the vehicle starboard axis
+ float sidewaysOffsetMeters;
+ // Offset along the vehicle up axis
+ float upOffsetMeters;
+};
+
+typedef uint32_t LeverArmTypeMask;
+
+enum LeverArmTypeBits {
+ // Lever arm regarding the VRP (Vehicle Reference Point) w.r.t
+ // the origin (at the GPS Antenna)
+ LEVER_ARM_TYPE_GNSS_TO_VRP_BIT = (1<<0),
+ // Lever arm regarding GNSS Antenna w.r.t the origin at the IMU
+ // e.g.: inertial measurement unit for DR (dead reckoning
+ // engine)
+ LEVER_ARM_TYPE_DR_IMU_TO_GNSS_BIT = (1<<1),
+ // Lever arm regarding GNSS Antenna w.r.t the origin at the
+ // IMU (inertial measurement unit) for VEPP (vision enhanced
+ // precise positioning engine)
+ LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS_BIT = (1<<2)
+};
+
+struct LeverArmConfigInfo {
+ // Valid mask for the types of lever arm parameters provided
+ LeverArmTypeMask leverArmValidMask;
+ // Lever arm regarding the VRP (Vehicle Reference Point) w.r.t the origin
+ // (at the GPS Antenna)
+ LeverArmParams gnssToVRP;
+ // Lever arm parameters regarding GNSS Antenna w.r.t the origin at the IMU
+ // (inertial measurement unit) for DR (dead reckoning engine)
+ LeverArmParams drImuToGnss;
+ // Lever arm regarding GNSS Antenna w.r.t the origin at the IMU
+ // (inertial measurement unit) for VEPP (vision enhanced precise position engine)
+ LeverArmParams veppImuToGnss;
+};
+
+/* Provides the capabilities of the system
+ capabilities callback is called once soon after createInstance is called */
+typedef std::function<void(
+ LocationCapabilitiesMask capabilitiesMask // bitwise OR of LocationCapabilitiesBits
+)> capabilitiesCallback;
+
+/* Used by tracking, batching, and miscellanous APIs
+ responseCallback is called for every Tracking, Batching API, and Miscellanous API */
+typedef std::function<void(
+ LocationError err, // if not SUCCESS, then id is not valid
+ uint32_t id // id to be associated to the request
+)> responseCallback;
+
+/* Used by APIs that gets more than one LocationError in it's response
+ collectiveResponseCallback is called for every geofence API call.
+ ids array and LocationError array are only valid until collectiveResponseCallback returns. */
+typedef std::function<void(
+ uint32_t count, // number of locations in arrays
+ LocationError* errs, // array of LocationError associated to the request
+ uint32_t* ids // array of ids to be associated to the request
+)> collectiveResponseCallback;
+
+/* Used for startTracking API, optional can be NULL
+ trackingCallback is called when delivering a location in a tracking session
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ Location location
+)> trackingCallback;
+
+/* Used for startBatching API, optional can be NULL
+ batchingCallback is called when delivering locations in a batching session.
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ uint32_t count, // number of locations in array
+ Location* location, // array of locations
+ BatchingOptions batchingOptions // Batching options
+)> batchingCallback;
+
+typedef std::function<void(
+ BatchingStatusInfo batchingStatus, // batch status
+ std::list<uint32_t> & listOfCompletedTrips
+)> batchingStatusCallback;
+
+/* Gives GNSS Location information, optional can be NULL
+ gnssLocationInfoCallback is called only during a tracking session
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ GnssLocationInfoNotification gnssLocationInfoNotification
+)> gnssLocationInfoCallback;
+
+/* Gives default combined location information from all engines and
+ location information individually from selected engines.
+ This callback is only used when there are multiple engines
+ running in the system.
+
+ optional can be NULL
+
+ engineLocationsInfoCallback is called only during a tracking session
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ uint32_t count,
+ GnssLocationInfoNotification* engineLocationInfoNotification
+)> engineLocationsInfoCallback;
+
+/* Used for addGeofences API, optional can be NULL
+ geofenceBreachCallback is called when any number of geofences have a state change */
+typedef std::function<void(
+ GeofenceBreachNotification geofenceBreachNotification
+)> geofenceBreachCallback;
+
+/* Used for addGeofences API, optional can be NULL
+ geofenceStatusCallback is called when any number of geofences have a status change */
+typedef std::function<void(
+ GeofenceStatusNotification geofenceStatusNotification
+)> geofenceStatusCallback;
+
+/* Network Initiated request, optional can be NULL
+ This callback should be responded to by calling gnssNiResponse */
+typedef std::function<void(
+ uint32_t id, // id that should be used to respond by calling gnssNiResponse
+ GnssNiNotification gnssNiNotification
+)> gnssNiCallback;
+
+/* Gives GNSS SV information, optional can be NULL
+ gnssSvCallback is called only during a tracking session
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ GnssSvNotification gnssSvNotification
+)> gnssSvCallback;
+
+/* Gives GNSS NMEA data, optional can be NULL
+ gnssNmeaCallback is called only during a tracking session
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ GnssNmeaNotification gnssNmeaNotification
+)> gnssNmeaCallback;
+
+/* Gives GNSS data, optional can be NULL
+ gnssDataCallback is called only during a tracking session
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ GnssDataNotification gnssDataNotification
+)> gnssDataCallback;
+
+/* Gives GNSS Measurements information, optional can be NULL
+ gnssMeasurementsCallback is called only during a tracking session
+ broadcasted to all clients, no matter if a session has started by client */
+typedef std::function<void(
+ GnssMeasurementsNotification gnssMeasurementsNotification
+)> gnssMeasurementsCallback;
+
+/* Provides the current GNSS configuration to the client */
+typedef std::function<void(
+ uint32_t session_id,
+ const GnssConfig& config
+)> gnssConfigCallback;
+
+/* LocationSystemInfoCb is for receiving rare occuring location
+ system information update. optional, can be NULL.
+*/
+typedef std::function<void(
+ LocationSystemInfo locationSystemInfo
+)> locationSystemInfoCallback;
+
+typedef std::function<void(
+)> locationApiDestroyCompleteCallback;
+
+typedef uint16_t LocationAdapterTypeMask;
+typedef enum {
+ LOCATION_ADAPTER_GNSS_TYPE_BIT = (1<<0), // adapter type is GNSS
+ LOCATION_ADAPTER_BATCHING_TYPE_BIT = (1<<1), // adapter type is BATCHING
+ LOCATION_ADAPTER_GEOFENCE_TYPE_BIT = (1<<2) // adapter type is geo fence
+} LocationAdapterTypeBits;
+
+typedef struct {
+ uint32_t size; // set to sizeof(LocationCallbacks)
+ capabilitiesCallback capabilitiesCb; // mandatory
+ responseCallback responseCb; // mandatory
+ collectiveResponseCallback collectiveResponseCb; // mandatory
+ trackingCallback trackingCb; // optional
+ batchingCallback batchingCb; // optional
+ geofenceBreachCallback geofenceBreachCb; // optional
+ geofenceStatusCallback geofenceStatusCb; // optional
+ gnssLocationInfoCallback gnssLocationInfoCb; // optional
+ gnssNiCallback gnssNiCb; // optional
+ gnssSvCallback gnssSvCb; // optional
+ gnssNmeaCallback gnssNmeaCb; // optional
+ gnssDataCallback gnssDataCb; // optional
+ gnssMeasurementsCallback gnssMeasurementsCb; // optional
+ batchingStatusCallback batchingStatusCb; // optional
+ locationSystemInfoCallback locationSystemInfoCb; // optional
+ engineLocationsInfoCallback engineLocationsInfoCb; // optional
+} LocationCallbacks;
+
+#endif /* LOCATIONDATATYPES_H */
diff --git a/gps/location/Makefile.am b/gps/location/Makefile.am
new file mode 100644
index 0000000..6a5a750
--- /dev/null
+++ b/gps/location/Makefile.am
@@ -0,0 +1,44 @@
+ACLOCAL_AMFLAGS = -I m4
+
+AM_CFLAGS = \
+ -I./ \
+ -I../utils \
+ $(LOCPLA_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ -std=c++11
+
+liblocation_api_la_SOURCES = \
+ LocationAPI.cpp \
+ LocationAPIClientBase.cpp
+
+if USE_EXTERNAL_AP
+AM_CFLAGS += -DFEATURE_EXTERNAL_AP
+endif
+
+if USE_GLIB
+liblocation_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+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 = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+liblocation_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+liblocation_api_la_LIBADD = -lstdc++ -ldl $(GPSUTILS_LIBS)
+
+library_include_HEADERS = \
+ LocationAPI.h \
+ LocationAPIClientBase.h \
+ location_interface.h \
+ LocationDataTypes.h \
+ ILocationAPI.h
+
+#Create and Install libraries
+lib_LTLIBRARIES = liblocation_api.la
+
+library_includedir = $(pkgincludedir)
+
+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..f8376f5
--- /dev/null
+++ b/gps/location/configure.ac
@@ -0,0 +1,95 @@
+# 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 subdir-objects])
+# 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")
+
+# External AP
+AC_ARG_WITH([external_ap],
+ AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
+ [Using External Application Processor]),
+ [],
+ with_external_ap=no)
+
+if test "x$with_external_ap" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
+fi
+
+AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "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
new file mode 100644
index 0000000..796e9ad
--- /dev/null
+++ b/gps/location/location_interface.h
@@ -0,0 +1,131 @@
+/* Copyright (c) 2017-2020 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 LOCATION_INTERFACE_H
+#define LOCATION_INTERFACE_H
+
+#include <LocationAPI.h>
+#include <gps_extended_c.h>
+#include <functional>
+
+/* Used for callback to deliver GNSS energy consumed */
+/** @fn
+ @brief Used by query API that retrieves energy consumed by
+ modem GNSS engine.
+
+ @param gnssEnergyConsumedFromFirstBoot:
+ Energy consumed by the GNSS engine since the first bootup
+ in units of 0.1 milli watt seconds.
+ A value of 0xffffffffffffffff indicates an invalid reading.
+*/
+typedef std::function<void(
+ uint64_t gnssEnergyConsumedFromFirstBoot
+)> GnssEnergyConsumedCallback;
+
+typedef void (*removeClientCompleteCallback)(LocationAPI* client);
+
+struct GnssInterface {
+ size_t size;
+ void (*initialize)(void);
+ void (*deinitialize)(void);
+ void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
+ void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb);
+ void (*requestCapabilities)(LocationAPI* client);
+ uint32_t (*startTracking)(LocationAPI* client, TrackingOptions&);
+ void (*updateTrackingOptions)(LocationAPI* client, uint32_t id, TrackingOptions&);
+ void (*stopTracking)(LocationAPI* client, uint32_t id);
+ void (*gnssNiResponse)(LocationAPI* client, uint32_t id, GnssNiResponse response);
+ void (*setControlCallbacks)(LocationControlCallbacks& controlCallbacks);
+ uint32_t (*enable)(LocationTechnologyType techType);
+ void (*disable)(uint32_t id);
+ uint32_t* (*gnssUpdateConfig)(GnssConfig config);
+ uint32_t* (*gnssGetConfig)(GnssConfigFlagsMask config);
+ void (*gnssUpdateSvTypeConfig)(GnssSvTypeConfig& config);
+ void (*gnssGetSvTypeConfig)(GnssSvTypeConfigCallback& callback);
+ void (*gnssResetSvTypeConfig)();
+ 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);
+ void (*agpsDataConnOpen)(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType);
+ void (*agpsDataConnClosed)(AGpsExtType agpsType);
+ void (*agpsDataConnFailed)(AGpsExtType agpsType);
+ void (*getDebugReport)(GnssDebugReport& report);
+ void (*updateConnectionStatus)(bool connected, int8_t type, bool roaming,
+ NetworkHandle networkHandle);
+ void (*odcpiInit)(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
+ void (*odcpiInject)(const Location& location);
+ void (*blockCPI)(double latitude, double longitude, float accuracy,
+ int blockDurationMsec, double latLonDiffThreshold);
+ void (*getGnssEnergyConsumed)(GnssEnergyConsumedCallback energyConsumedCb);
+ void (*enableNfwLocationAccess)(bool enable);
+ void (*nfwInit)(const NfwCbInfo& cbInfo);
+ void (*getPowerStateChanges)(std::function<void(bool)> powerStateCb);
+ void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo);
+ void (*updateBatteryStatus)(bool charging);
+ void (*updateSystemPowerState)(PowerStateType systemPowerState);
+ uint32_t (*setConstrainedTunc) (bool enable, float tuncConstraint, uint32_t energyBudget);
+ uint32_t (*setPositionAssistedClockEstimator) (bool enable);
+ uint32_t (*gnssUpdateSvConfig)(const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig);
+ uint32_t (*gnssResetSvConfig)();
+ uint32_t (*configLeverArm)(const LeverArmConfigInfo& configInfo);
+ uint32_t (*configRobustLocation)(bool enable, bool enableForE911);
+ bool (*isSS5HWEnabled)();
+};
+
+struct BatchingInterface {
+ size_t size;
+ void (*initialize)(void);
+ void (*deinitialize)(void);
+ void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
+ void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb);
+ void (*requestCapabilities)(LocationAPI* client);
+ uint32_t (*startBatching)(LocationAPI* client, BatchingOptions&);
+ void (*stopBatching)(LocationAPI* client, uint32_t id);
+ void (*updateBatchingOptions)(LocationAPI* client, uint32_t id, BatchingOptions&);
+ void (*getBatchedLocations)(LocationAPI* client, uint32_t id, size_t count);
+};
+
+struct GeofenceInterface {
+ size_t size;
+ void (*initialize)(void);
+ void (*deinitialize)(void);
+ void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
+ void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb);
+ void (*requestCapabilities)(LocationAPI* client);
+ uint32_t* (*addGeofences)(LocationAPI* client, size_t count, GeofenceOption*, GeofenceInfo*);
+ void (*removeGeofences)(LocationAPI* client, size_t count, uint32_t* ids);
+ void (*modifyGeofences)(LocationAPI* client, size_t count, uint32_t* ids,
+ GeofenceOption* options);
+ void (*pauseGeofences)(LocationAPI* client, size_t count, uint32_t* ids);
+ void (*resumeGeofences)(LocationAPI* client, size_t count, uint32_t* ids);
+};
+
+#endif /* LOCATION_INTERFACE_H */
diff --git a/gps/pla/Android.mk b/gps/pla/Android.mk
new file mode 100644
index 0000000..a57861d
--- /dev/null
+++ b/gps/pla/Android.mk
@@ -0,0 +1,29 @@
+GNSS_CFLAGS := \
+ -Werror \
+ -Wno-error=unused-parameter \
+ -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/pla/android/loc_pla.h b/gps/pla/android/loc_pla.h
new file mode 100644
index 0000000..1b99739
--- /dev/null
+++ b/gps/pla/android/loc_pla.h
@@ -0,0 +1,67 @@
+/* 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_PLA__
+#define __LOC_PLA__
+
+#ifdef __cplusplus
+#include <utils/SystemClock.h>
+#define uptimeMillis() android::uptimeMillis()
+#define elapsedRealtime() android::elapsedRealtime()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <cutils/properties.h>
+#include <cutils/threads.h>
+#include <cutils/sched_policy.h>
+#include <cutils/android_filesystem_config.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define UID_GPS (AID_GPS)
+#define GID_GPS (AID_GPS)
+#define UID_LOCCLIENT (4021)
+#define GID_LOCCLIENT (4021)
+
+#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 /* __LOC_PLA__ */
diff --git a/gps/pla/oe/loc_pla.h b/gps/pla/oe/loc_pla.h
new file mode 100644
index 0000000..2ab0aaa
--- /dev/null
+++ b/gps/pla/oe/loc_pla.h
@@ -0,0 +1,125 @@
+/* Copyright (c) 2014, 2020 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_PLA__
+#define __LOC_PLA__
+
+#ifdef __cplusplus
+#ifndef FEATURE_EXTERNAL_AP
+#include <utils/SystemClock.h>
+#endif /* FEATURE_EXTERNAL_AP */
+#include <inttypes.h>
+#include <sys/time.h>
+#include <time.h>
+
+#if defined(__GNUC__) && defined(__GNUC_PREREQ)
+#if __GNUC_PREREQ(6,0)
+ #pragma message "GNU C version is above 6"
+#else
+ #pragma message "GNU C version is less than 6"
+ #define NO_UNORDERED_SET_OR_MAP
+#endif
+#endif
+
+// use set/map instead of unordered_set/unordered_map for
+// older GCC versions
+#ifdef NO_UNORDERED_SET_OR_MAP
+#define unordered_set set
+#define unordered_map map
+#endif
+
+inline int64_t sysTimeMillis(int clock)
+{
+ struct timespec ts;
+ int64_t time_ms = 0;
+ clock_gettime(clock, &ts);
+ time_ms += (ts.tv_sec * 1000000000LL);
+ time_ms += ts.tv_nsec + 500000LL;
+ return time_ms / 1000000LL;
+}
+
+inline int64_t uptimeMillis() {
+ return sysTimeMillis(CLOCK_MONOTONIC);
+}
+inline int64_t elapsedRealtime() {
+ return sysTimeMillis(CLOCK_BOOTTIME);
+}
+
+extern "C" {
+#endif
+
+#ifndef FEATURE_EXTERNAL_AP
+#include <cutils/properties.h>
+#include <cutils/threads.h>
+#include <cutils/sched_policy.h>
+#else
+#define set_sched_policy(a, b)
+#endif /* FEATURE_EXTERNAL_AP */
+#include <pthread.h>
+#include <sys/time.h>
+#include <sys/types.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 UID_GPS (1021)
+#define GID_GPS (1021)
+#define UID_LOCCLIENT (4021)
+#define GID_LOCCLIENT (4021)
+
+#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 FEATURE_EXTERNAL_AP
+#define PROPERTY_VALUE_MAX 92
+
+inline int property_get(const char* key, char* value, const char* default_value)
+{
+ strlcpy(value, default_value, PROPERTY_VALUE_MAX - 1);
+ return strlen(value);
+}
+#endif /* FEATURE_EXTERNAL_AP */
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+#endif /* __LOC_PLA__ */
diff --git a/gps/utils/Android.mk b/gps/utils/Android.mk
new file mode 100644
index 0000000..57d485d
--- /dev/null
+++ b/gps/utils/Android.mk
@@ -0,0 +1,69 @@
+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 := \
+ libdl \
+ libutils \
+ libcutils \
+ liblog \
+ libprocessgroup
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ LocHeap.cpp \
+ LocTimer.cpp \
+ LocThread.cpp \
+ MsgTask.cpp \
+ loc_misc_utils.cpp \
+ loc_nmea.cpp \
+ LocIpc.cpp \
+ LogBuffer.cpp
+
+# Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
+endif
+
+LOCAL_LDFLAGS += -Wl,--export-dynamic
+
+## Includes
+LOCAL_HEADER_LIBRARIES := \
+ libutils_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+LOCAL_MODULE := libgps.utils
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+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 := libgps.utils_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/gps/utils/LocHeap.cpp b/gps/utils/LocHeap.cpp
new file mode 100644
index 0000000..d667f14
--- /dev/null
+++ b/gps/utils/LocHeap.cpp
@@ -0,0 +1,354 @@
+/* Copyright (c) 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 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 <LocHeap.h>
+
+class LocHeapNode {
+ friend class LocHeap;
+
+ // size of of the subtree, excluding self, 1 if no subtree
+ int mSize;
+ LocHeapNode* mLeft;
+ LocHeapNode* mRight;
+ LocRankable* mData;
+public:
+ inline LocHeapNode(LocRankable& data) :
+ mSize(1), mLeft(NULL), mRight(NULL), mData(&data) {}
+ ~LocHeapNode();
+
+ // this only swaps the data of the two nodes, so no
+ // detach / re-attached is necessary
+ void swap(LocHeapNode& node);
+
+ LocRankable* detachData();
+
+ // push a node into the tree stucture, keeping sorted by rank
+ void push(LocHeapNode& node);
+
+ // pop the head node out of the tree stucture. keeping sorted by rank
+ static LocHeapNode* pop(LocHeapNode*& top);
+
+ // remove a specific node from the tree
+ // returns the pointer to the node removed, which would be either the
+ // same as input (if successfully removed); or NULL (if failed).
+ static LocHeapNode* remove(LocHeapNode*& top, LocRankable& data);
+
+ // convenience method to compare data ranking
+ inline bool outRanks(LocHeapNode& node) { return mData->outRanks(*node.mData); }
+ inline bool outRanks(LocRankable& data) { return mData->outRanks(data); }
+
+ // checks if mSize is correct, AND this node is the highest ranking
+ // of the entire subtree
+ bool checkNodes();
+
+ inline int getSize() { return mSize; }
+};
+
+inline
+LocHeapNode::~LocHeapNode() {
+ if (mLeft) {
+ delete mLeft;
+ mLeft = NULL;
+ }
+ if (mRight) {
+ delete mRight;
+ mRight = NULL;
+ }
+ if (mData) {
+ mData = NULL;
+ }
+}
+
+inline
+void LocHeapNode::swap(LocHeapNode& node) {
+ LocRankable* tmpData = node.mData;
+ node.mData = mData;
+ mData = tmpData;
+}
+
+inline
+LocRankable* LocHeapNode::detachData() {
+ LocRankable* data = mData;
+ mData = NULL;
+ return data;
+}
+
+// push keeps the tree sorted by rank, it also tries to balance the
+// tree by adding the new node to the smaller of the subtrees.
+// The pointer to the tree and internal links never change. If the
+// mData of tree top ranks lower than that of the incoming node,
+// mData will be swapped with that of the incoming node to ensure
+// ranking, no restructuring the container nodes.
+void LocHeapNode::push(LocHeapNode& node) {
+ // ensure the current node ranks higher than in the incoming one
+ if (node.outRanks(*this)) {
+ swap(node);
+ }
+
+ // now drop the new node (ensured lower than *this) into a subtree
+ if (NULL == mLeft) {
+ mLeft = &node;
+ } else if (NULL == mRight) {
+ mRight = &node;
+ } else if (mLeft->mSize <= mRight->mSize) {
+ mLeft->push(node);
+ } else {
+ mRight->push(node);
+ }
+ mSize++;
+}
+
+// pop keeps the tree sorted by rank, but it does not try to balance
+// the tree. It recursively swaps with the higher ranked top of the
+// subtrees.
+// The return is a popped out node from leaf level, that has the data
+// swapped all the way down from the top. The pinter to the tree and
+// internal links will not be changed or restructured, except for the
+// node that is popped out.
+// If the return pointer == this, this the last node in the tree.
+LocHeapNode* LocHeapNode::pop(LocHeapNode*& top) {
+ // we know the top has the highest ranking at this point, else
+ // the tree is broken. This top will be popped out. But we need
+ // a node from the left or right child, whichever ranks higher,
+ // to replace the current top. This then will need to be done
+ // recursively to the leaf level. So we swap the mData of the
+ // current top node all the way down to the leaf level.
+ LocHeapNode* poppedNode = top;
+ // top is losing a node in its subtree
+ top->mSize--;
+ if (top->mLeft || top->mRight) {
+ // if mLeft is NULL, mRight for sure is NOT NULL, take that;
+ // else if mRight is NULL, mLeft for sure is NOT, take that;
+ // else we take the address of whatever has higher ranking mData
+ LocHeapNode*& subTop = (NULL == top->mLeft) ? top->mRight :
+ ((NULL == top->mRight) ? top->mLeft :
+ (top->mLeft->outRanks(*(top->mRight)) ? top->mLeft : top->mRight));
+ // swap mData, the tree top gets updated with the new data.
+ top->swap(*subTop);
+ // pop out from the subtree
+ poppedNode = pop(subTop);
+ } else {
+ // if the top has only single node
+ // detach the poppedNode from the tree
+ // subTop is the reference of ether mLeft or mRight
+ // NOT a local stack pointer. so it MUST be NULL'ed here.
+ top = NULL;
+ }
+
+ return poppedNode;
+}
+
+// navigating through the tree and find the node that hass the input
+// data. Since this is a heap, we do recursive linear search.
+// returns the pointer to the node removed, which would be either the
+// same as input (if successfully removed); or NULL (if failed).
+LocHeapNode* LocHeapNode::remove(LocHeapNode*& top, LocRankable& data) {
+ LocHeapNode* removedNode = NULL;
+ // this is the node, by address
+ if (&data == (LocRankable*)(top->mData)) {
+ // pop this node out
+ removedNode = pop(top);
+ } else if (!data.outRanks(*top->mData)) {
+ // subtrees might have this node
+ if (top->mLeft) {
+ removedNode = remove(top->mLeft, data);
+ }
+ // if we did not find in mLeft, and mRight is not empty
+ if (!removedNode && top->mRight) {
+ removedNode = remove(top->mRight, data);
+ }
+
+ // top lost a node in its subtree
+ if (removedNode) {
+ top->mSize--;
+ }
+ }
+
+ return removedNode;
+}
+
+// checks if mSize is correct, AND this node is the highest ranking
+// of the entire subtree
+bool LocHeapNode::checkNodes() {
+ // size of the current subtree
+ int totalSize = mSize;
+ if (mLeft) {
+ // check the consistency of left subtree
+ if (mLeft->outRanks(*this) || !mLeft->checkNodes()) {
+ return false;
+ }
+ // subtract the size of left subtree (with subtree head)
+ totalSize -= mLeft->mSize;
+ }
+
+ if (mRight) {
+ // check the consistency of right subtree
+ if (mRight->outRanks(*this) || !mRight->checkNodes()) {
+ return false;
+ }
+ // subtract the size of right subtree (with subtree head)
+ totalSize -= mRight->mSize;
+ }
+
+ // for the tree nodes to consistent, totalSize must be 1 now
+ return totalSize == 1;
+}
+
+LocHeap::~LocHeap() {
+ if (mTree) {
+ delete mTree;
+ }
+}
+
+void LocHeap::push(LocRankable& node) {
+ LocHeapNode* heapNode = new LocHeapNode(node);
+ if (!mTree) {
+ mTree = heapNode;
+ } else {
+ mTree->push(*heapNode);
+ }
+}
+
+LocRankable* LocHeap::peek() {
+ LocRankable* top = NULL;
+ if (mTree) {
+ top = mTree->mData;
+ }
+ return top;
+}
+
+LocRankable* LocHeap::pop() {
+ LocRankable* locNode = NULL;
+ if (mTree) {
+ // mTree may become NULL after this call
+ LocHeapNode* heapNode = LocHeapNode::pop(mTree);
+ locNode = heapNode->detachData();
+ delete heapNode;
+ }
+ return locNode;
+}
+
+LocRankable* LocHeap::remove(LocRankable& rankable) {
+ LocRankable* locNode = NULL;
+ if (mTree) {
+ // mTree may become NULL after this call
+ LocHeapNode* heapNode = LocHeapNode::remove(mTree, rankable);
+ if (heapNode) {
+ locNode = heapNode->detachData();
+ delete heapNode;
+ }
+ }
+ return locNode;
+}
+
+#ifdef __LOC_UNIT_TEST__
+bool LocHeap::checkTree() {
+ return ((NULL == mTree) || mTree->checkNodes());
+}
+uint32_t LocHeap::getTreeSize() {
+ return (NULL == mTree) ? 0 : mTree->getSize();
+}
+#endif
+
+#ifdef __LOC_DEBUG__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+class LocHeapDebug : public LocHeap {
+public:
+ bool checkTree() {
+ return ((NULL == mTree) || mTree->checkNodes());
+ }
+
+ uint32_t getTreeSize() {
+ return (NULL == mTree) ? 0 : (mTree->getSize());
+ }
+};
+
+class LocHeapDebugData : public LocRankable {
+ const int mID;
+public:
+ LocHeapDebugData(int id) : mID(id) {}
+ inline virtual int ranks(LocRankable& rankable) {
+ LocHeapDebugData* testData = dynamic_cast<LocHeapDebugData*>(&rankable);
+ return testData->mID - mID;
+ }
+};
+
+// For Linux command line testing:
+// compilation: g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../vendor/qcom/proprietary/gps-internal/unit-tests/fakes_for_host -I../../../../system/core/include LocHeap.cpp
+// test: valgrind --leak-check=full ./a.out 100
+int main(int argc, char** argv) {
+ srand(time(NULL));
+ int tries = atoi(argv[1]);
+ int checks = tries >> 3;
+ LocHeapDebug heap;
+ int treeSize = 0;
+
+ for (int i = 0; i < tries; i++) {
+ if (i % checks == 0 && !heap.checkTree()) {
+ printf("tree check failed before %dth op\n", i);
+ }
+ int r = rand();
+
+ if (r & 1) {
+ LocHeapDebugData* data = new LocHeapDebugData(r >> 1);
+ heap.push(dynamic_cast<LocRankable&>(*data));
+ treeSize++;
+ } else {
+ LocRankable* rankable = heap.pop();
+ if (rankable) {
+ delete rankable;
+ }
+ treeSize ? treeSize-- : 0;
+ }
+
+ printf("%s: %d == %d\n", (r&1)?"push":"pop", treeSize, heap.getTreeSize());
+ if (treeSize != heap.getTreeSize()) {
+ printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+ tries = i+1;
+ break;
+ }
+ }
+
+ if (!heap.checkTree()) {
+ printf("!!!!!!!!!!tree check failed at the end after %d ops!!!!!!!\n", tries);
+ } else {
+ printf("success!\n");
+ }
+
+ for (LocRankable* data = heap.pop(); NULL != data; data = heap.pop()) {
+ delete data;
+ }
+
+ return 0;
+}
+
+#endif
diff --git a/gps/utils/LocHeap.h b/gps/utils/LocHeap.h
new file mode 100644
index 0000000..b491948
--- /dev/null
+++ b/gps/utils/LocHeap.h
@@ -0,0 +1,96 @@
+/* Copyright (c) 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 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_HEAP__
+#define __LOC_HEAP__
+
+#include <stddef.h>
+#include <string.h>
+
+// abstract class to be implemented by client to provide a rankable class
+class LocRankable {
+public:
+ virtual inline ~LocRankable() {}
+
+ // method to rank objects of such type for sorting purposes.
+ // The pointer of the input node would be stored in the heap.
+ // >0 if ranks higher than the input;
+ // ==0 if equally ranks with the input;
+ // <0 if ranks lower than the input
+ virtual int ranks(LocRankable& rankable) = 0;
+
+ // convenient method to rank objects of such type for sorting purposes.
+ inline bool outRanks(LocRankable& rankable) { return ranks(rankable) > 0; }
+};
+
+// opaque class to provide service implementation.
+class LocHeapNode;
+
+// a heap whose left and right children are not sorted. It is sorted only vertically,
+// i.e. parent always ranks higher than children, if they exist. Ranking algorithm is
+// implemented in Rankable. The reason that there is no sort between children is to
+// help beter balance the tree with lower cost. When a node is pushed to the tree,
+// it is guaranteed that the subtree that is smaller gets to have the new node.
+class LocHeap {
+protected:
+ LocHeapNode* mTree;
+public:
+ inline LocHeap() : mTree(NULL) {}
+ ~LocHeap();
+
+ // push keeps the tree sorted by rank, it also tries to balance the
+ // tree by adding the new node to the smaller of the subtrees.
+ // node is reference to an obj that is managed by client, that client
+ // creates and destroyes. The destroy should happen after the
+ // node is popped out from the heap.
+ void push(LocRankable& node);
+
+ // Peeks the node data on tree top, which has currently the highest ranking
+ // There is no change the tree structure with this operation
+ // Returns NULL if the tree is empty, otherwise pointer to the node data of
+ // the tree top.
+ LocRankable* peek();
+
+ // pop keeps the tree sorted by rank, but it does not try to balance
+ // the tree.
+ // Return - pointer to the node popped out, or NULL if heap is already empty
+ LocRankable* pop();
+
+ // navigating through the tree and find the node that ranks the same
+ // as the input data, then remove it from the tree. Rank is implemented
+ // by rankable obj.
+ // returns the pointer to the node removed; or NULL (if failed).
+ LocRankable* remove(LocRankable& rankable);
+
+#ifdef __LOC_UNIT_TEST__
+ bool checkTree();
+ uint32_t getTreeSize();
+#endif
+};
+
+#endif //__LOC_HEAP__
diff --git a/gps/utils/LocIpc.cpp b/gps/utils/LocIpc.cpp
new file mode 100644
index 0000000..344e487
--- /dev/null
+++ b/gps/utils/LocIpc.cpp
@@ -0,0 +1,426 @@
+/* Copyright (c) 2017-2020 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 <netinet/in.h>
+#include <netdb.h>
+#include <loc_misc_utils.h>
+#include <log_util.h>
+#include <LocIpc.h>
+#include <algorithm>
+
+using namespace std;
+
+namespace loc_util {
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LocSvc_LocIpc"
+
+#define SOCK_OP_AND_LOG(buf, length, opable, rtv, exe) \
+ if (nullptr == (buf) || 0 == (length)) { \
+ LOC_LOGe("Invalid inputs: buf - %p, length - %u", (buf), (length)); \
+ } else if (!(opable)) { \
+ LOC_LOGe("Invalid object: operable - %d", (opable)); \
+ } else { \
+ rtv = (exe); \
+ if (-1 == rtv) { \
+ LOC_LOGw("failed reason: %s", strerror(errno)); \
+ } \
+ }
+
+const char Sock::MSG_ABORT[] = "LocIpc::Sock::ABORT";
+const char Sock::LOC_IPC_HEAD[] = "$MSGLEN$";
+ssize_t Sock::send(const void *buf, uint32_t len, int flags, const struct sockaddr *destAddr,
+ socklen_t addrlen) const {
+ ssize_t rtv = -1;
+ SOCK_OP_AND_LOG(buf, len, isValid(), rtv, sendto(buf, len, flags, destAddr, addrlen));
+ return rtv;
+}
+ssize_t Sock::recv(const LocIpcRecver& recver, const shared_ptr<ILocIpcListener>& dataCb, int flags,
+ struct sockaddr *srcAddr, socklen_t *addrlen, int sid) const {
+ ssize_t rtv = -1;
+ if (-1 == sid) {
+ sid = mSid;
+ } // else it sid would be connection based socket id for recv
+ SOCK_OP_AND_LOG(dataCb.get(), mMaxTxSize, isValid(), rtv,
+ recvfrom(recver, dataCb, sid, flags, srcAddr, addrlen));
+ return rtv;
+}
+ssize_t Sock::sendto(const void *buf, size_t len, int flags, const struct sockaddr *destAddr,
+ socklen_t addrlen) const {
+ ssize_t rtv = -1;
+ if (len <= mMaxTxSize) {
+ rtv = ::sendto(mSid, buf, len, flags, destAddr, addrlen);
+ } else {
+ std::string head(LOC_IPC_HEAD + to_string(len));
+ rtv = ::sendto(mSid, head.c_str(), head.length(), flags, destAddr, addrlen);
+ if (rtv > 0) {
+ for (size_t offset = 0; offset < len && rtv > 0; offset += rtv) {
+ rtv = ::sendto(mSid, (char*)buf + offset, min(len - offset, (size_t)mMaxTxSize),
+ flags, destAddr, addrlen);
+ }
+ rtv = (rtv > 0) ? (head.length() + len) : -1;
+ }
+ }
+ return rtv;
+}
+ssize_t Sock::recvfrom(const LocIpcRecver& recver, const shared_ptr<ILocIpcListener>& dataCb,
+ int sid, int flags, struct sockaddr *srcAddr, socklen_t *addrlen) const {
+ std::string msg(mMaxTxSize, 0);
+ ssize_t nBytes = ::recvfrom(sid, (void*)msg.data(), msg.size(), flags, srcAddr, addrlen);
+ if (nBytes > 0) {
+ if (strncmp(msg.data(), MSG_ABORT, sizeof(MSG_ABORT)) == 0) {
+ LOC_LOGi("recvd abort msg.data %s", msg.data());
+ nBytes = 0;
+ } else if (strncmp(msg.data(), LOC_IPC_HEAD, sizeof(LOC_IPC_HEAD) - 1)) {
+ // short message
+ msg.resize(nBytes);
+ dataCb->onReceive(msg.data(), nBytes, &recver);
+ } else {
+ // long message
+ size_t msgLen = 0;
+ sscanf(msg.data() + sizeof(LOC_IPC_HEAD) - 1, "%zu", &msgLen);
+ msg.resize(msgLen);
+ for (size_t msgLenReceived = 0; (msgLenReceived < msgLen) && (nBytes > 0);
+ msgLenReceived += nBytes) {
+ nBytes = ::recvfrom(sid, &(msg[msgLenReceived]), msg.size() - msgLenReceived,
+ flags, srcAddr, addrlen);
+ }
+ if (nBytes > 0) {
+ nBytes = msgLen;
+ dataCb->onReceive(msg.data(), nBytes, &recver);
+ }
+ }
+ }
+
+ return nBytes;
+}
+ssize_t Sock::sendAbort(int flags, const struct sockaddr *destAddr, socklen_t addrlen) {
+ return send(MSG_ABORT, sizeof(MSG_ABORT), flags, destAddr, addrlen);
+}
+
+class LocIpcLocalSender : public LocIpcSender {
+protected:
+ shared_ptr<Sock> mSock;
+ struct sockaddr_un mAddr;
+ inline virtual bool isOperable() const override { return mSock != nullptr && mSock->isValid(); }
+ inline virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t /* msgId */) const {
+ return mSock->send(data, length, 0, (struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+public:
+ inline LocIpcLocalSender(const char* name) : LocIpcSender(),
+ mSock(nullptr),
+ mAddr({.sun_family = AF_UNIX, {}}) {
+
+ int fd = -1;
+ if (nullptr != name) {
+ fd = ::socket(AF_UNIX, SOCK_DGRAM, 0);
+ if (fd >= 0) {
+ timeval timeout;
+ timeout.tv_sec = 2;
+ timeout.tv_usec = 0;
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
+ }
+ }
+ mSock.reset(new Sock(fd));
+ if (mSock != nullptr && mSock->isValid()) {
+ snprintf(mAddr.sun_path, sizeof(mAddr.sun_path), "%s", name);
+ }
+ }
+};
+
+class LocIpcLocalRecver : public LocIpcLocalSender, public LocIpcRecver {
+protected:
+ inline virtual ssize_t recv() const override {
+ socklen_t size = sizeof(mAddr);
+ return mSock->recv(*this, mDataCb, 0, (struct sockaddr*)&mAddr, &size);
+ }
+public:
+ inline LocIpcLocalRecver(const shared_ptr<ILocIpcListener>& listener, const char* name) :
+ LocIpcLocalSender(name), LocIpcRecver(listener, *this) {
+
+ if ((unlink(mAddr.sun_path) < 0) && (errno != ENOENT)) {
+ LOC_LOGw("unlink socket error. reason:%s", strerror(errno));
+ }
+
+ umask(0157);
+ if (mSock->isValid() && ::bind(mSock->mSid, (struct sockaddr*)&mAddr, sizeof(mAddr)) < 0) {
+ LOC_LOGe("bind socket error. sock fd: %d: %s, reason: %s", mSock->mSid,
+ mAddr.sun_path, strerror(errno));
+ mSock->close();
+ }
+ }
+ inline virtual ~LocIpcLocalRecver() { unlink(mAddr.sun_path); }
+ inline virtual const char* getName() const override { return mAddr.sun_path; };
+ inline virtual void abort() const override {
+ if (isSendable()) {
+ mSock->sendAbort(0, (struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+ }
+};
+
+class LocIpcInetSender : public LocIpcSender {
+protected:
+ int mSockType;
+ shared_ptr<Sock> mSock;
+ const string mName;
+ sockaddr_in mAddr;
+ inline virtual bool isOperable() const override { return mSock != nullptr && mSock->isValid(); }
+ virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t /* msgId */) const {
+ return mSock->send(data, length, 0, (struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+public:
+ inline LocIpcInetSender(const LocIpcInetSender& sender) :
+ mSockType(sender.mSockType), mSock(sender.mSock),
+ mName(sender.mName), mAddr(sender.mAddr) {
+ }
+ inline LocIpcInetSender(const char* name, int32_t port, int sockType) : LocIpcSender(),
+ mSockType(sockType),
+ mSock(make_shared<Sock>((nullptr == name) ? -1 : (::socket(AF_INET, mSockType, 0)))),
+ mName((nullptr == name) ? "" : name),
+ mAddr({.sin_family = AF_INET, .sin_port = htons(port),
+ .sin_addr = {htonl(INADDR_ANY)}}) {
+ if (mSock != nullptr && mSock->isValid() && nullptr != name) {
+ struct hostent* hp = gethostbyname(name);
+ if (nullptr != hp) {
+ memcpy((char*)&(mAddr.sin_addr.s_addr), hp->h_addr_list[0], hp->h_length);
+ }
+ }
+ }
+
+ unique_ptr<LocIpcRecver> getRecver(const shared_ptr<ILocIpcListener>& listener) override {
+ return make_unique<SockRecver>(listener, *this, mSock);
+ }
+};
+
+class LocIpcInetTcpSender : public LocIpcInetSender {
+protected:
+ mutable bool mFirstTime;
+
+ virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t /* msgId */) const {
+ if (mFirstTime) {
+ mFirstTime = false;
+ ::connect(mSock->mSid, (const struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+ return mSock->send(data, length, 0, (struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+
+public:
+ inline LocIpcInetTcpSender(const char* name, int32_t port) :
+ LocIpcInetSender(name, port, SOCK_STREAM),
+ mFirstTime(true) {}
+};
+
+class LocIpcInetRecver : public LocIpcInetSender, public LocIpcRecver {
+ int32_t mPort;
+protected:
+ virtual ssize_t recv() const = 0;
+public:
+ inline LocIpcInetRecver(const shared_ptr<ILocIpcListener>& listener, const char* name,
+ int32_t port, int sockType) :
+ LocIpcInetSender(name, port, sockType), LocIpcRecver(listener, *this),
+ mPort(port) {
+ if (mSock->isValid() && ::bind(mSock->mSid, (struct sockaddr*)&mAddr, sizeof(mAddr)) < 0) {
+ LOC_LOGe("bind socket error. sock fd: %d, reason: %s", mSock->mSid, strerror(errno));
+ mSock->close();
+ }
+ }
+ inline virtual ~LocIpcInetRecver() {}
+ inline virtual const char* getName() const override { return mName.data(); };
+ inline virtual void abort() const override {
+ if (isSendable()) {
+ sockaddr_in loopBackAddr = {.sin_family = AF_INET, .sin_port = htons(mPort),
+ .sin_addr = {htonl(INADDR_LOOPBACK)}};
+ mSock->sendAbort(0, (struct sockaddr*)&loopBackAddr, sizeof(loopBackAddr));
+ }
+ }
+ inline virtual unique_ptr<LocIpcSender> getLastSender() const override {
+ return make_unique<LocIpcInetSender>(static_cast<const LocIpcInetSender&>(*this));
+ }
+};
+
+class LocIpcInetTcpRecver : public LocIpcInetRecver {
+ mutable int32_t mConnFd;
+protected:
+ inline virtual ssize_t recv() const override {
+ socklen_t size = sizeof(mAddr);
+ if (-1 == mConnFd && mSock->isValid()) {
+ if (::listen(mSock->mSid, 3) < 0 ||
+ (mConnFd = accept(mSock->mSid, (struct sockaddr*)&mAddr, &size)) < 0) {
+ mSock->close();
+ mConnFd = -1;
+ }
+ }
+ return mSock->recv(*this, mDataCb, 0, (struct sockaddr*)&mAddr, &size, mConnFd);
+ }
+public:
+ inline LocIpcInetTcpRecver(const shared_ptr<ILocIpcListener>& listener, const char* name,
+ int32_t port) :
+ LocIpcInetRecver(listener, name, port, SOCK_STREAM), mConnFd(-1) {}
+ inline virtual ~LocIpcInetTcpRecver() { if (-1 != mConnFd) ::close(mConnFd);}
+};
+
+class LocIpcInetUdpRecver : public LocIpcInetRecver {
+protected:
+ inline virtual ssize_t recv() const override {
+ socklen_t size = sizeof(mAddr);
+ return mSock->recv(*this, mDataCb, 0, (struct sockaddr*)&mAddr, &size);
+ }
+public:
+ inline LocIpcInetUdpRecver(const shared_ptr<ILocIpcListener>& listener, const char* name,
+ int32_t port) :
+ LocIpcInetRecver(listener, name, port, SOCK_DGRAM) {}
+
+ inline virtual ~LocIpcInetUdpRecver() {}
+};
+
+class LocIpcRunnable : public LocRunnable {
+ bool mAbortCalled;
+ LocIpc& mLocIpc;
+ unique_ptr<LocIpcRecver> mIpcRecver;
+public:
+ inline LocIpcRunnable(LocIpc& locIpc, unique_ptr<LocIpcRecver>& ipcRecver) :
+ mAbortCalled(false),
+ mLocIpc(locIpc),
+ mIpcRecver(move(ipcRecver)) {}
+ inline bool run() override {
+ if (mIpcRecver != nullptr) {
+ mLocIpc.startBlockingListening(*(mIpcRecver.get()));
+ if (!mAbortCalled) {
+ LOC_LOGw("startListeningBlocking() returned w/o stopBlockingListening() called");
+ }
+ }
+ // return false so the calling thread exits while loop
+ return false;
+ }
+ inline void abort() {
+ mAbortCalled = true;
+ if (mIpcRecver != nullptr) {
+ mIpcRecver->abort();
+ }
+ }
+};
+
+bool LocIpc::startNonBlockingListening(unique_ptr<LocIpcRecver>& ipcRecver) {
+ if (ipcRecver != nullptr && ipcRecver->isRecvable()) {
+ std::string threadName("LocIpc-");
+ threadName.append(ipcRecver->getName());
+ mRunnable = new LocIpcRunnable(*this, ipcRecver);
+ return mThread.start(threadName.c_str(), mRunnable);
+ } else {
+ LOC_LOGe("ipcRecver is null OR ipcRecver->recvable() is fasle");
+ return false;
+ }
+}
+
+bool LocIpc::startBlockingListening(LocIpcRecver& ipcRecver) {
+ if (ipcRecver.isRecvable()) {
+ // inform that the socket is ready to receive message
+ ipcRecver.onListenerReady();
+ while (ipcRecver.recvData());
+ return true;
+ } else {
+ LOC_LOGe("ipcRecver is null OR ipcRecver->recvable() is fasle");
+ return false;
+ }
+}
+
+void LocIpc::stopNonBlockingListening() {
+ if (mRunnable) {
+ mRunnable->abort();
+ mRunnable = nullptr;
+ }
+}
+
+void LocIpc::stopBlockingListening(LocIpcRecver& ipcRecver) {
+ if (ipcRecver.isRecvable()) {
+ ipcRecver.abort();
+ }
+}
+
+bool LocIpc::send(LocIpcSender& sender, const uint8_t data[], uint32_t length, int32_t msgId) {
+ return sender.sendData(data, length, msgId);
+}
+
+shared_ptr<LocIpcSender> LocIpc::getLocIpcLocalSender(const char* localSockName) {
+ return make_shared<LocIpcLocalSender>(localSockName);
+}
+unique_ptr<LocIpcRecver> LocIpc::getLocIpcLocalRecver(const shared_ptr<ILocIpcListener>& listener,
+ const char* localSockName) {
+ return make_unique<LocIpcLocalRecver>(listener, localSockName);
+}
+static void* sLibQrtrHandle = nullptr;
+static const char* sLibQrtrName = "libloc_socket.so";
+shared_ptr<LocIpcSender> LocIpc::getLocIpcQrtrSender(int service, int instance) {
+ typedef shared_ptr<LocIpcSender> (*creator_t) (int, int);
+ static creator_t creator = (creator_t)dlGetSymFromLib(sLibQrtrHandle, sLibQrtrName,
+ "_ZN8loc_util22createLocIpcQrtrSenderEii");
+ return (nullptr == creator) ? nullptr : creator(service, instance);
+}
+unique_ptr<LocIpcRecver> LocIpc::getLocIpcQrtrRecver(const shared_ptr<ILocIpcListener>& listener,
+ int service, int instance) {
+ typedef unique_ptr<LocIpcRecver> (*creator_t)(const shared_ptr<ILocIpcListener>&, int, int);
+ static creator_t creator = (creator_t)dlGetSymFromLib(sLibQrtrHandle, sLibQrtrName,
+#ifdef USE_GLIB
+ "_ZN8loc_util22createLocIpcQrtrRecverERKSt10shared_ptrINS_15ILocIpcListenerEEii");
+#else
+ "_ZN8loc_util22createLocIpcQrtrRecverERKNSt3__110shared_ptrINS_15ILocIpcListenerEEEii");
+#endif
+ return (nullptr == creator) ? nullptr : creator(listener, service, instance);
+}
+shared_ptr<LocIpcSender> LocIpc::getLocIpcInetTcpSender(const char* serverName, int32_t port) {
+ return make_shared<LocIpcInetTcpSender>(serverName, port);
+}
+unique_ptr<LocIpcRecver> LocIpc::getLocIpcInetTcpRecver(const shared_ptr<ILocIpcListener>& listener,
+ const char* serverName, int32_t port) {
+ return make_unique<LocIpcInetTcpRecver>(listener, serverName, port);
+}
+shared_ptr<LocIpcSender> LocIpc::getLocIpcInetUdpSender(const char* serverName, int32_t port) {
+ return make_shared<LocIpcInetSender>(serverName, port, SOCK_DGRAM);
+}
+unique_ptr<LocIpcRecver> LocIpc::getLocIpcInetUdpRecver(const shared_ptr<ILocIpcListener>& listener,
+ const char* serverName, int32_t port) {
+ return make_unique<LocIpcInetUdpRecver>(listener, serverName, port);
+}
+pair<shared_ptr<LocIpcSender>, unique_ptr<LocIpcRecver>>
+ LocIpc::getLocIpcQmiLocServiceSenderRecverPair(const shared_ptr<ILocIpcListener>& listener, int instance) {
+ typedef pair<shared_ptr<LocIpcSender>, unique_ptr<LocIpcRecver>> (*creator_t)(const shared_ptr<ILocIpcListener>&, int);
+ static void* sLibEmuHandle = nullptr;
+ static creator_t creator = (creator_t)dlGetSymFromLib(sLibEmuHandle, "libloc_emu.so",
+ "_ZN13QmiLocService41createLocIpcQmiLocServiceSenderRecverPairERKNSt3__110shared_ptrIN8loc_util15ILocIpcListenerEEEi");
+ return (nullptr == creator) ?
+ make_pair<shared_ptr<LocIpcSender>, unique_ptr<LocIpcRecver>>(nullptr, nullptr) :
+ creator(listener, instance);
+}
+
+}
diff --git a/gps/utils/LocIpc.h b/gps/utils/LocIpc.h
new file mode 100644
index 0000000..d6f8d1d
--- /dev/null
+++ b/gps/utils/LocIpc.h
@@ -0,0 +1,206 @@
+/* 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_IPC__
+#define __LOC_IPC__
+
+#include <string>
+#include <memory>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <LocThread.h>
+
+using namespace std;
+
+namespace loc_util {
+
+
+class LocIpcRecver;
+class LocIpcSender;
+class LocIpcRunnable;
+
+class ILocIpcListener {
+protected:
+ inline virtual ~ILocIpcListener() {}
+public:
+ // LocIpc client can overwrite this function to get notification
+ // when the socket for LocIpc is ready to receive messages.
+ inline virtual void onListenerReady() {}
+ virtual void onReceive(const char* data, uint32_t len, const LocIpcRecver* recver) = 0;
+};
+
+
+class LocIpc {
+public:
+ inline LocIpc() : mRunnable(nullptr) {}
+ inline virtual ~LocIpc() {
+ stopNonBlockingListening();
+ }
+
+ static shared_ptr<LocIpcSender>
+ getLocIpcLocalSender(const char* localSockName);
+ static shared_ptr<LocIpcSender>
+ getLocIpcInetUdpSender(const char* serverName, int32_t port);
+ static shared_ptr<LocIpcSender>
+ getLocIpcInetTcpSender(const char* serverName, int32_t port);
+ static shared_ptr<LocIpcSender>
+ getLocIpcQrtrSender(int service, int instance);
+
+ static unique_ptr<LocIpcRecver>
+ getLocIpcLocalRecver(const shared_ptr<ILocIpcListener>& listener,
+ const char* localSockName);
+ static unique_ptr<LocIpcRecver>
+ getLocIpcInetUdpRecver(const shared_ptr<ILocIpcListener>& listener,
+ const char* serverName, int32_t port);
+ static unique_ptr<LocIpcRecver>
+ getLocIpcInetTcpRecver(const shared_ptr<ILocIpcListener>& listener,
+ const char* serverName, int32_t port);
+ static unique_ptr<LocIpcRecver>
+ getLocIpcQrtrRecver(const shared_ptr<ILocIpcListener>& listener,
+ int service, int instance);
+
+ static pair<shared_ptr<LocIpcSender>, unique_ptr<LocIpcRecver>>
+ getLocIpcQmiLocServiceSenderRecverPair(const shared_ptr<ILocIpcListener>& listener,
+ int instance);
+
+ // Listen for new messages in current thread. Calling this funciton will
+ // block current thread.
+ // The listening can be stopped by calling stopBlockingListening() passing
+ // in the same ipcRecver obj handle.
+ static bool startBlockingListening(LocIpcRecver& ipcRecver);
+ static void stopBlockingListening(LocIpcRecver& ipcRecver);
+
+ // 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 stopNonBlockingListening().
+ bool startNonBlockingListening(unique_ptr<LocIpcRecver>& ipcRecver);
+ void stopNonBlockingListening();
+
+ // 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(LocIpcSender& sender, const uint8_t data[],
+ uint32_t length, int32_t msgId = -1);
+
+private:
+ LocThread mThread;
+ LocIpcRunnable *mRunnable;
+};
+
+/* this is only when client needs to implement Sender / Recver that are not already provided by
+ the factor methods prvoided by LocIpc. */
+
+class LocIpcSender {
+protected:
+ LocIpcSender() = default;
+ virtual bool isOperable() const = 0;
+ virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t msgId) const = 0;
+public:
+ virtual ~LocIpcSender() = default;
+ virtual void informRecverRestarted() {}
+ inline bool isSendable() const { return isOperable(); }
+ inline bool sendData(const uint8_t data[], uint32_t length, int32_t msgId) const {
+ return isSendable() && (send(data, length, msgId) > 0);
+ }
+ virtual unique_ptr<LocIpcRecver> getRecver(const shared_ptr<ILocIpcListener>& listener) {
+ return nullptr;
+ }
+};
+
+class LocIpcRecver {
+ LocIpcSender& mIpcSender;
+protected:
+ const shared_ptr<ILocIpcListener> mDataCb;
+ inline LocIpcRecver(const shared_ptr<ILocIpcListener>& listener, LocIpcSender& sender) :
+ mIpcSender(sender), mDataCb(listener) {}
+ LocIpcRecver(LocIpcRecver const& recver) = delete;
+ LocIpcRecver& operator=(LocIpcRecver const& recver) = delete;
+ virtual ssize_t recv() const = 0;
+public:
+ virtual ~LocIpcRecver() = default;
+ inline bool recvData() const { return isRecvable() && (recv() > 0); }
+ inline bool isRecvable() const { return mDataCb != nullptr && mIpcSender.isSendable(); }
+ virtual void onListenerReady() { if (mDataCb != nullptr) mDataCb->onListenerReady(); }
+ inline virtual unique_ptr<LocIpcSender> getLastSender() const {
+ return nullptr;
+ }
+ virtual void abort() const = 0;
+ virtual const char* getName() const = 0;
+};
+
+class Sock {
+ static const char MSG_ABORT[];
+ static const char LOC_IPC_HEAD[];
+ const uint32_t mMaxTxSize;
+ ssize_t sendto(const void *buf, size_t len, int flags, const struct sockaddr *destAddr,
+ socklen_t addrlen) const;
+ ssize_t recvfrom(const LocIpcRecver& recver, const shared_ptr<ILocIpcListener>& dataCb,
+ int sid, int flags, struct sockaddr *srcAddr, socklen_t *addrlen) const;
+public:
+ int mSid;
+ inline Sock(int sid, const uint32_t maxTxSize = 8192) : mMaxTxSize(maxTxSize), mSid(sid) {}
+ inline ~Sock() { close(); }
+ inline bool isValid() const { return -1 != mSid; }
+ ssize_t send(const void *buf, uint32_t len, int flags, const struct sockaddr *destAddr,
+ socklen_t addrlen) const;
+ ssize_t recv(const LocIpcRecver& recver, const shared_ptr<ILocIpcListener>& dataCb, int flags,
+ struct sockaddr *srcAddr, socklen_t *addrlen, int sid = -1) const;
+ ssize_t sendAbort(int flags, const struct sockaddr *destAddr, socklen_t addrlen);
+ inline void close() {
+ if (isValid()) {
+ ::close(mSid);
+ mSid = -1;
+ }
+ }
+};
+
+class SockRecver : public LocIpcRecver {
+ shared_ptr<Sock> mSock;
+protected:
+ inline virtual ssize_t recv() const override {
+ return mSock->recv(*this, mDataCb, 0, nullptr, nullptr);
+ }
+public:
+ inline SockRecver(const shared_ptr<ILocIpcListener>& listener,
+ LocIpcSender& sender, shared_ptr<Sock> sock) :
+ LocIpcRecver(listener, sender), mSock(sock) {
+ }
+ inline virtual const char* getName() const override {
+ return "SockRecver";
+ }
+ inline virtual void abort() const override {}
+};
+
+}
+
+#endif //__LOC_IPC__
diff --git a/gps/utils/LocSharedLock.h b/gps/utils/LocSharedLock.h
new file mode 100644
index 0000000..a7af35e
--- /dev/null
+++ b/gps/utils/LocSharedLock.h
@@ -0,0 +1,77 @@
+/* Copyright (c) 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 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_SHARED_LOCK__
+#define __LOC_SHARED_LOCK__
+
+#include <stddef.h>
+#ifndef FEATURE_EXTERNAL_AP
+#include <cutils/atomic.h>
+#endif /* FEATURE_EXTERNAL_AP */
+#include <pthread.h>
+
+#ifdef FEATURE_EXTERNAL_AP
+#include <atomic>
+
+inline int32_t android_atomic_inc(volatile int32_t *addr)
+{
+ volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr;
+ return std::atomic_fetch_add_explicit(a, 1, std::memory_order_release);
+}
+
+inline int32_t android_atomic_dec(volatile int32_t *addr)
+{
+ volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr;
+ return std::atomic_fetch_sub_explicit(a, 1, std::memory_order_release);
+}
+
+#endif /* FEATURE_EXTERNAL_AP */
+ // This is a utility created for use cases such that there are more than
+// one client who need to share the same lock, but it is not predictable
+// which of these clients is to last to go away. This shared lock deletes
+// itself when the last client calls its drop() method. To add a cient,
+// this share lock's share() method has to be called, so that the obj
+// can maintain an accurate client count.
+class LocSharedLock {
+ volatile int32_t mRef;
+ pthread_mutex_t mMutex;
+ inline ~LocSharedLock() { pthread_mutex_destroy(&mMutex); }
+public:
+ // first client to create this LockSharedLock
+ inline LocSharedLock() : mRef(1) { pthread_mutex_init(&mMutex, NULL); }
+ // following client(s) are to *share()* this lock created by the first client
+ inline LocSharedLock* share() { android_atomic_inc(&mRef); return this; }
+ // whe a client no longer needs this shared lock, drop() shall be called.
+ inline void drop() { if (1 == android_atomic_dec(&mRef)) delete this; }
+ // locking the lock to enter critical section
+ inline void lock() { pthread_mutex_lock(&mMutex); }
+ // unlocking the lock to leave the critical section
+ inline void unlock() { pthread_mutex_unlock(&mMutex); }
+};
+
+#endif //__LOC_SHARED_LOCK__
diff --git a/gps/utils/LocThread.cpp b/gps/utils/LocThread.cpp
new file mode 100644
index 0000000..568a6bb
--- /dev/null
+++ b/gps/utils/LocThread.cpp
@@ -0,0 +1,266 @@
+/* Copyright (c) 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 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 <LocThread.h>
+#include <string.h>
+#include <pthread.h>
+#include <loc_pla.h>
+
+class LocThreadDelegate {
+ LocRunnable* mRunnable;
+ bool mJoinable;
+ pthread_t mThandle;
+ pthread_mutex_t mMutex;
+ int mRefCount;
+ ~LocThreadDelegate();
+ LocThreadDelegate(LocThread::tCreate creator, const char* threadName,
+ LocRunnable* runnable, bool joinable);
+ void destroy();
+public:
+ static LocThreadDelegate* create(LocThread::tCreate creator,
+ const char* threadName, LocRunnable* runnable, bool joinable);
+ void stop();
+ // bye() is for the parent thread to go away. if joinable,
+ // parent must stop the spawned thread, join, and then
+ // destroy(); if detached, the parent can go straight
+ // ahead to destroy()
+ inline void bye() { mJoinable ? stop() : destroy(); }
+ inline bool isRunning() { return (NULL != mRunnable); }
+ static void* threadMain(void* arg);
+};
+
+// it is important to note that internal members must be
+// initialized to values as if pthread_create succeeds.
+// This is to avoid the race condition between the threads,
+// once the thread is created, some of these values will
+// be check in the spawned thread, and must set correctly
+// then and there.
+// However, upon pthread_create failure, the data members
+// must be set to indicate failure, e.g. mRunnable, and
+// threashold approprietly for destroy(), e.g. mRefCount.
+LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator,
+ const char* threadName, LocRunnable* runnable, bool joinable) :
+ mRunnable(runnable), mJoinable(joinable), mThandle((pthread_t)NULL),
+ mMutex(PTHREAD_MUTEX_INITIALIZER), mRefCount(2) {
+
+ // set up thread name, if nothing is passed in
+ if (!threadName) {
+ threadName = "LocThread";
+ }
+
+ // create the thread here, then if successful
+ // and a name is given, we set the thread name
+ if (creator) {
+ mThandle = creator(threadName, threadMain, this);
+ } else if (pthread_create(&mThandle, NULL, threadMain, this)) {
+ // pthread_create() failed
+ mThandle = (pthread_t)NULL;
+ }
+
+ if (mThandle) {
+ // set thread name
+ char lname[16];
+ int len = (sizeof(lname) > (strlen(threadName) + 1)) ?
+ (strlen(threadName)):(sizeof(lname) - 1);
+ memcpy(lname, threadName, len);
+ lname[len] = 0;
+ // set the thread name here
+ pthread_setname_np(mThandle, lname);
+
+ // detach, if not joinable
+ if (!joinable) {
+ pthread_detach(mThandle);
+ }
+ } else {
+ // must set these values upon failure
+ mRunnable = NULL;
+ mJoinable = false;
+ mRefCount = 1;
+ }
+}
+
+inline
+LocThreadDelegate::~LocThreadDelegate() {
+ // at this point nothing should need done any more
+}
+
+// factory method so that we could return NULL upon failure
+LocThreadDelegate* LocThreadDelegate::create(LocThread::tCreate creator,
+ const char* threadName, LocRunnable* runnable, bool joinable) {
+ LocThreadDelegate* thread = NULL;
+ if (runnable) {
+ thread = new LocThreadDelegate(creator, threadName, runnable, joinable);
+ if (thread && !thread->isRunning()) {
+ thread->destroy();
+ thread = NULL;
+ }
+ }
+
+ return thread;
+}
+
+// The order is importang
+// NULLing mRunnalbe stops the while loop in threadMain()
+// join() if mJoinble must come before destroy() call, as
+// the obj must remain alive at this time so that mThandle
+// remains valud.
+void LocThreadDelegate::stop() {
+ // mRunnable and mJoinable are reset on different triggers.
+ // mRunnable may get nulled on the spawned thread's way out;
+ // or here.
+ // mJouinable (if ever been true) gets falsed when client
+ // thread triggers stop, with either a stop()
+ // call or the client releases thread obj handle.
+ if (mRunnable) {
+ mRunnable = NULL;
+ }
+ if (mJoinable) {
+ mJoinable = false;
+ pthread_join(mThandle, NULL);
+ }
+ // call destroy() to possibly delete the obj
+ destroy();
+}
+
+// method for clients to call to release the obj
+// when it is a detached thread, the client thread
+// and the spawned thread can both try to destroy()
+// asynchronously. And we delete this obj when
+// mRefCount becomes 0.
+void LocThreadDelegate::destroy() {
+ // else case shouldn't happen, unless there is a
+ // leaking obj. But only our code here has such
+ // obj, so if we test our code well, else case
+ // will never happen
+ if (mRefCount > 0) {
+ // we need a flag on the stack
+ bool callDelete = false;
+
+ // critical section between threads
+ pthread_mutex_lock(&mMutex);
+ // last destroy() call
+ callDelete = (1 == mRefCount--);
+ pthread_mutex_unlock(&mMutex);
+
+ // upon last destroy() call we delete this obj
+ if (callDelete) {
+ delete this;
+ }
+ }
+}
+
+void* LocThreadDelegate::threadMain(void* arg) {
+ LocThreadDelegate* locThread = (LocThreadDelegate*)(arg);
+
+ if (locThread) {
+ LocRunnable* runnable = locThread->mRunnable;
+
+ if (runnable) {
+ if (locThread->isRunning()) {
+ runnable->prerun();
+ }
+
+ while (locThread->isRunning() && runnable->run());
+
+ if (locThread->isRunning()) {
+ runnable->postrun();
+ }
+
+ // at this time, locThread->mRunnable may or may not be NULL
+ // NULL it just to be safe and clean, as we want the field
+ // in the released memory slot to be NULL.
+ locThread->mRunnable = NULL;
+ delete runnable;
+ }
+ locThread->destroy();
+ }
+
+ return NULL;
+}
+
+LocThread::~LocThread() {
+ if (mThread) {
+ mThread->bye();
+ mThread = NULL;
+ }
+}
+
+bool LocThread::start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable) {
+ bool success = false;
+ if (!mThread) {
+ mThread = LocThreadDelegate::create(creator, threadName, runnable, joinable);
+ // true only if thread is created successfully
+ success = (NULL != mThread);
+ }
+ return success;
+}
+
+void LocThread::stop() {
+ if (mThread) {
+ mThread->stop();
+ mThread = NULL;
+ }
+}
+
+#ifdef __LOC_DEBUG__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+class LocRunnableTest1 : public LocRunnable {
+ int mID;
+public:
+ LocRunnableTest1(int id) : LocRunnable(), mID(id) {}
+ virtual bool run() {
+ printf("LocRunnableTest1: %d\n", mID++);
+ sleep(1);
+ return true;
+ }
+};
+
+// on linux command line:
+// compile: g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -std=c++0x -I. -I../../../../vendor/qcom/proprietary/gps-internal/unit-tests/fakes_for_host -I../../../../system/core/include -lpthread LocThread.cpp
+// test detached thread: valgrind ./a.out 0
+// test joinable thread: valgrind ./a.out 1
+int main(int argc, char** argv) {
+ LocRunnableTest1 test(10);
+
+ LocThread thread;
+ thread.start("LocThreadTest", test, atoi(argv[1]));
+
+ sleep(10);
+
+ thread.stop();
+
+ sleep(5);
+
+ return 0;
+}
+
+#endif
diff --git a/gps/utils/LocThread.h b/gps/utils/LocThread.h
new file mode 100644
index 0000000..2a65d8f
--- /dev/null
+++ b/gps/utils/LocThread.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 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 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_THREAD__
+#define __LOC_THREAD__
+
+#include <stddef.h>
+#include <pthread.h>
+
+// abstract class to be implemented by client to provide a runnable class
+// which gets scheduled by LocThread
+class LocRunnable {
+public:
+ inline LocRunnable() {}
+ inline virtual ~LocRunnable() {}
+
+ // The method to be implemented by thread clients
+ // and be scheduled by LocThread
+ // This method will be repeated called until it returns false; or
+ // until thread is stopped.
+ virtual bool run() = 0;
+
+ // The method to be run before thread loop (conditionally repeatedly)
+ // calls run()
+ inline virtual void prerun() {}
+
+ // The method to be run after thread loop (conditionally repeatedly)
+ // calls run()
+ inline virtual void postrun() {}
+};
+
+// opaque class to provide service implementation.
+class LocThreadDelegate;
+
+// A utility class to create a thread and run LocRunnable
+// caller passes in.
+class LocThread {
+ LocThreadDelegate* mThread;
+public:
+ inline LocThread() : mThread(NULL) {}
+ virtual ~LocThread();
+
+ typedef pthread_t (*tCreate)(const char* name, void* (*start)(void*), void* arg);
+ // client starts thread with a runnable, which implements
+ // the logics to fun in the created thread context.
+ // The thread could be either joinable or detached.
+ // runnable is an obj managed by client. Client creates and
+ // frees it (but must be after stop() is called, or
+ // this LocThread obj is deleted).
+ // The obj will be deleted by LocThread if start()
+ // returns true. Else it is client's responsibility
+ // to delete the object
+ // Returns 0 if success; false if failure.
+ bool start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable = true);
+ inline bool start(const char* threadName, LocRunnable* runnable, bool joinable = true) {
+ return start(NULL, threadName, runnable, joinable);
+ }
+
+ // NOTE: if this is a joinable thread, this stop may block
+ // for a while until the thread is joined.
+ void stop();
+
+ // thread status check
+ inline bool isRunning() { return NULL != mThread; }
+};
+
+#endif //__LOC_THREAD__
diff --git a/gps/utils/LocTimer.cpp b/gps/utils/LocTimer.cpp
new file mode 100644
index 0000000..93775d0
--- /dev/null
+++ b/gps/utils/LocTimer.cpp
@@ -0,0 +1,753 @@
+/* Copyright (c) 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 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 <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/timerfd.h>
+#include <sys/epoll.h>
+#include <log_util.h>
+#include <loc_timer.h>
+#include <LocTimer.h>
+#include <LocHeap.h>
+#include <LocThread.h>
+#include <LocSharedLock.h>
+#include <MsgTask.h>
+
+#ifdef __HOST_UNIT_TEST__
+#define EPOLLWAKEUP 0
+#define CLOCK_BOOTTIME CLOCK_MONOTONIC
+#define CLOCK_BOOTTIME_ALARM CLOCK_MONOTONIC
+#endif
+
+/*
+There are implementations of 5 classes in this file:
+LocTimer, LocTimerDelegate, LocTimerContainer, LocTimerPollTask, LocTimerWrapper
+
+LocTimer - client front end, interface for client to start / stop timers, also
+ to provide a callback.
+LocTimerDelegate - an internal timer entity, which also is a LocRankable obj.
+ Its life cycle is different than that of LocTimer. It gets
+ created when LocTimer::start() is called, and gets deleted
+ when it expires or clients calls the hosting LocTimer obj's
+ stop() method. When a LocTimerDelegate obj is ticking, it
+ stays in the corresponding LocTimerContainer. When expired
+ or stopped, the obj is removed from the container. Since it
+ is also a LocRankable obj, and LocTimerContainer also is a
+ heap, its ranks() implementation decides where it is placed
+ in the heap.
+LocTimerContainer - core of the timer service. It is a container (derived from
+ LocHeap) for LocTimerDelegate (implements LocRankable) objs.
+ There are 2 of such containers, one for sw timers (or Linux
+ timers) one for hw timers (or Linux alarms). It adds one of
+ each (those that expire the soonest) to kernel via services
+ provided by LocTimerPollTask. All the heap management on the
+ LocTimerDelegate objs are done in the MsgTask context, such
+ that synchronization is ensured.
+LocTimerPollTask - is a class that wraps timerfd and epoll POXIS APIs. It also
+ both implements LocRunnalbe with epoll_wait() in the run()
+ method. It is also a LocThread client, so as to loop the run
+ method.
+LocTimerWrapper - a LocTimer client itself, to implement the existing C API with
+ APIs, loc_timer_start() and loc_timer_stop().
+
+*/
+
+class LocTimerPollTask;
+
+// This is a multi-functaional class that:
+// * extends the LocHeap class for the detection of head update upon add / remove
+// events. When that happens, soonest time out changes, so timerfd needs update.
+// * contains the timers, and add / remove them into the heap
+// * provides and maps 2 of such containers, one for timers (or mSwTimers), one
+// for alarms (or mHwTimers);
+// * provides a polling thread;
+// * provides a MsgTask thread for synchronized add / remove / timer client callback.
+class LocTimerContainer : public LocHeap {
+ // mutex to synchronize getters of static members
+ static pthread_mutex_t mMutex;
+ // Container of timers
+ static LocTimerContainer* mSwTimers;
+ // Container of alarms
+ static LocTimerContainer* mHwTimers;
+ // Msg task to provider msg Q, sender and reader.
+ static MsgTask* mMsgTask;
+ // Poll task to provide epoll call and threading to poll.
+ static LocTimerPollTask* mPollTask;
+ // timer / alarm fd
+ int mDevFd;
+ // ctor
+ LocTimerContainer(bool wakeOnExpire);
+ // dtor
+ ~LocTimerContainer();
+ static MsgTask* getMsgTaskLocked();
+ static LocTimerPollTask* getPollTaskLocked();
+ // extend LocHeap and pop if the top outRanks input
+ LocTimerDelegate* popIfOutRanks(LocTimerDelegate& timer);
+ // update the timer POSIX calls with updated soonest timer spec
+ void updateSoonestTime(LocTimerDelegate* priorTop);
+
+public:
+ // factory method to control the creation of mSwTimers / mHwTimers
+ static LocTimerContainer* get(bool wakeOnExpire);
+
+ LocTimerDelegate* getSoonestTimer();
+ int getTimerFd();
+ // add a timer / alarm obj into the container
+ void add(LocTimerDelegate& timer);
+ // remove a timer / alarm obj from the container
+ void remove(LocTimerDelegate& timer);
+ // handling of timer / alarm expiration
+ void expire();
+};
+
+// This class implements the polling thread that epolls imer / alarm fds.
+// The LocRunnable::run() contains the actual polling. The other methods
+// will be run in the caller's thread context to add / remove timer / alarm
+// fds the kernel, while the polling is blocked on epoll_wait() call.
+// Since the design is that we have maximally 2 polls, one for all the
+// timers; one for all the alarms, we will poll at most on 2 fds. But it
+// is possile that all we have are only timers or alarms at one time, so we
+// allow dynamically add / remove fds we poll on. The design decision of
+// having 1 fd per container of timer / alarm is such that, we may not need
+// to make a system call each time a timer / alarm is added / removed, unless
+// that changes the "soonest" time out of that of all the timers / alarms.
+class LocTimerPollTask : public LocRunnable {
+ // the epoll fd
+ const int mFd;
+ // the thread that calls run() method
+ LocThread* mThread;
+ friend class LocThreadDelegate;
+ // dtor
+ ~LocTimerPollTask();
+public:
+ // ctor
+ LocTimerPollTask();
+ // this obj will be deleted once thread is deleted
+ void destroy();
+ // add a container of timers. Each contain has a unique device fd, i.e.
+ // either timer or alarm fd, and a heap of timers / alarms. It is expected
+ // that container would have written to the device fd with the soonest
+ // time out value in the heap at the time of calling this method. So all
+ // this method does is to add the fd of the input container to the poll
+ // and also add the pointer of the container to the event data ptr, such
+ // when poll_wait wakes up on events, we know who is the owner of the fd.
+ void addPoll(LocTimerContainer& timerContainer);
+ // remove a fd that is assciated with a container. The expectation is that
+ // the atual timer would have been removed from the container.
+ void removePoll(LocTimerContainer& timerContainer);
+ // The polling thread context will call this method. This is where
+ // epoll_wait() is blocking and waiting for events..
+ virtual bool run();
+};
+
+// Internal class of timer obj. It gets born when client calls LocTimer::start();
+// and gets deleted when client calls LocTimer::stop() or when the it expire()'s.
+// This class implements LocRankable::ranks() so that when an obj is added into
+// the container (of LocHeap), it gets placed in sorted order.
+class LocTimerDelegate : public LocRankable {
+ friend class LocTimerContainer;
+ friend class LocTimer;
+ LocTimer* mClient;
+ LocSharedLock* mLock;
+ struct timespec mFutureTime;
+ LocTimerContainer* mContainer;
+ // not a complete obj, just ctor for LocRankable comparisons
+ inline LocTimerDelegate(struct timespec& delay)
+ : mClient(NULL), mLock(NULL), mFutureTime(delay), mContainer(NULL) {}
+ inline ~LocTimerDelegate() { if (mLock) { mLock->drop(); mLock = NULL; } }
+public:
+ LocTimerDelegate(LocTimer& client, struct timespec& futureTime, LocTimerContainer* container);
+ void destroyLocked();
+ // LocRankable virtual method
+ virtual int ranks(LocRankable& rankable);
+ void expire();
+ inline struct timespec getFutureTime() { return mFutureTime; }
+};
+
+/***************************LocTimerContainer methods***************************/
+
+// Most of these static recources are created on demand. They however are never
+// destoyed. The theory is that there are processes that link to this util lib
+// but never use timer, then these resources would never need to be created.
+// For those processes that do use timer, it will likely also need to every
+// once in a while. It might be cheaper keeping them around.
+pthread_mutex_t LocTimerContainer::mMutex = PTHREAD_MUTEX_INITIALIZER;
+LocTimerContainer* LocTimerContainer::mSwTimers = NULL;
+LocTimerContainer* LocTimerContainer::mHwTimers = NULL;
+MsgTask* LocTimerContainer::mMsgTask = NULL;
+LocTimerPollTask* LocTimerContainer::mPollTask = NULL;
+
+// ctor - initialize timer heaps
+// A container for swTimer (timer) is created, when wakeOnExpire is true; or
+// HwTimer (alarm), when wakeOnExpire is false.
+LocTimerContainer::LocTimerContainer(bool wakeOnExpire) :
+ mDevFd(timerfd_create(wakeOnExpire ? CLOCK_BOOTTIME_ALARM : CLOCK_BOOTTIME, 0)) {
+
+ if ((-1 == mDevFd) && (errno == EINVAL)) {
+ LOC_LOGW("%s: timerfd_create failure, fallback to CLOCK_MONOTONIC - %s",
+ __FUNCTION__, strerror(errno));
+ mDevFd = timerfd_create(CLOCK_MONOTONIC, 0);
+ }
+
+ if (-1 != mDevFd) {
+ // ensure we have the necessary resources created
+ LocTimerContainer::getPollTaskLocked();
+ LocTimerContainer::getMsgTaskLocked();
+ } else {
+ LOC_LOGE("%s: timerfd_create failure - %s", __FUNCTION__, strerror(errno));
+ }
+}
+
+// dtor
+// we do not ever destroy the static resources.
+inline
+LocTimerContainer::~LocTimerContainer() {
+ close(mDevFd);
+}
+
+LocTimerContainer* LocTimerContainer::get(bool wakeOnExpire) {
+ // get the reference of either mHwTimer or mSwTimers per wakeOnExpire
+ LocTimerContainer*& container = wakeOnExpire ? mHwTimers : mSwTimers;
+ // it is cheap to check pointer first than locking mutext unconditionally
+ if (!container) {
+ pthread_mutex_lock(&mMutex);
+ // let's check one more time to be safe
+ if (!container) {
+ container = new LocTimerContainer(wakeOnExpire);
+ // timerfd_create failure
+ if (-1 == container->getTimerFd()) {
+ delete container;
+ container = NULL;
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+ }
+ return container;
+}
+
+MsgTask* LocTimerContainer::getMsgTaskLocked() {
+ // it is cheap to check pointer first than locking mutext unconditionally
+ if (!mMsgTask) {
+ mMsgTask = new MsgTask("LocTimerMsgTask", false);
+ }
+ return mMsgTask;
+}
+
+LocTimerPollTask* LocTimerContainer::getPollTaskLocked() {
+ // it is cheap to check pointer first than locking mutext unconditionally
+ if (!mPollTask) {
+ mPollTask = new LocTimerPollTask();
+ }
+ return mPollTask;
+}
+
+inline
+LocTimerDelegate* LocTimerContainer::getSoonestTimer() {
+ return (LocTimerDelegate*)(peek());
+}
+
+inline
+int LocTimerContainer::getTimerFd() {
+ return mDevFd;
+}
+
+void LocTimerContainer::updateSoonestTime(LocTimerDelegate* priorTop) {
+ LocTimerDelegate* curTop = getSoonestTimer();
+
+ // check if top has changed
+ if (curTop != priorTop) {
+ struct itimerspec delay;
+ memset(&delay, 0, sizeof(struct itimerspec));
+ bool toSetTime = false;
+ // if tree is empty now, we remove poll and disarm timer
+ if (!curTop) {
+ mPollTask->removePoll(*this);
+ // setting the values to disarm timer
+ delay.it_value.tv_sec = 0;
+ delay.it_value.tv_nsec = 0;
+ toSetTime = true;
+ } else if (!priorTop || curTop->outRanks(*priorTop)) {
+ // do this first to avoid race condition, in case settime is called
+ // with too small an interval
+ mPollTask->addPoll(*this);
+ delay.it_value = curTop->getFutureTime();
+ toSetTime = true;
+ }
+ if (toSetTime) {
+ timerfd_settime(getTimerFd(), TFD_TIMER_ABSTIME, &delay, NULL);
+ }
+ }
+}
+
+// all the heap management is done in the MsgTask context.
+inline
+void LocTimerContainer::add(LocTimerDelegate& timer) {
+ struct MsgTimerPush : public LocMsg {
+ LocTimerContainer* mTimerContainer;
+ LocHeapNode* mTree;
+ LocTimerDelegate* mTimer;
+ inline MsgTimerPush(LocTimerContainer& container, LocTimerDelegate& timer) :
+ LocMsg(), mTimerContainer(&container), mTimer(&timer) {}
+ inline virtual void proc() const {
+ LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer();
+ mTimerContainer->push((LocRankable&)(*mTimer));
+ mTimerContainer->updateSoonestTime(priorTop);
+ }
+ };
+
+ mMsgTask->sendMsg(new MsgTimerPush(*this, timer));
+}
+
+// all the heap management is done in the MsgTask context.
+void LocTimerContainer::remove(LocTimerDelegate& timer) {
+ struct MsgTimerRemove : public LocMsg {
+ LocTimerContainer* mTimerContainer;
+ LocTimerDelegate* mTimer;
+ inline MsgTimerRemove(LocTimerContainer& container, LocTimerDelegate& timer) :
+ LocMsg(), mTimerContainer(&container), mTimer(&timer) {}
+ inline virtual void proc() const {
+ LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer();
+
+ // update soonest timer only if mTimer is actually removed from
+ // mTimerContainer AND mTimer is not priorTop.
+ if (priorTop == ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) {
+ // if passing in NULL, we tell updateSoonestTime to update
+ // kernel with the current top timer interval.
+ mTimerContainer->updateSoonestTime(NULL);
+ }
+ // all timers are deleted here, and only here.
+ delete mTimer;
+ }
+ };
+
+ mMsgTask->sendMsg(new MsgTimerRemove(*this, timer));
+}
+
+// all the heap management is done in the MsgTask context.
+// Upon expire, we check and continuously pop the heap until
+// the top node's timeout is in the future.
+void LocTimerContainer::expire() {
+ struct MsgTimerExpire : public LocMsg {
+ LocTimerContainer* mTimerContainer;
+ inline MsgTimerExpire(LocTimerContainer& container) :
+ LocMsg(), mTimerContainer(&container) {}
+ inline virtual void proc() const {
+ struct timespec now;
+ // get time spec of now
+ clock_gettime(CLOCK_BOOTTIME, &now);
+ LocTimerDelegate timerOfNow(now);
+ // pop everything in the heap that outRanks now, i.e. has time older than now
+ // and then call expire() on that timer.
+ for (LocTimerDelegate* timer = (LocTimerDelegate*)mTimerContainer->pop();
+ NULL != timer;
+ timer = mTimerContainer->popIfOutRanks(timerOfNow)) {
+ // the timer delegate obj will be deleted before the return of this call
+ timer->expire();
+ }
+ mTimerContainer->updateSoonestTime(NULL);
+ }
+ };
+
+ struct itimerspec delay;
+ memset(&delay, 0, sizeof(struct itimerspec));
+ timerfd_settime(getTimerFd(), TFD_TIMER_ABSTIME, &delay, NULL);
+ mPollTask->removePoll(*this);
+ mMsgTask->sendMsg(new MsgTimerExpire(*this));
+}
+
+LocTimerDelegate* LocTimerContainer::popIfOutRanks(LocTimerDelegate& timer) {
+ LocTimerDelegate* poppedNode = NULL;
+ if (mTree && !timer.outRanks(*peek())) {
+ poppedNode = (LocTimerDelegate*)(pop());
+ }
+
+ return poppedNode;
+}
+
+
+/***************************LocTimerPollTask methods***************************/
+
+inline
+LocTimerPollTask::LocTimerPollTask()
+ : mFd(epoll_create(2)), mThread(new LocThread()) {
+ // before a next call returens, a thread will be created. The run() method
+ // could already be running in parallel. Also, since each of the objs
+ // creates a thread, the container will make sure that there will be only
+ // one of such obj for our timer implementation.
+ if (!mThread->start("LocTimerPollTask", this)) {
+ delete mThread;
+ mThread = NULL;
+ }
+}
+
+inline
+LocTimerPollTask::~LocTimerPollTask() {
+ // when fs is closed, epoll_wait() should fail run() should return false
+ // and the spawned thread should exit.
+ close(mFd);
+}
+
+void LocTimerPollTask::destroy() {
+ if (mThread) {
+ LocThread* thread = mThread;
+ mThread = NULL;
+ delete thread;
+ } else {
+ delete this;
+ }
+}
+
+void LocTimerPollTask::addPoll(LocTimerContainer& timerContainer) {
+ struct epoll_event ev;
+ memset(&ev, 0, sizeof(ev));
+
+ ev.events = EPOLLIN | EPOLLWAKEUP;
+ ev.data.fd = timerContainer.getTimerFd();
+ // it is important that we set this context pointer with the input
+ // timer container this is how we know which container should handle
+ // which expiration.
+ ev.data.ptr = &timerContainer;
+
+ epoll_ctl(mFd, EPOLL_CTL_ADD, timerContainer.getTimerFd(), &ev);
+}
+
+inline
+void LocTimerPollTask::removePoll(LocTimerContainer& timerContainer) {
+ epoll_ctl(mFd, EPOLL_CTL_DEL, timerContainer.getTimerFd(), NULL);
+}
+
+// The polling thread context will call this method. If run() method needs to
+// be repetitvely called, it must return true from the previous call.
+bool LocTimerPollTask::run() {
+ struct epoll_event ev[2];
+
+ // we have max 2 descriptors to poll from
+ int fds = epoll_wait(mFd, ev, 2, -1);
+
+ // we pretty much want to continually poll until the fd is closed
+ bool rerun = (fds > 0) || (errno == EINTR);
+
+ if (fds > 0) {
+ // we may have 2 events
+ for (int i = 0; i < fds; i++) {
+ // each fd has a context pointer associated with the right timer container
+ LocTimerContainer* container = (LocTimerContainer*)(ev[i].data.ptr);
+ if (container) {
+ container->expire();
+ } else {
+ epoll_ctl(mFd, EPOLL_CTL_DEL, ev[i].data.fd, NULL);
+ }
+ }
+ }
+
+ // if rerun is true, we are requesting to be scheduled again
+ return rerun;
+}
+
+/***************************LocTimerDelegate methods***************************/
+
+inline
+LocTimerDelegate::LocTimerDelegate(LocTimer& client,
+ struct timespec& futureTime,
+ LocTimerContainer* container)
+ : mClient(&client),
+ mLock(mClient->mLock->share()),
+ mFutureTime(futureTime),
+ mContainer(container) {
+ // adding the timer into the container
+ mContainer->add(*this);
+}
+
+inline
+void LocTimerDelegate::destroyLocked() {
+ // client handle will likely be deleted soon after this
+ // method returns. Nulling this handle so that expire()
+ // won't call the callback on the dead handle any more.
+ mClient = NULL;
+
+ if (mContainer) {
+ LocTimerContainer* container = mContainer;
+ mContainer = NULL;
+ if (container) {
+ container->remove(*this);
+ }
+ } // else we do not do anything. No such *this* can be
+ // created and reached here with mContainer ever been
+ // a non NULL. So *this* must have reached the if clause
+ // once, and we want it reach there only once.
+}
+
+int LocTimerDelegate::ranks(LocRankable& rankable) {
+ int rank = -1;
+ LocTimerDelegate* timer = (LocTimerDelegate*)(&rankable);
+ if (timer) {
+ // larger time ranks lower!!!
+ // IOW, if input obj has bigger tv_sec/tv_nsec, this obj outRanks higher
+ rank = timer->mFutureTime.tv_sec - mFutureTime.tv_sec;
+ if(0 == rank)
+ {
+ //rank against tv_nsec for msec accuracy
+ rank = (int)(timer->mFutureTime.tv_nsec - mFutureTime.tv_nsec);
+ }
+ }
+ return rank;
+}
+
+inline
+void LocTimerDelegate::expire() {
+ // keeping a copy of client pointer to be safe
+ // when timeOutCallback() is called at the end of this
+ // method, *this* obj may be already deleted.
+ LocTimer* client = mClient;
+ // force a stop, which will lead to delete of this obj
+ if (client && client->stop()) {
+ // calling client callback with a pointer save on the stack
+ // only if stop() returns true, i.e. it hasn't been stopped
+ // already.
+ client->timeOutCallback();
+ }
+}
+
+
+/***************************LocTimer methods***************************/
+LocTimer::LocTimer() : mTimer(NULL), mLock(new LocSharedLock()) {
+}
+
+LocTimer::~LocTimer() {
+ stop();
+ if (mLock) {
+ mLock->drop();
+ mLock = NULL;
+ }
+}
+
+bool LocTimer::start(unsigned int timeOutInMs, bool wakeOnExpire) {
+ bool success = false;
+ mLock->lock();
+ if (!mTimer) {
+ struct timespec futureTime;
+ clock_gettime(CLOCK_BOOTTIME, &futureTime);
+ futureTime.tv_sec += timeOutInMs / 1000;
+ futureTime.tv_nsec += (timeOutInMs % 1000) * 1000000;
+ if (futureTime.tv_nsec >= 1000000000) {
+ futureTime.tv_sec += futureTime.tv_nsec / 1000000000;
+ futureTime.tv_nsec %= 1000000000;
+ }
+
+ LocTimerContainer* container;
+ container = LocTimerContainer::get(wakeOnExpire);
+ if (NULL != container) {
+ mTimer = new LocTimerDelegate(*this, futureTime, container);
+ // if mTimer is non 0, success should be 0; or vice versa
+ }
+ success = (NULL != mTimer);
+ }
+ mLock->unlock();
+ return success;
+}
+
+bool LocTimer::stop() {
+ bool success = false;
+ mLock->lock();
+ if (mTimer) {
+ LocTimerDelegate* timer = mTimer;
+ mTimer = NULL;
+ if (timer) {
+ timer->destroyLocked();
+ success = true;
+ }
+ }
+ mLock->unlock();
+ return success;
+}
+
+/***************************LocTimerWrapper methods***************************/
+//////////////////////////////////////////////////////////////////////////
+// This section below wraps for the C style APIs
+//////////////////////////////////////////////////////////////////////////
+class LocTimerWrapper : public LocTimer {
+ loc_timer_callback mCb;
+ void* mCallerData;
+ LocTimerWrapper* mMe;
+ static pthread_mutex_t mMutex;
+ inline ~LocTimerWrapper() { mCb = NULL; mMe = NULL; }
+public:
+ inline LocTimerWrapper(loc_timer_callback cb, void* callerData) :
+ mCb(cb), mCallerData(callerData), mMe(this) {
+ }
+ void destroy() {
+ pthread_mutex_lock(&mMutex);
+ if (NULL != mCb && this == mMe) {
+ delete this;
+ }
+ pthread_mutex_unlock(&mMutex);
+ }
+ virtual void timeOutCallback() {
+ loc_timer_callback cb = mCb;
+ void* callerData = mCallerData;
+ if (cb) {
+ cb(callerData, 0);
+ }
+ destroy();
+ }
+};
+
+pthread_mutex_t LocTimerWrapper::mMutex = PTHREAD_MUTEX_INITIALIZER;
+
+void* loc_timer_start(uint64_t msec, loc_timer_callback cb_func,
+ void *caller_data, bool wake_on_expire)
+{
+ LocTimerWrapper* locTimerWrapper = NULL;
+
+ if (cb_func) {
+ locTimerWrapper = new LocTimerWrapper(cb_func, caller_data);
+
+ if (locTimerWrapper) {
+ locTimerWrapper->start(msec, wake_on_expire);
+ }
+ }
+
+ return locTimerWrapper;
+}
+
+void loc_timer_stop(void*& handle)
+{
+ if (handle) {
+ LocTimerWrapper* locTimerWrapper = (LocTimerWrapper*)(handle);
+ locTimerWrapper->destroy();
+ handle = NULL;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// This section above wraps for the C style APIs
+//////////////////////////////////////////////////////////////////////////
+
+#ifdef __LOC_DEBUG__
+
+double getDeltaSeconds(struct timespec from, struct timespec to) {
+ return (double)to.tv_sec + (double)to.tv_nsec / 1000000000
+ - from.tv_sec - (double)from.tv_nsec / 1000000000;
+}
+
+struct timespec getNow() {
+ struct timespec now;
+ clock_gettime(CLOCK_BOOTTIME, &now);
+ return now;
+}
+
+class LocTimerTest : public LocTimer, public LocRankable {
+ int mTimeOut;
+ const struct timespec mTimeOfBirth;
+ inline struct timespec getTimerWrapper(int timeout) {
+ struct timespec now;
+ clock_gettime(CLOCK_BOOTTIME, &now);
+ now.tv_sec += timeout;
+ return now;
+ }
+public:
+ inline LocTimerTest(int timeout) : LocTimer(), LocRankable(),
+ mTimeOut(timeout), mTimeOfBirth(getTimerWrapper(0)) {}
+ inline virtual int ranks(LocRankable& rankable) {
+ LocTimerTest* timer = dynamic_cast<LocTimerTest*>(&rankable);
+ return timer->mTimeOut - mTimeOut;
+ }
+ inline virtual void timeOutCallback() {
+ printf("timeOutCallback() - ");
+ deviation();
+ }
+ double deviation() {
+ struct timespec now = getTimerWrapper(0);
+ double delta = getDeltaSeconds(mTimeOfBirth, now);
+ printf("%lf: %lf\n", delta, delta * 100 / mTimeOut);
+ return delta / mTimeOut;
+ }
+};
+
+// For Linux command line testing:
+// compilation:
+// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../system/core/include -o LocHeap.o LocHeap.cpp
+// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -std=c++0x -I. -I../../../../system/core/include -lpthread -o LocThread.o LocThread.cpp
+// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../system/core/include -o LocTimer.o LocTimer.cpp
+int main(int argc, char** argv) {
+ struct timespec timeOfStart=getNow();
+ srand(time(NULL));
+ int tries = atoi(argv[1]);
+ int checks = tries >> 3;
+ LocTimerTest** timerArray = new LocTimerTest*[tries];
+ memset(timerArray, NULL, tries);
+
+ for (int i = 0; i < tries; i++) {
+ int r = rand() % tries;
+ LocTimerTest* timer = new LocTimerTest(r);
+ if (timerArray[r]) {
+ if (!timer->stop()) {
+ printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow()));
+ printf("ERRER: %dth timer, id %d, not running when it should be\n", i, r);
+ exit(0);
+ } else {
+ printf("stop() - %d\n", r);
+ delete timer;
+ timerArray[r] = NULL;
+ }
+ } else {
+ if (!timer->start(r, false)) {
+ printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow()));
+ printf("ERRER: %dth timer, id %d, running when it should not be\n", i, r);
+ exit(0);
+ } else {
+ printf("stop() - %d\n", r);
+ timerArray[r] = timer;
+ }
+ }
+ }
+
+ for (int i = 0; i < tries; i++) {
+ if (timerArray[i]) {
+ if (!timerArray[i]->stop()) {
+ printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow()));
+ printf("ERRER: %dth timer, not running when it should be\n", i);
+ exit(0);
+ } else {
+ printf("stop() - %d\n", i);
+ delete timerArray[i];
+ timerArray[i] = NULL;
+ }
+ }
+ }
+
+ delete[] timerArray;
+
+ return 0;
+}
+
+#endif
diff --git a/gps/utils/LocTimer.h b/gps/utils/LocTimer.h
new file mode 100644
index 0000000..abc7f64
--- /dev/null
+++ b/gps/utils/LocTimer.h
@@ -0,0 +1,74 @@
+/* Copyright (c) 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 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_TIMER_CPP_H__
+#define __LOC_TIMER_CPP_H__
+
+#include <stddef.h>
+#include <loc_pla.h>
+
+// opaque class to provide service implementation.
+class LocTimerDelegate;
+class LocSharedLock;
+
+// LocTimer client must extend this class and implementthe callback.
+// start() / stop() methods are to arm / disarm timer.
+class LocTimer
+{
+ LocTimerDelegate* mTimer;
+ LocSharedLock* mLock;
+ // don't really want mLock to be manipulated by clients, yet LocTimer
+ // has to have a reference to the lock so that the delete of LocTimer
+ // and LocTimerDelegate can work together on their share resources.
+ friend class LocTimerDelegate;
+
+public:
+ LocTimer();
+ virtual ~LocTimer();
+
+ // timeOutInMs: timeout delay in ms
+ // wakeOnExpire: true if to wake up CPU (if sleeping) upon timer
+ // expiration and notify the client.
+ // false if to wait until next time CPU wakes up (if
+ // sleeping) and then notify the client.
+ // return: true on success;
+ // false on failure, e.g. timer is already running.
+ bool start(uint32_t timeOutInMs, bool wakeOnExpire);
+
+ // return: true on success;
+ // false on failure, e.g. timer is not running.
+ bool stop();
+
+ // LocTimer client Should implement this method.
+ // This method is used for timeout calling back to client. This method
+ // should be short enough (eg: send a message to your own thread).
+ virtual void timeOutCallback() = 0;
+};
+
+#endif //__LOC_DELAY_H__
diff --git a/gps/utils/LocUnorderedSetMap.h b/gps/utils/LocUnorderedSetMap.h
new file mode 100644
index 0000000..7b25ad0
--- /dev/null
+++ b/gps/utils/LocUnorderedSetMap.h
@@ -0,0 +1,201 @@
+/* Copyright (c) 2015, 2017, 2020 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 <loc_pla.h>
+
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <set>
+ #include <map>
+#else
+ #include <unordered_set>
+ #include <unordered_map>
+#endif
+
+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 = {};
+ 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) : LocUnorderedSetMap() {
+ mMap.get_allocator().allocate(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>{};
+ }
+
+ // This gets all the KEYs from the map
+ inline unordered_set<KEY> getKeys() {
+ unordered_set<KEY> keys = {};
+ 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 = {};
+ 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/LogBuffer.cpp b/gps/utils/LogBuffer.cpp
new file mode 100644
index 0000000..1bb6f0f
--- /dev/null
+++ b/gps/utils/LogBuffer.cpp
@@ -0,0 +1,167 @@
+/* Copyright (c) 2019 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 "LogBuffer.h"
+#include <utils/Log.h>
+
+#define LOG_TAG "LocSvc_LogBuffer"
+
+namespace loc_util {
+
+LogBuffer* LogBuffer::mInstance;
+struct sigaction LogBuffer::mOriSigAction[NSIG];
+struct sigaction LogBuffer::mNewSigAction;
+mutex LogBuffer::sLock;
+
+LogBuffer* LogBuffer::getInstance() {
+ if (mInstance == nullptr) {
+ lock_guard<mutex> guard(sLock);
+ if (mInstance == nullptr) {
+ mInstance = new LogBuffer();
+ }
+ }
+ return mInstance;
+}
+
+LogBuffer::LogBuffer(): mLogList(TOTAL_LOG_LEVELS),
+ mConfigVec(TOTAL_LOG_LEVELS, ConfigsInLevel(TIME_DEPTH_THRESHOLD_MINIMAL_IN_SEC,
+ MAXIMUM_NUM_IN_LIST, 0)) {
+ loc_param_s_type log_buff_config_table[] =
+ {
+ {"E_LEVEL_TIME_DEPTH", &mConfigVec[0].mTimeDepthThres, NULL, 'n'},
+ {"E_LEVEL_MAX_CAPACITY", &mConfigVec[0].mMaxNumThres, NULL, 'n'},
+ {"W_LEVEL_TIME_DEPTH", &mConfigVec[1].mTimeDepthThres, NULL, 'n'},
+ {"W_LEVEL_MAX_CAPACITY", &mConfigVec[1].mMaxNumThres, NULL, 'n'},
+ {"I_LEVEL_TIME_DEPTH", &mConfigVec[2].mTimeDepthThres, NULL, 'n'},
+ {"I_LEVEL_MAX_CAPACITY", &mConfigVec[2].mMaxNumThres, NULL, 'n'},
+ {"D_LEVEL_TIME_DEPTH", &mConfigVec[3].mTimeDepthThres, NULL, 'n'},
+ {"D_LEVEL_MAX_CAPACITY", &mConfigVec[3].mMaxNumThres, NULL, 'n'},
+ {"V_LEVEL_TIME_DEPTH", &mConfigVec[4].mTimeDepthThres, NULL, 'n'},
+ {"V_LEVEL_MAX_CAPACITY", &mConfigVec[4].mMaxNumThres, NULL, 'n'},
+ };
+ loc_read_conf(LOC_PATH_GPS_CONF_STR, log_buff_config_table,
+ sizeof(log_buff_config_table)/sizeof(log_buff_config_table[0]));
+ registerSignalHandler();
+}
+
+void LogBuffer::append(string& data, int level, uint64_t timestamp) {
+ lock_guard<mutex> guard(mLock);
+ pair<uint64_t, string> item(timestamp, data);
+ mLogList.append(item, level);
+ mConfigVec[level].mCurrentSize++;
+
+ while ((timestamp - mLogList.front(level).first) > mConfigVec[level].mTimeDepthThres ||
+ mConfigVec[level].mCurrentSize > mConfigVec[level].mMaxNumThres) {
+ mLogList.pop(level);
+ mConfigVec[level].mCurrentSize--;
+ }
+}
+
+//Dump the log buffer of specific level, level = -1 to dump all the levels in log buffer.
+void LogBuffer::dump(std::function<void(stringstream&)> log, int level) {
+ lock_guard<mutex> guard(mLock);
+ list<pair<pair<uint64_t, string>, int>> li;
+ if (-1 == level) {
+ li = mLogList.dump();
+ } else {
+ li = mLogList.dump(level);
+ }
+ ALOGE("Begining of dump, buffer size: %d", (int)li.size());
+ stringstream ln;
+ ln << "dump log buffer, level[" << level << "]" << ", buffer size: " << li.size() << endl;
+ log(ln);
+ for_each (li.begin(), li.end(), [&, this](const pair<pair<uint64_t, string>, int> &item){
+ stringstream line;
+ line << "["<<item.first.first << "] ";
+ line << "Level " << mLevelMap[item.second] << ": ";
+ line << item.first.second << endl;
+ if (log != nullptr) {
+ log(line);
+ }
+ });
+ ALOGE("End of dump");
+}
+
+void LogBuffer::dumpToAdbLogcat() {
+ dump([](stringstream& line){
+ ALOGE("%s", line.str().c_str());
+ });
+}
+
+void LogBuffer::dumpToLogFile(string filePath) {
+ ALOGE("Dump GPS log buffer to file: %s", filePath.c_str());
+ fstream s;
+ s.open(filePath, std::fstream::out | std::fstream::app);
+ dump([&s](stringstream& line){
+ s << line.str();
+ });
+ s.close();
+}
+
+void LogBuffer::flush() {
+ mLogList.flush();
+}
+
+void LogBuffer::registerSignalHandler() {
+ ALOGE("Singal handler registered");
+ mNewSigAction.sa_sigaction = &LogBuffer::signalHandler;
+ mNewSigAction.sa_flags = SA_SIGINFO;
+ sigemptyset(&mNewSigAction.sa_mask);
+
+ sigaction(SIGINT, &mNewSigAction, &mOriSigAction[SIGINT]);
+ sigaction(SIGKILL, &mNewSigAction, &mOriSigAction[SIGKILL]);
+ sigaction(SIGSEGV, &mNewSigAction, &mOriSigAction[SIGSEGV]);
+ sigaction(SIGABRT, &mNewSigAction, &mOriSigAction[SIGABRT]);
+ sigaction(SIGTRAP, &mNewSigAction, &mOriSigAction[SIGTRAP]);
+ sigaction(SIGUSR1, &mNewSigAction, &mOriSigAction[SIGUSR1]);
+}
+
+void LogBuffer::signalHandler(const int code, siginfo_t *const si, void *const sc) {
+ ALOGE("[Gnss Log buffer]Singal handler, signal ID: %d", code);
+
+ //Dump the log buffer to adb logcat
+ mInstance->dumpToAdbLogcat();
+
+ //Dump the log buffer to file
+ time_t now = time(NULL);
+ struct tm *curr_time = localtime(&now);
+ char path[50];
+ snprintf(path, 50, LOG_BUFFER_FILE_PATH "gpslog_%d%d%d-%d%d%d.log",
+ (1900 + curr_time->tm_year), ( 1 + curr_time->tm_mon), curr_time->tm_mday,
+ curr_time->tm_hour, curr_time->tm_min, curr_time->tm_sec);
+
+ mInstance->dumpToLogFile(path);
+
+ //Process won't be terminated if SIGUSR1 is recieved
+ if (code != SIGUSR1) {
+ mOriSigAction[code].sa_sigaction(code, si, sc);
+ }
+}
+
+}
diff --git a/gps/utils/LogBuffer.h b/gps/utils/LogBuffer.h
new file mode 100644
index 0000000..8d90439
--- /dev/null
+++ b/gps/utils/LogBuffer.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2019 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 LOG_BUFFER_H
+#define LOG_BUFFER_H
+
+#include "SkipList.h"
+#include "log_util.h"
+#include <loc_cfg.h>
+#include <loc_pla.h>
+#include <string>
+#include <sstream>
+#include <ostream>
+#include <fstream>
+#include <time.h>
+#include <mutex>
+#include <signal.h>
+#include <thread>
+#include <functional>
+
+//default error level time depth threshold,
+#define TIME_DEPTH_THRESHOLD_MINIMAL_IN_SEC 60
+//default maximum log buffer size
+#define MAXIMUM_NUM_IN_LIST 50
+//file path of dumped log buffer
+#define LOG_BUFFER_FILE_PATH "/data/vendor/location/"
+
+namespace loc_util {
+
+class ConfigsInLevel{
+public:
+ uint32_t mTimeDepthThres;
+ uint32_t mMaxNumThres;
+ int mCurrentSize;
+
+ ConfigsInLevel(uint32_t time, int num, int size):
+ mTimeDepthThres(time), mMaxNumThres(num), mCurrentSize(size) {}
+};
+
+class LogBuffer {
+private:
+ static LogBuffer* mInstance;
+ static struct sigaction mOriSigAction[NSIG];
+ static struct sigaction mNewSigAction;
+ static mutex sLock;
+
+ SkipList<pair<uint64_t, string>> mLogList;
+ vector<ConfigsInLevel> mConfigVec;
+ mutex mLock;
+
+ const vector<string> mLevelMap {"E", "W", "I", "D", "V"};
+
+public:
+ static LogBuffer* getInstance();
+ void append(string& data, int level, uint64_t timestamp);
+ void dump(std::function<void(stringstream&)> log, int level = -1);
+ void dumpToAdbLogcat();
+ void dumpToLogFile(string filePath);
+ void flush();
+private:
+ LogBuffer();
+ void registerSignalHandler();
+ static void signalHandler(const int code, siginfo_t *const si, void *const sc);
+
+};
+
+}
+
+#endif
diff --git a/gps/utils/Makefile.am b/gps/utils/Makefile.am
new file mode 100644
index 0000000..72c7872
--- /dev/null
+++ b/gps/utils/Makefile.am
@@ -0,0 +1,74 @@
+ACLOCAL_AMFLAGS = -I m4
+
+AM_CFLAGS = -Wundef \
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ -I./ \
+ -std=c++14 \
+ $(LOCPLA_CFLAGS)
+
+libgps_utils_la_h_sources = \
+ msg_q.h \
+ linked_list.h \
+ loc_cfg.h \
+ loc_log.h \
+ loc_target.h \
+ loc_timer.h \
+ MsgTask.h \
+ LocHeap.h \
+ LocThread.h \
+ LocTimer.h \
+ LocIpc.h \
+ SkipList.h\
+ loc_misc_utils.h \
+ loc_nmea.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_gps.h \
+ log_util.h \
+ LocSharedLock.h \
+ LocUnorderedSetMap.h
+
+libgps_utils_la_c_sources = \
+ linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ loc_target.cpp \
+ LocHeap.cpp \
+ LocTimer.cpp \
+ LocThread.cpp \
+ LocIpc.cpp \
+ LogBuffer.cpp \
+ MsgTask.cpp \
+ loc_misc_utils.cpp \
+ loc_nmea.cpp
+
+library_includedir = $(pkgincludedir)
+
+library_include_HEADERS = $(libgps_utils_la_h_sources)
+
+libgps_utils_la_SOURCES = $(libgps_utils_la_c_sources)
+
+if USE_GLIB
+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_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_la_LIBADD = $(CUTILS_LIBS) -ldl
+
+#Create and Install libraries
+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
new file mode 100644
index 0000000..0a978ed
--- /dev/null
+++ b/gps/utils/MsgTask.cpp
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2013, 2015, 2017, 2020 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+#include <loc_pla.h>
+
+static void LocMsgDestroy(void* msg) {
+ delete (LocMsg*)msg;
+}
+
+MsgTask::MsgTask(LocThread::tCreate tCreator,
+ const char* threadName, bool joinable) :
+ mQ(msg_q_init2()), mThread(new LocThread()) {
+ if (!mThread->start(tCreator, threadName, this, joinable)) {
+ delete mThread;
+ mThread = NULL;
+ }
+}
+
+MsgTask::MsgTask(const char* threadName, bool joinable) :
+ mQ(msg_q_init2()), mThread(new LocThread()) {
+ if (!mThread->start(threadName, this, joinable)) {
+ delete mThread;
+ mThread = NULL;
+ }
+}
+
+MsgTask::~MsgTask() {
+ msg_q_flush((void*)mQ);
+ msg_q_destroy((void**)&mQ);
+}
+
+void MsgTask::destroy() {
+ LocThread* thread = mThread;
+ msg_q_unblock((void*)mQ);
+ if (thread) {
+ mThread = NULL;
+ delete thread;
+ } else {
+ delete this;
+ }
+}
+
+void MsgTask::sendMsg(const LocMsg* msg) const {
+ if (msg && this) {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+ } else {
+ LOC_LOGE("%s: msg is %p and this is %p",
+ __func__, msg, this);
+ }
+}
+
+void MsgTask::prerun() {
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+}
+
+bool MsgTask::run() {
+ LocMsg* msg;
+ msq_q_err_type result = msg_q_rcv((void*)mQ, (void **)&msg);
+ if (eMSG_Q_SUCCESS != result) {
+ LOC_LOGE("%s:%d] fail receiving msg: %s\n", __func__, __LINE__,
+ loc_get_msg_q_status(result));
+ return false;
+ }
+
+ msg->log();
+ // there is where each individual msg handling is invoked
+ msg->proc();
+
+ delete msg;
+
+ return true;
+}
diff --git a/gps/utils/MsgTask.h b/gps/utils/MsgTask.h
new file mode 100644
index 0000000..9eb1f56
--- /dev/null
+++ b/gps/utils/MsgTask.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2011-2013,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 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 __MSG_TASK__
+#define __MSG_TASK__
+
+#include <LocThread.h>
+
+struct LocMsg {
+ inline LocMsg() {}
+ inline virtual ~LocMsg() {}
+ virtual void proc() const = 0;
+ inline virtual void log() const {}
+};
+
+class MsgTask : public LocRunnable {
+ const void* mQ;
+ LocThread* mThread;
+ friend class LocThreadDelegate;
+protected:
+ virtual ~MsgTask();
+public:
+ MsgTask(LocThread::tCreate tCreator, const char* threadName = NULL, bool joinable = true);
+ MsgTask(const char* threadName = NULL, bool joinable = true);
+ // this obj will be deleted once thread is deleted
+ void destroy();
+ void sendMsg(const LocMsg* msg) const;
+ // Overrides of LocRunnable methods
+ // This method will be repeated called until it returns false; or
+ // until thread is stopped.
+ virtual bool run();
+
+ // The method to be run before thread loop (conditionally repeatedly)
+ // calls run()
+ virtual void prerun();
+
+ // The method to be run after thread loop (conditionally repeatedly)
+ // calls run()
+ inline virtual void postrun() {}
+};
+
+#endif //__MSG_TASK__
diff --git a/gps/utils/SkipList.h b/gps/utils/SkipList.h
new file mode 100644
index 0000000..afaa1a6
--- /dev/null
+++ b/gps/utils/SkipList.h
@@ -0,0 +1,158 @@
+/* Copyright (c) 2019 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_SKIP_LIST_H
+#define LOC_SKIP_LIST_H
+
+#include <stdlib.h>
+#include <list>
+#include <vector>
+#include <iostream>
+#include <algorithm>
+
+using namespace std;
+
+namespace loc_util {
+
+template <typename T,
+ template<typename elem, typename Allocator = std::allocator<elem>> class container = list>
+class SkipNode {
+public:
+ typedef typename container<SkipNode<T, container>>::iterator NodeIterator;
+
+ int mLevel;
+ T mData;
+ NodeIterator mNextInLevel;
+
+ SkipNode(int level, T& data): mLevel(level), mData(data) {}
+};
+
+template <typename T>
+class SkipList {
+ using NodeIterator = typename SkipNode<T>::NodeIterator;
+private:
+ list<SkipNode<T>> mMainList;
+ vector<NodeIterator> mHeadVec;
+ vector<NodeIterator> mTailVec;
+public:
+ SkipList(int totalLevels);
+ void append(T& data, int level);
+ void pop(int level);
+ void pop();
+ T front(int level);
+ int size();
+ void flush();
+ list<pair<T, int>> dump();
+ list<pair<T, int>> dump(int level);
+};
+
+template <typename T>
+SkipList<T>::SkipList(int totalLevels): mHeadVec(totalLevels, mMainList.end()),
+ mTailVec(totalLevels, mMainList.end()) {}
+
+template <typename T>
+void SkipList<T>::append(T& data, int level) {
+ if ( level < 0 || level >= mHeadVec.size()) {
+ return;
+ }
+
+ SkipNode<T> node(level, data);
+ node.mNextInLevel = mMainList.end();
+ mMainList.push_back(node);
+ auto iter = --mMainList.end();
+ if (mHeadVec[level] == mMainList.end()) {
+ mHeadVec[level] = iter;
+ } else {
+ (*mTailVec[level]).mNextInLevel = iter;
+ }
+ mTailVec[level] = iter;
+}
+
+template <typename T>
+void SkipList<T>::pop(int level) {
+ if (mHeadVec[level] == mMainList.end()) {
+ return;
+ }
+
+ if ((*mHeadVec[level]).mNextInLevel == mMainList.end()) {
+ mTailVec[level] = mMainList.end();
+ }
+
+ auto tmp_iter = (*mHeadVec[level]).mNextInLevel;
+ mMainList.erase(mHeadVec[level]);
+ mHeadVec[level] = tmp_iter;
+}
+
+template <typename T>
+void SkipList<T>::pop() {
+ pop(mMainList.front().mLevel);
+}
+
+template <typename T>
+T SkipList<T>::front(int level) {
+ return (*mHeadVec[level]).mData;
+}
+
+template <typename T>
+int SkipList<T>::size() {
+ return mMainList.size();
+}
+
+template <typename T>
+void SkipList<T>::flush() {
+ mMainList.clear();
+ for (int i = 0; i < mHeadVec.size(); i++) {
+ mHeadVec[i] = mMainList.end();
+ mTailVec[i] = mMainList.end();
+ }
+}
+
+template <typename T>
+list<pair<T, int>> SkipList<T>::dump() {
+ list<pair<T, int>> li;
+ for_each(mMainList.begin(), mMainList.end(), [&](SkipNode<T> &item) {
+ li.push_back(make_pair(item.mData, item.mLevel));
+ });
+ return li;
+}
+
+template <typename T>
+list<pair<T, int>> SkipList<T>::dump(int level) {
+ list<pair<T, int>> li;
+ auto head = mHeadVec[level];
+ while (head != mMainList.end()) {
+ li.push_back(make_pair((*head).mData, (*head).mLevel));
+ head = (*head).mNextInLevel;
+ }
+ return li;
+}
+
+}
+
+#endif
diff --git a/gps/utils/configure.ac b/gps/utils/configure.ac
new file mode 100644
index 0000000..2a04f45
--- /dev/null
+++ b/gps/utils/configure.ac
@@ -0,0 +1,92 @@
+# configure.ac -- Autoconf script for gps gps-utils
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the gps gps-utils package version 1.0.0
+AC_INIT([gps-utils],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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
+
+AC_ARG_WITH([external_ap],
+ AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
+ [Using External Application Processor]),
+ [],
+ with_external_ap=no)
+
+if test "x$with_external_ap" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
+else
+ # Checks for libraries.
+ PKG_CHECK_MODULES([CUTILS], [libcutils])
+ AC_SUBST([CUTILS_CFLAGS])
+ AC_SUBST([CUTILS_LIBS])
+fi
+
+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 \
+ gps-utils.pc
+ ])
+
+AC_OUTPUT
diff --git a/gps/utils/gps-utils.pc.in b/gps/utils/gps-utils.pc.in
new file mode 100644
index 0000000..a988731
--- /dev/null
+++ b/gps/utils/gps-utils.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gps-utils
+Description: QTI GPS Location utils
+Version: @VERSION
+Libs: -L${libdir} -lgps_utils
+Cflags: -I${includedir}/gps-utils
diff --git a/gps/utils/gps_extended.h b/gps/utils/gps_extended.h
new file mode 100644
index 0000000..2455629
--- /dev/null
+++ b/gps/utils/gps_extended.h
@@ -0,0 +1,114 @@
+/* Copyright (c) 2013-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 GPS_EXTENDED_H
+#define GPS_EXTENDED_H
+
+/**
+ * @file
+ * @brief C++ declarations for GPS types
+ */
+
+#include <gps_extended_c.h>
+#if defined(USE_GLIB) || defined(OFF_TARGET)
+#include <string.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+
+struct LocPosMode
+{
+ LocPositionMode mode;
+ LocGpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ bool share_position;
+ char credentials[14];
+ char provider[8];
+ GnssPowerMode powerMode;
+ uint32_t timeBetweenMeasurements;
+ LocPosMode(LocPositionMode m, LocGpsPositionRecurrence recr,
+ uint32_t gap, uint32_t accu, uint32_t time,
+ bool sp, const char* cred, const char* prov,
+ GnssPowerMode pMode = GNSS_POWER_MODE_INVALID,
+ uint32_t tbm = 0) :
+ mode(m), recurrence(recr),
+ min_interval(gap < GPS_MIN_POSSIBLE_FIX_INTERVAL_MS ?
+ GPS_MIN_POSSIBLE_FIX_INTERVAL_MS : gap),
+ preferred_accuracy(accu), preferred_time(time),
+ share_position(sp), powerMode(pMode),
+ timeBetweenMeasurements(tbm) {
+ memset(credentials, 0, sizeof(credentials));
+ memset(provider, 0, sizeof(provider));
+ if (NULL != cred) {
+ memcpy(credentials, cred, sizeof(credentials)-1);
+ }
+ if (NULL != prov) {
+ memcpy(provider, prov, sizeof(provider)-1);
+ }
+ }
+
+ inline LocPosMode() :
+ mode(LOC_POSITION_MODE_MS_BASED),
+ recurrence(LOC_GPS_POSITION_RECURRENCE_PERIODIC),
+ min_interval(GPS_DEFAULT_FIX_INTERVAL_MS),
+ preferred_accuracy(50), preferred_time(120000),
+ share_position(true), powerMode(GNSS_POWER_MODE_INVALID),
+ timeBetweenMeasurements(GPS_DEFAULT_FIX_INTERVAL_MS) {
+ memset(credentials, 0, sizeof(credentials));
+ memset(provider, 0, sizeof(provider));
+ }
+
+ inline bool equals(const LocPosMode &anotherMode) const
+ {
+ return anotherMode.mode == mode &&
+ anotherMode.recurrence == recurrence &&
+ anotherMode.min_interval == min_interval &&
+ anotherMode.preferred_accuracy == preferred_accuracy &&
+ anotherMode.preferred_time == preferred_time &&
+ anotherMode.powerMode == powerMode &&
+ anotherMode.timeBetweenMeasurements == timeBetweenMeasurements &&
+ !strncmp(anotherMode.credentials, credentials, sizeof(credentials)-1) &&
+ !strncmp(anotherMode.provider, provider, sizeof(provider)-1);
+ }
+
+ void logv() const;
+};
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_H */
+
diff --git a/gps/utils/gps_extended_c.h b/gps/utils/gps_extended_c.h
new file mode 100644
index 0000000..fcda385
--- /dev/null
+++ b/gps/utils/gps_extended_c.h
@@ -0,0 +1,2331 @@
+/* Copyright (c) 2013-2020 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 GPS_EXTENDED_C_H
+#define GPS_EXTENDED_C_H
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <loc_gps.h>
+#include <LocationAPI.h>
+
+struct timespec32_t {
+ uint32_t tv_sec; /* seconds */
+ uint32_t tv_nsec; /* and nanoseconds */
+};
+
+
+/**
+ * @file
+ * @brief C++ declarations for GPS types
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Location has valid source information. */
+#define LOCATION_HAS_SOURCE_INFO 0x0020
+/** LocGpsLocation has valid "is indoor?" flag */
+#define LOC_GPS_LOCATION_HAS_IS_INDOOR 0x0040
+/** LocGpsLocation has valid floor number */
+#define LOC_GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080
+/** LocGpsLocation has valid map URL*/
+#define LOC_GPS_LOCATION_HAS_MAP_URL 0x0100
+/** LocGpsLocation has valid map index */
+#define LOC_GPS_LOCATION_HAS_MAP_INDEX 0x0200
+
+#define GNSS_INVALID_JAMMER_IND 0x7FFFFFFF
+
+/** Sizes for indoor fields */
+#define GPS_LOCATION_MAP_URL_SIZE 400
+#define GPS_LOCATION_MAP_INDEX_SIZE 16
+
+/** Position source is ULP */
+#define ULP_LOCATION_IS_FROM_HYBRID 0x0001
+/** Position source is GNSS only */
+#define ULP_LOCATION_IS_FROM_GNSS 0x0002
+/** Position is from a Geofence Breach Event */
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0004
+/** Position is from Hardware FLP */
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0008
+/** Position is from NLP */
+#define ULP_LOCATION_IS_FROM_NLP 0x0010
+/** Position is from external DR solution*/
+#define ULP_LOCATION_IS_FROM_EXT_DR 0X0020
+/** Raw GNSS position fixes */
+#define ULP_LOCATION_IS_FROM_GNSS_RAW 0X0040
+
+typedef uint32_t LocSvInfoSource;
+/** SVinfo source is GNSS/DR */
+#define ULP_SVINFO_IS_FROM_GNSS ((LocSvInfoSource)0x0001)
+/** Raw SVinfo from GNSS */
+#define ULP_SVINFO_IS_FROM_DR ((LocSvInfoSource)0x0002)
+
+#define ULP_MIN_INTERVAL_INVALID 0xffffffff
+#define ULP_MAX_NMEA_STRING_SIZE 201
+
+/*Emergency SUPL*/
+#define LOC_GPS_NI_TYPE_EMERGENCY_SUPL 4
+
+#define LOC_AGPS_CERTIFICATE_MAX_LENGTH 2000
+#define LOC_AGPS_CERTIFICATE_MAX_SLOTS 10
+
+/* TBM Threshold for tracking in background power mode : in millis */
+#define TRACKING_TBM_THRESHOLD_MILLIS 480000
+
+/** Maximum number of satellites in an ephemeris report. */
+#define GNSS_EPHEMERIS_LIST_MAX_SIZE_V02 32
+
+typedef uint32_t LocPosTechMask;
+#define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000)
+#define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001)
+#define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002)
+#define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004)
+#define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008)
+#define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010)
+#define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020)
+#define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040)
+#define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080)
+#define LOC_POS_TECH_MASK_PPE ((LocPosTechMask)0x00000100)
+
+enum loc_registration_mask_status {
+ LOC_REGISTRATION_MASK_ENABLED,
+ LOC_REGISTRATION_MASK_DISABLED,
+ LOC_REGISTRATION_MASK_SET
+};
+
+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_GNSS_ONLY_POSITION_REPORT, /**< Support GNSS Only position reports */
+ LOC_SUPPORTED_FEATURE_FDCL, /**< Support FDCL */
+ LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02, /**< Support constellation enablement */
+ LOC_SUPPORTED_FEATURE_AGPM_V02, /**< Support AGPM feature */
+ LOC_SUPPORTED_FEATURE_XTRA_INTEGRITY, /**< Support XTRA integrity */
+ LOC_SUPPORTED_FEATURE_FDCL_2, /**< Support FDCL V2 */
+ LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY /**< Support location privacy */
+} loc_supported_feature_enum;
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ uint32_t size;
+ LocGpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ LocPosTechMask tech_mask;
+ bool unpropagatedPosition;
+} UlpLocation;
+
+typedef struct {
+ /** set to sizeof(UlpNmea) */
+ uint32_t size;
+ char nmea_str[ULP_MAX_NMEA_STRING_SIZE];
+ unsigned int len;
+} UlpNmea;
+
+
+/** AGPS type */
+typedef int8_t AGpsExtType;
+#define LOC_AGPS_TYPE_INVALID -1
+#define LOC_AGPS_TYPE_ANY 0
+#define LOC_AGPS_TYPE_SUPL 1
+#define LOC_AGPS_TYPE_C2K 2
+#define LOC_AGPS_TYPE_WWAN_ANY 3
+#define LOC_AGPS_TYPE_WIFI 4
+#define LOC_AGPS_TYPE_SUPL_ES 5
+
+/** SSID length */
+#define SSID_BUF_SIZE (32+1)
+
+typedef int16_t AGpsBearerType;
+#define AGPS_APN_BEARER_INVALID 0
+#define AGPS_APN_BEARER_IPV4 1
+#define AGPS_APN_BEARER_IPV6 2
+#define AGPS_APN_BEARER_IPV4V6 3
+
+typedef uint32_t LocApnTypeMask;
+/**< Denotes APN type for Default/Internet traffic */
+#define LOC_APN_TYPE_MASK_DEFAULT ((LocApnTypeMask)0x00000001)
+/**< Denotes APN type for IP Multimedia Subsystem */
+#define LOC_APN_TYPE_MASK_IMS ((LocApnTypeMask)0x00000002)
+/**< Denotes APN type for Multimedia Messaging Service */
+#define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x00000004)
+/**< Denotes APN type for Dial Up Network */
+#define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x00000008)
+/**< Denotes APN type for Secure User Plane Location */
+#define LOC_APN_TYPE_MASK_SUPL ((LocApnTypeMask)0x00000010)
+/**< Denotes APN type for High Priority Mobile Data */
+#define LOC_APN_TYPE_MASK_HIPRI ((LocApnTypeMask)0x00000020)
+/**< Denotes APN type for over the air administration */
+#define LOC_APN_TYPE_MASK_FOTA ((LocApnTypeMask)0x00000040)
+/**< Denotes APN type for Carrier Branded Services */
+#define LOC_APN_TYPE_MASK_CBS ((LocApnTypeMask)0x00000080)
+/**< Denotes APN type for Initial Attach */
+#define LOC_APN_TYPE_MASK_IA ((LocApnTypeMask)0x00000100)
+/**< Denotes APN type for emergency */
+#define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x00000200)
+
+typedef uint32_t AGpsTypeMask;
+#define AGPS_ATL_TYPE_SUPL ((AGpsTypeMask)0x00000001)
+#define AGPS_ATL_TYPE_SUPL_ES ((AGpsTypeMask)0x00000002)
+#define AGPS_ATL_TYPE_WWAN ((AGpsTypeMask)0x00000004)
+
+typedef struct {
+ void* statusV4Cb;
+ AGpsTypeMask atlType;
+} AgpsCbInfo;
+
+typedef struct {
+ void* visibilityControlCb;
+ void* isInEmergencySession;
+} NfwCbInfo;
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(LocGpsCallbacks) */
+ uint32_t size;
+ loc_gps_set_capabilities set_capabilities_cb;
+ loc_gps_acquire_wakelock acquire_wakelock_cb;
+ loc_gps_release_wakelock release_wakelock_cb;
+ loc_gps_create_thread create_thread_cb;
+ loc_gps_request_utc_time request_utc_time_cb;
+} GpsExtCallbacks;
+
+/** Callback to report the xtra server url to the client.
+ * The client should use this url when downloading xtra unless overwritten
+ * in the gps.conf file
+ */
+typedef void (* report_xtra_server)(const char*, const char*, const char*);
+
+/** Callback structure for the XTRA interface. */
+typedef struct {
+ loc_gps_xtra_download_request download_request_cb;
+ loc_gps_create_thread create_thread_cb;
+ report_xtra_server report_xtra_server_cb;
+} GpsXtraExtCallbacks;
+
+/** Represents the status of AGPS. */
+typedef struct {
+ /** set to sizeof(AGpsExtStatus) */
+ uint32_t size;
+
+ AGpsExtType type;
+ LocAGpsStatusValue status;
+ uint32_t ipv4_addr;
+ struct sockaddr_storage addr;
+ char ssid[SSID_BUF_SIZE];
+ char password[SSID_BUF_SIZE];
+} AGpsExtStatus;
+
+/** Callback with AGPS status information.
+ * Can only be called from a thread created by create_thread_cb.
+ */
+typedef void (* agps_status_extended)(AGpsExtStatus* status);
+
+/** Callback structure for the AGPS interface. */
+typedef struct {
+ agps_status_extended status_cb;
+ loc_gps_create_thread create_thread_cb;
+} AGpsExtCallbacks;
+
+
+typedef void (*loc_ni_notify_callback)(LocGpsNiNotification *notification, bool esEnalbed);
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ loc_ni_notify_callback notify_cb;
+} GpsNiExtCallbacks;
+
+typedef enum loc_server_type {
+ LOC_AGPS_CDMA_PDE_SERVER,
+ LOC_AGPS_CUSTOM_PDE_SERVER,
+ LOC_AGPS_MPC_SERVER,
+ LOC_AGPS_SUPL_SERVER,
+ LOC_AGPS_MO_SUPL_SERVER
+} LocServerType;
+
+typedef enum loc_position_mode_type {
+ LOC_POSITION_MODE_INVALID = -1,
+ LOC_POSITION_MODE_STANDALONE = 0,
+ LOC_POSITION_MODE_MS_BASED,
+ LOC_POSITION_MODE_MS_ASSISTED,
+ LOC_POSITION_MODE_RESERVED_1,
+ LOC_POSITION_MODE_RESERVED_2,
+ LOC_POSITION_MODE_RESERVED_3,
+ LOC_POSITION_MODE_RESERVED_4,
+ LOC_POSITION_MODE_RESERVED_5
+
+} LocPositionMode;
+
+/**
+ * @brief Minimum allowed value for fix interval.
+ *
+ * This value is a sanity limit in GPS framework. The hardware has own internal
+ * limits that may not match this value
+ *
+ * @sa GPS_DEFAULT_FIX_INTERVAL_MS
+ */
+
+#define GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 100
+/**
+ * @brief Default value for fix interval.
+ *
+ * This value is used by default whenever appropriate.
+ *
+ * @sa GPS_MIN_POSSIBLE_FIX_INTERVAL_MS
+ */
+#define GPS_DEFAULT_FIX_INTERVAL_MS 1000
+
+/** Flags to indicate which values are valid in a GpsLocationExtended. */
+typedef uint64_t GpsLocationExtendedFlags;
+/** GpsLocationExtended has valid pdop, hdop, vdop. */
+#define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001
+/** GpsLocationExtended has valid altitude mean sea level. */
+#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002
+/** UlpLocation has valid magnetic deviation. */
+#define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004
+/** UlpLocation has valid mode indicator. */
+#define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008
+/** GpsLocationExtended has valid vertical uncertainty */
+#define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010
+/** GpsLocationExtended has valid speed uncertainty */
+#define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020
+/** GpsLocationExtended has valid heading uncertainty */
+#define GPS_LOCATION_EXTENDED_HAS_BEARING_UNC 0x0040
+/** GpsLocationExtended has valid horizontal reliability */
+#define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080
+/** GpsLocationExtended has valid vertical reliability */
+#define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100
+/** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Major Axis) */
+#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR 0x0200
+/** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Minor Axis) */
+#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400
+/** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */
+#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH 0x0800
+/** GpsLocationExtended has valid gnss sv used in position data */
+#define GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA 0x1000
+/** GpsLocationExtended has valid navSolutionMask */
+#define GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK 0x2000
+/** GpsLocationExtended has valid LocPosTechMask */
+#define GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK 0x4000
+/** GpsLocationExtended has valid LocSvInfoSource */
+#define GPS_LOCATION_EXTENDED_HAS_SV_SOURCE_INFO 0x8000
+/** GpsLocationExtended has valid position dynamics data */
+#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 North standard deviation */
+#define GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV 0x80000
+/** GpsLocationExtended has East standard deviation*/
+#define GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV 0x100000
+/** GpsLocationExtended has North Velocity */
+#define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL 0x200000
+/** GpsLocationExtended has East Velocity */
+#define GPS_LOCATION_EXTENDED_HAS_EAST_VEL 0x400000
+/** GpsLocationExtended has up Velocity */
+#define GPS_LOCATION_EXTENDED_HAS_UP_VEL 0x800000
+/** GpsLocationExtended has North Velocity Uncertainty */
+#define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC 0x1000000
+/** GpsLocationExtended has East Velocity Uncertainty */
+#define GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC 0x2000000
+/** GpsLocationExtended has up Velocity Uncertainty */
+#define GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC 0x4000000
+/** GpsLocationExtended has Clock Bias */
+#define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS 0x8000000
+/** GpsLocationExtended has Clock Bias std deviation*/
+#define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS_STD_DEV 0x10000000
+/** GpsLocationExtended has Clock drift*/
+#define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT 0x20000000
+/** GpsLocationExtended has Clock drift std deviation**/
+#define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT_STD_DEV 0x40000000
+/** GpsLocationExtended has leap seconds **/
+#define GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS 0x80000000
+/** GpsLocationExtended has time uncertainty **/
+#define GPS_LOCATION_EXTENDED_HAS_TIME_UNC 0x100000000
+/** GpsLocationExtended has heading rate **/
+#define GPS_LOCATION_EXTENDED_HAS_HEADING_RATE 0x200000000
+/** GpsLocationExtended has multiband signals **/
+#define GPS_LOCATION_EXTENDED_HAS_MULTIBAND 0x400000000
+/** GpsLocationExtended has sensor calibration confidence */
+#define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_CONFIDENCE 0x800000000
+/** GpsLocationExtended has sensor calibration status */
+#define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_STATUS 0x1000000000
+/** GpsLocationExtended has the engine type that produced this
+ * position, the bit mask will only be set when there are two
+ * or more position engines running in the system */
+#define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE 0x2000000000
+ /** GpsLocationExtended has the engine mask that indicates the
+ * set of engines contribute to the fix. */
+#define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000
+/** GpsLocationExtended has dgnss correction source */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x8000000000
+/** GpsLocationExtended has dgnss correction source ID */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_ID 0x10000000000
+/** GpsLocationExtended has dgnss constellation usage */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CONSTELLATION_USAGE 0x20000000000
+/** GpsLocationExtended has dgnss ref station Id */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000
+/** GpsLocationExtended has dgnss data age */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE 0x80000000000
+ /** GpsLocationExtended has the conformityIndex computed from
+ * robust location feature. */
+#define GPS_LOCATION_EXTENDED_HAS_CONFORMITY_INDEX 0x100000000000
+
+typedef uint32_t LocNavSolutionMask;
+/* Bitmask to specify whether SBAS ionospheric correction is used */
+#define LOC_NAV_MASK_SBAS_CORRECTION_IONO ((LocNavSolutionMask)0x0001)
+/* Bitmask to specify whether SBAS fast correction is used */
+#define LOC_NAV_MASK_SBAS_CORRECTION_FAST ((LocNavSolutionMask)0x0002)
+/**< Bitmask to specify whether SBAS long-tem correction is used */
+#define LOC_NAV_MASK_SBAS_CORRECTION_LONG ((LocNavSolutionMask)0x0004)
+/**< Bitmask to specify whether SBAS integrity information is used */
+#define LOC_NAV_MASK_SBAS_INTEGRITY ((LocNavSolutionMask)0x0008)
+/**< Bitmask to specify whether Position Report is DGNSS corrected */
+#define LOC_NAV_MASK_DGNSS_CORRECTION ((LocNavSolutionMask)0x0010)
+/**< Bitmask to specify whether Position Report is RTK corrected */
+#define LOC_NAV_MASK_RTK_CORRECTION ((LocNavSolutionMask)0x0020)
+/**< Bitmask to specify whether Position Report is PPP corrected */
+#define LOC_NAV_MASK_PPP_CORRECTION ((LocNavSolutionMask)0x0040)
+/**< Bitmask to specify whether Position Report is RTK fixed corrected */
+#define LOC_NAV_MASK_RTK_FIXED_CORRECTION ((LocNavSolutionMask)0x0080)
+
+typedef uint32_t LocPosDataMask;
+/* Bitmask to specify whether Navigation data has Forward Acceleration */
+#define LOC_NAV_DATA_HAS_LONG_ACCEL ((LocPosDataMask)0x0001)
+/* Bitmask to specify whether Navigation data has Sideward Acceleration */
+#define LOC_NAV_DATA_HAS_LAT_ACCEL ((LocPosDataMask)0x0002)
+/* Bitmask to specify whether Navigation data has Vertical Acceleration */
+#define LOC_NAV_DATA_HAS_VERT_ACCEL ((LocPosDataMask)0x0004)
+/* Bitmask to specify whether Navigation data has Heading Rate */
+#define LOC_NAV_DATA_HAS_YAW_RATE ((LocPosDataMask)0x0008)
+/* Bitmask to specify whether Navigation data has Body pitch */
+#define LOC_NAV_DATA_HAS_PITCH ((LocPosDataMask)0x0010)
+/* Bitmask to specify whether Navigation data has Forward Acceleration Unc */
+#define LOC_NAV_DATA_HAS_LONG_ACCEL_UNC ((LocPosDataMask)0x0020)
+/* Bitmask to specify whether Navigation data has Sideward Acceleration Unc*/
+#define LOC_NAV_DATA_HAS_LAT_ACCEL_UNC ((LocPosDataMask)0x0040)
+/* Bitmask to specify whether Navigation data has Vertical Acceleration Unc*/
+#define LOC_NAV_DATA_HAS_VERT_ACCEL_UNC ((LocPosDataMask)0x0080)
+/* Bitmask to specify whether Navigation data has Heading Rate Unc*/
+#define LOC_NAV_DATA_HAS_YAW_RATE_UNC ((LocPosDataMask)0x0100)
+/* Bitmask to specify whether Navigation data has Body pitch Unc*/
+#define LOC_NAV_DATA_HAS_PITCH_UNC ((LocPosDataMask)0x0200)
+
+typedef uint32_t GnssAdditionalSystemInfoMask;
+/* Bitmask to specify whether Tauc is valid */
+#define GNSS_ADDITIONAL_SYSTEMINFO_HAS_TAUC ((GnssAdditionalSystemInfoMask)0x0001)
+/* Bitmask to specify whether leapSec is valid */
+#define GNSS_ADDITIONAL_SYSTEMINFO_HAS_LEAP_SEC ((GnssAdditionalSystemInfoMask)0x0002)
+
+
+/** GPS PRN Range */
+#define GPS_SV_PRN_MIN 1
+#define GPS_SV_PRN_MAX 32
+#define GLO_SV_PRN_MIN 65
+#define GLO_SV_PRN_MAX 96
+#define SBAS_SV_PRN_MIN 120
+#define SBAS_SV_PRN_MAX 191
+#define QZSS_SV_PRN_MIN 193
+#define QZSS_SV_PRN_MAX 197
+#define BDS_SV_PRN_MIN 201
+#define BDS_SV_PRN_MAX 237
+#define GAL_SV_PRN_MIN 301
+#define GAL_SV_PRN_MAX 336
+#define NAVIC_SV_PRN_MIN 401
+#define NAVIC_SV_PRN_MAX 414
+
+/* Checking svIdOneBase can be set to the corresponding bit in mask */
+#define svFitsMask(mask, svIdOneBase) \
+ ((svIdOneBase) >= 1 && (svIdOneBase) <= (sizeof(mask) << 3))
+/* Setting svIdOneBase specific bit in the mask if the bit offset fits */
+#define setSvMask(mask, svIdOneBase) \
+ if (svFitsMask(mask, svIdOneBase)) mask |= (1ULL << ((svIdOneBase) - 1))
+
+typedef enum {
+ LOC_RELIABILITY_NOT_SET = 0,
+ LOC_RELIABILITY_VERY_LOW = 1,
+ LOC_RELIABILITY_LOW = 2,
+ LOC_RELIABILITY_MEDIUM = 3,
+ LOC_RELIABILITY_HIGH = 4
+}LocReliability;
+
+typedef enum {
+ LOC_IN_EMERGENCY_UNKNOWN = 0,
+ LOC_IN_EMERGENCY_SET = 1,
+ LOC_IN_EMERGENCY_NOT_SET = 2
+}LocInEmergency;
+
+typedef struct {
+ struct timespec32_t apTimeStamp;
+ /*boottime received from pps-ktimer*/
+ float apTimeStampUncertaintyMs;
+ /* timestamp uncertainty in milli seconds */
+}Gnss_ApTimeStampStructType;
+
+typedef struct {
+ uint64_t gps_sv_used_ids_mask;
+ uint64_t glo_sv_used_ids_mask;
+ uint64_t gal_sv_used_ids_mask;
+ uint64_t bds_sv_used_ids_mask;
+ uint64_t qzss_sv_used_ids_mask;
+ uint64_t navic_sv_used_ids_mask;
+} GnssSvUsedInPosition;
+
+typedef struct {
+ uint64_t gps_l1ca_sv_used_ids_mask; // GPS L1CA
+ uint64_t gps_l1c_sv_used_ids_mask; // GPS L1C
+ uint64_t gps_l2_sv_used_ids_mask; // GPS L2
+ uint64_t gps_l5_sv_used_ids_mask; // GPS L5
+ uint64_t glo_g1_sv_used_ids_mask; // GLO G1
+ uint64_t glo_g2_sv_used_ids_mask; // GLO G2
+ uint64_t gal_e1_sv_used_ids_mask; // GAL E1
+ uint64_t gal_e5a_sv_used_ids_mask; // GAL E5A
+ uint64_t gal_e5b_sv_used_ids_mask; // GAL E5B
+ uint64_t bds_b1i_sv_used_ids_mask; // BDS B1I
+ uint64_t bds_b1c_sv_used_ids_mask; // BDS B1C
+ uint64_t bds_b2i_sv_used_ids_mask; // BDS B2I
+ uint64_t bds_b2ai_sv_used_ids_mask; // BDS B2AI
+ uint64_t qzss_l1ca_sv_used_ids_mask; // QZSS L1CA
+ uint64_t qzss_l1s_sv_used_ids_mask; // QZSS L1S
+ uint64_t qzss_l2_sv_used_ids_mask; // QZSS L2
+ uint64_t qzss_l5_sv_used_ids_mask; // QZSS L5
+ uint64_t sbas_l1_sv_used_ids_mask; // SBAS L1
+ uint64_t bds_b2aq_sv_used_ids_mask; // BDS B2AQ
+} GnssSvMbUsedInPosition;
+
+/* Body Frame parameters */
+typedef struct {
+ /** Contains Body frame LocPosDataMask bits. */
+ uint32_t bodyFrameDatamask;
+ /* Forward Acceleration in body frame (m/s2)*/
+ float longAccel;
+ /** Uncertainty of Forward Acceleration in body frame */
+ float longAccelUnc;
+ /* Sideward Acceleration in body frame (m/s2)*/
+ float latAccel;
+ /** Uncertainty of Side-ward Acceleration in body frame */
+ float latAccelUnc;
+ /* Vertical Acceleration in body frame (m/s2)*/
+ float vertAccel;
+ /** Uncertainty of Vertical Acceleration in body frame */
+ float vertAccelUnc;
+ /* Heading Rate (Radians/second) */
+ float yawRate;
+ /** Uncertainty of Heading Rate */
+ float yawRateUnc;
+ /* Body pitch (Radians) */
+ float pitch;
+ /** Uncertainty of Body pitch */
+ float pitchRadUnc;
+}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 {
+
+ /**< Current GPS week as calculated from midnight, Jan. 6, 1980. \n
+ - Units: Weeks */
+ uint16_t gpsWeek;
+
+ /**< Amount of time into the current GPS week. \n
+ - Units: Milliseconds */
+ uint32_t gpsTimeOfWeekMs;
+}GPSTimeStruct;
+
+typedef uint8_t CarrierPhaseAmbiguityType;
+#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_NONE ((CarrierPhaseAmbiguityType)0)
+#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FLOAT ((CarrierPhaseAmbiguityType)1)
+#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FIXED ((CarrierPhaseAmbiguityType)2)
+
+
+typedef enum {
+ LOC_DGNSS_CORR_SOURCE_TYPE_INVALID = 0, /**< Invalid DGNSS correction source type \n */
+ LOC_DGNSS_CORR_SOURCE_TYPE_RTCM = 1, /**< DGNSS correction source type RTCM \n */
+ LOC_DGNSS_CORR_SOURCE_TYPE_3GPP = 2, /**< DGNSS correction source type 3GPP \n */
+}LocDgnssCorrectionSourceType;
+
+typedef uint16_t GnssMeasUsageStatusBitMask;
+/** Used in fix */
+#define GNSS_MEAS_USED_IN_PVT ((GnssMeasUsageStatusBitMask)0x00000001ul)
+/** Measurement is Bad */
+#define GNSS_MEAS_USAGE_STATUS_BAD_MEAS ((GnssMeasUsageStatusBitMask)0x00000002ul)
+/** Measurement has too low C/N */
+#define GNSS_MEAS_USAGE_STATUS_CNO_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000004ul)
+/** Measurement has too low elevation */
+#define GNSS_MEAS_USAGE_STATUS_ELEVATION_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000008ul)
+/** No ephemeris available for this measurement */
+#define GNSS_MEAS_USAGE_STATUS_NO_EPHEMERIS ((GnssMeasUsageStatusBitMask)0x00000010ul)
+/** No corrections available for the measurement */
+#define GNSS_MEAS_USAGE_STATUS_NO_CORRECTIONS ((GnssMeasUsageStatusBitMask)0x00000020ul)
+/** Corrections has timed out for the measurement */
+#define GNSS_MEAS_USAGE_STATUS_CORRECTION_TIMEOUT ((GnssMeasUsageStatusBitMask)0x00000040ul)
+/** Measurement is unhealthy */
+#define GNSS_MEAS_USAGE_STATUS_UNHEALTHY ((GnssMeasUsageStatusBitMask)0x00000080ul)
+/** Configuration is disabled for this measurement */
+#define GNSS_MEAS_USAGE_STATUS_CONFIG_DISABLED ((GnssMeasUsageStatusBitMask)0x00000100ul)
+/** Measurement not used for other reasons */
+#define GNSS_MEAS_USAGE_STATUS_OTHER ((GnssMeasUsageStatusBitMask)0x00000200ul)
+
+/** Flags to indicate valid fields in epMeasUsageInfo */
+typedef uint16_t GnssMeasUsageInfoValidityMask;
+#define GNSS_PSEUDO_RANGE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000001ul)
+#define GNSS_DOPPLER_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000002ul)
+#define GNSS_CARRIER_PHASE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000004ul)
+#define GNSS_CARRIER_PHASE_AMBIGUITY_TYPE_VALID ((GnssMeasUsageInfoValidityMask)0x00000008ul)
+
+typedef uint16_t GnssSvPolyStatusMask;
+#define GNSS_SV_POLY_SRC_ALM_CORR_V02 ((GnssSvPolyStatusMask)0x01)
+#define GNSS_SV_POLY_GLO_STR4_V02 ((GnssSvPolyStatusMask)0x02)
+#define GNSS_SV_POLY_DELETE_V02 ((GnssSvPolyStatusMask)0x04)
+#define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((GnssSvPolyStatusMask)0x08)
+typedef uint16_t GnssSvPolyStatusMaskValidity;
+#define GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x01)
+#define GNSS_SV_POLY_GLO_STR4_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x02)
+#define GNSS_SV_POLY_DELETE_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x04)
+#define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x08)
+
+
+typedef struct {
+ /** Specifies GNSS signal type
+ Mandatory Field*/
+ GnssSignalTypeMask gnssSignalType;
+ /** Specifies GNSS Constellation Type
+ Mandatory Field*/
+ Gnss_LocSvSystemEnumType gnssConstellation;
+ /** Unique SV Identifier.
+ * SV Range for supported constellation is specified as below:
+ * - For GPS: 1 to 32
+ * - For GLONASS: 65 to 96
+ * - For SBAS: 120 to 158 and 183 to 191
+ * - For QZSS: 193 to 197
+ * - For BDS: 201 to 237
+ * - For GAL: 301 to 336
+ * - For NAVIC: 401 to 414 */
+ uint16_t gnssSvId;
+ /** GLONASS frequency number + 7.
+ Valid only for a GLONASS system and
+ is to be ignored for all other systems.
+ Range: 1 to 14 */
+ uint8_t gloFrequency;
+ /** Carrier phase ambiguity type. */
+ CarrierPhaseAmbiguityType carrierPhaseAmbiguityType;
+ /** Validity mask */
+ GnssMeasUsageStatusBitMask measUsageStatusMask;
+ /** Specifies measurement usage status
+ Mandatory Field*/
+ GnssMeasUsageInfoValidityMask validityMask;
+ /** Computed pseudorange residual.
+ Unit: Meters */
+ float pseudorangeResidual;
+ /** Computed doppler residual.
+ Unit: Meters/sec*/
+ float dopplerResidual;
+ /** Computed carrier phase residual.
+ Unit: Cycles*/
+ float carrierPhaseResidual;
+ /** Carrier phase ambiguity value.
+ Unit: Cycles*/
+ float carrierPhasAmbiguity;
+} GpsMeasUsageInfo;
+
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ uint32_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint64_t flags;
+ /** Contains the Altitude wrt mean sea level */
+ float altitudeMeanSeaLevel;
+ /** Contains Position Dilusion of Precision. */
+ float pdop;
+ /** Contains Horizontal Dilusion of Precision. */
+ float hdop;
+ /** Contains Vertical Dilusion of Precision. */
+ float vdop;
+ /** Contains Magnetic Deviation. */
+ float magneticDeviation;
+ /** vertical uncertainty in meters */
+ float vert_unc;
+ /** speed uncertainty in m/s */
+ float speed_unc;
+ /** heading uncertainty in degrees (0 to 359.999) */
+ float bearing_unc;
+ /** horizontal reliability. */
+ LocReliability horizontal_reliability;
+ /** vertical reliability. */
+ LocReliability vertical_reliability;
+ /* Horizontal Elliptical Uncertainty (Semi-Major Axis) */
+ float horUncEllipseSemiMajor;
+ /* Horizontal Elliptical Uncertainty (Semi-Minor Axis) */
+ float horUncEllipseSemiMinor;
+ /* Elliptical Horizontal Uncertainty Azimuth */
+ float horUncEllipseOrientAzimuth;
+
+ Gnss_ApTimeStampStructType timeStamp;
+ /** Gnss sv used in position data */
+ GnssSvUsedInPosition gnss_sv_used_ids;
+ /** Gnss sv used in position data for multiband */
+ GnssSvMbUsedInPosition gnss_mb_sv_used_ids;
+ /** Nav solution mask to indicate sbas corrections */
+ LocNavSolutionMask navSolutionMask;
+ /** Position technology used in computing this fix */
+ LocPosTechMask tech_mask;
+ /** SV Info source used in computing this fix */
+ LocSvInfoSource sv_source;
+ /** Body Frame Dynamics: 4wayAcceleration and pitch set with validity */
+ GnssLocationPositionDynamics bodyFrameData;
+ /** GPS Time */
+ GPSTimeStruct gpsTime;
+ GnssSystemTime gnssSystemTime;
+ /** Dilution of precision associated with this position*/
+ LocExtDOP extDOP;
+ /** North standard deviation.
+ Unit: Meters */
+ float northStdDeviation;
+ /** East standard deviation.
+ Unit: Meters */
+ float eastStdDeviation;
+ /** North Velocity.
+ Unit: Meters/sec */
+ float northVelocity;
+ /** East Velocity.
+ Unit: Meters/sec */
+ float eastVelocity;
+ /** Up Velocity.
+ Unit: Meters/sec */
+ float upVelocity;
+ /** North Velocity standard deviation.
+ Unit: Meters/sec */
+ float northVelocityStdDeviation;
+ /** East Velocity standard deviation.
+ Unit: Meters/sec */
+ float eastVelocityStdDeviation;
+ /** Up Velocity standard deviation
+ Unit: Meters/sec */
+ float upVelocityStdDeviation;
+ /** Estimated clock bias. Unit: Nano seconds */
+ float clockbiasMeter;
+ /** Estimated clock bias std deviation. Unit: Nano seconds */
+ float clockBiasStdDeviationMeter;
+ /** Estimated clock drift. Unit: Meters/sec */
+ float clockDrift;
+ /** Estimated clock drift std deviation. Unit: Meters/sec */
+ float clockDriftStdDeviation;
+ /** Number of valid reference stations. Range:[0-4] */
+ uint8_t numValidRefStations;
+ /** Reference station(s) number */
+ uint16_t referenceStation[4];
+ /** Number of measurements received for use in fix.
+ Shall be used as maximum index in-to svUsageInfo[].
+ Set to 0, if svUsageInfo reporting is not supported.
+ Range: 0-EP_GNSS_MAX_MEAS */
+ uint8_t numOfMeasReceived;
+ /** Measurement Usage Information */
+ GpsMeasUsageInfo measUsageInfo[GNSS_SV_MAX];
+ /** Leap Seconds */
+ uint8_t leapSeconds;
+ /** Time uncertainty in milliseconds */
+ float timeUncMs;
+ /** Heading Rate is in NED frame.
+ Range: 0 to 359.999. 946
+ Unit: Degrees per Seconds */
+ float headingRateDeg;
+ /** Sensor calibration confidence percent. Range: 0 - 100 */
+ uint8_t calibrationConfidence;
+ DrCalibrationStatusMask calibrationStatus;
+ /** location engine type. When the fix. when the type is set to
+ LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
+ reports from all engines running on the system (e.g.:
+ DR/SPE/PPE). To check which location engine contributes to
+ the fused output, check for locOutputEngMask. */
+ LocOutputEngineType locOutputEngType;
+ /** when loc output eng type is set to fused, this field
+ indicates the set of engines contribute to the fix. */
+ PositioningEngineMask locOutputEngMask;
+
+ /** DGNSS Correction Source for position report: RTCM, 3GPP
+ * etc. */
+ LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
+
+ /** If DGNSS is used, the SourceID is a 32bit number identifying
+ * the DGNSS source ID */
+ uint32_t dgnssCorrectionSourceID;
+
+ /** If DGNSS is used, which constellation was DGNSS used for to
+ * produce the pos report. */
+ GnssConstellationTypeMask dgnssConstellationUsage;
+
+ /** If DGNSS is used, DGNSS Reference station ID used for
+ * position report */
+ uint16_t dgnssRefStationId;
+
+ /** If DGNSS is used, DGNSS data age in milli-seconds */
+ uint32_t dgnssDataAgeMsec;
+
+ /* When robust location is enabled, this field
+ * will how well the various input data considered for
+ * navigation solution conform to expectations.
+ * Range: 0 (least conforming) to 1 (most conforming) */
+ float conformityIndex;
+} GpsLocationExtended;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+// struct that contains complete position info from engine
+typedef struct {
+ UlpLocation location;
+ GpsLocationExtended locationExtended;
+ enum loc_sess_status sessionStatus;
+} EngineLocationInfo;
+
+// Nmea sentence types mask
+typedef uint32_t NmeaSentenceTypesMask;
+#define LOC_NMEA_MASK_GGA_V02 ((NmeaSentenceTypesMask)0x00000001) /**< Enable GGA type */
+#define LOC_NMEA_MASK_RMC_V02 ((NmeaSentenceTypesMask)0x00000002) /**< Enable RMC type */
+#define LOC_NMEA_MASK_GSV_V02 ((NmeaSentenceTypesMask)0x00000004) /**< Enable GSV type */
+#define LOC_NMEA_MASK_GSA_V02 ((NmeaSentenceTypesMask)0x00000008) /**< Enable GSA type */
+#define LOC_NMEA_MASK_VTG_V02 ((NmeaSentenceTypesMask)0x00000010) /**< Enable VTG type */
+#define LOC_NMEA_MASK_PQXFI_V02 ((NmeaSentenceTypesMask)0x00000020) /**< Enable PQXFI type */
+#define LOC_NMEA_MASK_PSTIS_V02 ((NmeaSentenceTypesMask)0x00000040) /**< Enable PSTIS type */
+#define LOC_NMEA_MASK_GLGSV_V02 ((NmeaSentenceTypesMask)0x00000080) /**< Enable GLGSV type */
+#define LOC_NMEA_MASK_GNGSA_V02 ((NmeaSentenceTypesMask)0x00000100) /**< Enable GNGSA type */
+#define LOC_NMEA_MASK_GNGNS_V02 ((NmeaSentenceTypesMask)0x00000200) /**< Enable GNGNS type */
+#define LOC_NMEA_MASK_GARMC_V02 ((NmeaSentenceTypesMask)0x00000400) /**< Enable GARMC type */
+#define LOC_NMEA_MASK_GAGSV_V02 ((NmeaSentenceTypesMask)0x00000800) /**< Enable GAGSV type */
+#define LOC_NMEA_MASK_GAGSA_V02 ((NmeaSentenceTypesMask)0x00001000) /**< Enable GAGSA type */
+#define LOC_NMEA_MASK_GAVTG_V02 ((NmeaSentenceTypesMask)0x00002000) /**< Enable GAVTG type */
+#define LOC_NMEA_MASK_GAGGA_V02 ((NmeaSentenceTypesMask)0x00004000) /**< Enable GAGGA type */
+#define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */
+#define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */
+#define LOC_NMEA_MASK_DEBUG_V02 ((NmeaSentenceTypesMask)0x00020000) /**< Enable DEBUG type */
+#define LOC_NMEA_MASK_GPDTM_V02 ((NmeaSentenceTypesMask)0x00040000) /**< Enable GPDTM type */
+#define LOC_NMEA_MASK_GNGGA_V02 ((NmeaSentenceTypesMask)0x00080000) /**< Enable GNGGA type */
+#define LOC_NMEA_MASK_GNRMC_V02 ((NmeaSentenceTypesMask)0x00100000) /**< Enable GNRMC type */
+#define LOC_NMEA_MASK_GNVTG_V02 ((NmeaSentenceTypesMask)0x00200000) /**< Enable GNVTG type */
+#define LOC_NMEA_MASK_GAGNS_V02 ((NmeaSentenceTypesMask)0x00400000) /**< Enable GAGNS type */
+#define LOC_NMEA_MASK_GBGGA_V02 ((NmeaSentenceTypesMask)0x00800000) /**< Enable GBGGA type */
+#define LOC_NMEA_MASK_GBGSA_V02 ((NmeaSentenceTypesMask)0x01000000) /**< Enable GBGSA type */
+#define LOC_NMEA_MASK_GBGSV_V02 ((NmeaSentenceTypesMask)0x02000000) /**< Enable GBGSV type */
+#define LOC_NMEA_MASK_GBRMC_V02 ((NmeaSentenceTypesMask)0x04000000) /**< Enable GBRMC type */
+#define LOC_NMEA_MASK_GBVTG_V02 ((NmeaSentenceTypesMask)0x08000000) /**< Enable GBVTG type */
+#define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */
+#define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */
+#define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */
+
+
+// all bitmasks of general supported NMEA sentenses - debug is not part of this
+#define LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \
+ LOC_NMEA_MASK_GSV_V02 | LOC_NMEA_MASK_GSA_V02 | LOC_NMEA_MASK_VTG_V02 | \
+ LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \
+ LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \
+ LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \
+ LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 | \
+ LOC_NMEA_MASK_GPDTM_V02 | LOC_NMEA_MASK_GNGGA_V02 | LOC_NMEA_MASK_GNRMC_V02 | \
+ LOC_NMEA_MASK_GNVTG_V02 | LOC_NMEA_MASK_GAGNS_V02 | LOC_NMEA_MASK_GBGGA_V02 | \
+ LOC_NMEA_MASK_GBGSA_V02 | LOC_NMEA_MASK_GBGSV_V02 | LOC_NMEA_MASK_GBRMC_V02 | \
+ LOC_NMEA_MASK_GBVTG_V02 | LOC_NMEA_MASK_GQGSV_V02 | LOC_NMEA_MASK_GIGSV_V02 | \
+ LOC_NMEA_MASK_GNDTM_V02)
+
+typedef enum {
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MODEM,
+ LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN
+} loc_if_req_sender_id_e_type;
+
+
+#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
+#define MAX_APN_LEN 100
+
+// This will be overridden by the individual adapters
+// if necessary.
+#define DEFAULT_IMPL(rtv) \
+{ \
+ LOC_LOGD("%s: default implementation invoked", __func__); \
+ return rtv; \
+}
+
+enum loc_api_adapter_err {
+ LOC_API_ADAPTER_ERR_SUCCESS = 0,
+ LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1,
+ LOC_API_ADAPTER_ERR_UNSUPPORTED = 2,
+ LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4,
+ LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5,
+ LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6,
+ LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7,
+ LOC_API_ADAPTER_ERR_TIMEOUT = 8,
+ LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9,
+ LOC_API_ADAPTER_ERR_INTERNAL = 10,
+
+ /* equating engine down to phone offline, as they are the same errror */
+ LOC_API_ADAPTER_ERR_ENGINE_DOWN = LOC_API_ADAPTER_ERR_PHONE_OFFLINE,
+ LOC_API_ADAPTER_ERR_FAILURE = 101,
+ LOC_API_ADAPTER_ERR_UNKNOWN
+};
+
+enum loc_api_adapter_event_index {
+ LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type
+ LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report
+ LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate
+ LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate
+ LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request
+ LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request
+ LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server
+ LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl
+ LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state
+ LOC_API_ADAPTER_REQUEST_WIFI, //
+ LOC_API_ADAPTER_SENSOR_STATUS, //
+ LOC_API_ADAPTER_REQUEST_TIME_SYNC, //
+ LOC_API_ADAPTER_REPORT_SPI, //
+ LOC_API_ADAPTER_REPORT_NI_GEOFENCE, //
+ LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, //
+ LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, //
+ LOC_API_ADAPTER_PEDOMETER_CTRL, //
+ LOC_API_ADAPTER_MOTION_CTRL, //
+ LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data
+ LOC_API_ADAPTER_BATCH_FULL, // Batching on full
+ LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix
+ LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, //
+ LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, // GNSS Measurement Report
+ LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, // GNSS SV Polynomial Report
+ LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request
+ LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request
+ LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report
+ LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request
+ 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_FDCL_SERVICE_REQ, // FDCL service request
+ LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION, // Unpropagated Position report
+ LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ, // BS observation data request
+ LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT, // GNSS SV Ephemeris Report
+ LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event
+ LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report
+ LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info
+ LOC_API_ADAPTER_EVENT_MAX
+};
+
+#define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_POSITION)
+#define LOC_API_ADAPTER_BIT_SATELLITE_REPORT (1<<LOC_API_ADAPTER_REPORT_SATELLITE)
+#define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_1HZ)
+#define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_POSITION)
+#define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST (1<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY)
+#define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST (1<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA)
+#define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST (1<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER)
+#define LOC_API_ADAPTER_BIT_IOCTL_REPORT (1<<LOC_API_ADAPTER_REPORT_IOCTL)
+#define LOC_API_ADAPTER_BIT_STATUS_REPORT (1<<LOC_API_ADAPTER_REPORT_STATUS)
+#define LOC_API_ADAPTER_BIT_REQUEST_WIFI (1<<LOC_API_ADAPTER_REQUEST_WIFI)
+#define LOC_API_ADAPTER_BIT_SENSOR_STATUS (1<<LOC_API_ADAPTER_SENSOR_STATUS)
+#define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC (1<<LOC_API_ADAPTER_REQUEST_TIME_SYNC)
+#define LOC_API_ADAPTER_BIT_REPORT_SPI (1<<LOC_API_ADAPTER_REPORT_SPI)
+#define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE (1<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE)
+#define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT (1<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT)
+#define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH (1<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH)
+#define LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT (1<<LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT)
+#define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL (1<<LOC_API_ADAPTER_PEDOMETER_CTRL)
+#define LOC_API_ADAPTER_BIT_MOTION_CTRL (1<<LOC_API_ADAPTER_MOTION_CTRL)
+#define LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA (1<<LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA)
+#define LOC_API_ADAPTER_BIT_BATCH_FULL (1<<LOC_API_ADAPTER_BATCH_FULL)
+#define LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT (1<<LOC_API_ADAPTER_BATCHED_POSITION_REPORT)
+#define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT)
+#define LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT (1<<LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT)
+#define LOC_API_ADAPTER_BIT_GDT_UPLOAD_BEGIN_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ)
+#define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_END_REQ)
+#define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT)
+#define LOC_API_ADAPTER_BIT_REQUEST_TIMEZONE (1<<LOC_API_ADAPTER_REQUEST_TIMEZONE)
+#define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL (1<<LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT)
+#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)
+#define LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION)
+#define LOC_API_ADAPTER_BIT_BS_OBS_DATA_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ)
+#define LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT)
+#define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO)
+#define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT)
+#define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO)
+
+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
+ LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH, // Geofence Batched Breach
+ LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING, // DBT 2.0
+ LOC_API_ADAPTER_MESSAGE_ADAPTIVE_LOCATION_BATCHING, // Batching 1.5
+ LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING, // Batching 2.0
+ LOC_API_ADAPTER_MESSAGE_UPDATE_TBF_ON_THE_FLY, // Updating Tracking TBF On The Fly
+ LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING, // Outdoor Trip Batching
+
+ LOC_API_ADAPTER_MESSAGE_MAX
+} LocCheckingMessagesID;
+
+typedef int IzatDevId_t;
+
+typedef uint32_t LOC_GPS_LOCK_MASK;
+#define isGpsLockNone(lock) ((lock) == 0)
+#define isGpsLockMO(lock) ((lock) & ((LOC_GPS_LOCK_MASK)1))
+#define isGpsLockMT(lock) ((lock) & ((LOC_GPS_LOCK_MASK)2))
+#define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3)
+
+/*++ ***********************************************
+** Satellite Measurement and Satellite Polynomial
+** structure definitions
+** ***********************************************
+--*/
+#define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE 12
+#define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3
+#define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9
+#define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4
+/** Max number of GNSS SV measurement */
+#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 128
+
+enum ulp_gnss_sv_measurement_valid_flags{
+
+ ULP_GNSS_SV_MEAS_GPS_TIME = 0,
+ ULP_GNSS_SV_MEAS_PSUEDO_RANGE,
+ ULP_GNSS_SV_MEAS_MS_IN_WEEK,
+ ULP_GNSS_SV_MEAS_SUB_MSEC,
+ ULP_GNSS_SV_MEAS_CARRIER_PHASE,
+ ULP_GNSS_SV_MEAS_DOPPLER_SHIFT,
+ ULP_GNSS_SV_MEAS_CNO,
+ ULP_GNSS_SV_MEAS_LOSS_OF_LOCK,
+
+ ULP_GNSS_SV_MEAS_MAX_VALID_FLAGS
+};
+
+#define ULP_GNSS_SV_MEAS_BIT_GPS_TIME (1<<ULP_GNSS_SV_MEAS_GPS_TIME)
+#define ULP_GNSS_SV_MEAS_BIT_PSUEDO_RANGE (1<<ULP_GNSS_SV_MEAS_PSUEDO_RANGE)
+#define ULP_GNSS_SV_MEAS_BIT_MS_IN_WEEK (1<<ULP_GNSS_SV_MEAS_MS_IN_WEEK)
+#define ULP_GNSS_SV_MEAS_BIT_SUB_MSEC (1<<ULP_GNSS_SV_MEAS_SUB_MSEC)
+#define ULP_GNSS_SV_MEAS_BIT_CARRIER_PHASE (1<<ULP_GNSS_SV_MEAS_CARRIER_PHASE)
+#define ULP_GNSS_SV_MEAS_BIT_DOPPLER_SHIFT (1<<ULP_GNSS_SV_MEAS_DOPPLER_SHIFT)
+#define ULP_GNSS_SV_MEAS_BIT_CNO (1<<ULP_GNSS_SV_MEAS_CNO)
+#define ULP_GNSS_SV_MEAS_BIT_LOSS_OF_LOCK (1<<ULP_GNSS_SV_MEAS_LOSS_OF_LOCK)
+
+enum ulp_gnss_sv_poly_valid_flags{
+
+ ULP_GNSS_SV_POLY_GLO_FREQ = 0,
+ ULP_GNSS_SV_POLY_T0,
+ ULP_GNSS_SV_POLY_IODE,
+ ULP_GNSS_SV_POLY_FLAG,
+ ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0,
+ ULP_GNSS_SV_POLY_POLYCOEFF_XYZN,
+ ULP_GNSS_SV_POLY_POLYCOEFF_OTHER,
+ ULP_GNSS_SV_POLY_SV_POSUNC,
+ ULP_GNSS_SV_POLY_IONODELAY,
+ ULP_GNSS_SV_POLY_IONODOT,
+ ULP_GNSS_SV_POLY_SBAS_IONODELAY,
+ ULP_GNSS_SV_POLY_SBAS_IONODOT,
+ ULP_GNSS_SV_POLY_TROPODELAY,
+ ULP_GNSS_SV_POLY_ELEVATION,
+ ULP_GNSS_SV_POLY_ELEVATIONDOT,
+ ULP_GNSS_SV_POLY_ELEVATIONUNC,
+ ULP_GNSS_SV_POLY_VELO_COEFF,
+ ULP_GNSS_SV_POLY_ENHANCED_IOD,
+ ULP_GNSS_SV_POLY_GPS_ISC_L1CA,
+ ULP_GNSS_SV_POLY_GPS_ISC_L2C,
+ ULP_GNSS_SV_POLY_GPS_ISC_L5I5,
+ ULP_GNSS_SV_POLY_GPS_ISC_L5Q5,
+ ULP_GNSS_SV_POLY_GPS_TGD,
+ ULP_GNSS_SV_POLY_GLO_TGD_G1G2,
+ ULP_GNSS_SV_POLY_BDS_TGD_B1,
+ ULP_GNSS_SV_POLY_BDS_TGD_B2,
+ ULP_GNSS_SV_POLY_BDS_TGD_B2A,
+ ULP_GNSS_SV_POLY_BDS_ISC_B2A,
+ ULP_GNSS_SV_POLY_GAL_BGD_E1E5A,
+ ULP_GNSS_SV_POLY_GAL_BGD_E1E5B,
+ ULP_GNSS_SV_POLY_NAVIC_TGD_L5
+};
+
+#define ULP_GNSS_SV_POLY_BIT_GLO_FREQ (1<<ULP_GNSS_SV_POLY_GLO_FREQ)
+#define ULP_GNSS_SV_POLY_BIT_T0 (1<<ULP_GNSS_SV_POLY_T0)
+#define ULP_GNSS_SV_POLY_BIT_IODE (1<<ULP_GNSS_SV_POLY_IODE)
+#define ULP_GNSS_SV_POLY_BIT_FLAG (1<<ULP_GNSS_SV_POLY_FLAG)
+#define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZ0 (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0)
+#define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZN (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZN)
+#define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_OTHER (1<<ULP_GNSS_SV_POLY_POLYCOEFF_OTHER)
+#define ULP_GNSS_SV_POLY_BIT_SV_POSUNC (1<<ULP_GNSS_SV_POLY_SV_POSUNC)
+#define ULP_GNSS_SV_POLY_BIT_IONODELAY (1<<ULP_GNSS_SV_POLY_IONODELAY)
+#define ULP_GNSS_SV_POLY_BIT_IONODOT (1<<ULP_GNSS_SV_POLY_IONODOT)
+#define ULP_GNSS_SV_POLY_BIT_SBAS_IONODELAY (1<<ULP_GNSS_SV_POLY_SBAS_IONODELAY)
+#define ULP_GNSS_SV_POLY_BIT_SBAS_IONODOT (1<<ULP_GNSS_SV_POLY_SBAS_IONODOT)
+#define ULP_GNSS_SV_POLY_BIT_TROPODELAY (1<<ULP_GNSS_SV_POLY_TROPODELAY)
+#define ULP_GNSS_SV_POLY_BIT_ELEVATION (1<<ULP_GNSS_SV_POLY_ELEVATION)
+#define ULP_GNSS_SV_POLY_BIT_ELEVATIONDOT (1<<ULP_GNSS_SV_POLY_ELEVATIONDOT)
+#define ULP_GNSS_SV_POLY_BIT_ELEVATIONUNC (1<<ULP_GNSS_SV_POLY_ELEVATIONUNC)
+#define ULP_GNSS_SV_POLY_BIT_VELO_COEFF (1<<ULP_GNSS_SV_POLY_VELO_COEFF)
+#define ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD (1<<ULP_GNSS_SV_POLY_ENHANCED_IOD)
+#define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L1CA (1<<ULP_GNSS_SV_POLY_GPS_ISC_L1CA)
+#define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L2C (1<<ULP_GNSS_SV_POLY_GPS_ISC_L2C)
+#define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5I5 (1<<ULP_GNSS_SV_POLY_GPS_ISC_L5I5)
+#define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5Q5 (1<<ULP_GNSS_SV_POLY_GPS_ISC_L5Q5)
+#define ULP_GNSS_SV_POLY_BIT_GPS_TGD (1<<ULP_GNSS_SV_POLY_GPS_TGD)
+#define ULP_GNSS_SV_POLY_BIT_GLO_TGD_G1G2 (1<<ULP_GNSS_SV_POLY_GLO_TGD_G1G2)
+#define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B1 (1<<ULP_GNSS_SV_POLY_BDS_TGD_B1)
+#define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2 (1<<ULP_GNSS_SV_POLY_BDS_TGD_B2)
+#define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2A (1<<ULP_GNSS_SV_POLY_BDS_TGD_B2A)
+#define ULP_GNSS_SV_POLY_BIT_BDS_ISC_B2A (1<<ULP_GNSS_SV_POLY_BDS_ISC_B2A)
+#define ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5A (1<<ULP_GNSS_SV_POLY_GAL_BGD_E1E5A)
+#define ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5B (1<<ULP_GNSS_SV_POLY_GAL_BGD_E1E5B)
+#define ULP_GNSS_SV_POLY_BIT_NAVIC_TGD_L5 (1<<ULP_GNSS_SV_POLY_NAVIC_TGD_L5)
+
+typedef enum
+{
+ GNSS_LOC_FREQ_SOURCE_INVALID = 0,
+ /**< Source of the frequency is invalid */
+ GNSS_LOC_FREQ_SOURCE_EXTERNAL = 1,
+ /**< Source of the frequency is from external injection */
+ GNSS_LOC_FREQ_SOURCE_PE_CLK_REPORT = 2,
+ /**< Source of the frequency is from Navigation engine */
+ GNSS_LOC_FREQ_SOURCE_UNKNOWN = 3
+ /**< Source of the frequency is unknown */
+} Gnss_LocSourceofFreqEnumType;
+
+typedef struct
+{
+ uint32_t size;
+ float clockDrift;
+ /**< Receiver clock Drift \n
+ - Units: meter per sec \n
+ */
+ float clockDriftUnc;
+ /**< Receiver clock Drift uncertainty \n
+ - Units: meter per sec \n
+ */
+ Gnss_LocSourceofFreqEnumType sourceOfFreq;
+}Gnss_LocRcvrClockFrequencyInfoStructType;
+
+typedef struct
+{
+ uint32_t size;
+ uint8_t leapSec;
+ /**< GPS time leap second delta to UTC time \n
+ - Units: sec \n
+ */
+ uint8_t leapSecUnc;
+ /**< Uncertainty for GPS leap second \n
+ - Units: sec \n
+ */
+}Gnss_LeapSecondInfoStructType;
+
+typedef enum
+{
+ GNSS_LOC_SYS_TIME_BIAS_VALID = 0x01,
+ /**< System time bias valid */
+ GNSS_LOC_SYS_TIME_BIAS_UNC_VALID = 0x02,
+ /**< System time bias uncertainty valid */
+}Gnss_LocInterSystemBiasValidMaskType;
+
+typedef struct
+{
+ uint32_t size;
+ uint32_t validMask;
+ /* Validity mask as per Gnss_LocInterSystemBiasValidMaskType */
+
+ float timeBias;
+ /**< System-1 to System-2 Time Bias \n
+ - Units: msec \n
+ */
+ float timeBiasUnc;
+ /**< System-1 to System-2 Time Bias uncertainty \n
+ - Units: msec \n
+ */
+} Gnss_InterSystemBiasStructType;
+
+
+typedef struct {
+
+ uint32_t size;
+
+ uint8_t systemRtc_valid;
+ /**< Validity indicator for System RTC */
+
+ uint64_t systemRtcMs;
+ /**< Platform system RTC value \n
+ - Units: msec \n
+ */
+
+}Gnss_LocGnssTimeExtStructType;
+
+typedef enum
+{
+ GNSS_LOC_MEAS_STATUS_NULL = 0x00000000,
+ /**< No information state */
+ GNSS_LOC_MEAS_STATUS_SM_VALID = 0x00000001,
+ /**< Code phase is known */
+ GNSS_LOC_MEAS_STATUS_SB_VALID = 0x00000002,
+ /**< Sub-bit time is known */
+ GNSS_LOC_MEAS_STATUS_MS_VALID = 0x00000004,
+ /**< Satellite time is known */
+ GNSS_LOC_MEAS_STATUS_BE_CONFIRM = 0x00000008,
+ /**< Bit edge is confirmed from signal */
+ GNSS_LOC_MEAS_STATUS_VELOCITY_VALID = 0x00000010,
+ /**< Satellite Doppler measured */
+ GNSS_LOC_MEAS_STATUS_VELOCITY_FINE = 0x00000020,
+ /**< TRUE: Fine Doppler measured, FALSE: Coarse Doppler measured */
+ GNSS_LOC_MEAS_STATUS_LP_VALID = 0x00000040,
+ /**< TRUE/FALSE -- Lock Point is valid/invalid */
+ GNSS_LOC_MEAS_STATUS_LP_POS_VALID = 0x00000080,
+ /**< TRUE/FALSE -- Lock Point is positive/negative */
+ GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF = 0x00000200,
+ /**< Range update from Satellite differences */
+ GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF = 0x00000400,
+ /**< Doppler update from Satellite differences */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_X = 0x00000800,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_M = 0x00001000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x00002000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x00004000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x00008000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_GNSS_FRESH_MEAS = 0x08000000
+ /**< TRUE -- Fresh GNSS measurement observed in last second */
+}Gnss_LocSvMeasStatusMaskType;
+
+typedef struct
+{
+ uint32_t size;
+ uint32_t svMs;
+ /**< Satellite time milisecond.\n
+ For GPS, BDS, GAL range of 0 thru (604800000-1) \n
+ For GLONASS range of 0 thru (86400000-1) \n
+ Valid when PD_LOC_MEAS_STATUS_MS_VALID bit is set in measurement status \n
+ Note: All SV times in the current measurement block are alredy propagated to common reference time epoch. \n
+ - Units: msec \n
+ */
+ float svSubMs;
+ /**<Satellite time sub-millisecond. \n
+ Total SV Time = svMs + svSubMs \n
+ - Units: msec \n
+ */
+ float svTimeUncMs;
+ /**< Satellite Time uncertainty \n
+ - Units: msec \n
+ */
+ float dopplerShift;
+ /**< Satellite Doppler \n
+ - Units: meter per sec \n
+ */
+ float dopplerShiftUnc;
+ /**< Satellite Doppler uncertainty\n
+ - Units: meter per sec \n
+ */
+}Gnss_LocSVTimeSpeedStructType;
+
+typedef enum
+{
+ GNSS_SV_STATE_IDLE = 0,
+ GNSS_SV_STATE_SEARCH = 1,
+ GNSS_SV_STATE_SEARCH_VERIFY = 2,
+ GNSS_SV_STATE_BIT_EDGE = 3,
+ GNSS_SV_STATE_VERIFY_TRACK = 4,
+ GNSS_SV_STATE_TRACK = 5,
+ GNSS_SV_STATE_RESTART = 6,
+ GNSS_SV_STATE_DPO_TRACK = 7
+} Gnss_LocSVStateEnumType;
+
+typedef enum
+{
+ GNSS_LOC_SVINFO_MASK_HAS_EPHEMERIS = 0x01,
+ /**< Ephemeris is available for this SV */
+ GNSS_LOC_SVINFO_MASK_HAS_ALMANAC = 0x02
+ /**< Almanac is available for this SV */
+}Gnss_LocSvInfoMaskT;
+
+typedef enum
+{
+ GNSS_LOC_SV_SRCH_STATUS_IDLE = 1,
+ /**< SV is not being actively processed */
+ GNSS_LOC_SV_SRCH_STATUS_SEARCH = 2,
+ /**< The system is searching for this SV */
+ GNSS_LOC_SV_SRCH_STATUS_TRACK = 3
+ /**< SV is being tracked */
+}Gnss_LocSvSearchStatusEnumT;
+
+typedef uint32_t LocSvDgnssMeasStatusMask;
+#define LOC_MASK_DGNSS_EPOCH_TIME_VALID 0x1 /**< DGNSS Epoch time is valid */
+#define LOC_MASK_DGNSS_MEAS_STATUS_PR_VALID 0x2 /**< Pseudo Range correction is valid */
+#define LOC_MASK_DGNSS_MEAS_STATUS_PRR_VALID 0x4 /**< Pseudo Range rate correction is valid */
+
+typedef struct {
+ LocSvDgnssMeasStatusMask dgnssMeasStatus;
+ /**< Bitmask indicating the DGNSS SV measurement status. */
+
+ uint32_t diffDataEpochTimeMsec;
+ /**< Age of differential data in Milli Seconds with respect to the Measurement time. */
+
+ float prCorrMeters;
+ /**< Pseudo Range correction in meters. */
+
+ float prrCorrMetersPerSec;
+ /**< Pseudo Range rate correction in meters per second. */
+} Gnss_LocDgnssSVMeasurement;
+
+typedef struct
+{
+ uint32_t size;
+ Gnss_LocSvSystemEnumType gnssSystem;
+ // 0 signal type mask indicates invalid value
+ GnssSignalTypeMask gnssSignalTypeMask;
+ uint16_t gnssSvId;
+ /** Unique SV Identifier.
+ * For SV Range of supported constellation, please refer to the
+ * comment section of gnssSvId in GpsMeasUsageInfo.
+ */
+ uint8_t gloFrequency;
+ /**< GLONASS frequency number + 7 \n
+ Valid only for GLONASS System \n
+ Shall be ignored for all other systems \n
+ - Range: 1 to 14 \n
+ */
+ Gnss_LocSvSearchStatusEnumT svStatus;
+ /**< Satellite search state \n
+ @ENUM()
+ */
+ bool healthStatus_valid;
+ /**< SV Health Status validity flag\n
+ - 0: Not valid \n
+ - 1: Valid \n
+ */
+ uint8_t healthStatus;
+ /**< Health status.
+ \begin{itemize1}
+ \item Range: 0 to 1; 0 = unhealthy, \n 1 = healthy, 2 = unknown
+ \vspace{-0.18in} \end{itemize1}
+ */
+ Gnss_LocSvInfoMaskT svInfoMask;
+ /**< Indicates whether almanac and ephemeris information is available. \n
+ @MASK()
+ */
+ uint64_t measurementStatus;
+ /**< Bitmask indicating SV measurement status.
+ Valid bitmasks: \n
+ If any MSB bit in 0xFFC0000000000000 DONT_USE is set, the measurement
+ must not be used by the client.
+ @MASK()
+ */
+ uint16_t CNo;
+ /**< Carrier to Noise ratio \n
+ - Units: 0.1 dBHz \n
+ */
+ uint16_t gloRfLoss;
+ /**< GLONASS Rf loss reference to Antenna. \n
+ - Units: dB, Scale: 0.1 \n
+ */
+ bool lossOfLock;
+ /**< Loss of signal lock indicator \n
+ - 0: Signal in continuous track \n
+ - 1: Signal not in track \n
+ */
+ int16_t measLatency;
+ /**< Age of the measurement. Positive value means measurement precedes ref time. \n
+ - Units: msec \n
+ */
+ Gnss_LocSVTimeSpeedStructType svTimeSpeed;
+ /**< Unfiltered SV Time and Speed information
+ */
+ float dopplerAccel;
+ /**< Satellite Doppler Accelertion\n
+ - Units: Hz/s \n
+ */
+ bool multipathEstValid;
+ /**< Multipath estimate validity flag\n
+ - 0: Multipath estimate not valid \n
+ - 1: Multipath estimate valid \n
+ */
+ float multipathEstimate;
+ /**< Estimate of multipath in measurement\n
+ - Units: Meters \n
+ */
+ bool fineSpeedValid;
+ /**< Fine speed validity flag\n
+ - 0: Fine speed not valid \n
+ - 1: Fine speed valid \n
+ */
+ float fineSpeed;
+ /**< Carrier phase derived speed \n
+ - Units: m/s \n
+ */
+ bool fineSpeedUncValid;
+ /**< Fine speed uncertainty validity flag\n
+ - 0: Fine speed uncertainty not valid \n
+ - 1: Fine speed uncertainty valid \n
+ */
+ float fineSpeedUnc;
+ /**< Carrier phase derived speed \n
+ - Units: m/s \n
+ */
+ bool carrierPhaseValid;
+ /**< Carrier Phase measurement validity flag\n
+ - 0: Carrier Phase not valid \n
+ - 1: Carrier Phase valid \n
+ */
+ double carrierPhase;
+ /**< Carrier phase measurement [L1 cycles] \n
+ */
+ bool cycleSlipCountValid;
+ /**< Cycle slup count validity flag\n
+ - 0: Not valid \n
+ - 1: Valid \n
+ */
+ uint8_t cycleSlipCount;
+ /**< Increments when a CSlip is detected */
+
+ bool svDirectionValid;
+ /**< Validity flag for SV direction */
+
+ float svAzimuth;
+ /**< Satellite Azimuth
+ - Units: radians \n
+ */
+ float svElevation;
+ /**< Satellite Elevation
+ - Units: radians \n
+ */
+ uint64_t validMeasStatusMask;
+ /**< Bitmask indicating SV measurement status Validity.
+ Valid bitmasks: \n
+ If any MSB bit in 0xFFC0000000000000 DONT_USE is set, the measurement
+ must not be used by the client.
+ @MASK()
+ */
+ bool carrierPhaseUncValid;
+ /**< Validity flag for SV direction */
+
+ float carrierPhaseUnc;
+
+ /** < DGNSS Measurements Report for SVs */
+ Gnss_LocDgnssSVMeasurement dgnssSvMeas;
+} Gnss_SVMeasurementStructType;
+
+
+typedef uint64_t GpsSvMeasHeaderFlags;
+#define GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND 0x00000001
+#define GNSS_SV_MEAS_HEADER_HAS_CLOCK_FREQ 0x00000002
+#define GNSS_SV_MEAS_HEADER_HAS_AP_TIMESTAMP 0x00000004
+#define GNSS_SV_MEAS_HEADER_HAS_GPS_GLO_INTER_SYSTEM_BIAS 0x00000008
+#define GNSS_SV_MEAS_HEADER_HAS_GPS_BDS_INTER_SYSTEM_BIAS 0x00000010
+#define GNSS_SV_MEAS_HEADER_HAS_GPS_GAL_INTER_SYSTEM_BIAS 0x00000020
+#define GNSS_SV_MEAS_HEADER_HAS_BDS_GLO_INTER_SYSTEM_BIAS 0x00000040
+#define GNSS_SV_MEAS_HEADER_HAS_GAL_GLO_INTER_SYSTEM_BIAS 0x00000080
+#define GNSS_SV_MEAS_HEADER_HAS_GAL_BDS_INTER_SYSTEM_BIAS 0x00000100
+#define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME 0x00000200
+#define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME 0x00000400
+#define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME 0x00000800
+#define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME 0x00001000
+#define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME 0x00002000
+#define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME_EXT 0x00004000
+#define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME_EXT 0x00008000
+#define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME_EXT 0x00010000
+#define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME_EXT 0x00020000
+#define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME_EXT 0x00040000
+#define GNSS_SV_MEAS_HEADER_HAS_GPSL1L5_TIME_BIAS 0x00080000
+#define GNSS_SV_MEAS_HEADER_HAS_GALE1E5A_TIME_BIAS 0x00100000
+#define GNSS_SV_MEAS_HEADER_HAS_GPS_NAVIC_INTER_SYSTEM_BIAS 0x00200000
+#define GNSS_SV_MEAS_HEADER_HAS_GAL_NAVIC_INTER_SYSTEM_BIAS 0x00400000
+#define GNSS_SV_MEAS_HEADER_HAS_GLO_NAVIC_INTER_SYSTEM_BIAS 0x00800000
+#define GNSS_SV_MEAS_HEADER_HAS_BDS_NAVIC_INTER_SYSTEM_BIAS 0x01000000
+#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME 0x02000000
+#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME_EXT 0x04000000
+#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x08000000
+#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_ID 0x010000000
+#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_REF_STATION_ID 0x020000000
+#define GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS 0x040000000
+
+typedef struct
+{
+ uint32_t size;
+ // see defines in GNSS_SV_MEAS_HEADER_HAS_XXX_XXX
+ uint64_t flags;
+
+ Gnss_LeapSecondInfoStructType leapSec;
+
+ Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */
+
+ Gnss_ApTimeStampStructType apBootTimeStamp;
+
+ Gnss_InterSystemBiasStructType gpsGloInterSystemBias;
+ Gnss_InterSystemBiasStructType gpsBdsInterSystemBias;
+ Gnss_InterSystemBiasStructType gpsGalInterSystemBias;
+ Gnss_InterSystemBiasStructType bdsGloInterSystemBias;
+ Gnss_InterSystemBiasStructType galGloInterSystemBias;
+ Gnss_InterSystemBiasStructType galBdsInterSystemBias;
+ Gnss_InterSystemBiasStructType gpsNavicInterSystemBias;
+ Gnss_InterSystemBiasStructType galNavicInterSystemBias;
+ Gnss_InterSystemBiasStructType gloNavicInterSystemBias;
+ Gnss_InterSystemBiasStructType bdsNavicInterSystemBias;
+ Gnss_InterSystemBiasStructType gpsL1L5TimeBias;
+ Gnss_InterSystemBiasStructType galE1E5aTimeBias;
+
+ GnssSystemTimeStructType gpsSystemTime;
+ GnssSystemTimeStructType galSystemTime;
+ GnssSystemTimeStructType bdsSystemTime;
+ GnssSystemTimeStructType qzssSystemTime;
+ GnssSystemTimeStructType navicSystemTime;
+ GnssGloTimeStructType gloSystemTime;
+
+ /** GPS system RTC time information. */
+ Gnss_LocGnssTimeExtStructType gpsSystemTimeExt;
+ /** GAL system RTC time information. */
+ Gnss_LocGnssTimeExtStructType galSystemTimeExt;
+ /** BDS system RTC time information. */
+ Gnss_LocGnssTimeExtStructType bdsSystemTimeExt;
+ /** QZSS system RTC time information. */
+ Gnss_LocGnssTimeExtStructType qzssSystemTimeExt;
+ /** GLONASS system RTC time information. */
+ Gnss_LocGnssTimeExtStructType gloSystemTimeExt;
+ /** NAVIC system RTC time information. */
+ Gnss_LocGnssTimeExtStructType navicSystemTimeExt;
+
+ /** Receiver tick at frame count */
+ uint64_t refCountTicks;
+
+ /** DGNSS corrections source type RTCM, 3GPP etc, if DGNSS was
+ * used for these measurements. */
+ LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
+
+ /** DGNSS SourceID: 32bit number identifying the DGNSS source
+ * ID, if DGNSS was used for these measurements. */
+ uint32_t dgnssCorrectionSourceID;
+
+ /** DGNSS Ref station ID: 32bit number identifying the DGNSS
+ * ref station ID, if DGNSS was used for these measurements. */
+ uint16_t dgnssRefStationId;
+} GnssSvMeasurementHeader;
+
+typedef struct {
+ uint32_t size;
+ bool isNhz;
+ GnssSvMeasurementHeader svMeasSetHeader;
+ uint32_t svMeasCount;
+ Gnss_SVMeasurementStructType svMeas[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE];
+
+} GnssSvMeasurementSet;
+
+typedef struct {
+ uint32_t size; // set to sizeof(GnssMeasurements)
+ GnssSvMeasurementSet gnssSvMeasurementSet;
+ GnssMeasurementsNotification gnssMeasNotification;
+} GnssMeasurements;
+
+typedef enum
+{
+ GNSS_SV_POLY_COEFF_VALID = 0x01,
+ /**< SV position in orbit coefficients are valid */
+ GNSS_SV_POLY_IONO_VALID = 0x02,
+ /**< Iono estimates are valid */
+
+ GNSS_SV_POLY_TROPO_VALID = 0x04,
+ /**< Tropo estimates are valid */
+
+ GNSS_SV_POLY_ELEV_VALID = 0x08,
+ /**< Elevation, rate, uncertainty are valid */
+
+ GNSS_SV_POLY_SRC_ALM_CORR = 0x10,
+ /**< Polynomials based on XTRA */
+
+ GNSS_SV_POLY_SBAS_IONO_VALID = 0x20,
+ /**< SBAS IONO and rate are valid */
+
+ GNSS_SV_POLY_GLO_STR4 = 0x40
+ /**< GLONASS String 4 has been received */
+} Gnss_SvPolyStatusMaskType;
+
+
+typedef struct {
+ uint32_t size;
+ uint16_t gnssSvId;
+ /** Unique SV Identifier.
+ * For SV Range of supported constellation, please refer to the
+ * comment section of gnssSvId in GpsMeasUsageInfo.
+ */
+ int8_t freqNum;
+ /** Freq index, only valid if u_SysInd is GLO */
+
+ GnssSvPolyStatusMaskValidity svPolyStatusMaskValidity;
+ GnssSvPolyStatusMask svPolyStatusMask;
+
+ uint32_t is_valid;
+
+ uint16_t iode;
+ /* Ephemeris reference time
+ GPS:Issue of Data Ephemeris used [unitless].
+ GLO: Tb 7-bit, refer to ICD02
+ */
+ double T0;
+ /* Reference time for polynominal calculations
+ GPS: Secs in week.
+ GLO: Full secs since Jan/01/96
+ */
+ double polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE];
+ /* C0X, C0Y, C0Z */
+ double polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE];
+ /* C1X, C2X ... C2Z, C3Z */
+ float polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE];
+ /* C0T, C1T, C2T, C3T */
+ float svPosUnc; /* SV position uncertainty [m]. */
+ float ionoDelay; /* Ionospheric delay at d_T0 [m]. */
+ float ionoDot; /* Iono delay rate [m/s]. */
+ float sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */
+ float sbasIonoDot; /* SBAS Iono delay rate [m/s]. */
+ float tropoDelay; /* Tropospheric delay [m]. */
+ float elevation; /* Elevation [rad] at d_T0 */
+ float elevationDot; /* Elevation rate [rad/s] */
+ float elevationUnc; /* SV elevation [rad] uncertainty */
+ double velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE];
+ /* Coefficients of velocity poly */
+ uint32_t enhancedIOD; /* Enhanced Reference Time */
+ float gpsIscL1ca;
+ float gpsIscL2c;
+ float gpsIscL5I5;
+ float gpsIscL5Q5;
+ float gpsTgd;
+ float gloTgdG1G2;
+ float bdsTgdB1;
+ float bdsTgdB2;
+ float bdsTgdB2a;
+ float bdsIscB2a;
+ float galBgdE1E5a;
+ float galBgdE1E5b;
+ float navicTgdL5;
+} GnssSvPolynomial;
+
+typedef enum {
+ GNSS_EPH_ACTION_UPDATE_SRC_UNKNOWN_V02 = 0, /**<Update ephemeris. Source of ephemeris is unknown */
+ GNSS_EPH_ACTION_UPDATE_SRC_OTA_V02 = 1, /**<Update ephemeris. Source of ephemeris is OTA */
+ GNSS_EPH_ACTION_UPDATE_SRC_NETWORK_V02 = 2, /**<Update ephemeris. Source of ephemeris is Network */
+ GNSS_EPH_ACTION_UPDATE_MAX_V02 = 999, /**<Max value for update ephemeris action. DO NOT USE */
+ GNSS_EPH_ACTION_DELETE_SRC_UNKNOWN_V02 = 1000, /**<Delete previous ephemeris from unknown source */
+ GNSS_EPH_ACTION_DELETE_SRC_NETWORK_V02 = 1001, /**<Delete previous ephemeris from network */
+ GNSS_EPH_ACTION_DELETE_SRC_OTA_V02 = 1002, /**<Delete previous ephemeris from OTA */
+ GNSS_EPH_ACTION_DELETE_MAX_V02 = 1999, /**<Max value for delete ephemeris action. DO NOT USE */
+} GnssEphAction;
+
+typedef enum {
+ GAL_EPH_SIGNAL_SRC_UNKNOWN_V02 = 0, /**< GALILEO signal is unknown */
+ GAL_EPH_SIGNAL_SRC_E1B_V02 = 1, /**< GALILEO signal is E1B */
+ GAL_EPH_SIGNAL_SRC_E5A_V02 = 2, /**< GALILEO signal is E5A */
+ GAL_EPH_SIGNAL_SRC_E5B_V02 = 3, /**< GALILEO signal is E5B */
+} GalEphSignalSource;
+
+typedef struct {
+ uint16_t gnssSvId;
+ /** Unique SV Identifier.
+ * For SV Range of supported constellation, please refer to the
+ * comment section of gnssSvId in GpsMeasUsageInfo.
+ */
+
+ GnssEphAction updateAction;
+ /**< Specifies the action and source of ephemeris. \n
+ - Type: int32 enum */
+
+ uint16_t IODE;
+ /**< Issue of data ephemeris used (unit-less). \n
+ GPS: IODE 8 bits.\n
+ BDS: AODE 5 bits. \n
+ GAL: SIS IOD 10 bits. \n
+ - Type: uint16
+ - Units: Unit-less */
+
+ double aSqrt;
+ /**< Square root of semi-major axis. \n
+ - Type: double
+ - Units: Square Root of Meters */
+
+ double deltaN;
+ /**< Mean motion difference from computed value. \n
+ - Type: double
+ - Units: Radians/Second */
+
+ double m0;
+ /**< Mean anomaly at reference time. \n
+ - Type: double
+ - Units: Radians */
+
+ double eccentricity;
+ /**< Eccentricity . \n
+ - Type: double
+ - Units: Unit-less */
+
+ double omega0;
+ /**< Longitude of ascending node of orbital plane at the weekly epoch. \n
+ - Type: double
+ - Units: Radians */
+
+ double i0;
+ /**< Inclination angle at reference time. \n
+ - Type: double
+ - Units: Radians */
+
+ double omega;
+ /**< Argument of Perigee. \n
+ - Type: double
+ - Units: Radians */
+
+ double omegaDot;
+ /**< Rate of change of right ascension. \n
+ - Type: double
+ - Units: Radians/Second */
+
+ double iDot;
+ /**< Rate of change of inclination angle. \n
+ - Type: double
+ - Units: Radians/Second */
+
+ double cUc;
+ /**< Amplitude of the cosine harmonic correction term to the argument of latitude. \n
+ - Type: double
+ - Units: Radians */
+
+ double cUs;
+ /**< Amplitude of the sine harmonic correction term to the argument of latitude. \n
+ - Type: double
+ - Units: Radians */
+
+ double cRc;
+ /**< Amplitude of the cosine harmonic correction term to the orbit radius. \n
+ - Type: double
+ - Units: Meters */
+
+ double cRs;
+ /**< Amplitude of the sine harmonic correction term to the orbit radius. \n
+ - Type: double
+ - Units: Meters */
+
+ double cIc;
+ /**< Amplitude of the cosine harmonic correction term to the angle of inclination. \n
+ - Type: double
+ - Units: Radians */
+
+ double cIs;
+ /**< Amplitude of the sine harmonic correction term to the angle of inclination. \n
+ - Type: double
+ - Units: Radians */
+
+ uint32_t toe;
+ /**< Reference time of ephemeris. \n
+ - Type: uint32
+ - Units: Seconds */
+
+ uint32_t toc;
+ /**< Clock data reference time of week. \n
+ - Type: uint32
+ - Units: Seconds */
+
+ double af0;
+ /**< Clock bias correction coefficient. \n
+ - Type: double
+ - Units: Seconds */
+
+ double af1;
+ /**< Clock drift coefficient. \n
+ - Type: double
+ - Units: Seconds/Second */
+
+ double af2;
+ /**< Clock drift rate correction coefficient. \n
+ - Type: double
+ - Units: Seconds/Seconds^2 */
+
+} GnssEphCommon;
+
+/* GPS Navigation Model Info */
+typedef struct {
+ GnssEphCommon commonEphemerisData;
+ /**< Common ephemeris data. */
+
+ uint8_t signalHealth;
+ /**< Signal health. \n
+ Bit 0 : L5 Signal Health. \n
+ Bit 1 : L2 Signal Health. \n
+ Bit 2 : L1 Signal Health. \n
+ - Type: uint8
+ - Values: 3 bit mask of signal health, where set bit indicates unhealthy signal */
+
+ uint8_t URAI;
+ /**< User Range Accuracy Index. \n
+ - Type: uint8
+ - Units: Unit-less */
+
+ uint8_t codeL2;
+ /**< Indicates which codes are commanded ON for the L2 channel (2-bits). \n
+ - Type: uint8
+ Valid Values: \n
+ - 00 : Reserved
+ - 01 : P code ON
+ - 10 : C/A code ON */
+
+ uint8_t dataFlagL2P;
+ /**< L2 P-code indication flag. \n
+ - Type: uint8
+ - Value 1 indicates that the Nav data stream was commanded OFF on the P-code of the L2 channel. */
+
+ double tgd;
+ /**< Time of group delay. \n
+ - Type: double
+ - Units: Seconds */
+
+ uint8_t fitInterval;
+ /**< Indicates the curve-fit interval used by the CS. \n
+ - Type: uint8
+ Valid Values:
+ - 0 : Four hours
+ - 1 : Greater than four hours */
+
+ uint16_t IODC;
+ /**< Issue of Data, Clock. \n
+ - Type: uint16
+ - Units: Unit-less */
+} GpsEphemeris;
+
+/* GLONASS Navigation Model Info */
+typedef struct {
+
+ uint16_t gnssSvId;
+ /**< GNSS SV ID.
+ - Type: uint16
+ - Range: 65 to 96 if known. When the slot number to SV ID mapping is unknown, set to 255 */
+
+ GnssEphAction updateAction;
+ /**< Specifies the action and source of ephemeris. \n
+ - Type: int32 enum */
+
+ uint8_t bnHealth;
+ /**< SV health flags. \n
+ - Type: uint8
+ Valid Values: \n
+ - 0 : Healthy
+ - 1 : Unhealthy */
+
+ uint8_t lnHealth;
+ /**< Ln SV health flags. GLONASS-M. \n
+ - Type: uint8
+ Valid Values: \n
+ - 0 : Healthy
+ - 1 : Unhealthy */
+
+ uint8_t tb;
+ /**< Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. \n
+ - Type: uint8
+ - Units: Unit-less */
+
+ uint8_t ft;
+ /**< SV accuracy index. \n
+ - Type: uint8
+ - Units: Unit-less */
+
+ uint8_t gloM;
+ /**< GLONASS-M flag. \n
+ - Type: uint8
+ Valid Values: \n
+ - 0 : GLONASS
+ - 1 : GLONASS-M */
+
+ uint8_t enAge;
+ /**< Characterizes "Age" of current information. \n
+ - Type: uint8
+ - Units: Days */
+
+ uint8_t gloFrequency;
+ /**< GLONASS frequency number + 8. \n
+ - Type: uint8
+ - Range: 1 to 14
+ */
+
+ uint8_t p1;
+ /**< Time interval between two adjacent values of tb parameter. \n
+ - Type: uint8
+ - Units: Minutes */
+
+ uint8_t p2;
+ /**< Flag of oddness ("1") or evenness ("0") of the value of tb \n
+ for intervals 30 or 60 minutes. \n
+ - Type: uint8 */
+
+ float deltaTau;
+ /**< Time difference between navigation RF signal transmitted in L2 sub-band \n
+ and aviation RF signal transmitted in L1 sub-band. \n
+ - Type: floating point
+ - Units: Seconds */
+
+ double position[3];
+ /**< Satellite XYZ position. \n
+ - Type: array of doubles
+ - Units: Meters */
+
+ double velocity[3];
+ /**< Satellite XYZ velocity. \n
+ - Type: array of doubles
+ - Units: Meters/Second */
+
+ double acceleration[3];
+ /**< Satellite XYZ sola-luni acceleration. \n
+ - Type: array of doubles
+ - Units: Meters/Second^2 */
+
+ float tauN;
+ /**< Satellite clock correction relative to GLONASS time. \n
+ - Type: floating point
+ - Units: Seconds */
+
+ float gamma;
+ /**< Relative deviation of predicted carrier frequency value \n
+ from nominal value at the instant tb. \n
+ - Type: floating point
+ - Units: Unit-less */
+
+ double toe;
+ /**< Complete ephemeris time, including N4, NT and Tb. \n
+ [(N4-1)*1461 + (NT-1)]*86400 + tb*900 \n
+ - Type: double
+ - Units: Seconds */
+
+ uint16_t nt;
+ /**< Current date, calendar number of day within four-year interval. \n
+ Starting from the 1-st of January in a leap year. \n
+ - Type: uint16
+ - Units: Days */
+} GlonassEphemeris;
+
+/* BDS Navigation Model Info */
+typedef struct {
+
+ GnssEphCommon commonEphemerisData;
+ /**< Common ephemeris data. */
+
+ uint8_t svHealth;
+ /**< Satellite health information applied to both B1 and B2 (SatH1). \n
+ - Type: uint8
+ Valid Values: \n
+ - 0 : Healthy
+ - 1 : Unhealthy */
+
+ uint8_t AODC;
+ /**< Age of data clock. \n
+ - Type: uint8
+ - Units: Hours */
+
+ double tgd1;
+ /**< Equipment group delay differential on B1 signal. \n
+ - Type: double
+ - Units: Nano-Seconds */
+
+ double tgd2;
+ /**< Equipment group delay differential on B2 signal. \n
+ - Type: double
+ - Units: Nano-Seconds */
+
+ uint8_t URAI;
+ /**< User range accuracy index (4-bits). \n
+ - Type: uint8
+ - Units: Unit-less */
+} BdsEphemeris;
+
+/* GALIELO Navigation Model Info */
+typedef struct {
+
+ GnssEphCommon commonEphemerisData;
+ /**< Common ephemeris data. */
+
+ GalEphSignalSource dataSourceSignal;
+ /**< Galileo Signal Source. \n
+ Valid Values: \n
+ - GAL_EPH_SIGNAL_SRC_UNKNOWN (0) -- GALILEO signal is unknown
+ - GAL_EPH_SIGNAL_SRC_E1B (1) -- GALILEO signal is E1B
+ - GAL_EPH_SIGNAL_SRC_E5A (2) -- GALILEO signal is E5A
+ - GAL_EPH_SIGNAL_SRC_E5B (3) -- GALILEO signal is E5B */
+
+ uint8_t sisIndex;
+ /**< Signal-in-space index for dual frequency E1-E5b/E5a depending on dataSignalSource. \n
+ - Type: uint8
+ - Units: Unit-less */
+
+ double bgdE1E5a;
+ /**< E1-E5a Broadcast group delay from F/Nav (E5A). \n
+ - Type: double
+ - Units: Seconds */
+
+ double bgdE1E5b;
+ /**< E1-E5b Broadcast group delay from I/Nav (E1B or E5B). \n
+ For E1B or E5B signal, both bgdE1E5a and bgdE1E5b are valid. \n
+ For E5A signal, only bgdE1E5a is valid. \n
+ Signal source identified using dataSignalSource. \n
+ - Type: double
+ - Units: Seconds */
+
+ uint8_t svHealth;
+ /**< SV health status of signal identified by dataSourceSignal. \n
+ - Type: uint8
+ Valid Values: \n
+ - 0 : Healthy
+ - 1 : Unhealthy */
+} GalileoEphemeris;
+
+/** GPS Navigation model for each SV */
+typedef struct {
+ uint16_t numOfEphemeris;
+ GpsEphemeris gpsEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
+} GpsEphemerisResponse;
+
+/** GLONASS Navigation model for each SV */
+typedef struct {
+ uint16_t numOfEphemeris;
+ GlonassEphemeris gloEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
+} GlonassEphemerisResponse;
+
+/** BDS Navigation model for each SV */
+typedef struct {
+ uint16_t numOfEphemeris;
+ BdsEphemeris bdsEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
+} BdsEphemerisResponse;
+
+/** GALILEO Navigation model for each SV */
+typedef struct {
+ uint16_t numOfEphemeris;
+ GalileoEphemeris galEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
+} GalileoEphemerisResponse;
+
+/** QZSS Navigation model for each SV */
+typedef struct {
+ uint16_t numOfEphemeris;
+ GpsEphemeris qzssEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02];
+} QzssEphemerisResponse;
+
+
+typedef struct {
+ /** Indicates GNSS Constellation Type
+ Mandatory field */
+ Gnss_LocSvSystemEnumType gnssConstellation;
+
+ /** GPS System Time of the ephemeris report */
+ bool isSystemTimeValid;
+ GnssSystemTimeStructType systemTime;
+
+ union {
+ /** GPS Ephemeris */
+ GpsEphemerisResponse gpsEphemeris;
+ /** GLONASS Ephemeris */
+ GlonassEphemerisResponse glonassEphemeris;
+ /** BDS Ephemeris */
+ BdsEphemerisResponse bdsEphemeris;
+ /** GALILEO Ephemeris */
+ GalileoEphemerisResponse galileoEphemeris;
+ /** QZSS Ephemeris */
+ QzssEphemerisResponse qzssEphemeris;
+ } ephInfo;
+} GnssSvEphemerisReport;
+
+typedef struct {
+ /** GPS System Time of the iono model report */
+ bool isSystemTimeValid;
+ GnssSystemTimeStructType systemTime;
+
+ /** Indicates GNSS Constellation Type */
+ Gnss_LocSvSystemEnumType gnssConstellation;
+
+ float alpha0;
+ /**< Klobuchar Model Parameter Alpha 0.
+ - Type: float
+ - Unit: Seconds
+ */
+
+ float alpha1;
+ /**< Klobuchar Model Parameter Alpha 1.
+ - Type: float
+ - Unit: Seconds / Semi-Circle
+ */
+
+ float alpha2;
+ /**< Klobuchar Model Parameter Alpha 2.
+ - Type: float
+ - Unit: Seconds / Semi-Circle^2
+ */
+
+ float alpha3;
+ /**< Klobuchar Model Parameter Alpha 3.
+ - Type: float
+ - Unit: Seconds / Semi-Circle^3
+ */
+
+ float beta0;
+ /**< Klobuchar Model Parameter Beta 0.
+ - Type: float
+ - Unit: Seconds
+ */
+
+ float beta1;
+ /**< Klobuchar Model Parameter Beta 1.
+ - Type: float
+ - Unit: Seconds / Semi-Circle
+ */
+
+ float beta2;
+ /**< Klobuchar Model Parameter Beta 2.
+ - Type: float
+ - Unit: Seconds / Semi-Circle^2
+ */
+
+ float beta3;
+ /**< Klobuchar Model Parameter Beta 3.
+ - Type: float
+ - Unit: Seconds / Semi-Circle^3
+ */
+} GnssKlobucharIonoModel;
+
+typedef struct {
+ /** GPS System Time of the report */
+ bool isSystemTimeValid;
+ GnssSystemTimeStructType systemTime;
+
+ GnssAdditionalSystemInfoMask validityMask;
+ double tauC;
+ int8_t leapSec;
+} GnssAdditionalSystemInfo;
+
+/* Various Short Range Node Technology type*/
+typedef enum {
+ SRN_AP_DATA_TECH_TYPE_NONE,
+ SRN_AP_DATA_TECH_TYPE_BT,
+ SRN_AP_DATA_TECH_TYPE_BTLE,
+ SRN_AP_DATA_TECH_TYPE_NFC,
+ SRN_AP_DATA_TECH_TYPE_MOBILE_CODE,
+ SRN_AP_DATA_TECH_TYPE_OTHER
+} Gnss_SrnTech;
+
+/* Mac Address type requested by modem */
+typedef enum {
+ SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_INVALID, /* No valid mac address type send */
+ SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PUBLIC, /* SRN AP MAC Address type PUBLIC */
+ SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PRIVATE, /* SRN AP MAC Address type PRIVATE */
+ SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_OTHER, /* SRN AP MAC Address type OTHER */
+}Gnss_Srn_MacAddr_Type;
+
+typedef struct
+{
+ uint32_t size;
+ Gnss_SrnTech srnTechType; /* SRN Technology type in request */
+ bool srnRequest; /* scan - start(true) or stop(false) */
+ bool e911Mode; /* If in E911 emergency */
+ Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */
+} GnssSrnDataReq;
+
+/* Provides the current GNSS SV Type configuration to the client.
+ * This is fetched via direct call to GNSS Adapter bypassing
+ * Location API */
+typedef std::function<void(
+ const GnssSvTypeConfig& config
+)> GnssSvTypeConfigCallback;
+
+/*
+ * Represents the status of AGNSS augmented to support IPv4.
+ */
+struct AGnssExtStatusIpV4 {
+ AGpsExtType type;
+ LocApnTypeMask apnTypeMask;
+ LocAGpsStatusValue status;
+ /*
+ * 32-bit IPv4 address.
+ */
+ uint32_t ipV4Addr;
+};
+
+/*
+ * Represents the status of AGNSS augmented to support IPv6.
+ */
+struct AGnssExtStatusIpV6 {
+ AGpsExtType type;
+ LocApnTypeMask apnTypeMask;
+ LocAGpsStatusValue status;
+ /*
+ * 128-bit IPv6 address.
+ */
+ uint8_t ipV6Addr[16];
+};
+
+/*
+* Represents the the Nfw Notification structure
+*/
+#define GNSS_MAX_NFW_APP_STRING_LEN 64
+#define GNSS_MAX_NFW_STRING_LEN 20
+
+typedef enum {
+ GNSS_NFW_CTRL_PLANE = 0,
+ GNSS_NFW_SUPL = 1,
+ GNSS_NFW_IMS = 10,
+ GNSS_NFW_SIM = 11,
+ GNSS_NFW_OTHER_PROTOCOL_STACK = 100
+} GnssNfwProtocolStack;
+
+typedef enum {
+ GNSS_NFW_CARRIER = 0,
+ GNSS_NFW_OEM = 10,
+ GNSS_NFW_MODEM_CHIPSET_VENDOR = 11,
+ GNSS_NFW_GNSS_CHIPSET_VENDOR = 12,
+ GNSS_NFW_OTHER_CHIPSET_VENDOR = 13,
+ GNSS_NFW_AUTOMOBILE_CLIENT = 20,
+ GNSS_NFW_OTHER_REQUESTOR = 100
+} GnssNfwRequestor;
+
+typedef enum {
+ GNSS_NFW_REJECTED = 0,
+ GNSS_NFW_ACCEPTED_NO_LOCATION_PROVIDED = 1,
+ GNSS_NFW_ACCEPTED_LOCATION_PROVIDED = 2,
+} GnssNfwResponseType;
+
+typedef struct {
+ char proxyAppPackageName[GNSS_MAX_NFW_APP_STRING_LEN];
+ GnssNfwProtocolStack protocolStack;
+ char otherProtocolStackName[GNSS_MAX_NFW_STRING_LEN];
+ GnssNfwRequestor requestor;
+ char requestorId[GNSS_MAX_NFW_STRING_LEN];
+ GnssNfwResponseType responseType;
+ bool inEmergencyMode;
+ bool isCachedLocation;
+} GnssNfwNotification;
+
+/* ODCPI Request Info */
+enum OdcpiRequestType {
+ ODCPI_REQUEST_TYPE_START,
+ ODCPI_REQUEST_TYPE_STOP
+};
+struct OdcpiRequestInfo {
+ uint32_t size;
+ OdcpiRequestType type;
+ uint32_t tbfMillis;
+ bool isEmergencyMode;
+};
+/* Callback to send ODCPI request to framework */
+typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallback;
+
+/* ODCPI callback priorities*/
+enum OdcpiPrioritytype {
+ ODCPI_HANDLER_PRIORITY_LOW,
+ ODCPI_HANDLER_PRIORITY_HIGH
+};
+
+/*
+ * Callback with AGNSS(IpV4) status information.
+ *
+ * @param status Will be of type AGnssExtStatusIpV4.
+ */
+typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status);
+
+/*
+* Callback with NFW information.
+*/
+typedef void(*NfwStatusCb)(GnssNfwNotification notification);
+typedef bool(*IsInEmergencySession)(void);
+
+/*
+ * Callback with AGNSS(IpV6) status information.
+ *
+ * @param status Will be of type AGnssExtStatusIpV6.
+ */
+typedef void (*AgnssStatusIpV6Cb)(AGnssExtStatusIpV6 status);
+
+/* Constructs for interaction with loc_net_iface library */
+typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const char* apn,
+ AGpsBearerType bearerType, void* userDataPtr);
+
+typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr);
+
+enum PowerStateType {
+ POWER_STATE_UNKNOWN = 0,
+ POWER_STATE_SUSPEND = 1,
+ POWER_STATE_RESUME = 2,
+ POWER_STATE_SHUTDOWN = 3
+};
+
+/* Shared resources of LocIpc */
+#define LOC_IPC_HAL "/dev/socket/location/socket_hal"
+#define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra"
+
+#define SOCKET_DIR_LOCATION "/dev/socket/location/"
+#define SOCKET_DIR_EHUB "/dev/socket/location/ehub/"
+#define SOCKET_TO_LOCATION_HAL_DAEMON "/dev/socket/loc_client/hal_daemon"
+
+#define SOCKET_LOC_CLIENT_DIR "/dev/socket/loc_client/"
+#define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/"
+
+#define LOC_CLIENT_NAME_PREFIX "toclient"
+// Please note that the socket name for all location hal daemon client need
+// to start with LOC_CLIENT_NAME_PREFIX so that upon hal daemon restarts,
+// every client can get the notification that hal daemon has restarted.
+#define LOC_INTAPI_NAME_PREFIX LOC_CLIENT_NAME_PREFIX "_intapi"
+
+typedef uint64_t NetworkHandle;
+#define NETWORK_HANDLE_UNKNOWN ~0
+#define MAX_NETWORK_HANDLES 10
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
diff --git a/gps/utils/linked_list.c b/gps/utils/linked_list.c
new file mode 100644
index 0000000..02e1463
--- /dev/null
+++ b/gps/utils/linked_list.c
@@ -0,0 +1,325 @@
+/* Copyright (c) 2011, 2014, 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.
+ */
+
+#define LOG_TAG "LocSvc_utils_ll"
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <loc_pla.h>
+#include <log_util.h>
+
+typedef struct list_element {
+ struct list_element* next;
+ struct list_element* prev;
+ void* data_ptr;
+ void (*dealloc_func)(void*);
+}list_element;
+
+typedef struct list_state {
+ list_element* p_head;
+ list_element* p_tail;
+} list_state;
+
+/* ----------------------- END INTERNAL FUNCTIONS ---------------------------------------- */
+
+/*===========================================================================
+
+ FUNCTION: linked_list_init
+
+ ===========================================================================*/
+linked_list_err_type linked_list_init(void** list_data)
+{
+ if( list_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
+ return eLINKED_LIST_INVALID_PARAMETER;
+ }
+
+ list_state* tmp_list;
+ tmp_list = (list_state*)calloc(1, sizeof(list_state));
+ if( tmp_list == NULL )
+ {
+ LOC_LOGE("%s: Unable to allocate space for list!\n", __FUNCTION__);
+ return eLINKED_LIST_FAILURE_GENERAL;
+ }
+
+ tmp_list->p_head = NULL;
+ tmp_list->p_tail = NULL;
+
+ *list_data = tmp_list;
+
+ return eLINKED_LIST_SUCCESS;
+}
+
+/*===========================================================================
+
+ FUNCTION: linked_list_destroy
+
+ ===========================================================================*/
+linked_list_err_type linked_list_destroy(void** list_data)
+{
+ if( list_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
+ return eLINKED_LIST_INVALID_HANDLE;
+ }
+
+ list_state* p_list = (list_state*)*list_data;
+
+ linked_list_flush(p_list);
+
+ free(*list_data);
+ *list_data = NULL;
+
+ return eLINKED_LIST_SUCCESS;
+}
+
+/*===========================================================================
+
+ FUNCTION: linked_list_add
+
+ ===========================================================================*/
+linked_list_err_type linked_list_add(void* list_data, void *data_obj, void (*dealloc)(void*))
+{
+ if( list_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
+ return eLINKED_LIST_INVALID_HANDLE;
+ }
+
+ if( data_obj == NULL )
+ {
+ LOC_LOGE("%s: Invalid input parameter!\n", __FUNCTION__);
+ return eLINKED_LIST_INVALID_PARAMETER;
+ }
+
+ list_state* p_list = (list_state*)list_data;
+ list_element* elem = (list_element*)malloc(sizeof(list_element));
+ if( elem == NULL )
+ {
+ LOC_LOGE("%s: Memory allocation failed\n", __FUNCTION__);
+ return eLINKED_LIST_FAILURE_GENERAL;
+ }
+
+ /* Copy data to newly created element */
+ elem->data_ptr = data_obj;
+ elem->next = NULL;
+ elem->prev = NULL;
+ elem->dealloc_func = dealloc;
+
+ /* Replace head element */
+ list_element* tmp = p_list->p_head;
+ p_list->p_head = elem;
+ /* Point next to the previous head element */
+ p_list->p_head->next = tmp;
+
+ if( tmp != NULL )
+ {
+ tmp->prev = p_list->p_head;
+ }
+ else
+ {
+ p_list->p_tail = p_list->p_head;
+ }
+
+ return eLINKED_LIST_SUCCESS;
+}
+
+/*===========================================================================
+
+ FUNCTION: linked_list_remove
+
+ ===========================================================================*/
+linked_list_err_type linked_list_remove(void* list_data, void **data_obj)
+{
+ if( list_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
+ return eLINKED_LIST_INVALID_HANDLE;
+ }
+
+ if( data_obj == NULL )
+ {
+ LOC_LOGE("%s: Invalid input parameter!\n", __FUNCTION__);
+ return eLINKED_LIST_INVALID_PARAMETER;
+ }
+
+ list_state* p_list = (list_state*)list_data;
+ if( p_list->p_tail == NULL )
+ {
+ return eLINKED_LIST_UNAVAILABLE_RESOURCE;
+ }
+
+ list_element* tmp = p_list->p_tail;
+
+ /* Replace tail element */
+ p_list->p_tail = tmp->prev;
+
+ if( p_list->p_tail != NULL )
+ {
+ p_list->p_tail->next = NULL;
+ }
+ else
+ {
+ p_list->p_head = p_list->p_tail;
+ }
+
+ /* Copy data to output param */
+ *data_obj = tmp->data_ptr;
+
+ /* Free allocated list element */
+ free(tmp);
+
+ return eLINKED_LIST_SUCCESS;
+}
+
+/*===========================================================================
+
+ FUNCTION: linked_list_empty
+
+ ===========================================================================*/
+int linked_list_empty(void* list_data)
+{
+ if( list_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
+ return (int)eLINKED_LIST_INVALID_HANDLE;
+ }
+ else
+ {
+ list_state* p_list = (list_state*)list_data;
+ return p_list->p_head == NULL ? 1 : 0;
+ }
+}
+
+/*===========================================================================
+
+ FUNCTION: linked_list_flush
+
+ ===========================================================================*/
+linked_list_err_type linked_list_flush(void* list_data)
+{
+ if( list_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
+ return eLINKED_LIST_INVALID_HANDLE;
+ }
+
+ list_state* p_list = (list_state*)list_data;
+
+ /* Remove all dynamically allocated elements */
+ while( p_list->p_head != NULL )
+ {
+ list_element* tmp = p_list->p_head->next;
+
+ /* Free data pointer if told to do so. */
+ if( p_list->p_head->dealloc_func != NULL )
+ {
+ p_list->p_head->dealloc_func(p_list->p_head->data_ptr);
+ }
+
+ /* Free list element */
+ free(p_list->p_head);
+
+ p_list->p_head = tmp;
+ }
+
+ p_list->p_tail = NULL;
+
+ return eLINKED_LIST_SUCCESS;
+}
+
+/*===========================================================================
+
+ FUNCTION: linked_list_search
+
+ ===========================================================================*/
+linked_list_err_type linked_list_search(void* list_data, void **data_p,
+ bool (*equal)(void* data_0, void* data),
+ void* data_0, bool rm_if_found)
+{
+ if( list_data == NULL || NULL == equal )
+ {
+ LOC_LOGE("%s: Invalid list parameter! list_data %p equal %p\n",
+ __FUNCTION__, list_data, equal);
+ return eLINKED_LIST_INVALID_HANDLE;
+ }
+
+ list_state* p_list = (list_state*)list_data;
+ if( p_list->p_tail == NULL )
+ {
+ return eLINKED_LIST_UNAVAILABLE_RESOURCE;
+ }
+
+ list_element* tmp = p_list->p_head;
+
+ if (NULL != data_p) {
+ *data_p = NULL;
+ }
+
+ while (NULL != tmp) {
+ if ((*equal)(data_0, tmp->data_ptr)) {
+ if (NULL != data_p) {
+ *data_p = tmp->data_ptr;
+ }
+
+ if (rm_if_found) {
+ if (NULL == tmp->prev) {
+ p_list->p_head = tmp->next;
+ } else {
+ tmp->prev->next = tmp->next;
+ }
+
+ if (NULL == tmp->next) {
+ p_list->p_tail = tmp->prev;
+ } else {
+ tmp->next->prev = tmp->prev;
+ }
+
+ tmp->prev = tmp->next = NULL;
+
+ // dealloc data if it is not copied out && caller
+ // has given us a dealloc function pointer.
+ if (NULL == data_p && NULL != tmp->dealloc_func) {
+ tmp->dealloc_func(tmp->data_ptr);
+ }
+ free(tmp);
+ }
+
+ tmp = NULL;
+ } else {
+ tmp = tmp->next;
+ }
+ }
+
+ return eLINKED_LIST_SUCCESS;
+}
+
diff --git a/gps/utils/linked_list.h b/gps/utils/linked_list.h
new file mode 100644
index 0000000..0b33ecb
--- /dev/null
+++ b/gps/utils/linked_list.h
@@ -0,0 +1,219 @@
+/* Copyright (c) 2011, 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 __LINKED_LIST_H__
+#define __LINKED_LIST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdbool.h>
+#include <stdlib.h>
+
+/** Linked List Return Codes */
+typedef enum
+{
+ eLINKED_LIST_SUCCESS = 0,
+ /**< Request was successful. */
+ eLINKED_LIST_FAILURE_GENERAL = -1,
+ /**< Failed because of a general failure. */
+ eLINKED_LIST_INVALID_PARAMETER = -2,
+ /**< Failed because the request contained invalid parameters. */
+ eLINKED_LIST_INVALID_HANDLE = -3,
+ /**< Failed because an invalid handle was specified. */
+ eLINKED_LIST_UNAVAILABLE_RESOURCE = -4,
+ /**< Failed because an there were not enough resources. */
+ eLINKED_LIST_INSUFFICIENT_BUFFER = -5,
+ /**< Failed because an the supplied buffer was too small. */
+ eLINKED_LIST_EMPTY = -6
+ /**< Failed because list is empty. */
+}linked_list_err_type;
+
+/*===========================================================================
+FUNCTION linked_list_init
+
+DESCRIPTION
+ Initializes internal structures for linked list.
+
+ list_data: State of list to be initialized.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+linked_list_err_type linked_list_init(void** list_data);
+
+/*===========================================================================
+FUNCTION linked_list_destroy
+
+DESCRIPTION
+ Destroys internal structures for linked list.
+
+ p_list_data: State of list to be destroyed.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+linked_list_err_type linked_list_destroy(void** list_data);
+
+/*===========================================================================
+FUNCTION linked_list_add
+
+DESCRIPTION
+ Adds an element to the head of the linked list. The passed in data pointer
+ is not modified or freed. Passed in data_obj is expected to live throughout
+ the use of the linked_list (i.e. data is not allocated internally)
+
+ p_list_data: List to add data to the head of.
+ data_obj: Pointer to data to add into list
+ dealloc: Function used to deallocate memory for this element. Pass NULL
+ if you do not want data deallocated during a flush operation
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+linked_list_err_type linked_list_add(void* list_data, void *data_obj, void (*dealloc)(void*));
+
+/*===========================================================================
+FUNCTION linked_list_remove
+
+DESCRIPTION
+ Retrieves data from the list tail. data_obj is the tail element from the list
+ passed in by linked_list_add.
+
+ p_list_data: List to remove the tail from.
+ data_obj: Pointer to data removed from list
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+linked_list_err_type linked_list_remove(void* list_data, void **data_obj);
+
+/*===========================================================================
+FUNCTION linked_list_empty
+
+DESCRIPTION
+ Tells whether the list currently contains any elements
+
+ p_list_data: List to check if empty.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0/FALSE : List contains elements
+ 1/TRUE : List is Empty
+ Otherwise look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int linked_list_empty(void* list_data);
+
+/*===========================================================================
+FUNCTION linked_list_flush
+
+DESCRIPTION
+ Removes all elements from the list and deallocates them using the provided
+ dealloc function while adding elements.
+
+ p_list_data: List to remove all elements from.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+linked_list_err_type linked_list_flush(void* list_data);
+
+/*===========================================================================
+FUNCTION linked_list_search
+
+DESCRIPTION
+ Searches for an element in the linked list.
+
+ p_list_data: List handle.
+ data_p: to be stored with the data found; NUll if no match.
+ if data_p passed in as NULL, then no write to it.
+ equal: Function ptr takes in a list element, and returns
+ indication if this the one looking for.
+ data_0: The data being compared against.
+ rm_if_found: Should data be removed if found?
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+linked_list_err_type linked_list_search(void* list_data, void **data_p,
+ bool (*equal)(void* data_0, void* data),
+ void* data_0, bool rm_if_found);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LINKED_LIST_H__ */
diff --git a/gps/utils/loc_cfg.cpp b/gps/utils/loc_cfg.cpp
new file mode 100644
index 0000000..db0225b
--- /dev/null
+++ b/gps/utils/loc_cfg.cpp
@@ -0,0 +1,1124 @@
+/* Copyright (c) 2011-2015, 2018-2020 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_utils_cfg"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <grp.h>
+#include <errno.h>
+#include <loc_cfg.h>
+#include <loc_pla.h>
+#include <loc_target.h>
+#include <loc_misc_utils.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "log_util.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint32_t DEBUG_LEVEL = 0xff;
+static uint32_t TIMESTAMP = 0;
+static uint32_t DATUM_TYPE = 0;
+static bool sVendorEnhanced = true;
+static uint32_t sLogBufferEnabled = 0;
+
+/* Parameter spec table */
+static const loc_param_s_type loc_param_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
+ {"DATUM_TYPE", &DATUM_TYPE, NULL, 'n'},
+ {"LOG_BUFFER_ENABLED", &sLogBufferEnabled, NULL, 'n'},
+};
+static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type);
+
+typedef struct loc_param_v_type
+{
+ char* param_name;
+ char* param_str_value;
+ int param_int_value;
+ 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;
+
+bool isVendorEnhanced() {
+ return sVendorEnhanced;
+}
+void setVendorEnhanced(bool vendorEnhanced) {
+ sVendorEnhanced = vendorEnhanced;
+}
+
+/*===========================================================================
+FUNCTION loc_get_datum_type
+
+DESCRIPTION
+ get datum type
+
+PARAMETERS:
+ N/A
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ DATUM TYPE
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_get_datum_type()
+{
+ return DATUM_TYPE;
+}
+
+/*===========================================================================
+FUNCTION loc_set_config_entry
+
+DESCRIPTION
+ Potentially sets a given configuration table entry based on the passed in
+ configuration value. This is done by using a string comparison of the
+ parameter names and those found in the configuration file.
+
+PARAMETERS:
+ config_entry: configuration entry in the table to possibly set
+ config_value: value to store in the entry if the parameter names match
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_set_config_entry(const loc_param_s_type* config_entry, loc_param_v_type* config_value)
+{
+ int ret=-1;
+ if(NULL == config_entry || NULL == config_value)
+ {
+ LOC_LOGE("%s: INVALID config entry or parameter", __FUNCTION__);
+ return ret;
+ }
+
+ if (strcmp(config_entry->param_name, config_value->param_name) == 0 &&
+ config_entry->param_ptr)
+ {
+ switch (config_entry->param_type)
+ {
+ case 's':
+ if (strcmp(config_value->param_str_value, "NULL") == 0)
+ {
+ *((char*)config_entry->param_ptr) = '\0';
+ }
+ else {
+ strlcpy((char*) config_entry->param_ptr,
+ config_value->param_str_value,
+ LOC_MAX_PARAM_STRING);
+ }
+ /* Log INI values */
+ LOC_LOGD("%s: PARAM %s = %s", __FUNCTION__,
+ config_entry->param_name, (char*)config_entry->param_ptr);
+
+ if(NULL != config_entry->param_set)
+ {
+ *(config_entry->param_set) = 1;
+ }
+ ret = 0;
+ break;
+ case 'n':
+ *((int *)config_entry->param_ptr) = config_value->param_int_value;
+ /* Log INI values */
+ LOC_LOGD("%s: PARAM %s = %d", __FUNCTION__,
+ config_entry->param_name, config_value->param_int_value);
+
+ if(NULL != config_entry->param_set)
+ {
+ *(config_entry->param_set) = 1;
+ }
+ ret = 0;
+ break;
+ case 'f':
+ *((double *)config_entry->param_ptr) = config_value->param_double_value;
+ /* Log INI values */
+ LOC_LOGD("%s: PARAM %s = %f", __FUNCTION__,
+ config_entry->param_name, config_value->param_double_value);
+
+ if(NULL != config_entry->param_set)
+ {
+ *(config_entry->param_set) = 1;
+ }
+ ret = 0;
+ break;
+ default:
+ LOC_LOGE("%s: PARAM %s parameter type must be n, f, or s",
+ __FUNCTION__, config_entry->param_name);
+ }
+ }
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_fill_conf_item
+
+DESCRIPTION
+ Takes a line of configuration item and sets defined values based on
+ the passed in configuration table. This table maps strings to values to
+ set along with the type of each of these values.
+
+PARAMETERS:
+ input_buf : buffer contanis config item
+ config_table: table definition of strings to places to store information
+ table_length: length of the configuration table
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: Number of records in the config_table filled with input_buf
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_fill_conf_item(char* input_buf,
+ const loc_param_s_type* config_table, uint32_t table_length)
+{
+ int ret = 0;
+
+ if (input_buf && config_table) {
+ char *lasts;
+ loc_param_v_type config_value;
+ memset(&config_value, 0, sizeof(config_value));
+
+ /* Separate variable and value */
+ config_value.param_name = strtok_r(input_buf, "=", &lasts);
+ /* skip lines that do not contain "=" */
+ if (config_value.param_name) {
+ config_value.param_str_value = strtok_r(NULL, "\0", &lasts);
+
+ /* skip lines that do not contain two operands */
+ if (config_value.param_str_value) {
+ /* Trim leading and trailing spaces */
+ loc_util_trim_space(config_value.param_name);
+ loc_util_trim_space(config_value.param_str_value);
+
+ /* Parse numerical value */
+ if ((strlen(config_value.param_str_value) >=3) &&
+ (config_value.param_str_value[0] == '0') &&
+ (tolower(config_value.param_str_value[1]) == 'x'))
+ {
+ /* hex */
+ config_value.param_int_value = (int) strtol(&config_value.param_str_value[2],
+ (char**) NULL, 16);
+ }
+ else {
+ config_value.param_double_value = (double) atof(config_value.param_str_value); /* float */
+ config_value.param_int_value = atoi(config_value.param_str_value); /* dec */
+ }
+
+ for(uint32_t i = 0; NULL != config_table && i < table_length; i++)
+ {
+ if(!loc_set_config_entry(&config_table[i], &config_value)) {
+ ret += 1;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_read_conf_r (repetitive)
+
+DESCRIPTION
+ Reads the specified configuration file and sets defined values based on
+ the passed in configuration table. This table maps strings to values to
+ set along with the type of each of these values.
+ The difference between this and loc_read_conf is that this function returns
+ the file pointer position at the end of filling a config table. Also, it
+ reads a fixed number of parameters at a time which is equal to the length
+ of the configuration table. This functionality enables the caller to
+ repeatedly call the function to read data from the same file.
+
+PARAMETERS:
+ conf_fp : file pointer
+ config_table: table definition of strings to places to store information
+ table_length: length of the configuration table
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: Table filled successfully
+ 1: No more parameters to read
+ -1: Error filling table
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, uint32_t table_length)
+{
+ int ret=0;
+
+ unsigned int num_params=table_length;
+ if(conf_fp == NULL) {
+ LOC_LOGE("%s:%d]: ERROR: File pointer is NULL\n", __func__, __LINE__);
+ ret = -1;
+ goto err;
+ }
+
+ /* Clear all validity bits */
+ for(uint32_t i = 0; NULL != config_table && i < table_length; i++)
+ {
+ if(NULL != config_table[i].param_set)
+ {
+ *(config_table[i].param_set) = 0;
+ }
+ }
+
+ char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */
+
+ LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params);
+ while(num_params)
+ {
+ if(!fgets(input_buf, LOC_MAX_PARAM_LINE, conf_fp)) {
+ LOC_LOGD("%s:%d]: fgets returned NULL\n", __func__, __LINE__);
+ break;
+ }
+
+ num_params -= loc_fill_conf_item(input_buf, config_table, table_length);
+ }
+
+err:
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_udpate_conf
+
+DESCRIPTION
+ Parses the passed in buffer for configuration items, and update the table
+ that is also passed in.
+
+Reads the specified configuration file and sets defined values based on
+ the passed in configuration table. This table maps strings to values to
+ set along with the type of each of these values.
+
+PARAMETERS:
+ conf_data: configuration items in bufferas a string
+ length: strlen(conf_data)
+ config_table: table definition of strings to places to store information
+ table_length: length of the configuration table
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ number of the records in the table that is updated at time of return.
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_update_conf(const char* conf_data, int32_t length,
+ const loc_param_s_type* config_table, uint32_t table_length)
+{
+ int ret = -1;
+
+ if (conf_data && length && config_table && table_length) {
+ // make a copy, so we do not tokenize the original data
+ char* conf_copy = (char*)malloc(length+1);
+
+ if (conf_copy != NULL)
+ {
+ memcpy(conf_copy, conf_data, length);
+ // we hard NULL the end of string to be safe
+ conf_copy[length] = 0;
+
+ // start with one record off
+ uint32_t num_params = table_length - 1;
+ char* saveptr = NULL;
+ char* input_buf = strtok_r(conf_copy, "\n", &saveptr);
+ ret = 0;
+
+ LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params);
+ while(num_params && input_buf) {
+ ret++;
+ num_params -= loc_fill_conf_item(input_buf, config_table, table_length);
+ input_buf = strtok_r(NULL, "\n", &saveptr);
+ }
+ free(conf_copy);
+ }
+ }
+
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_read_conf
+
+DESCRIPTION
+ Reads the specified configuration file and sets defined values based on
+ the passed in configuration table. This table maps strings to values to
+ set along with the type of each of these values.
+
+PARAMETERS:
+ conf_file_name: configuration file to read
+ config_table: table definition of strings to places to store information
+ table_length: length of the configuration table
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_table,
+ uint32_t table_length)
+{
+ FILE *conf_fp = NULL;
+
+ log_buffer_init(false);
+ if((conf_fp = fopen(conf_file_name, "r")) != NULL)
+ {
+ LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name);
+ if(table_length && config_table) {
+ loc_read_conf_r(conf_fp, config_table, table_length);
+ rewind(conf_fp);
+ }
+ loc_read_conf_r(conf_fp, loc_param_table, loc_param_num);
+ fclose(conf_fp);
+ }
+ /* Initialize logging mechanism with parsed data */
+ loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
+ log_buffer_init(sLogBufferEnabled);
+}
+
+/*=============================================================================
+ *
+ * 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 CONFIG_MASK_SOCID_ALL 0x40
+#define CONFIG_MASK_SOCID_FOUND 0x80
+#define CONFIG_MASK_SOCID_CHECK 0xc0
+
+#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_SAP_BASIC 0x40
+#define LOC_FEATURE_MASK_SAP_PREMIUM 0X80
+#define LOC_FEATURE_MASK_GTP_WAA_BASIC 0X100
+#define LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC 0X400
+#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];
+ char low_ram_targets[LOC_MAX_PARAM_STRING];
+ char soc_id_list[LOC_MAX_PARAM_STRING];
+ unsigned int sglte_target;
+ char feature_gtp_mode[LOC_MAX_PARAM_STRING];
+ char feature_gtp_waa[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];
+ unsigned int vendor_enhanced_process;
+} 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_MODE", &conf.feature_gtp_mode, 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'},
+ {"SOC_IDS", &conf.soc_id_list, NULL, 's'},
+ {"BASEBAND", &conf.baseband, NULL, 's'},
+ {"LOW_RAM_TARGETS", &conf.low_ram_targets, NULL, 's'},
+ {"HARDWARE_TYPE", &conf.auto_platform, NULL, 's'},
+ {"VENDOR_ENHANCED_PROCESS", &conf.vendor_enhanced_process, NULL, 'n'},
+};
+
+/*===========================================================================
+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, soc_id_list_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];
+ int low_ram_target=0;
+ char autoplatform_name[PROPERTY_VALUE_MAX], socid_value[PROPERTY_VALUE_MAX];
+ unsigned int loc_service_mask=0;
+ unsigned 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_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_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));
+ //Identify if this is a low ram target from ro.config.low_ram property
+ low_ram_target = loc_identify_low_ram_target();
+ // Get the soc-id for this device.
+ loc_get_device_soc_id(socid_value, sizeof(socid_value));
+
+ UTIL_READ_CONF(conf_file_name, loc_feature_conf_table);
+
+ //Set service mask for GTP_MODE
+ if (strcmp(conf.feature_gtp_mode, "DISABLED") == 0) {
+ LOC_LOGD("%s:%d]: GTP MODE DISABLED", __func__, __LINE__);
+ }
+ else if (strcmp(conf.feature_gtp_mode, "LEGACY_WWAN") == 0) {
+ LOC_LOGD("%s:%d]: Setting GTP MODE to mode: LEGACY_WWAN", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_MODEM_CELL_BASIC;
+ }
+ else if (strcmp(conf.feature_gtp_mode, "SDK") == 0) {
+ LOC_LOGD("%s:%d]: Setting GTP MODE to mode: SDK", __func__, __LINE__);
+ loc_service_mask |= LOC_FEATURE_MASK_GTP_WIFI_BASIC;
+ }
+ else if (strcmp(conf.feature_gtp_mode, "SDK_WIFI") == 0) {
+ LOC_LOGD("%s:%d]: Setting GTP MODE to mode: SDK", __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 MODE Mode."\
+ " Setting GTP WIFI to default mode: DISABLED", __func__, __LINE__);
+ }
+ //Set service mask for GTP_WAA
+ 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, "MODEM_DEFAULT") == 0) {
+ LOC_LOGD("%s:%d]: Setting SAP to mode: MODEM_DEFAULT", __func__, __LINE__);
+ }
+ 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);
+ soc_id_list_length = (int)strlen(conf.soc_id_list);
+
+ if(!name_length || !group_list_length || !platform_length ||
+ !baseband_length || !status_length || !auto_platform_length || !soc_id_list_length) {
+ LOC_LOGE("%s:%d]: Error: i: %d; One of the parameters not specified in conf file",
+ __func__, __LINE__, i);
+ continue;
+ }
+
+ if (!isVendorEnhanced() && (conf.vendor_enhanced_process != 0)) {
+ LOC_LOGD("%s:%d]: Process %s is disabled via vendor enhanced process check",
+ __func__, __LINE__, conf.proc_name);
+ child_proc[j].proc_status = DISABLED_VIA_VENDOR_ENHANCED_CHECK;
+ 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, ' ');
+ for(i=0; i<ngroups; i++) {
+ struct group* grp = getgrnam(split_strings[i]);
+ if (grp) {
+ child_proc[j].group_list[child_proc[j].num_groups] = grp->gr_gid;
+ child_proc[j].num_groups++;
+ LOC_LOGd("Group %s = %d", split_strings[i], grp->gr_gid);
+ }
+ }
+
+ 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;
+ }
+ }
+ }
+
+ // SOC Id's check
+ nstrings = loc_util_split_string(conf.soc_id_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("Enabled for all SOC ids\n");
+ config_mask |= CONFIG_MASK_SOCID_ALL;
+ }
+ else if (nstrings > 2 && (strcmp("exclude", split_strings[1]) == 0)) {
+ config_mask |= CONFIG_MASK_SOCID_FOUND;
+ for (i = 2; i < nstrings; i++) {
+ if (strcmp(socid_value, split_strings[i]) == 0) {
+ LOC_LOGd("Disabled for SOC id %s\n", socid_value);
+ config_mask &= ~CONFIG_MASK_SOCID_FOUND;
+ break;
+ }
+ }
+ }
+ }
+ else {
+ for (i = 0; i < nstrings; i++) {
+ if (strcmp(socid_value, split_strings[i]) == 0) {
+ LOC_LOGd("Matched SOC id : %s\n", split_strings[i]);
+ config_mask |= CONFIG_MASK_SOCID_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;
+ }
+ }
+ }
+
+ nstrings = loc_util_split_string(conf.low_ram_targets, split_strings, MAX_NUM_STRINGS, ' ');
+ if (!strcmp("DISABLED", split_strings[0]) && low_ram_target) {
+ LOC_LOGd("Disabled for low ram targets\n");
+ child_proc[j].proc_status = DISABLED;
+ continue;
+ }
+
+ if((config_mask & CONFIG_MASK_TARGET_CHECK) &&
+ (config_mask & CONFIG_MASK_BASEBAND_CHECK) &&
+ (config_mask & CONFIG_MASK_AUTOPLATFORM_CHECK) &&
+ (config_mask & CONFIG_MASK_SOCID_CHECK) &&
+ (child_proc[j].proc_status != DISABLED_FROM_CONF) &&
+ (child_proc[j].proc_status != DISABLED_VIA_VENDOR_ENHANCED_CHECK)) {
+
+ //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_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);
+ }
+ else {
+ 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_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(conf.loc_feature_mask & LOC_FEATURE_MASK_GTP_WAA_BASIC) {
+ 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
+ {
+ 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_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
new file mode 100644
index 0000000..5c77dc6
--- /dev/null
+++ b/gps/utils/loc_cfg.h
@@ -0,0 +1,143 @@
+/* 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
+ * 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_CFG_H
+#define LOC_CFG_H
+
+#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 172
+#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]))
+
+#define UTIL_READ_CONF_DEFAULT(filename) \
+ loc_read_conf((filename), NULL, 0);
+
+#define UTIL_READ_CONF(filename, config_table) \
+ loc_read_conf((filename), (config_table), sizeof(config_table) / sizeof(config_table[0]))
+
+/*=============================================================================
+ *
+ * MODULE TYPE DECLARATION
+ *
+ *============================================================================*/
+typedef struct
+{
+ const char *param_name;
+ void *param_ptr; /* for string type, buf size need to be LOC_MAX_PARAM_STRING */
+ uint8_t *param_set; /* indicate value set by config file */
+ char param_type; /* 'n' for number,
+ 's' for string, NOTE: buf size need to be LOC_MAX_PARAM_STRING
+ 'f' for double */
+} loc_param_s_type;
+
+typedef enum {
+ ENABLED,
+ RUNNING,
+ DISABLED,
+ DISABLED_FROM_CONF,
+ DISABLED_VIA_VENDOR_ENHANCED_CHECK
+} 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
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+bool isVendorEnhanced();
+void setVendorEnhanced(bool vendorEnhanced);
+void loc_read_conf(const char* conf_file_name,
+ const loc_param_s_type* config_table,
+ uint32_t table_length);
+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);
+int loc_get_datum_type();
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/gps/utils/loc_gps.h b/gps/utils/loc_gps.h
new file mode 100644
index 0000000..90541c4
--- /dev/null
+++ b/gps/utils/loc_gps.h
@@ -0,0 +1,2235 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LOC_GPS_H
+#define LOC_GPS_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <sys/socket.h>
+#include <stdbool.h>
+
+__BEGIN_DECLS
+
+#define LOC_FLP_STATUS_LOCATION_AVAILABLE 0
+#define LOC_FLP_STATUS_LOCATION_UNAVAILABLE 1
+#define LOC_CAPABILITY_GNSS (1U<<0)
+#define LOC_CAPABILITY_WIFI (1U<<1)
+#define LOC_CAPABILITY_CELL (1U<<3)
+
+/** Milliseconds since January 1, 1970 */
+typedef int64_t LocGpsUtcTime;
+
+/** Maximum number of SVs for loc_gps_sv_status_callback(). */
+#define LOC_GPS_MAX_SVS 32
+/** Maximum number of SVs for loc_gps_sv_status_callback(). */
+#define LOC_GNSS_MAX_SVS 64
+
+/** Maximum number of Measurements in loc_gps_measurement_callback(). */
+#define LOC_GPS_MAX_MEASUREMENT 32
+
+/** Maximum number of Measurements in loc_gnss_measurement_callback(). */
+#define LOC_GNSS_MAX_MEASUREMENT 64
+
+/** Requested operational mode for GPS operation. */
+typedef uint32_t LocGpsPositionMode;
+/* IMPORTANT: Note that the following values must match
+ * constants in GpsLocationProvider.java. */
+/** Mode for running GPS standalone (no assistance). */
+#define LOC_GPS_POSITION_MODE_STANDALONE 0
+/** AGPS MS-Based mode. */
+#define LOC_GPS_POSITION_MODE_MS_BASED 1
+/**
+ * AGPS MS-Assisted mode. This mode is not maintained by the platform anymore.
+ * It is strongly recommended to use LOC_GPS_POSITION_MODE_MS_BASED instead.
+ */
+#define LOC_GPS_POSITION_MODE_MS_ASSISTED 2
+
+/** Requested recurrence mode for GPS operation. */
+typedef uint32_t LocGpsPositionRecurrence;
+/* IMPORTANT: Note that the following values must match
+ * constants in GpsLocationProvider.java. */
+/** Receive GPS fixes on a recurring basis at a specified period. */
+#define LOC_GPS_POSITION_RECURRENCE_PERIODIC 0
+/** Request a single shot GPS fix. */
+#define LOC_GPS_POSITION_RECURRENCE_SINGLE 1
+
+/** GPS status event values. */
+typedef uint16_t LocGpsStatusValue;
+/* IMPORTANT: Note that the following values must match
+ * constants in GpsLocationProvider.java. */
+/** GPS status unknown. */
+#define LOC_GPS_STATUS_NONE 0
+/** GPS has begun navigating. */
+#define LOC_GPS_STATUS_SESSION_BEGIN 1
+/** GPS has stopped navigating. */
+#define LOC_GPS_STATUS_SESSION_END 2
+/** GPS has powered on but is not navigating. */
+#define LOC_GPS_STATUS_ENGINE_ON 3
+/** GPS is powered off. */
+#define LOC_GPS_STATUS_ENGINE_OFF 4
+
+/** Flags to indicate which values are valid in a LocGpsLocation. */
+typedef uint16_t LocGpsLocationFlags;
+/* IMPORTANT: Note that the following values must match
+ * constants in GpsLocationProvider.java. */
+/** LocGpsLocation has valid latitude and longitude. */
+#define LOC_GPS_LOCATION_HAS_LAT_LONG 0x0001
+/** LocGpsLocation has valid altitude. */
+#define LOC_GPS_LOCATION_HAS_ALTITUDE 0x0002
+/** LocGpsLocation has valid speed. */
+#define LOC_GPS_LOCATION_HAS_SPEED 0x0004
+/** LocGpsLocation has valid bearing. */
+#define LOC_GPS_LOCATION_HAS_BEARING 0x0008
+/** LocGpsLocation has valid accuracy. */
+#define LOC_GPS_LOCATION_HAS_ACCURACY 0x0010
+/** LocGpsLocation has valid vertical uncertainity */
+#define LOC_GPS_LOCATION_HAS_VERT_UNCERTAINITY 0x0040
+/** LocGpsLocation has valid spoof mask */
+#define LOC_GPS_LOCATION_HAS_SPOOF_MASK 0x0080
+/** LocGpsLocation has valid speed accuracy */
+#define LOC_GPS_LOCATION_HAS_SPEED_ACCURACY 0x0100
+/** LocGpsLocation has valid bearing accuracy */
+#define LOC_GPS_LOCATION_HAS_BEARING_ACCURACY 0x0200
+/** LocGpsLocation has valid Real Time and Real Time Uncertainty */
+#define LOC_GPS_LOCATION_HAS_ELAPSED_REAL_TIME 0x0400
+
+/** Spoof mask in LocGpsLocation */
+typedef uint32_t LocGpsSpoofMask;
+#define LOC_GPS_LOCATION_NONE_SPOOFED 0x0000
+#define LOC_GPS_LOCATION_POSITION_SPOOFED 0x0001
+#define LOC_GPS_LOCATION_TIME_SPOOFED 0x0002
+#define LOC_GPS_LOCATION_NAVIGATION_DATA_SPOOFED 0x0004
+
+/** Flags for the loc_gps_set_capabilities callback. */
+
+/**
+ * GPS HAL schedules fixes for LOC_GPS_POSITION_RECURRENCE_PERIODIC mode. If this is
+ * not set, then the framework will use 1000ms for min_interval and will start
+ * and call start() and stop() to schedule the GPS.
+ */
+#define LOC_GPS_CAPABILITY_SCHEDULING (1 << 0)
+/** GPS supports MS-Based AGPS mode */
+#define LOC_GPS_CAPABILITY_MSB (1 << 1)
+/** GPS supports MS-Assisted AGPS mode */
+#define LOC_GPS_CAPABILITY_MSA (1 << 2)
+/** GPS supports single-shot fixes */
+#define LOC_GPS_CAPABILITY_SINGLE_SHOT (1 << 3)
+/** GPS supports on demand time injection */
+#define LOC_GPS_CAPABILITY_ON_DEMAND_TIME (1 << 4)
+/** GPS supports Geofencing */
+#define LOC_GPS_CAPABILITY_GEOFENCING (1 << 5)
+/** GPS supports Measurements. */
+#define LOC_GPS_CAPABILITY_MEASUREMENTS (1 << 6)
+/** GPS supports Navigation Messages */
+#define LOC_GPS_CAPABILITY_NAV_MESSAGES (1 << 7)
+
+/**
+ * Flags used to specify which aiding data to delete when calling
+ * delete_aiding_data().
+ */
+typedef uint16_t LocGpsAidingData;
+/* IMPORTANT: Note that the following values must match
+ * constants in GpsLocationProvider.java. */
+#define LOC_GPS_DELETE_EPHEMERIS 0x0001
+#define LOC_GPS_DELETE_ALMANAC 0x0002
+#define LOC_GPS_DELETE_POSITION 0x0004
+#define LOC_GPS_DELETE_TIME 0x0008
+#define LOC_GPS_DELETE_IONO 0x0010
+#define LOC_GPS_DELETE_UTC 0x0020
+#define LOC_GPS_DELETE_HEALTH 0x0040
+#define LOC_GPS_DELETE_SVDIR 0x0080
+#define LOC_GPS_DELETE_SVSTEER 0x0100
+#define LOC_GPS_DELETE_SADATA 0x0200
+#define LOC_GPS_DELETE_RTI 0x0400
+#define LOC_GPS_DELETE_MB_DATA 0x0800
+#define LOC_GPS_DELETE_CELLDB_INFO 0x8000
+#define LOC_GPS_DELETE_ALL 0xFFFF
+
+/** AGPS type */
+typedef uint16_t LocAGpsType;
+#define LOC_AGPS_TYPE_ANY 0
+#define LOC_AGPS_TYPE_SUPL 1
+#define LOC_AGPS_TYPE_C2K 2
+#define LOC_AGPS_TYPE_WWAN_ANY 3
+#define LOC_AGPS_TYPE_WIFI 4
+#define LOC_AGPS_TYPE_SUPL_ES 5
+
+typedef uint16_t LocAGpsSetIDType;
+#define LOC_AGPS_SETID_TYPE_NONE 0
+#define LOC_AGPS_SETID_TYPE_IMSI 1
+#define LOC_AGPS_SETID_TYPE_MSISDN 2
+
+typedef uint16_t LocApnIpType;
+#define LOC_APN_IP_INVALID 0
+#define LOC_APN_IP_IPV4 1
+#define LOC_APN_IP_IPV6 2
+#define LOC_APN_IP_IPV4V6 3
+
+/**
+ * String length constants
+ */
+#define LOC_GPS_NI_SHORT_STRING_MAXLEN 256
+#define LOC_GPS_NI_LONG_STRING_MAXLEN 2048
+
+/**
+ * LocGpsNiType constants
+ */
+typedef uint32_t LocGpsNiType;
+#define LOC_GPS_NI_TYPE_VOICE 1
+#define LOC_GPS_NI_TYPE_UMTS_SUPL 2
+#define LOC_GPS_NI_TYPE_UMTS_CTRL_PLANE 3
+/*Emergency SUPL*/
+#define LOC_GPS_NI_TYPE_EMERGENCY_SUPL 4
+
+/**
+ * LocGpsNiNotifyFlags constants
+ */
+typedef uint32_t LocGpsNiNotifyFlags;
+/** NI requires notification */
+#define LOC_GPS_NI_NEED_NOTIFY 0x0001
+/** NI requires verification */
+#define LOC_GPS_NI_NEED_VERIFY 0x0002
+/** NI requires privacy override, no notification/minimal trace */
+#define LOC_GPS_NI_PRIVACY_OVERRIDE 0x0004
+
+/**
+ * GPS NI responses, used to define the response in
+ * NI structures
+ */
+typedef int LocGpsUserResponseType;
+#define LOC_GPS_NI_RESPONSE_ACCEPT 1
+#define LOC_GPS_NI_RESPONSE_DENY 2
+#define LOC_GPS_NI_RESPONSE_NORESP 3
+
+/**
+ * NI data encoding scheme
+ */
+typedef int LocGpsNiEncodingType;
+#define LOC_GPS_ENC_NONE 0
+#define LOC_GPS_ENC_SUPL_GSM_DEFAULT 1
+#define LOC_GPS_ENC_SUPL_UTF8 2
+#define LOC_GPS_ENC_SUPL_UCS2 3
+#define LOC_GPS_ENC_UNKNOWN -1
+
+/** AGPS status event values. */
+typedef uint8_t LocAGpsStatusValue;
+/** GPS requests data connection for AGPS. */
+#define LOC_GPS_REQUEST_AGPS_DATA_CONN 1
+/** GPS releases the AGPS data connection. */
+#define LOC_GPS_RELEASE_AGPS_DATA_CONN 2
+/** AGPS data connection initiated */
+#define LOC_GPS_AGPS_DATA_CONNECTED 3
+/** AGPS data connection completed */
+#define LOC_GPS_AGPS_DATA_CONN_DONE 4
+/** AGPS data connection failed */
+#define LOC_GPS_AGPS_DATA_CONN_FAILED 5
+
+typedef uint16_t LocAGpsRefLocationType;
+#define LOC_AGPS_REF_LOCATION_TYPE_GSM_CELLID 1
+#define LOC_AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2
+#define LOC_AGPS_REF_LOCATION_TYPE_MAC 3
+#define LOC_AGPS_REF_LOCATION_TYPE_LTE_CELLID 4
+
+/* Deprecated, to be removed in the next Android release. */
+#define LOC_AGPS_REG_LOCATION_TYPE_MAC 3
+
+/** Network types for update_network_state "type" parameter */
+#define LOC_AGPS_RIL_NETWORK_TYPE_MOBILE 0
+#define LOC_AGPS_RIL_NETWORK_TYPE_WIFI 1
+#define LOC_AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2
+#define LOC_AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3
+#define LOC_AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4
+#define LOC_AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5
+#define LOC_AGPS_RIL_NETWORK_TTYPE_WIMAX 6
+
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. */
+typedef uint16_t LocGpsClockFlags;
+#define LOC_GPS_CLOCK_HAS_LEAP_SECOND (1<<0)
+#define LOC_GPS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1)
+#define LOC_GPS_CLOCK_HAS_FULL_BIAS (1<<2)
+#define LOC_GPS_CLOCK_HAS_BIAS (1<<3)
+#define LOC_GPS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4)
+#define LOC_GPS_CLOCK_HAS_DRIFT (1<<5)
+#define LOC_GPS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6)
+
+/**
+ * Flags to indicate what fields in LocGnssClock are valid.
+ */
+typedef uint16_t LocGnssClockFlags;
+/** A valid 'leap second' is stored in the data structure. */
+#define LOC_GNSS_CLOCK_HAS_LEAP_SECOND (1<<0)
+/** A valid 'time uncertainty' is stored in the data structure. */
+#define LOC_GNSS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1)
+/** A valid 'full bias' is stored in the data structure. */
+#define LOC_GNSS_CLOCK_HAS_FULL_BIAS (1<<2)
+/** A valid 'bias' is stored in the data structure. */
+#define LOC_GNSS_CLOCK_HAS_BIAS (1<<3)
+/** A valid 'bias uncertainty' is stored in the data structure. */
+#define LOC_GNSS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4)
+/** A valid 'drift' is stored in the data structure. */
+#define LOC_GNSS_CLOCK_HAS_DRIFT (1<<5)
+/** A valid 'drift uncertainty' is stored in the data structure. */
+#define LOC_GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6)
+
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. */
+typedef uint8_t LocGpsClockType;
+#define LOC_GPS_CLOCK_TYPE_UNKNOWN 0
+#define LOC_GPS_CLOCK_TYPE_LOCAL_HW_TIME 1
+#define LOC_GPS_CLOCK_TYPE_GPS_TIME 2
+
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. */
+typedef uint32_t LocGpsMeasurementFlags;
+#define LOC_GPS_MEASUREMENT_HAS_SNR (1<<0)
+#define LOC_GPS_MEASUREMENT_HAS_ELEVATION (1<<1)
+#define LOC_GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY (1<<2)
+#define LOC_GPS_MEASUREMENT_HAS_AZIMUTH (1<<3)
+#define LOC_GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY (1<<4)
+#define LOC_GPS_MEASUREMENT_HAS_PSEUDORANGE (1<<5)
+#define LOC_GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY (1<<6)
+#define LOC_GPS_MEASUREMENT_HAS_CODE_PHASE (1<<7)
+#define LOC_GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY (1<<8)
+#define LOC_GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9)
+#define LOC_GPS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10)
+#define LOC_GPS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11)
+#define LOC_GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12)
+#define LOC_GPS_MEASUREMENT_HAS_BIT_NUMBER (1<<13)
+#define LOC_GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT (1<<14)
+#define LOC_GPS_MEASUREMENT_HAS_DOPPLER_SHIFT (1<<15)
+#define LOC_GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16)
+#define LOC_GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17)
+#define LOC_GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE (1<<18)
+
+/**
+ * Flags to indicate what fields in LocGnssMeasurement are valid.
+ */
+typedef uint32_t LocGnssMeasurementFlags;
+/** A valid 'snr' is stored in the data structure. */
+#define LOC_GNSS_MEASUREMENT_HAS_SNR (1<<0)
+/** A valid 'carrier frequency' is stored in the data structure. */
+#define LOC_GNSS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9)
+/** A valid 'carrier cycles' is stored in the data structure. */
+#define LOC_GNSS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10)
+/** A valid 'carrier phase' is stored in the data structure. */
+#define LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11)
+/** A valid 'carrier phase uncertainty' is stored in the data structure. */
+#define LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12)
+
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. */
+typedef uint8_t LocGpsLossOfLock;
+#define LOC_GPS_LOSS_OF_LOCK_UNKNOWN 0
+#define LOC_GPS_LOSS_OF_LOCK_OK 1
+#define LOC_GPS_LOSS_OF_LOCK_CYCLE_SLIP 2
+
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. Use LocGnssMultipathIndicator instead.
+ */
+typedef uint8_t LocGpsMultipathIndicator;
+#define LOC_GPS_MULTIPATH_INDICATOR_UNKNOWN 0
+#define LOC_GPS_MULTIPATH_INDICATOR_DETECTED 1
+#define LOC_GPS_MULTIPATH_INDICATOR_NOT_USED 2
+
+/**
+ * Enumeration of available values for the GNSS Measurement's multipath
+ * indicator.
+ */
+typedef uint8_t LocGnssMultipathIndicator;
+/** The indicator is not available or unknown. */
+#define LOC_GNSS_MULTIPATH_INDICATOR_UNKNOWN 0
+/** The measurement is indicated to be affected by multipath. */
+#define LOC_GNSS_MULTIPATH_INDICATOR_PRESENT 1
+/** The measurement is indicated to be not affected by multipath. */
+#define LOC_GNSS_MULTIPATH_INDICATOR_NOT_PRESENT 2
+
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. */
+typedef uint16_t LocGpsMeasurementState;
+#define LOC_GPS_MEASUREMENT_STATE_UNKNOWN 0
+#define LOC_GPS_MEASUREMENT_STATE_CODE_LOCK (1<<0)
+#define LOC_GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1)
+#define LOC_GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2)
+#define LOC_GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3)
+#define LOC_GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4)
+
+/**
+ * Flags indicating the GNSS measurement state.
+ *
+ * The expected behavior here is for GPS HAL to set all the flags that applies.
+ * For example, if the state for a satellite is only C/A code locked and bit
+ * synchronized, and there is still millisecond ambiguity, the state should be
+ * set as:
+ *
+ * LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK | LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC |
+ * LOC_GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS
+ *
+ * If GNSS is still searching for a satellite, the corresponding state should be
+ * set to LOC_GNSS_MEASUREMENT_STATE_UNKNOWN(0).
+ */
+typedef uint32_t LocGnssMeasurementState;
+#define LOC_GNSS_MEASUREMENT_STATE_UNKNOWN 0
+#define LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK (1<<0)
+#define LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC (1<<1)
+#define LOC_GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2)
+#define LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED (1<<3)
+#define LOC_GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4)
+#define LOC_GNSS_MEASUREMENT_STATE_SYMBOL_SYNC (1<<5)
+#define LOC_GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC (1<<6)
+#define LOC_GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED (1<<7)
+#define LOC_GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC (1<<8)
+#define LOC_GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC (1<<9)
+#define LOC_GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK (1<<10)
+#define LOC_GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK (1<<11)
+#define LOC_GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC (1<<12)
+#define LOC_GNSS_MEASUREMENT_STATE_SBAS_SYNC (1<<13)
+
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. */
+typedef uint16_t LocGpsAccumulatedDeltaRangeState;
+#define LOC_GPS_ADR_STATE_UNKNOWN 0
+#define LOC_GPS_ADR_STATE_VALID (1<<0)
+#define LOC_GPS_ADR_STATE_RESET (1<<1)
+#define LOC_GPS_ADR_STATE_CYCLE_SLIP (1<<2)
+
+/**
+ * Flags indicating the Accumulated Delta Range's states.
+ */
+typedef uint16_t LocGnssAccumulatedDeltaRangeState;
+#define LOC_GNSS_ADR_STATE_UNKNOWN 0
+#define LOC_GNSS_ADR_STATE_VALID (1<<0)
+#define LOC_GNSS_ADR_STATE_RESET (1<<1)
+#define LOC_GNSS_ADR_STATE_CYCLE_SLIP (1<<2)
+
+#if 0
+/* The following typedef together with its constants below are deprecated, and
+ * will be removed in the next release. */
+typedef uint8_t GpsNavigationMessageType;
+#define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0
+#define GPS_NAVIGATION_MESSAGE_TYPE_L1CA 1
+#define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV 2
+#define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV 3
+#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4
+
+/**
+ * Enumeration of available values to indicate the GNSS Navigation message
+ * types.
+ *
+ * For convenience, first byte is the LocGnssConstellationType on which that signal
+ * is typically transmitted
+ */
+typedef int16_t GnssNavigationMessageType;
+
+#define GNSS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0
+/** GPS L1 C/A message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L1CA 0x0101
+/** GPS L2-CNAV message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L2CNAV 0x0102
+/** GPS L5-CNAV message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L5CNAV 0x0103
+/** GPS CNAV-2 message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_CNAV2 0x0104
+/** Glonass L1 CA message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GLO_L1CA 0x0301
+/** Beidou D1 message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D1 0x0501
+/** Beidou D2 message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D2 0x0502
+/** Galileo I/NAV message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GAL_I 0x0601
+/** Galileo F/NAV message contained in the structure. */
+#define GNSS_NAVIGATION_MESSAGE_TYPE_GAL_F 0x0602
+
+/**
+ * Status of Navigation Message
+ * When a message is received properly without any parity error in its navigation words, the
+ * status should be set to NAV_MESSAGE_STATUS_PARITY_PASSED. But if a message is received
+ * with words that failed parity check, but GPS is able to correct those words, the status
+ * should be set to NAV_MESSAGE_STATUS_PARITY_REBUILT.
+ * No need to send any navigation message that contains words with parity error and cannot be
+ * corrected.
+ */
+typedef uint16_t NavigationMessageStatus;
+#define NAV_MESSAGE_STATUS_UNKNOWN 0
+#define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0)
+#define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1)
+
+/* This constant is deprecated, and will be removed in the next release. */
+#define NAV_MESSAGE_STATUS_UNKONW 0
+#endif
+
+/**
+ * Flags that indicate information about the satellite
+ */
+typedef uint8_t LocGnssSvFlags;
+#define LOC_GNSS_SV_FLAGS_NONE 0
+#define LOC_GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA (1 << 0)
+#define LOC_GNSS_SV_FLAGS_HAS_ALMANAC_DATA (1 << 1)
+#define LOC_GNSS_SV_FLAGS_USED_IN_FIX (1 << 2)
+
+/**
+ * Constellation type of LocGnssSvInfo
+ */
+typedef uint8_t LocGnssConstellationType;
+#define LOC_GNSS_CONSTELLATION_UNKNOWN 0
+#define LOC_GNSS_CONSTELLATION_GPS 1
+#define LOC_GNSS_CONSTELLATION_SBAS 2
+#define LOC_GNSS_CONSTELLATION_GLONASS 3
+#define LOC_GNSS_CONSTELLATION_QZSS 4
+#define LOC_GNSS_CONSTELLATION_BEIDOU 5
+#define LOC_GNSS_CONSTELLATION_GALILEO 6
+
+/**
+ * Name for the GPS XTRA interface.
+ */
+#define LOC_GPS_XTRA_INTERFACE "gps-xtra"
+
+/**
+ * Name for the GPS DEBUG interface.
+ */
+#define LOC_GPS_DEBUG_INTERFACE "gps-debug"
+
+/**
+ * Name for the AGPS interface.
+ */
+
+#define LOC_AGPS_INTERFACE "agps"
+
+/**
+ * Name of the Supl Certificate interface.
+ */
+#define LOC_SUPL_CERTIFICATE_INTERFACE "supl-certificate"
+
+/**
+ * Name for NI interface
+ */
+#define LOC_GPS_NI_INTERFACE "gps-ni"
+
+/**
+ * Name for the AGPS-RIL interface.
+ */
+#define LOC_AGPS_RIL_INTERFACE "agps_ril"
+
+/**
+ * Name for the GPS_Geofencing interface.
+ */
+#define LOC_GPS_GEOFENCING_INTERFACE "gps_geofencing"
+
+/**
+ * Name of the GPS Measurements interface.
+ */
+#define LOC_GPS_MEASUREMENT_INTERFACE "gps_measurement"
+
+/**
+ * Name of the GPS navigation message interface.
+ */
+#define LOC_GPS_NAVIGATION_MESSAGE_INTERFACE "gps_navigation_message"
+
+/**
+ * Name of the GNSS/GPS configuration interface.
+ */
+#define LOC_GNSS_CONFIGURATION_INTERFACE "gnss_configuration"
+
+/** Represents a location. */
+typedef struct {
+ /** set to sizeof(LocGpsLocation) */
+ uint32_t size;
+ /** Contains LocGpsLocationFlags bits. */
+ uint16_t flags;
+ /** The spoof mask */
+ LocGpsSpoofMask spoof_mask;
+ /** Represents latitude in degrees. */
+ double latitude;
+ /** Represents longitude in degrees. */
+ double longitude;
+ /**
+ * Represents altitude in meters above the WGS 84 reference ellipsoid.
+ */
+ double altitude;
+ /** Represents horizontal speed in meters per second. */
+ float speed;
+ /** Represents heading in degrees. */
+ float bearing;
+ /** Represents expected accuracy in meters. */
+ float accuracy;
+ /** Represents the expected vertical uncertainity in meters*/
+ float vertUncertainity;
+ /** Timestamp for the location fix. */
+ LocGpsUtcTime timestamp;
+ /** Elapsed RealTime in nanosends */
+ uint64_t elapsedRealTime;
+ /** Elapsed Real Time Uncertainty in nanosends */
+ uint64_t elapsedRealTimeUnc;
+} LocGpsLocation;
+
+/** Represents the status. */
+typedef struct {
+ /** set to sizeof(LocGpsStatus) */
+ size_t size;
+ LocGpsStatusValue status;
+} LocGpsStatus;
+
+/**
+ * Legacy struct to represents SV information.
+ * Deprecated, to be removed in the next Android release.
+ * Use LocGnssSvInfo instead.
+ */
+typedef struct {
+ /** set to sizeof(LocGpsSvInfo) */
+ size_t size;
+ /** Pseudo-random number for the SV. */
+ int prn;
+ /** Signal to noise ratio. */
+ float snr;
+ /** Elevation of SV in degrees. */
+ float elevation;
+ /** Azimuth of SV in degrees. */
+ float azimuth;
+} LocGpsSvInfo;
+
+typedef struct {
+ /** set to sizeof(LocGnssSvInfo) */
+ size_t size;
+
+ /**
+ * Pseudo-random number for the SV, or FCN/OSN number for Glonass. The
+ * distinction is made by looking at constellation field. Values should be
+ * in the range of:
+ *
+ * - GPS: 1-32
+ * - SBAS: 120-151, 183-192
+ * - GLONASS: 1-24, the orbital slot number (OSN), if known. Or, if not:
+ * 93-106, the frequency channel number (FCN) (-7 to +6) offset by + 100
+ * i.e. report an FCN of -7 as 93, FCN of 0 as 100, and FCN of +6 as 106.
+ * - QZSS: 193-200
+ * - Galileo: 1-36
+ * - Beidou: 1-37
+ */
+ int16_t svid;
+
+ /**
+ * Defines the constellation of the given SV. Value should be one of those
+ * LOC_GNSS_CONSTELLATION_* constants
+ */
+ LocGnssConstellationType constellation;
+
+ /**
+ * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+ * It contains the measured C/N0 value for the signal at the antenna port.
+ *
+ * This is a mandatory value.
+ */
+ float c_n0_dbhz;
+
+ /** Elevation of SV in degrees. */
+ float elevation;
+
+ /** Azimuth of SV in degrees. */
+ float azimuth;
+
+ /**
+ * Contains additional data about the given SV. Value should be one of those
+ * LOC_GNSS_SV_FLAGS_* constants
+ */
+ LocGnssSvFlags flags;
+
+} LocGnssSvInfo;
+
+/**
+ * Legacy struct to represents SV status.
+ * Deprecated, to be removed in the next Android release.
+ * Use LocGnssSvStatus instead.
+ */
+typedef struct {
+ /** set to sizeof(LocGpsSvStatus) */
+ size_t size;
+ int num_svs;
+ LocGpsSvInfo sv_list[LOC_GPS_MAX_SVS];
+ uint32_t ephemeris_mask;
+ uint32_t almanac_mask;
+ uint32_t used_in_fix_mask;
+} LocGpsSvStatus;
+
+/**
+ * Represents SV status.
+ */
+typedef struct {
+ /** set to sizeof(LocGnssSvStatus) */
+ size_t size;
+
+ /** Number of GPS SVs currently visible, refers to the SVs stored in sv_list */
+ int num_svs;
+ /**
+ * Pointer to an array of SVs information for all GNSS constellations,
+ * except GPS, which is reported using sv_list
+ */
+ LocGnssSvInfo gnss_sv_list[LOC_GNSS_MAX_SVS];
+
+} LocGnssSvStatus;
+
+/* CellID for 2G, 3G and LTE, used in AGPS. */
+typedef struct {
+ LocAGpsRefLocationType type;
+ /** Mobile Country Code. */
+ uint16_t mcc;
+ /** Mobile Network Code .*/
+ uint16_t mnc;
+ /** Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE,
+ * lac is populated with tac, to ensure that we don't break old clients that
+ * might rely in the old (wrong) behavior.
+ */
+ uint16_t lac;
+ /** Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */
+ uint32_t cid;
+ /** Tracking Area Code in LTE. */
+ uint16_t tac;
+ /** Physical Cell id in LTE (not used in 2G and 3G) */
+ uint16_t pcid;
+} LocAGpsRefLocationCellID;
+
+typedef struct {
+ uint8_t mac[6];
+} LocAGpsRefLocationMac;
+
+/** Represents ref locations */
+typedef struct {
+ LocAGpsRefLocationType type;
+ union {
+ LocAGpsRefLocationCellID cellID;
+ LocAGpsRefLocationMac mac;
+ } u;
+} LocAGpsRefLocation;
+
+/**
+ * Callback with location information. Can only be called from a thread created
+ * by create_thread_cb.
+ */
+typedef void (* loc_gps_location_callback)(LocGpsLocation* location);
+
+/**
+ * Callback with status information. Can only be called from a thread created by
+ * create_thread_cb.
+ */
+typedef void (* loc_gps_status_callback)(LocGpsStatus* status);
+/**
+ * Legacy callback with SV status information.
+ * Can only be called from a thread created by create_thread_cb.
+ *
+ * This callback is deprecated, and will be removed in the next release. Use
+ * loc_gnss_sv_status_callback() instead.
+ */
+typedef void (* loc_gps_sv_status_callback)(LocGpsSvStatus* sv_info);
+
+/**
+ * Callback with SV status information.
+ * Can only be called from a thread created by create_thread_cb.
+ */
+typedef void (* loc_gnss_sv_status_callback)(LocGnssSvStatus* sv_info);
+
+/**
+ * Callback for reporting NMEA sentences. Can only be called from a thread
+ * created by create_thread_cb.
+ */
+typedef void (* loc_gps_nmea_callback)(LocGpsUtcTime timestamp, const char* nmea, int length);
+
+/**
+ * Callback to inform framework of the GPS engine's capabilities. Capability
+ * parameter is a bit field of LOC_GPS_CAPABILITY_* flags.
+ */
+typedef void (* loc_gps_set_capabilities)(uint32_t capabilities);
+
+/**
+ * Callback utility for acquiring the GPS wakelock. This can be used to prevent
+ * the CPU from suspending while handling GPS events.
+ */
+typedef void (* loc_gps_acquire_wakelock)();
+
+/** Callback utility for releasing the GPS wakelock. */
+typedef void (* loc_gps_release_wakelock)();
+
+/** Callback for requesting NTP time */
+typedef void (* loc_gps_request_utc_time)();
+
+/**
+ * Callback for creating a thread that can call into the Java framework code.
+ * This must be used to create any threads that report events up to the
+ * framework.
+ */
+typedef pthread_t (* loc_gps_create_thread)(const char* name, void (*start)(void *), void* arg);
+
+/**
+ * Provides information about how new the underlying GPS/GNSS hardware and
+ * software is.
+ *
+ * This information will be available for Android Test Applications. If a GPS
+ * HAL does not provide this information, it will be considered "2015 or
+ * earlier".
+ *
+ * If a GPS HAL does provide this information, then newer years will need to
+ * meet newer CTS standards. E.g. if the date are 2016 or above, then N+ level
+ * LocGpsMeasurement support will be verified.
+ */
+typedef struct {
+ /** Set to sizeof(LocGnssSystemInfo) */
+ size_t size;
+ /* year in which the last update was made to the underlying hardware/firmware
+ * used to capture GNSS signals, e.g. 2016 */
+ uint16_t year_of_hw;
+} LocGnssSystemInfo;
+
+/**
+ * Callback to inform framework of the engine's hardware version information.
+ */
+typedef void (*loc_gnss_set_system_info)(const LocGnssSystemInfo* info);
+
+/** New GPS callback structure. */
+typedef struct {
+ /** set to sizeof(LocGpsCallbacks) */
+ size_t size;
+ loc_gps_location_callback location_cb;
+ loc_gps_status_callback status_cb;
+ loc_gps_sv_status_callback sv_status_cb;
+ loc_gps_nmea_callback nmea_cb;
+ loc_gps_set_capabilities set_capabilities_cb;
+ loc_gps_acquire_wakelock acquire_wakelock_cb;
+ loc_gps_release_wakelock release_wakelock_cb;
+ loc_gps_create_thread create_thread_cb;
+ loc_gps_request_utc_time request_utc_time_cb;
+
+ loc_gnss_set_system_info set_system_info_cb;
+ loc_gnss_sv_status_callback gnss_sv_status_cb;
+} LocGpsCallbacks;
+
+/** Represents the standard GPS interface. */
+typedef struct {
+ /** set to sizeof(LocGpsInterface) */
+ size_t size;
+ /**
+ * Opens the interface and provides the callback routines
+ * to the implementation of this interface.
+ */
+ int (*init)( LocGpsCallbacks* callbacks );
+
+ /** Starts navigating. */
+ int (*start)( void );
+
+ /** Stops navigating. */
+ int (*stop)( void );
+
+ /** Closes the interface. */
+ void (*cleanup)( void );
+
+ /** Injects the current time. */
+ int (*inject_time)(LocGpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+
+ /**
+ * Injects current location from another location provider (typically cell
+ * ID). Latitude and longitude are measured in degrees expected accuracy is
+ * measured in meters
+ */
+ int (*inject_location)(double latitude, double longitude, float accuracy);
+
+ /**
+ * Specifies that the next call to start will not use the
+ * information defined in the flags. LOC_GPS_DELETE_ALL is passed for
+ * a cold start.
+ */
+ void (*delete_aiding_data)(LocGpsAidingData flags);
+
+ /**
+ * min_interval represents the time between fixes in milliseconds.
+ * preferred_accuracy represents the requested fix accuracy in meters.
+ * preferred_time represents the requested time to first fix in milliseconds.
+ *
+ * 'mode' parameter should be one of LOC_GPS_POSITION_MODE_MS_BASED
+ * or LOC_GPS_POSITION_MODE_STANDALONE.
+ * It is allowed by the platform (and it is recommended) to fallback to
+ * LOC_GPS_POSITION_MODE_MS_BASED if LOC_GPS_POSITION_MODE_MS_ASSISTED is passed in, and
+ * LOC_GPS_POSITION_MODE_MS_BASED is supported.
+ */
+ int (*set_position_mode)(LocGpsPositionMode mode, LocGpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
+
+ /** Get a pointer to extension information. */
+ const void* (*get_extension)(const char* name);
+} LocGpsInterface;
+
+/**
+ * Callback to request the client to download XTRA data. The client should
+ * download XTRA data and inject it by calling inject_xtra_data(). Can only be
+ * called from a thread created by create_thread_cb.
+ */
+typedef void (* loc_gps_xtra_download_request)();
+
+/** Callback structure for the XTRA interface. */
+typedef struct {
+ loc_gps_xtra_download_request download_request_cb;
+ loc_gps_create_thread create_thread_cb;
+} LocGpsXtraCallbacks;
+
+/** Extended interface for XTRA support. */
+typedef struct {
+ /** set to sizeof(LocGpsXtraInterface) */
+ size_t size;
+ /**
+ * Opens the XTRA interface and provides the callback routines
+ * to the implementation of this interface.
+ */
+ int (*init)( LocGpsXtraCallbacks* callbacks );
+ /** Injects XTRA data into the GPS. */
+ int (*inject_xtra_data)( char* data, int length );
+} LocGpsXtraInterface;
+
+#if 0
+/** Extended interface for DEBUG support. */
+typedef struct {
+ /** set to sizeof(LocGpsDebugInterface) */
+ size_t size;
+
+ /**
+ * This function should return any information that the native
+ * implementation wishes to include in a bugreport.
+ */
+ size_t (*get_internal_state)(char* buffer, size_t bufferSize);
+} LocGpsDebugInterface;
+#endif
+
+/*
+ * Represents the status of AGPS augmented to support IPv4 and IPv6.
+ */
+typedef struct {
+ /** set to sizeof(LocAGpsStatus) */
+ size_t size;
+
+ LocAGpsType type;
+ LocAGpsStatusValue status;
+
+ /**
+ * Must be set to a valid IPv4 address if the field 'addr' contains an IPv4
+ * address, or set to INADDR_NONE otherwise.
+ */
+ uint32_t ipaddr;
+
+ /**
+ * Must contain the IPv4 (AF_INET) or IPv6 (AF_INET6) address to report.
+ * Any other value of addr.ss_family will be rejected.
+ */
+ struct sockaddr_storage addr;
+} LocAGpsStatus;
+
+/**
+ * Callback with AGPS status information. Can only be called from a thread
+ * created by create_thread_cb.
+ */
+typedef void (* loc_agps_status_callback)(LocAGpsStatus* status);
+
+/** Callback structure for the AGPS interface. */
+typedef struct {
+ loc_agps_status_callback status_cb;
+ loc_gps_create_thread create_thread_cb;
+} LocAGpsCallbacks;
+
+/**
+ * Extended interface for AGPS support, it is augmented to enable to pass
+ * extra APN data.
+ */
+typedef struct {
+ /** set to sizeof(LocAGpsInterface) */
+ size_t size;
+
+ /**
+ * Opens the AGPS interface and provides the callback routines to the
+ * implementation of this interface.
+ */
+ void (*init)(LocAGpsCallbacks* callbacks);
+ /**
+ * Deprecated.
+ * If the HAL supports LocAGpsInterface_v2 this API will not be used, see
+ * data_conn_open_with_apn_ip_type for more information.
+ */
+ int (*data_conn_open)(const char* apn);
+ /**
+ * Notifies that the AGPS data connection has been closed.
+ */
+ int (*data_conn_closed)();
+ /**
+ * Notifies that a data connection is not available for AGPS.
+ */
+ int (*data_conn_failed)();
+ /**
+ * Sets the hostname and port for the AGPS server.
+ */
+ int (*set_server)(LocAGpsType type, const char* hostname, int port);
+
+ /**
+ * Notifies that a data connection is available and sets the name of the
+ * APN, and its IP type, to be used for SUPL connections.
+ */
+ int (*data_conn_open_with_apn_ip_type)(
+ const char* apn,
+ LocApnIpType apnIpType);
+} LocAGpsInterface;
+
+/** Error codes associated with certificate operations */
+#define LOC_AGPS_CERTIFICATE_OPERATION_SUCCESS 0
+#define LOC_AGPS_CERTIFICATE_ERROR_GENERIC -100
+#define LOC_AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES -101
+
+/** A data structure that represents an X.509 certificate using DER encoding */
+typedef struct {
+ size_t length;
+ u_char* data;
+} LocDerEncodedCertificate;
+
+/**
+ * A type definition for SHA1 Fingerprints used to identify X.509 Certificates
+ * The Fingerprint is a digest of the DER Certificate that uniquely identifies it.
+ */
+typedef struct {
+ u_char data[20];
+} LocSha1CertificateFingerprint;
+
+/** AGPS Interface to handle SUPL certificate operations */
+typedef struct {
+ /** set to sizeof(LocSuplCertificateInterface) */
+ size_t size;
+
+ /**
+ * Installs a set of Certificates used for SUPL connections to the AGPS server.
+ * If needed the HAL should find out internally any certificates that need to be removed to
+ * accommodate the certificates to install.
+ * The certificates installed represent a full set of valid certificates needed to connect to
+ * AGPS SUPL servers.
+ * The list of certificates is required, and all must be available at the same time, when trying
+ * to establish a connection with the AGPS Server.
+ *
+ * Parameters:
+ * certificates - A pointer to an array of DER encoded certificates that are need to be
+ * installed in the HAL.
+ * length - The number of certificates to install.
+ * Returns:
+ * LOC_AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully
+ * LOC_AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES if the HAL cannot store the number of
+ * certificates attempted to be installed, the state of the certificates stored should
+ * remain the same as before on this error case.
+ *
+ * IMPORTANT:
+ * If needed the HAL should find out internally the set of certificates that need to be
+ * removed to accommodate the certificates to install.
+ */
+ int (*install_certificates) ( const LocDerEncodedCertificate* certificates, size_t length );
+
+ /**
+ * Notifies the HAL that a list of certificates used for SUPL connections are revoked. It is
+ * expected that the given set of certificates is removed from the internal store of the HAL.
+ *
+ * Parameters:
+ * fingerprints - A pointer to an array of SHA1 Fingerprints to identify the set of
+ * certificates to revoke.
+ * length - The number of fingerprints provided.
+ * Returns:
+ * LOC_AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully.
+ *
+ * IMPORTANT:
+ * If any of the certificates provided (through its fingerprint) is not known by the HAL,
+ * it should be ignored and continue revoking/deleting the rest of them.
+ */
+ int (*revoke_certificates) ( const LocSha1CertificateFingerprint* fingerprints, size_t length );
+} LocSuplCertificateInterface;
+
+/** Represents an NI request */
+typedef struct {
+ /** set to sizeof(LocGpsNiNotification) */
+ size_t size;
+
+ /**
+ * An ID generated by HAL to associate NI notifications and UI
+ * responses
+ */
+ int notification_id;
+
+ /**
+ * An NI type used to distinguish different categories of NI
+ * events, such as LOC_GPS_NI_TYPE_VOICE, LOC_GPS_NI_TYPE_UMTS_SUPL, ...
+ */
+ LocGpsNiType ni_type;
+
+ /**
+ * Notification/verification options, combinations of LocGpsNiNotifyFlags constants
+ */
+ LocGpsNiNotifyFlags notify_flags;
+
+ /**
+ * Timeout period to wait for user response.
+ * Set to 0 for no time out limit.
+ */
+ int timeout;
+
+ /**
+ * Default response when time out.
+ */
+ LocGpsUserResponseType default_response;
+
+ /**
+ * Requestor ID
+ */
+ char requestor_id[LOC_GPS_NI_SHORT_STRING_MAXLEN];
+
+ /**
+ * Notification message. It can also be used to store client_id in some cases
+ */
+ char text[LOC_GPS_NI_LONG_STRING_MAXLEN];
+
+ /**
+ * Client name decoding scheme
+ */
+ LocGpsNiEncodingType requestor_id_encoding;
+
+ /**
+ * Client name decoding scheme
+ */
+ LocGpsNiEncodingType text_encoding;
+
+ /**
+ * A pointer to extra data. Format:
+ * key_1 = value_1
+ * key_2 = value_2
+ */
+ char extras[LOC_GPS_NI_LONG_STRING_MAXLEN];
+
+} LocGpsNiNotification;
+
+/**
+ * Callback with NI notification. Can only be called from a thread created by
+ * create_thread_cb.
+ */
+typedef void (*loc_gps_ni_notify_callback)(LocGpsNiNotification *notification);
+
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ loc_gps_ni_notify_callback notify_cb;
+ loc_gps_create_thread create_thread_cb;
+} LocGpsNiCallbacks;
+
+/**
+ * Extended interface for Network-initiated (NI) support.
+ */
+typedef struct
+{
+ /** set to sizeof(LocGpsNiInterface) */
+ size_t size;
+
+ /** Registers the callbacks for HAL to use. */
+ void (*init) (LocGpsNiCallbacks *callbacks);
+
+ /** Sends a response to HAL. */
+ void (*respond) (int notif_id, LocGpsUserResponseType user_response);
+} LocGpsNiInterface;
+
+#define LOC_AGPS_RIL_REQUEST_SETID_IMSI (1<<0L)
+#define LOC_AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L)
+
+#define LOC_AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L)
+#define LOC_AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L)
+
+typedef void (*loc_agps_ril_request_set_id)(uint32_t flags);
+typedef void (*loc_agps_ril_request_ref_loc)(uint32_t flags);
+
+typedef struct {
+ loc_agps_ril_request_set_id request_setid;
+ loc_agps_ril_request_ref_loc request_refloc;
+ loc_gps_create_thread create_thread_cb;
+} LocAGpsRilCallbacks;
+
+/** Extended interface for AGPS_RIL support. */
+typedef struct {
+ /** set to sizeof(LocAGpsRilInterface) */
+ size_t size;
+ /**
+ * Opens the AGPS interface and provides the callback routines
+ * to the implementation of this interface.
+ */
+ void (*init)( LocAGpsRilCallbacks* callbacks );
+
+ /**
+ * Sets the reference location.
+ */
+ void (*set_ref_location) (const LocAGpsRefLocation *agps_reflocation, size_t sz_struct);
+ /**
+ * Sets the set ID.
+ */
+ void (*set_set_id) (LocAGpsSetIDType type, const char* setid);
+
+ /**
+ * Send network initiated message.
+ */
+ void (*ni_message) (uint8_t *msg, size_t len);
+
+ /**
+ * Notify GPS of network status changes.
+ * These parameters match values in the android.net.NetworkInfo class.
+ */
+ void (*update_network_state) (int connected, int type, int roaming, const char* extra_info);
+
+ /**
+ * Notify GPS of network status changes.
+ * These parameters match values in the android.net.NetworkInfo class.
+ */
+ void (*update_network_availability) (int avaiable, const char* apn);
+} LocAGpsRilInterface;
+
+/**
+ * GPS Geofence.
+ * There are 3 states associated with a Geofence: Inside, Outside, Unknown.
+ * There are 3 transitions: ENTERED, EXITED, UNCERTAIN.
+ *
+ * An example state diagram with confidence level: 95% and Unknown time limit
+ * set as 30 secs is shown below. (confidence level and Unknown time limit are
+ * explained latter)
+ * ____________________________
+ * | Unknown (30 secs) |
+ * """"""""""""""""""""""""""""
+ * ^ | | ^
+ * UNCERTAIN| |ENTERED EXITED| |UNCERTAIN
+ * | v v |
+ * ________ EXITED _________
+ * | Inside | -----------> | Outside |
+ * | | <----------- | |
+ * """""""" ENTERED """""""""
+ *
+ * Inside state: We are 95% confident that the user is inside the geofence.
+ * Outside state: We are 95% confident that the user is outside the geofence
+ * Unknown state: Rest of the time.
+ *
+ * The Unknown state is better explained with an example:
+ *
+ * __________
+ * | c|
+ * | ___ | _______
+ * | |a| | | b |
+ * | """ | """""""
+ * | |
+ * """"""""""
+ * In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy
+ * circle reported by the GPS subsystem. Now with regard to "b", the system is
+ * confident that the user is outside. But with regard to "a" is not confident
+ * whether it is inside or outside the geofence. If the accuracy remains the
+ * same for a sufficient period of time, the UNCERTAIN transition would be
+ * triggered with the state set to Unknown. If the accuracy improves later, an
+ * appropriate transition should be triggered. This "sufficient period of time"
+ * is defined by the parameter in the add_geofence_area API.
+ * In other words, Unknown state can be interpreted as a state in which the
+ * GPS subsystem isn't confident enough that the user is either inside or
+ * outside the Geofence. It moves to Unknown state only after the expiry of the
+ * timeout.
+ *
+ * The geofence callback needs to be triggered for the ENTERED and EXITED
+ * transitions, when the GPS system is confident that the user has entered
+ * (Inside state) or exited (Outside state) the Geofence. An implementation
+ * which uses a value of 95% as the confidence is recommended. The callback
+ * should be triggered only for the transitions requested by the
+ * add_geofence_area call.
+ *
+ * Even though the diagram and explanation talks about states and transitions,
+ * the callee is only interested in the transistions. The states are mentioned
+ * here for illustrative purposes.
+ *
+ * Startup Scenario: When the device boots up, if an application adds geofences,
+ * and then we get an accurate GPS location fix, it needs to trigger the
+ * appropriate (ENTERED or EXITED) transition for every Geofence it knows about.
+ * By default, all the Geofences will be in the Unknown state.
+ *
+ * When the GPS system is unavailable, loc_gps_geofence_status_callback should be
+ * called to inform the upper layers of the same. Similarly, when it becomes
+ * available the callback should be called. This is a global state while the
+ * UNKNOWN transition described above is per geofence.
+ *
+ * An important aspect to note is that users of this API (framework), will use
+ * other subsystems like wifi, sensors, cell to handle Unknown case and
+ * hopefully provide a definitive state transition to the third party
+ * application. GPS Geofence will just be a signal indicating what the GPS
+ * subsystem knows about the Geofence.
+ *
+ */
+#define LOC_GPS_GEOFENCE_ENTERED (1<<0L)
+#define LOC_GPS_GEOFENCE_EXITED (1<<1L)
+#define LOC_GPS_GEOFENCE_UNCERTAIN (1<<2L)
+
+#define LOC_GPS_GEOFENCE_UNAVAILABLE (1<<0L)
+#define LOC_GPS_GEOFENCE_AVAILABLE (1<<1L)
+
+#define LOC_GPS_GEOFENCE_OPERATION_SUCCESS 0
+#define LOC_GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES -100
+#define LOC_GPS_GEOFENCE_ERROR_ID_EXISTS -101
+#define LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN -102
+#define LOC_GPS_GEOFENCE_ERROR_INVALID_TRANSITION -103
+#define LOC_GPS_GEOFENCE_ERROR_GENERIC -149
+
+/**
+ * The callback associated with the geofence.
+ * Parameters:
+ * geofence_id - The id associated with the add_geofence_area.
+ * location - The current GPS location.
+ * transition - Can be one of LOC_GPS_GEOFENCE_ENTERED, LOC_GPS_GEOFENCE_EXITED,
+ * LOC_GPS_GEOFENCE_UNCERTAIN.
+ * timestamp - Timestamp when the transition was detected.
+ *
+ * The callback should only be called when the caller is interested in that
+ * particular transition. For instance, if the caller is interested only in
+ * ENTERED transition, then the callback should NOT be called with the EXITED
+ * transition.
+ *
+ * IMPORTANT: If a transition is triggered resulting in this callback, the GPS
+ * subsystem will wake up the application processor, if its in suspend state.
+ */
+typedef void (*loc_gps_geofence_transition_callback) (int32_t geofence_id, LocGpsLocation* location,
+ int32_t transition, LocGpsUtcTime timestamp);
+
+/**
+ * The callback associated with the availability of the GPS system for geofencing
+ * monitoring. If the GPS system determines that it cannot monitor geofences
+ * because of lack of reliability or unavailability of the GPS signals, it will
+ * call this callback with LOC_GPS_GEOFENCE_UNAVAILABLE parameter.
+ *
+ * Parameters:
+ * status - LOC_GPS_GEOFENCE_UNAVAILABLE or LOC_GPS_GEOFENCE_AVAILABLE.
+ * last_location - Last known location.
+ */
+typedef void (*loc_gps_geofence_status_callback) (int32_t status, LocGpsLocation* last_location);
+
+/**
+ * The callback associated with the add_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS
+ * LOC_GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES - geofence limit has been reached.
+ * LOC_GPS_GEOFENCE_ERROR_ID_EXISTS - geofence with id already exists
+ * LOC_GPS_GEOFENCE_ERROR_INVALID_TRANSITION - the monitorTransition contains an
+ * invalid transition
+ * LOC_GPS_GEOFENCE_ERROR_GENERIC - for other errors.
+ */
+typedef void (*loc_gps_geofence_add_callback) (int32_t geofence_id, int32_t status);
+
+/**
+ * The callback associated with the remove_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS
+ * LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
+ * LOC_GPS_GEOFENCE_ERROR_GENERIC for others.
+ */
+typedef void (*loc_gps_geofence_remove_callback) (int32_t geofence_id, int32_t status);
+
+
+/**
+ * The callback associated with the pause_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS
+ * LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
+ * LOC_GPS_GEOFENCE_ERROR_INVALID_TRANSITION -
+ * when monitor_transitions is invalid
+ * LOC_GPS_GEOFENCE_ERROR_GENERIC for others.
+ */
+typedef void (*loc_gps_geofence_pause_callback) (int32_t geofence_id, int32_t status);
+
+/**
+ * The callback associated with the resume_geofence call.
+ *
+ * Parameter:
+ * geofence_id - Id of the geofence.
+ * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS
+ * LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id
+ * LOC_GPS_GEOFENCE_ERROR_GENERIC for others.
+ */
+typedef void (*loc_gps_geofence_resume_callback) (int32_t geofence_id, int32_t status);
+
+typedef struct {
+ loc_gps_geofence_transition_callback geofence_transition_callback;
+ loc_gps_geofence_status_callback geofence_status_callback;
+ loc_gps_geofence_add_callback geofence_add_callback;
+ loc_gps_geofence_remove_callback geofence_remove_callback;
+ loc_gps_geofence_pause_callback geofence_pause_callback;
+ loc_gps_geofence_resume_callback geofence_resume_callback;
+ loc_gps_create_thread create_thread_cb;
+} LocGpsGeofenceCallbacks;
+
+/** Extended interface for GPS_Geofencing support */
+typedef struct {
+ /** set to sizeof(LocGpsGeofencingInterface) */
+ size_t size;
+
+ /**
+ * Opens the geofence interface and provides the callback routines
+ * to the implementation of this interface.
+ */
+ void (*init)( LocGpsGeofenceCallbacks* callbacks );
+
+ /**
+ * Add a geofence area. This api currently supports circular geofences.
+ * Parameters:
+ * geofence_id - The id for the geofence. If a geofence with this id
+ * already exists, an error value (LOC_GPS_GEOFENCE_ERROR_ID_EXISTS)
+ * should be returned.
+ * latitude, longtitude, radius_meters - The lat, long and radius
+ * (in meters) for the geofence
+ * last_transition - The current state of the geofence. For example, if
+ * the system already knows that the user is inside the geofence,
+ * this will be set to LOC_GPS_GEOFENCE_ENTERED. In most cases, it
+ * will be LOC_GPS_GEOFENCE_UNCERTAIN.
+ * monitor_transition - Which transitions to monitor. Bitwise OR of
+ * LOC_GPS_GEOFENCE_ENTERED, LOC_GPS_GEOFENCE_EXITED and
+ * LOC_GPS_GEOFENCE_UNCERTAIN.
+ * notification_responsiveness_ms - Defines the best-effort description
+ * of how soon should the callback be called when the transition
+ * associated with the Geofence is triggered. For instance, if set
+ * to 1000 millseconds with LOC_GPS_GEOFENCE_ENTERED, the callback
+ * should be called 1000 milliseconds within entering the geofence.
+ * This parameter is defined in milliseconds.
+ * NOTE: This is not to be confused with the rate that the GPS is
+ * polled at. It is acceptable to dynamically vary the rate of
+ * sampling the GPS for power-saving reasons; thus the rate of
+ * sampling may be faster or slower than this.
+ * unknown_timer_ms - The time limit after which the UNCERTAIN transition
+ * should be triggered. This parameter is defined in milliseconds.
+ * See above for a detailed explanation.
+ */
+ void (*add_geofence_area) (int32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int last_transition, int monitor_transitions,
+ int notification_responsiveness_ms, int unknown_timer_ms);
+
+ /**
+ * Pause monitoring a particular geofence.
+ * Parameters:
+ * geofence_id - The id for the geofence.
+ */
+ void (*pause_geofence) (int32_t geofence_id);
+
+ /**
+ * Resume monitoring a particular geofence.
+ * Parameters:
+ * geofence_id - The id for the geofence.
+ * monitor_transitions - Which transitions to monitor. Bitwise OR of
+ * LOC_GPS_GEOFENCE_ENTERED, LOC_GPS_GEOFENCE_EXITED and
+ * LOC_GPS_GEOFENCE_UNCERTAIN.
+ * This supersedes the value associated provided in the
+ * add_geofence_area call.
+ */
+ void (*resume_geofence) (int32_t geofence_id, int monitor_transitions);
+
+ /**
+ * Remove a geofence area. After the function returns, no notifications
+ * should be sent.
+ * Parameter:
+ * geofence_id - The id for the geofence.
+ */
+ void (*remove_geofence_area) (int32_t geofence_id);
+} LocGpsGeofencingInterface;
+
+/**
+ * Legacy struct to represent an estimate of the GPS clock time.
+ * Deprecated, to be removed in the next Android release.
+ * Use LocGnssClock instead.
+ */
+typedef struct {
+ /** set to sizeof(LocGpsClock) */
+ size_t size;
+ LocGpsClockFlags flags;
+ int16_t leap_second;
+ LocGpsClockType type;
+ int64_t time_ns;
+ double time_uncertainty_ns;
+ int64_t full_bias_ns;
+ double bias_ns;
+ double bias_uncertainty_ns;
+ double drift_nsps;
+ double drift_uncertainty_nsps;
+} LocGpsClock;
+
+/**
+ * Represents an estimate of the GPS clock time.
+ */
+typedef struct {
+ /** set to sizeof(LocGnssClock) */
+ size_t size;
+
+ /**
+ * A set of flags indicating the validity of the fields in this data
+ * structure.
+ */
+ LocGnssClockFlags flags;
+
+ /**
+ * Leap second data.
+ * The sign of the value is defined by the following equation:
+ * utc_time_ns = time_ns - (full_bias_ns + bias_ns) - leap_second *
+ * 1,000,000,000
+ *
+ * If the data is available 'flags' must contain LOC_GNSS_CLOCK_HAS_LEAP_SECOND.
+ */
+ int16_t leap_second;
+
+ /**
+ * The GNSS receiver internal clock value. This is the local hardware clock
+ * value.
+ *
+ * For local hardware clock, this value is expected to be monotonically
+ * increasing while the hardware clock remains power on. (For the case of a
+ * HW clock that is not continuously on, see the
+ * hw_clock_discontinuity_count field). The receiver's estimate of GPS time
+ * can be derived by substracting the sum of full_bias_ns and bias_ns (when
+ * available) from this value.
+ *
+ * This GPS time is expected to be the best estimate of current GPS time
+ * that GNSS receiver can achieve.
+ *
+ * Sub-nanosecond accuracy can be provided by means of the 'bias_ns' field.
+ * The value contains the 'time uncertainty' in it.
+ *
+ * This field is mandatory.
+ */
+ int64_t time_ns;
+
+ /**
+ * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available, 'flags' must contain
+ * LOC_GNSS_CLOCK_HAS_TIME_UNCERTAINTY. This value is effectively zero (it is
+ * the reference local clock, by which all other times and time
+ * uncertainties are measured.) (And thus this field can be not provided,
+ * per LOC_GNSS_CLOCK_HAS_TIME_UNCERTAINTY flag, or provided & set to 0.)
+ */
+ double time_uncertainty_ns;
+
+ /**
+ * The difference between hardware clock ('time' field) inside GPS receiver
+ * and the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
+ *
+ * The sign of the value is defined by the following equation:
+ * local estimate of GPS time = time_ns - (full_bias_ns + bias_ns)
+ *
+ * This value is mandatory if the receiver has estimated GPS time. If the
+ * computed time is for a non-GPS constellation, the time offset of that
+ * constellation to GPS has to be applied to fill this value. The error
+ * estimate for the sum of this and the bias_ns is the bias_uncertainty_ns,
+ * and the caller is responsible for using this uncertainty (it can be very
+ * large before the GPS time has been solved for.) If the data is available
+ * 'flags' must contain LOC_GNSS_CLOCK_HAS_FULL_BIAS.
+ */
+ int64_t full_bias_ns;
+
+ /**
+ * Sub-nanosecond bias.
+ * The error estimate for the sum of this and the full_bias_ns is the
+ * bias_uncertainty_ns
+ *
+ * If the data is available 'flags' must contain LOC_GNSS_CLOCK_HAS_BIAS. If GPS
+ * has computed a position fix. This value is mandatory if the receiver has
+ * estimated GPS time.
+ */
+ double bias_ns;
+
+ /**
+ * 1-Sigma uncertainty associated with the local estimate of GPS time (clock
+ * bias) in nanoseconds. The uncertainty is represented as an absolute
+ * (single sided) value.
+ *
+ * If the data is available 'flags' must contain
+ * LOC_GNSS_CLOCK_HAS_BIAS_UNCERTAINTY. This value is mandatory if the receiver
+ * has estimated GPS time.
+ */
+ double bias_uncertainty_ns;
+
+ /**
+ * The clock's drift in nanoseconds (per second).
+ *
+ * A positive value means that the frequency is higher than the nominal
+ * frequency, and that the (full_bias_ns + bias_ns) is growing more positive
+ * over time.
+ *
+ * The value contains the 'drift uncertainty' in it.
+ * If the data is available 'flags' must contain LOC_GNSS_CLOCK_HAS_DRIFT.
+ *
+ * This value is mandatory if the receiver has estimated GNSS time
+ */
+ double drift_nsps;
+
+ /**
+ * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per second).
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available 'flags' must contain
+ * LOC_GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY. If GPS has computed a position fix this
+ * field is mandatory and must be populated.
+ */
+ double drift_uncertainty_nsps;
+
+ /**
+ * When there are any discontinuities in the HW clock, this field is
+ * mandatory.
+ *
+ * A "discontinuity" is meant to cover the case of a switch from one source
+ * of clock to another. A single free-running crystal oscillator (XO)
+ * should generally not have any discontinuities, and this can be set and
+ * left at 0.
+ *
+ * If, however, the time_ns value (HW clock) is derived from a composite of
+ * sources, that is not as smooth as a typical XO, or is otherwise stopped &
+ * restarted, then this value shall be incremented each time a discontinuity
+ * occurs. (E.g. this value may start at zero at device boot-up and
+ * increment each time there is a change in clock continuity. In the
+ * unlikely event that this value reaches full scale, rollover (not
+ * clamping) is required, such that this value continues to change, during
+ * subsequent discontinuity events.)
+ *
+ * While this number stays the same, between LocGnssClock reports, it can be
+ * safely assumed that the time_ns value has been running continuously, e.g.
+ * derived from a single, high quality clock (XO like, or better, that's
+ * typically used during continuous GNSS signal sampling.)
+ *
+ * It is expected, esp. during periods where there are few GNSS signals
+ * available, that the HW clock be discontinuity-free as long as possible,
+ * as this avoids the need to use (waste) a GNSS measurement to fully
+ * re-solve for the GPS clock bias and drift, when using the accompanying
+ * measurements, from consecutive LocGnssData reports.
+ */
+ uint32_t hw_clock_discontinuity_count;
+
+} LocGnssClock;
+
+/**
+ * Legacy struct to represent a GPS Measurement, it contains raw and computed
+ * information.
+ * Deprecated, to be removed in the next Android release.
+ * Use LocGnssMeasurement instead.
+ */
+typedef struct {
+ /** set to sizeof(LocGpsMeasurement) */
+ size_t size;
+ LocGpsMeasurementFlags flags;
+ int8_t prn;
+ double time_offset_ns;
+ LocGpsMeasurementState state;
+ int64_t received_gps_tow_ns;
+ int64_t received_gps_tow_uncertainty_ns;
+ double c_n0_dbhz;
+ double pseudorange_rate_mps;
+ double pseudorange_rate_uncertainty_mps;
+ LocGpsAccumulatedDeltaRangeState accumulated_delta_range_state;
+ double accumulated_delta_range_m;
+ double accumulated_delta_range_uncertainty_m;
+ double pseudorange_m;
+ double pseudorange_uncertainty_m;
+ double code_phase_chips;
+ double code_phase_uncertainty_chips;
+ float carrier_frequency_hz;
+ int64_t carrier_cycles;
+ double carrier_phase;
+ double carrier_phase_uncertainty;
+ LocGpsLossOfLock loss_of_lock;
+ int32_t bit_number;
+ int16_t time_from_last_bit_ms;
+ double doppler_shift_hz;
+ double doppler_shift_uncertainty_hz;
+ LocGpsMultipathIndicator multipath_indicator;
+ double snr_db;
+ double elevation_deg;
+ double elevation_uncertainty_deg;
+ double azimuth_deg;
+ double azimuth_uncertainty_deg;
+ bool used_in_fix;
+} LocGpsMeasurement;
+
+/**
+ * Represents a GNSS Measurement, it contains raw and computed information.
+ *
+ * Independence - All signal measurement information (e.g. sv_time,
+ * pseudorange_rate, multipath_indicator) reported in this struct should be
+ * based on GNSS signal measurements only. You may not synthesize measurements
+ * by calculating or reporting expected measurements based on known or estimated
+ * position, velocity, or time.
+ */
+typedef struct {
+ /** set to sizeof(LocGnssMeasurement) */
+ size_t size;
+
+ /** A set of flags indicating the validity of the fields in this data structure. */
+ LocGnssMeasurementFlags flags;
+
+ /**
+ * Satellite vehicle ID number, as defined in LocGnssSvInfo::svid
+ * This is a mandatory value.
+ */
+ int16_t svid;
+
+ /**
+ * Defines the constellation of the given SV. Value should be one of those
+ * LOC_GNSS_CONSTELLATION_* constants
+ */
+ LocGnssConstellationType constellation;
+
+ /**
+ * Time offset at which the measurement was taken in nanoseconds.
+ * The reference receiver's time is specified by LocGpsData::clock::time_ns and should be
+ * interpreted in the same way as indicated by LocGpsClock::type.
+ *
+ * The sign of time_offset_ns is given by the following equation:
+ * measurement time = LocGpsClock::time_ns + time_offset_ns
+ *
+ * It provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy.
+ * This is a mandatory value.
+ */
+ double time_offset_ns;
+
+ /**
+ * Per satellite sync state. It represents the current sync state for the associated satellite.
+ * Based on the sync state, the 'received GPS tow' field should be interpreted accordingly.
+ *
+ * This is a mandatory value.
+ */
+ LocGnssMeasurementState state;
+
+ /**
+ * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
+ * Ensure that this field is independent (see comment at top of
+ * LocGnssMeasurement struct.)
+ *
+ * For GPS & QZSS, this is:
+ * Received GPS Time-of-Week at the measurement time, in nanoseconds.
+ * The value is relative to the beginning of the current GPS week.
+ *
+ * Given the highest sync state that can be achieved, per each satellite, valid range
+ * for this field can be:
+ * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN
+ * C/A code lock : [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set
+ * Bit sync : [ 0 20ms ] : LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC is set
+ * Subframe sync : [ 0 6s ] : LOC_GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC is set
+ * TOW decoded : [ 0 1week ] : LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED is set
+ *
+ * Note well: if there is any ambiguity in integer millisecond,
+ * LOC_GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field.
+ *
+ * This value must be populated if 'state' != LOC_GNSS_MEASUREMENT_STATE_UNKNOWN.
+ *
+ * For Glonass, this is:
+ * Received Glonass time of day, at the measurement time in nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite, valid range for
+ * this field can be:
+ * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN
+ * C/A code lock : [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set
+ * Symbol sync : [ 0 10ms ] : LOC_GNSS_MEASUREMENT_STATE_SYMBOL_SYNC is set
+ * Bit sync : [ 0 20ms ] : LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC is set
+ * String sync : [ 0 2s ] : LOC_GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC is set
+ * Time of day : [ 0 1day ] : LOC_GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED is set
+ *
+ * For Beidou, this is:
+ * Received Beidou time of week, at the measurement time in nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite, valid range for
+ * this field can be:
+ * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN
+ * C/A code lock: [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set
+ * Bit sync (D2): [ 0 2ms ] : LOC_GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC is set
+ * Bit sync (D1): [ 0 20ms ] : LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC is set
+ * Subframe (D2): [ 0 0.6s ] : LOC_GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC is set
+ * Subframe (D1): [ 0 6s ] : LOC_GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC is set
+ * Time of week : [ 0 1week ] : LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED is set
+ *
+ * For Galileo, this is:
+ * Received Galileo time of week, at the measurement time in nanoseconds.
+ *
+ * E1BC code lock : [ 0 4ms ] : LOC_GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK is set
+ * E1C 2nd code lock: [ 0 100ms ] :
+ * LOC_GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK is set
+ *
+ * E1B page : [ 0 2s ] : LOC_GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC is set
+ * Time of week: [ 0 1week ] : LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED is set
+ *
+ * For SBAS, this is:
+ * Received SBAS time, at the measurement time in nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN
+ * C/A code lock: [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set
+ * Symbol sync : [ 0 2ms ] : LOC_GNSS_MEASUREMENT_STATE_SYMBOL_SYNC is set
+ * Message : [ 0 1s ] : LOC_GNSS_MEASUREMENT_STATE_SBAS_SYNC is set
+ */
+ int64_t received_sv_time_in_ns;
+
+ /**
+ * 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds.
+ *
+ * This value must be populated if 'state' != LOC_GPS_MEASUREMENT_STATE_UNKNOWN.
+ */
+ int64_t received_sv_time_uncertainty_in_ns;
+
+ /**
+ * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+ * It contains the measured C/N0 value for the signal at the antenna port.
+ *
+ * This is a mandatory value.
+ */
+ double c_n0_dbhz;
+
+ /**
+ * Pseudorange rate at the timestamp in m/s. The correction of a given
+ * Pseudorange Rate value includes corrections for receiver and satellite
+ * clock frequency errors. Ensure that this field is independent (see
+ * comment at top of LocGnssMeasurement struct.)
+ *
+ * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and provide LocGpsClock's
+ * 'drift' field as well (When providing the uncorrected pseudorange rate, do not apply the
+ * corrections described above.)
+ *
+ * The value includes the 'pseudorange rate uncertainty' in it.
+ * A positive 'uncorrected' value indicates that the SV is moving away from the receiver.
+ *
+ * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler
+ * shift' is given by the equation:
+ * pseudorange rate = -k * doppler shift (where k is a constant)
+ *
+ * This should be the most accurate pseudorange rate available, based on
+ * fresh signal measurements from this channel.
+ *
+ * It is mandatory that this value be provided at typical carrier phase PRR
+ * quality (few cm/sec per second of uncertainty, or better) - when signals
+ * are sufficiently strong & stable, e.g. signals from a GPS simulator at >=
+ * 35 dB-Hz.
+ */
+ double pseudorange_rate_mps;
+
+ /**
+ * 1-Sigma uncertainty of the pseudorange_rate_mps.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * This is a mandatory value.
+ */
+ double pseudorange_rate_uncertainty_mps;
+
+ /**
+ * Accumulated delta range's state. It indicates whether ADR is reset or there is a cycle slip
+ * (indicating loss of lock).
+ *
+ * This is a mandatory value.
+ */
+ LocGnssAccumulatedDeltaRangeState accumulated_delta_range_state;
+
+ /**
+ * Accumulated delta range since the last channel reset in meters.
+ * A positive value indicates that the SV is moving away from the receiver.
+ *
+ * The sign of the 'accumulated delta range' and its relation to the sign of 'carrier phase'
+ * is given by the equation:
+ * accumulated delta range = -k * carrier phase (where k is a constant)
+ *
+ * This value must be populated if 'accumulated delta range state' != LOC_GPS_ADR_STATE_UNKNOWN.
+ * However, it is expected that the data is only accurate when:
+ * 'accumulated delta range state' == LOC_GPS_ADR_STATE_VALID.
+ */
+ double accumulated_delta_range_m;
+
+ /**
+ * 1-Sigma uncertainty of the accumulated delta range in meters.
+ * This value must be populated if 'accumulated delta range state' != LOC_GPS_ADR_STATE_UNKNOWN.
+ */
+ double accumulated_delta_range_uncertainty_m;
+
+ /**
+ * Carrier frequency at which codes and messages are modulated, it can be L1 or L2.
+ * If the field is not set, the carrier frequency is assumed to be L1.
+ *
+ * If the data is available, 'flags' must contain
+ * LOC_GNSS_MEASUREMENT_HAS_CARRIER_FREQUENCY.
+ */
+ float carrier_frequency_hz;
+
+ /**
+ * The number of full carrier cycles between the satellite and the receiver.
+ * The reference frequency is given by the field 'carrier_frequency_hz'.
+ * Indications of possible cycle slips and resets in the accumulation of
+ * this value can be inferred from the accumulated_delta_range_state flags.
+ *
+ * If the data is available, 'flags' must contain
+ * LOC_GNSS_MEASUREMENT_HAS_CARRIER_CYCLES.
+ */
+ int64_t carrier_cycles;
+
+ /**
+ * The RF phase detected by the receiver, in the range [0.0, 1.0].
+ * This is usually the fractional part of the complete carrier phase measurement.
+ *
+ * The reference frequency is given by the field 'carrier_frequency_hz'.
+ * The value contains the 'carrier-phase uncertainty' in it.
+ *
+ * If the data is available, 'flags' must contain
+ * LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE.
+ */
+ double carrier_phase;
+
+ /**
+ * 1-Sigma uncertainty of the carrier-phase.
+ * If the data is available, 'flags' must contain
+ * LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY.
+ */
+ double carrier_phase_uncertainty;
+
+ /**
+ * An enumeration that indicates the 'multipath' state of the event.
+ *
+ * The multipath Indicator is intended to report the presence of overlapping
+ * signals that manifest as distorted correlation peaks.
+ *
+ * - if there is a distorted correlation peak shape, report that multipath
+ * is LOC_GNSS_MULTIPATH_INDICATOR_PRESENT.
+ * - if there is not a distorted correlation peak shape, report
+ * LOC_GNSS_MULTIPATH_INDICATOR_NOT_PRESENT
+ * - if signals are too weak to discern this information, report
+ * LOC_GNSS_MULTIPATH_INDICATOR_UNKNOWN
+ *
+ * Example: when doing the standardized overlapping Multipath Performance
+ * test (3GPP TS 34.171) the Multipath indicator should report
+ * LOC_GNSS_MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and
+ * contain multipath, and LOC_GNSS_MULTIPATH_INDICATOR_NOT_PRESENT for those
+ * signals that are tracked and do not contain multipath.
+ */
+ LocGnssMultipathIndicator multipath_indicator;
+
+ /**
+ * Signal-to-noise ratio at correlator output in dB.
+ * If the data is available, 'flags' must contain LOC_GNSS_MEASUREMENT_HAS_SNR.
+ * This is the power ratio of the "correlation peak height above the
+ * observed noise floor" to "the noise RMS".
+ */
+ double snr_db;
+} LocGnssMeasurement;
+
+/**
+ * Legacy struct to represents a reading of GPS measurements.
+ * Deprecated, to be removed in the next Android release.
+ * Use LocGnssData instead.
+ */
+typedef struct {
+ /** set to sizeof(LocGpsData) */
+ size_t size;
+ size_t measurement_count;
+ LocGpsMeasurement measurements[LOC_GPS_MAX_MEASUREMENT];
+
+ /** The GPS clock time reading. */
+ LocGpsClock clock;
+} LocGpsData;
+
+/**
+ * Represents a reading of GNSS measurements. For devices where LocGnssSystemInfo's
+ * year_of_hw is set to 2016+, it is mandatory that these be provided, on
+ * request, when the GNSS receiver is searching/tracking signals.
+ *
+ * - Reporting of GPS constellation measurements is mandatory.
+ * - Reporting of all tracked constellations are encouraged.
+ */
+typedef struct {
+ /** set to sizeof(LocGnssData) */
+ size_t size;
+
+ /** Number of measurements. */
+ size_t measurement_count;
+
+ /** The array of measurements. */
+ LocGnssMeasurement measurements[LOC_GNSS_MAX_MEASUREMENT];
+
+ /** The GPS clock time reading. */
+ LocGnssClock clock;
+} LocGnssData;
+
+/**
+ * The legacy callback for to report measurements from the HAL.
+ *
+ * This callback is deprecated, and will be removed in the next release. Use
+ * loc_gnss_measurement_callback() instead.
+ *
+ * Parameters:
+ * data - A data structure containing the measurements.
+ */
+typedef void (*loc_gps_measurement_callback) (LocGpsData* data);
+
+/**
+ * The callback for to report measurements from the HAL.
+ *
+ * Parameters:
+ * data - A data structure containing the measurements.
+ */
+typedef void (*loc_gnss_measurement_callback) (LocGnssData* data);
+
+typedef struct {
+ /** set to sizeof(LocGpsMeasurementCallbacks) */
+ size_t size;
+ loc_gps_measurement_callback measurement_callback;
+ loc_gnss_measurement_callback loc_gnss_measurement_callback;
+} LocGpsMeasurementCallbacks;
+
+#define LOC_GPS_MEASUREMENT_OPERATION_SUCCESS 0
+#define LOC_GPS_MEASUREMENT_ERROR_ALREADY_INIT -100
+#define LOC_GPS_MEASUREMENT_ERROR_GENERIC -101
+
+/**
+ * Extended interface for GPS Measurements support.
+ */
+typedef struct {
+ /** Set to sizeof(LocGpsMeasurementInterface) */
+ size_t size;
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL.
+ * After a successful call to 'init' the HAL must begin to provide updates at its own phase.
+ *
+ * Status:
+ * LOC_GPS_MEASUREMENT_OPERATION_SUCCESS
+ * LOC_GPS_MEASUREMENT_ERROR_ALREADY_INIT - if a callback has already been registered without a
+ * corresponding call to 'close'
+ * LOC_GPS_MEASUREMENT_ERROR_GENERIC - if any other error occurred, it is expected that the HAL
+ * will not generate any updates upon returning this error code.
+ */
+ int (*init) (LocGpsMeasurementCallbacks* callbacks);
+
+ /**
+ * Stops updates from the HAL, and unregisters the callback routines.
+ * After a call to stop, the previously registered callbacks must be considered invalid by the
+ * HAL.
+ * If stop is invoked without a previous 'init', this function should perform no work.
+ */
+ void (*close) ();
+
+} LocGpsMeasurementInterface;
+
+#if 0
+/**
+ * Legacy struct to represents a GPS navigation message (or a fragment of it).
+ * Deprecated, to be removed in the next Android release.
+ * Use GnssNavigationMessage instead.
+ */
+typedef struct {
+ /** set to sizeof(GpsNavigationMessage) */
+ size_t size;
+ int8_t prn;
+ GpsNavigationMessageType type;
+ NavigationMessageStatus status;
+ int16_t message_id;
+ int16_t submessage_id;
+ size_t data_length;
+ uint8_t* data;
+} GpsNavigationMessage;
+
+/** Represents a GPS navigation message (or a fragment of it). */
+typedef struct {
+ /** set to sizeof(GnssNavigationMessage) */
+ size_t size;
+
+ /**
+ * Satellite vehicle ID number, as defined in LocGnssSvInfo::svid
+ * This is a mandatory value.
+ */
+ int16_t svid;
+
+ /**
+ * The type of message contained in the structure.
+ * This is a mandatory value.
+ */
+ GnssNavigationMessageType type;
+
+ /**
+ * The status of the received navigation message.
+ * No need to send any navigation message that contains words with parity error and cannot be
+ * corrected.
+ */
+ NavigationMessageStatus status;
+
+ /**
+ * Message identifier. It provides an index so the complete Navigation
+ * Message can be assembled.
+ *
+ * - For GPS L1 C/A subframe 4 and 5, this value corresponds to the 'frame
+ * id' of the navigation message, in the range of 1-25 (Subframe 1, 2, 3
+ * does not contain a 'frame id' and this value can be set to -1.)
+ *
+ * - For Glonass L1 C/A, this refers to the frame ID, in the range of 1-5.
+ *
+ * - For BeiDou D1, this refers to the frame number in the range of 1-24
+ *
+ * - For Beidou D2, this refers to the frame number, in the range of 1-120
+ *
+ * - For Galileo F/NAV nominal frame structure, this refers to the subframe
+ * number, in the range of 1-12
+ *
+ * - For Galileo I/NAV nominal frame structure, this refers to the subframe
+ * number in the range of 1-24
+ */
+ int16_t message_id;
+
+ /**
+ * Sub-message identifier. If required by the message 'type', this value
+ * contains a sub-index within the current message (or frame) that is being
+ * transmitted.
+ *
+ * - For GPS L1 C/A, BeiDou D1 & BeiDou D2, the submessage id corresponds to
+ * the subframe number of the navigation message, in the range of 1-5.
+ *
+ * - For Glonass L1 C/A, this refers to the String number, in the range from
+ * 1-15
+ *
+ * - For Galileo F/NAV, this refers to the page type in the range 1-6
+ *
+ * - For Galileo I/NAV, this refers to the word type in the range 1-10+
+ */
+ int16_t submessage_id;
+
+ /**
+ * The length of the data (in bytes) contained in the current message.
+ * If this value is different from zero, 'data' must point to an array of the same size.
+ * e.g. for L1 C/A the size of the sub-frame will be 40 bytes (10 words, 30 bits/word).
+ *
+ * This is a mandatory value.
+ */
+ size_t data_length;
+
+ /**
+ * The data of the reported GPS message. The bytes (or words) specified
+ * using big endian format (MSB first).
+ *
+ * - For GPS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit
+ * words. Each word (30 bits) should be fit into the last 30 bits in a
+ * 4-byte word (skip B31 and B32), with MSB first, for a total of 40
+ * bytes, covering a time period of 6, 6, and 0.6 seconds, respectively.
+ *
+ * - For Glonass L1 C/A, each string contains 85 data bits, including the
+ * checksum. These bits should be fit into 11 bytes, with MSB first (skip
+ * B86-B88), covering a time period of 2 seconds.
+ *
+ * - For Galileo F/NAV, each word consists of 238-bit (sync & tail symbols
+ * excluded). Each word should be fit into 30-bytes, with MSB first (skip
+ * B239, B240), covering a time period of 10 seconds.
+ *
+ * - For Galileo I/NAV, each page contains 2 page parts, even and odd, with
+ * a total of 2x114 = 228 bits, (sync & tail excluded) that should be fit
+ * into 29 bytes, with MSB first (skip B229-B232).
+ */
+ uint8_t* data;
+
+} GnssNavigationMessage;
+
+/**
+ * The legacy callback to report an available fragment of a GPS navigation
+ * messages from the HAL.
+ *
+ * This callback is deprecated, and will be removed in the next release. Use
+ * gnss_navigation_message_callback() instead.
+ *
+ * Parameters:
+ * message - The GPS navigation submessage/subframe representation.
+ */
+typedef void (*gps_navigation_message_callback) (GpsNavigationMessage* message);
+
+/**
+ * The callback to report an available fragment of a GPS navigation messages from the HAL.
+ *
+ * Parameters:
+ * message - The GPS navigation submessage/subframe representation.
+ */
+typedef void (*gnss_navigation_message_callback) (GnssNavigationMessage* message);
+
+typedef struct {
+ /** set to sizeof(GpsNavigationMessageCallbacks) */
+ size_t size;
+ gps_navigation_message_callback navigation_message_callback;
+ gnss_navigation_message_callback gnss_navigation_message_callback;
+} GpsNavigationMessageCallbacks;
+
+#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 0
+#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT -100
+#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC -101
+
+/**
+ * Extended interface for GPS navigation message reporting support.
+ */
+typedef struct {
+ /** Set to sizeof(GpsNavigationMessageInterface) */
+ size_t size;
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL.
+ * After a successful call to 'init' the HAL must begin to provide updates as they become
+ * available.
+ *
+ * Status:
+ * GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS
+ * GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT - if a callback has already been registered
+ * without a corresponding call to 'close'.
+ * GPS_NAVIGATION_MESSAGE_ERROR_GENERIC - if any other error occurred, it is expected that
+ * the HAL will not generate any updates upon returning this error code.
+ */
+ int (*init) (GpsNavigationMessageCallbacks* callbacks);
+
+ /**
+ * Stops updates from the HAL, and unregisters the callback routines.
+ * After a call to stop, the previously registered callbacks must be considered invalid by the
+ * HAL.
+ * If stop is invoked without a previous 'init', this function should perform no work.
+ */
+ void (*close) ();
+
+} GpsNavigationMessageInterface;
+#endif
+
+/**
+ * Interface for passing GNSS configuration contents from platform to HAL.
+ */
+typedef struct {
+ /** Set to sizeof(LocGnssConfigurationInterface) */
+ size_t size;
+
+ /**
+ * Deliver GNSS configuration contents to HAL.
+ * Parameters:
+ * config_data - a pointer to a char array which holds what usually is expected from
+ file(/vendor/etc/gps.conf), i.e., a sequence of UTF8 strings separated by '\n'.
+ * length - total number of UTF8 characters in configuraiton data.
+ *
+ * IMPORTANT:
+ * GPS HAL should expect this function can be called multiple times. And it may be
+ * called even when GpsLocationProvider is already constructed and enabled. GPS HAL
+ * should maintain the existing requests for various callback regardless the change
+ * in configuration data.
+ */
+ void (*configuration_update) (const char* config_data, int32_t length);
+} LocGnssConfigurationInterface;
+
+__END_DECLS
+
+#endif /* LOC_GPS_H */
+
diff --git a/gps/utils/loc_log.cpp b/gps/utils/loc_log.cpp
new file mode 100644
index 0000000..5bb96b8
--- /dev/null
+++ b/gps/utils/loc_log.cpp
@@ -0,0 +1,219 @@
+/* Copyright (c) 2011-2012, 2015, 2020, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include "log_util.h"
+#include "loc_log.h"
+#include "msg_q.h"
+#include <loc_pla.h>
+#include "LogBuffer.h"
+
+#define BUFFER_SIZE 120
+
+// Logging Improvements
+const char *loc_logger_boolStr[]={"False","True"};
+const char VOID_RET[] = "None";
+const char FROM_AFW[] = "===>";
+const char TO_MODEM[] = "--->";
+const char FROM_MODEM[] = "<---";
+const char TO_AFW[] = "<===";
+const char EXIT_TAG[] = "Exiting";
+const char ENTRY_TAG[] = "Entering";
+const char EXIT_ERROR_TAG[] = "Exiting with error";
+
+const string gEmptyStr = "";
+const string gUnknownStr = "UNKNOWN";
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* returns the least signification bit that is set in the mask
+ Param
+ mask - bit mask.
+ clearTheBit - if true, mask gets modified upon return.
+ returns 0 if mask is 0.
+*/
+uint64_t loc_get_least_bit(uint64_t& mask, bool clearTheBit) {
+ uint64_t bit = 0;
+
+ if (mask > 0) {
+ uint64_t less1 = mask - 1;
+ bit = mask & ~(less1);
+ if (clearTheBit) {
+ mask &= less1;
+ }
+ }
+
+ return bit;
+}
+
+string loc_get_bit_defs(uint64_t mask, const NameValTbl& tbl) {
+ string out;
+ while (mask > 0) {
+ out += loc_get_name_from_tbl(tbl, loc_get_least_bit(mask));
+ if (mask > 0) {
+ out += " | ";
+ }
+ }
+ return out;
+}
+
+DECLARE_TBL(loc_msg_q_status) =
+{
+ NAME_VAL( eMSG_Q_SUCCESS ),
+ NAME_VAL( eMSG_Q_FAILURE_GENERAL ),
+ NAME_VAL( eMSG_Q_INVALID_PARAMETER ),
+ NAME_VAL( eMSG_Q_INVALID_HANDLE ),
+ NAME_VAL( eMSG_Q_UNAVAILABLE_RESOURCE ),
+ NAME_VAL( eMSG_Q_INSUFFICIENT_BUFFER )
+};
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status_tbl, (int64_t) status);
+}
+
+//Target names
+DECLARE_TBL(target_name) =
+{
+ NAME_VAL(GNSS_NONE),
+ NAME_VAL(GNSS_MSM),
+ NAME_VAL(GNSS_GSS),
+ NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_AUTO),
+ NAME_VAL(GNSS_UNKNOWN)
+};
+
+/*===========================================================================
+
+FUNCTION loc_get_target_name
+
+DESCRIPTION
+ Returns pointer to a string that contains name of the target
+
+ XX:XX:XX.000\0
+
+RETURN VALUE
+ The target name string
+
+===========================================================================*/
+const char *loc_get_target_name(unsigned int target)
+{
+ int64_t index = 0;
+ static char ret[BUFFER_SIZE];
+
+ snprintf(ret, sizeof(ret), " %s with%s SSC",
+ loc_get_name_from_val(target_name_tbl, getTargetGnssType(target)),
+ ((target & HAS_SSC) == HAS_SSC) ? gEmptyStr.c_str() : "out");
+
+ return ret;
+}
+
+
+/*===========================================================================
+
+FUNCTION loc_get_time
+
+DESCRIPTION
+ Logs a callback event header.
+ The pointer time_string should point to a buffer of at least 13 bytes:
+
+ XX:XX:XX.000\0
+
+RETURN VALUE
+ The time string
+
+===========================================================================*/
+char *loc_get_time(char *time_string, size_t buf_size)
+{
+ struct timeval now; /* sec and usec */
+ struct tm now_tm; /* broken-down time */
+ char hms_string[80]; /* HH:MM:SS */
+
+ gettimeofday(&now, NULL);
+ localtime_r(&now.tv_sec, &now_tm);
+
+ strftime(hms_string, sizeof hms_string, "%H:%M:%S", &now_tm);
+ snprintf(time_string, buf_size, "%s.%03d", hms_string, (int) (now.tv_usec / 1000));
+
+ return time_string;
+}
+
+/*===========================================================================
+FUNCTION get_timestamp
+
+DESCRIPTION
+ Generates a timestamp using the current system time
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Char pointer to the parameter str
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+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;
+}
+
+/*===========================================================================
+
+FUNCTION log_buffer_insert
+
+DESCRIPTION
+ Insert a log sentence with specific level to the log buffer.
+
+RETURN VALUE
+ N/A
+
+===========================================================================*/
+void log_buffer_insert(char *str, unsigned long buf_size, int level)
+{
+ timespec tv;
+ clock_gettime(CLOCK_BOOTTIME, &tv);
+ uint64_t elapsedTime = (uint64_t)tv.tv_sec + (uint64_t)tv.tv_nsec/1000000000;
+ string ss = str;
+ loc_util::LogBuffer::getInstance()->append(ss, level, elapsedTime);
+}
diff --git a/gps/utils/loc_log.h b/gps/utils/loc_log.h
new file mode 100644
index 0000000..b750932
--- /dev/null
+++ b/gps/utils/loc_log.h
@@ -0,0 +1,122 @@
+/* Copyright (c) 2011-2012, 2015, 2020 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_LOG_H
+#define LOC_LOG_H
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unordered_map>
+#include <string>
+#include "loc_target.h"
+#include "loc_misc_utils.h"
+
+using std::string;
+using std::unordered_map;
+
+typedef unordered_map<int64_t, string> NameValTbl;
+
+#define NAME_VAL(x) {x, "" #x ""}
+#define DECLARE_TBL(T) static const NameValTbl T##_tbl
+
+extern const string gEmptyStr;
+extern const string gUnknownStr;
+
+#define CHECK_MASK(type, value, mask_var, mask) \
+ (((mask_var) & (mask)) ? (type) (value) : (type) (-1))
+
+#define LOC_TABLE_SIZE(table) (sizeof(table)/sizeof((table)[0]))
+
+#define FIELDVAL_DEC(field) \
+ loc_put_tag_val(#field, to_string(field))
+#define FIELDVAL_DEC_ARR(field) \
+ loc_put_tag_val(#field, \
+ loc_parenthesize(loc_prim_arr_to_string(field, \
+ sizeof(field)/sizeof(field[0]))))
+#define FIELDVAL_HEX(field) \
+ loc_put_tag_val(#field, to_string_hex(field))
+#define FIELDVAL_HEX_ARR(field) \
+ loc_put_tag_val(#field, \
+ loc_parenthesize(loc_prim_arr_to_string(field, \
+ sizeof(field)/sizeof(field[0]), \
+ false)))
+#define FIELDVAL_ENUM(field, tbl) \
+ loc_put_tag_val(#field, \
+ loc_get_name_from_tbl(tbl, field, gUnknownStr))
+#define FIELDVAL_MASK(field, tbl) \
+ loc_put_tag_val(#field, \
+ to_string_hex((uint64_t)field) + " " + \
+ loc_parenthesize(loc_get_bit_defs(field, tbl)))
+
+/* get from a table of strings with index */
+/* tbl - map of <int, string> entries
+ key - key to the matching entry
+ defalt - default pointer in case of incorrect parameters
+ */
+inline static const string& loc_get_name_from_tbl(const NameValTbl& tbl, int64_t key,
+ const string& defalt = gEmptyStr) {
+ auto item = tbl.find(key);
+ if (item != tbl.end()) {
+ return item->second;
+ } else {
+ return defalt;
+ }
+}
+
+/* puts to string formatted "TAG: VAL" with option ending string, default to newline */
+inline string loc_put_tag_val(const string& tag, const string& val, const string& eol = "\n") {
+ return tag + ": " + val + eol;
+}
+
+inline string loc_parenthesize(const string& str) {
+ return "(" + str + ")";
+}
+
+/* Get names from value */
+inline const char* loc_get_name_from_val(const NameValTbl& table, int64_t value) {
+ return loc_get_name_from_tbl(table, value, gUnknownStr).c_str();
+}
+
+inline const char* log_succ_fail_string(int is_succ) {
+ return is_succ? "successful" : "failed";
+}
+
+/* prints mask into a string with bit definitions from tbl */
+/* mask - bit mask, to be expanded into " BIT_NAMEx | BIT_NAMEy ... "
+ tbl - a table with defs for each bit, defined as <bit, name> entries
+ {{bit0, "BIT0_NAME"}, {bit1, "BIT1_NAME"}, .... {bitn, "BITn_NAME"} }
+ entries - number of strings in the table
+ */
+string loc_get_bit_defs(uint64_t mask, const NameValTbl& tbl);
+uint64_t loc_get_least_bit(uint64_t& mask, bool clearThebit = true);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+char *loc_get_time(char *time_string, size_t buf_size);
+
+#endif /* LOC_LOG_H */
diff --git a/gps/utils/loc_misc_utils.cpp b/gps/utils/loc_misc_utils.cpp
new file mode 100644
index 0000000..d674ec5
--- /dev/null
+++ b/gps/utils/loc_misc_utils.cpp
@@ -0,0 +1,157 @@
+/* Copyright (c) 2014, 2020 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
+#include <stdio.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#include <ctype.h>
+
+
+int loc_util_split_string(char *raw_string, char **split_strings_ptr,
+ int max_num_substrings, char delimiter)
+{
+ int raw_string_index=0;
+ int num_split_strings=0;
+ unsigned char end_string=0;
+ int raw_string_length=0;
+
+ if(!raw_string || !split_strings_ptr) {
+ LOC_LOGE("%s:%d]: NULL parameters", __func__, __LINE__);
+ num_split_strings = -1;
+ goto err;
+ }
+ LOC_LOGD("%s:%d]: raw string: %s\n", __func__, __LINE__, raw_string);
+ raw_string_length = strlen(raw_string) + 1;
+ split_strings_ptr[num_split_strings] = &raw_string[raw_string_index];
+ for(raw_string_index=0; raw_string_index < raw_string_length; raw_string_index++) {
+ if(raw_string[raw_string_index] == '\0')
+ end_string=1;
+ if((raw_string[raw_string_index] == delimiter) || end_string) {
+ raw_string[raw_string_index] = '\0';
+ LOC_LOGD("%s:%d]: split string: %s\n",
+ __func__, __LINE__, split_strings_ptr[num_split_strings]);
+ num_split_strings++;
+ if(((raw_string_index + 1) < raw_string_length) &&
+ (num_split_strings < max_num_substrings)) {
+ split_strings_ptr[num_split_strings] = &raw_string[raw_string_index+1];
+ }
+ else {
+ break;
+ }
+ }
+ if(end_string)
+ break;
+ }
+err:
+ LOC_LOGD("%s:%d]: num_split_strings: %d\n", __func__, __LINE__, num_split_strings);
+ return num_split_strings;
+}
+
+void loc_util_trim_space(char *org_string)
+{
+ char *scan_ptr, *write_ptr;
+ char *first_nonspace = NULL, *last_nonspace = NULL;
+
+ if(org_string == NULL) {
+ LOC_LOGE("%s:%d]: NULL parameter", __func__, __LINE__);
+ goto err;
+ }
+
+ scan_ptr = write_ptr = org_string;
+
+ while (*scan_ptr) {
+ //Find the first non-space character
+ if ( !isspace(*scan_ptr) && first_nonspace == NULL) {
+ first_nonspace = scan_ptr;
+ }
+ //Once the first non-space character is found in the
+ //above check, keep shifting the characters to the left
+ //to replace the spaces
+ if (first_nonspace != NULL) {
+ *(write_ptr++) = *scan_ptr;
+ //Keep track of which was the last non-space character
+ //encountered
+ //last_nonspace will not be updated in the case where
+ //the string ends with spaces
+ if ( !isspace(*scan_ptr)) {
+ last_nonspace = write_ptr;
+ }
+ }
+ scan_ptr++;
+ }
+ //Add NULL terminator after the last non-space character
+ if (last_nonspace) { *last_nonspace = '\0'; }
+err:
+ return;
+}
+
+inline void logDlError(const char* failedCall) {
+ const char * err = dlerror();
+ LOC_LOGe("%s error: %s", failedCall, (nullptr == err) ? "unknown" : err);
+}
+
+void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName)
+{
+ void* sym = nullptr;
+ if ((nullptr != libHandle || nullptr != libName) && nullptr != symName) {
+ if (nullptr == libHandle) {
+ libHandle = dlopen(libName, RTLD_NOW);
+ if (nullptr == libHandle) {
+ logDlError("dlopen");
+ }
+ }
+ // NOT else, as libHandle gets assigned 5 line above
+ if (nullptr != libHandle) {
+ sym = dlsym(libHandle, symName);
+ if (nullptr == sym) {
+ logDlError("dlsym");
+ }
+ }
+ } else {
+ LOC_LOGe("Either libHandle (%p) or libName (%p) must not be null; "
+ "symName (%p) can not be null.", libHandle, libName, symName);
+ }
+
+ return sym;
+}
+
+uint64_t getQTimerTickCount()
+{
+ uint64_t qTimerCount = 0;
+#if __aarch64__
+ asm volatile("mrs %0, cntvct_el0" : "=r" (qTimerCount));
+#else
+ asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (qTimerCount));
+#endif
+
+ return qTimerCount;
+}
diff --git a/gps/utils/loc_misc_utils.h b/gps/utils/loc_misc_utils.h
new file mode 100644
index 0000000..840947d
--- /dev/null
+++ b/gps/utils/loc_misc_utils.h
@@ -0,0 +1,228 @@
+/* Copyright (c) 2014, 2020 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_MISC_UTILS_H_
+#define _LOC_MISC_UTILS_H_
+#include <ios>
+#include <string>
+#include <sstream>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stddef.h>
+#include <stdint.h>
+/*===========================================================================
+FUNCTION loc_split_string
+
+DESCRIPTION:
+ This function is used to split a delimiter separated string into
+ sub-strings. This function does not allocate new memory to store the split
+ strings. Instead, it places '\0' in places of delimiters and assings the
+ starting address of the substring within the raw string as the string address
+ The input raw_string no longer remains to be a collection of sub-strings
+ after this function is executed.
+ Please make a copy of the input string before calling this function if
+ necessary
+
+PARAMETERS:
+ char *raw_string: is the original string with delimiter separated substrings
+ char **split_strings_ptr: is the arraw of pointers which will hold the addresses
+ of individual substrings
+ int max_num_substrings: is the maximum number of substrings that are expected
+ by the caller. The array of pointers in the above parameter
+ is usually this long
+ char delimiter: is the delimiter that separates the substrings. Examples: ' ', ';'
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ int Number of split strings
+
+SIDE EFFECTS
+ The input raw_string no longer remains a delimiter separated single string.
+
+EXAMPLE
+ delimiter = ' ' //space
+ raw_string = "hello new user" //delimiter is space ' '
+ addresses = 0123456789abcd
+ split_strings_ptr[0] = &raw_string[0]; //split_strings_ptr[0] contains "hello"
+ split_strings_ptr[1] = &raw_string[6]; //split_strings_ptr[1] contains "new"
+ split_strings_ptr[2] = &raw_string[a]; //split_strings_ptr[2] contains "user"
+
+===========================================================================*/
+int loc_util_split_string(char *raw_string, char **split_strings_ptr, int max_num_substrings,
+ char delimiter);
+
+/*===========================================================================
+FUNCTION trim_space
+
+DESCRIPTION
+ Removes leading and trailing spaces of the string
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void loc_util_trim_space(char *org_string);
+
+/*===========================================================================
+FUNCTION dlGetSymFromLib
+
+DESCRIPTION
+ Handy function to get a pointer to a symbol from a library.
+
+ If libHandle is not null, it will be used as the handle to the library. In
+ that case libName wll not be used;
+ libHandle is an in / out parameter.
+ If libHandle is null, libName will be used to dlopen.
+ Either libHandle or libName must not be nullptr.
+ symName must not be null.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ pointer to symName. Could be nullptr if
+ Parameters are incorrect; or
+ libName can not be opened; or
+ symName can not be found.
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName);
+
+/*===========================================================================
+FUNCTION getQTimerTickCount
+
+DESCRIPTION
+ This function is used to read the QTimer ticks count. This value is globally maintained and
+ must be the same across all processors on a target.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ uint64_t QTimer tick count
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+uint64_t getQTimerTickCount();
+
+#ifdef __cplusplus
+}
+#endif
+
+using std::hex;
+using std::string;
+using std::stringstream;
+
+/*===========================================================================
+FUNCTION to_string_hex
+
+DESCRIPTION
+ This function works similar to std::to_string, but puts only in hex format.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ string, of input val in hex format
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+template <typename T>
+string to_string_hex(T val) {
+ stringstream ss;
+ if (val < 0) {
+ val = -val;
+ ss << "-";
+ }
+ ss << hex << "0x" << val;
+ return ss.str();
+}
+
+/*===========================================================================
+FUNCTION loc_prim_arr_to_string
+
+DESCRIPTION
+ This function puts out primitive array in DEC or EHX format.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ string, space separated string of values in the input array, either
+ in decimal or hex format, depending on the value of decIfTrue
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+template <typename T>
+static string loc_prim_arr_to_string(T* arr, uint32_t size, bool decIfTrue = true) {
+ stringstream ss;
+ for (uint32_t i = 0; i < size; i++) {
+ ss << (decIfTrue ? to_string(arr[i]) : to_string_hex(arr[i]));
+ if (i != size - 1) {
+ ss << " ";
+ }
+ }
+ return ss.str();
+}
+
+/*===========================================================================
+FUNCTION qTimerTicksToNanos
+
+DESCRIPTION
+ Transform from ticks to nanoseconds, clock is 19.2 MHz
+ so the formula would be qtimer(ns) = (ticks * 1000000000) / 19200000
+ or simplified qtimer(ns) = (ticks * 10000) / 192.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Qtimer value in nanoseconds
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+inline uint64_t qTimerTicksToNanos(double qTimer) {
+ return (uint64_t((qTimer * double(10000ull)) / (double)192ull));
+}
+
+#endif //_LOC_MISC_UTILS_H_
diff --git a/gps/utils/loc_nmea.cpp b/gps/utils/loc_nmea.cpp
new file mode 100644
index 0000000..3f28f04
--- /dev/null
+++ b/gps/utils/loc_nmea.cpp
@@ -0,0 +1,2335 @@
+/* Copyright (c) 2012-2020, 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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_nmea"
+#include <loc_nmea.h>
+#include <math.h>
+#include <log_util.h>
+#include <loc_pla.h>
+#include <loc_cfg.h>
+
+#define GLONASS_SV_ID_OFFSET 64
+#define QZSS_SV_ID_OFFSET (192)
+#define BDS_SV_ID_OFFSET (200)
+#define GALILEO_SV_ID_OFFSET (300)
+#define MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION 64
+#define MAX_SATELLITES_IN_USE 12
+#define MSEC_IN_ONE_WEEK 604800000ULL
+#define UTC_GPS_OFFSET_MSECS 315964800000ULL
+
+// GNSS system id according to NMEA spec
+#define SYSTEM_ID_GPS 1
+#define SYSTEM_ID_GLONASS 2
+#define SYSTEM_ID_GALILEO 3
+#define SYSTEM_ID_BDS 4
+#define SYSTEM_ID_QZSS 5
+#define SYSTEM_ID_NAVIC 6
+
+//GNSS signal id according to NMEA spec
+#define SIGNAL_ID_ALL_SIGNALS 0
+#define SIGNAL_ID_GPS_L1CA 1
+#define SIGNAL_ID_GPS_L1P 2
+#define SIGNAL_ID_GPS_L1M 3
+#define SIGNAL_ID_GPS_L2P 4
+#define SIGNAL_ID_GPS_L2CM 5
+#define SIGNAL_ID_GPS_L2CL 6
+#define SIGNAL_ID_GPS_L5I 7
+#define SIGNAL_ID_GPS_L5Q 8
+
+
+#define SIGNAL_ID_GLO_G1CA 1
+#define SIGNAL_ID_GLO_G1P 2
+#define SIGNAL_ID_GLO_G2CA 3
+#define SIGNAL_ID_GLO_G2P 4
+
+
+#define SIGNAL_ID_GAL_E5A 1
+#define SIGNAL_ID_GAL_E5B 2
+#define SIGNAL_ID_GAL_E5AB 3
+#define SIGNAL_ID_GAL_E6A 4
+#define SIGNAL_ID_GAL_E6BC 5
+#define SIGNAL_ID_GAL_L1A 6
+#define SIGNAL_ID_GAL_L1BC 7
+
+#define SIGNAL_ID_BDS_B1I 1
+#define SIGNAL_ID_BDS_B1Q 2
+#define SIGNAL_ID_BDS_B1C 3
+#define SIGNAL_ID_BDS_B1A 4
+#define SIGNAL_ID_BDS_B2A 5
+#define SIGNAL_ID_BDS_B2B 6
+#define SIGNAL_ID_BDS_B2AB 7
+#define SIGNAL_ID_BDS_B3I 8
+#define SIGNAL_ID_BDS_B3Q 9
+#define SIGNAL_ID_BDS_B3A 0xA
+#define SIGNAL_ID_BDS_B2I 0xB
+#define SIGNAL_ID_BDS_B2Q 0xC
+
+#define SIGNAL_ID_QZSS_L1CA 1
+#define SIGNAL_ID_QZSS_L1CD 2
+#define SIGNAL_ID_QZSS_L1CP 3
+#define SIGNAL_ID_QZSS_LIS 4
+#define SIGNAL_ID_QZSS_L2CM 5
+#define SIGNAL_ID_QZSS_L2CL 6
+#define SIGNAL_ID_QZSS_L5I 7
+#define SIGNAL_ID_QZSS_L5Q 8
+#define SIGNAL_ID_QZSS_L6D 9
+#define SIGNAL_ID_QZSS_L6E 0xA
+
+#define SIGNAL_ID_NAVIC_L5SPS 1
+#define SIGNAL_ID_NAVIC_SSPS 2
+#define SIGNAL_ID_NAVIC_L5RS 3
+#define SIGNAL_ID_NAVIC_SRS 4
+#define SIGNAL_ID_NAVIC_L1SPS 5
+
+
+typedef struct loc_nmea_sv_meta_s
+{
+ char talker[3];
+ LocGnssConstellationType svType;
+ uint64_t mask;
+ uint32_t svCount;
+ uint32_t totalSvUsedCount;
+ uint32_t svIdOffset;
+ uint32_t signalId;
+ uint32_t systemId;
+} loc_nmea_sv_meta;
+
+typedef struct loc_sv_cache_info_s
+{
+ uint64_t gps_used_mask;
+ uint64_t glo_used_mask;
+ uint64_t gal_used_mask;
+ uint64_t qzss_used_mask;
+ uint64_t bds_used_mask;
+ uint64_t navic_used_mask;
+ uint32_t gps_l1_count;
+ uint32_t gps_l2_count;
+ uint32_t gps_l5_count;
+ uint32_t glo_g1_count;
+ uint32_t glo_g2_count;
+ uint32_t gal_e1_count;
+ uint32_t gal_e5_count;
+ uint32_t gal_e5b_count;
+ uint32_t qzss_l1_count;
+ uint32_t qzss_l2_count;
+ uint32_t qzss_l5_count;
+ uint32_t bds_b1_count;
+ uint32_t bds_b2_count;
+ uint32_t navic_l5_count;
+ float hdop;
+ float pdop;
+ float vdop;
+} loc_sv_cache_info;
+
+/*===========================================================================
+FUNCTION convert_Lla_to_Ecef
+
+DESCRIPTION
+ Convert LLA to ECEF
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ NONE
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void convert_Lla_to_Ecef(const LocLla& plla, LocEcef& pecef)
+{
+ double r;
+
+ r = MAJA / sqrt(1.0 - ESQR * sin(plla.lat) * sin(plla.lat));
+ pecef.X = (r + plla.alt) * cos(plla.lat) * cos(plla.lon);
+ pecef.Y = (r + plla.alt) * cos(plla.lat) * sin(plla.lon);
+ pecef.Z = (r * OMES + plla.alt) * sin(plla.lat);
+}
+
+/*===========================================================================
+FUNCTION convert_WGS84_to_PZ90
+
+DESCRIPTION
+ Convert datum from WGS84 to PZ90
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ NONE
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void convert_WGS84_to_PZ90(const LocEcef& pWGS84, LocEcef& pPZ90)
+{
+ double deltaX = DatumConstFromWGS84[0];
+ double deltaY = DatumConstFromWGS84[1];
+ double deltaZ = DatumConstFromWGS84[2];
+ double deltaScale = DatumConstFromWGS84[3];
+ double rotX = DatumConstFromWGS84[4];
+ double rotY = DatumConstFromWGS84[5];
+ double rotZ = DatumConstFromWGS84[6];
+
+ pPZ90.X = deltaX + deltaScale * (pWGS84.X + rotZ * pWGS84.Y - rotY * pWGS84.Z);
+ pPZ90.Y = deltaY + deltaScale * (pWGS84.Y - rotZ * pWGS84.X + rotX * pWGS84.Z);
+ pPZ90.Z = deltaZ + deltaScale * (pWGS84.Z + rotY * pWGS84.X - rotX * pWGS84.Y);
+}
+
+/*===========================================================================
+FUNCTION convert_Ecef_to_Lla
+
+DESCRIPTION
+ Convert ECEF to LLA
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ NONE
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void convert_Ecef_to_Lla(const LocEcef& pecef, LocLla& plla)
+{
+ double p, r;
+ double EcefA = C_PZ90A;
+ double EcefB = C_PZ90B;
+ double Ecef1Mf;
+ double EcefE2;
+ double Mu;
+ double Smu;
+ double Cmu;
+ double Phi;
+ double Sphi;
+ double N;
+
+ p = sqrt(pecef.X * pecef.X + pecef.Y * pecef.Y);
+ r = sqrt(p * p + pecef.Z * pecef.Z);
+ if (r < 1.0) {
+ plla.lat = 1.0;
+ plla.lon = 1.0;
+ plla.alt = 1.0;
+ }
+ Ecef1Mf = 1.0 - (EcefA - EcefB) / EcefA;
+ EcefE2 = 1.0 - (EcefB * EcefB) / (EcefA * EcefA);
+ if (p > 1.0) {
+ Mu = atan2(pecef.Z * (Ecef1Mf + EcefE2 * EcefA / r), p);
+ } else {
+ if (pecef.Z > 0.0) {
+ Mu = M_PI / 2.0;
+ } else {
+ Mu = -M_PI / 2.0;
+ }
+ }
+ Smu = sin(Mu);
+ Cmu = cos(Mu);
+ Phi = atan2(pecef.Z * Ecef1Mf + EcefE2 * EcefA * Smu * Smu * Smu,
+ Ecef1Mf * (p - EcefE2 * EcefA * Cmu * Cmu * Cmu));
+ Sphi = sin(Phi);
+ N = EcefA / sqrt(1.0 - EcefE2 * Sphi * Sphi);
+ plla.alt = p * cos(Phi) + pecef.Z * Sphi - EcefA * EcefA/N;
+ plla.lat = Phi;
+ if ( p > 1.0) {
+ plla.lon = atan2(pecef.Y, pecef.X);
+ } else {
+ plla.lon = 0.0;
+ }
+}
+
+/*===========================================================================
+FUNCTION convert_signalType_to_signalId
+
+DESCRIPTION
+ convert signalType to signal ID
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ value of signal ID
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static uint32_t convert_signalType_to_signalId(GnssSignalTypeMask signalType)
+{
+ uint32_t signalId = SIGNAL_ID_ALL_SIGNALS;
+
+ switch (signalType) {
+ case GNSS_SIGNAL_GPS_L1CA:
+ signalId = SIGNAL_ID_GPS_L1CA;
+ break;
+ case GNSS_SIGNAL_GPS_L2:
+ signalId = SIGNAL_ID_GPS_L2CL;
+ break;
+ case GNSS_SIGNAL_GPS_L5:
+ signalId = SIGNAL_ID_GPS_L5Q;
+ break;
+ case GNSS_SIGNAL_GLONASS_G1:
+ signalId = SIGNAL_ID_GLO_G1CA;
+ break;
+ case GNSS_SIGNAL_GLONASS_G2:
+ signalId = SIGNAL_ID_GLO_G2CA;
+ break;
+ case GNSS_SIGNAL_GALILEO_E1:
+ signalId = SIGNAL_ID_GAL_L1BC;
+ break;
+ case GNSS_SIGNAL_GALILEO_E5A:
+ signalId = SIGNAL_ID_GAL_E5A;
+ break;
+ case GNSS_SIGNAL_GALILEO_E5B:
+ signalId = SIGNAL_ID_GAL_E5B;
+ break;
+ case GNSS_SIGNAL_QZSS_L1CA:
+ signalId = SIGNAL_ID_QZSS_L1CA;
+ break;
+ case GNSS_SIGNAL_QZSS_L2:
+ signalId = SIGNAL_ID_QZSS_L2CL;
+ break;
+ case GNSS_SIGNAL_QZSS_L5:
+ signalId = SIGNAL_ID_QZSS_L5Q;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B1I:
+ signalId = SIGNAL_ID_BDS_B1I;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B1C:
+ signalId = SIGNAL_ID_BDS_B1C;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B2I:
+ signalId = SIGNAL_ID_BDS_B2I;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B2AI:
+ case GNSS_SIGNAL_BEIDOU_B2AQ:
+ signalId = SIGNAL_ID_BDS_B2A;
+ break;
+ case GNSS_SIGNAL_NAVIC_L5:
+ signalId = SIGNAL_ID_NAVIC_L5SPS;
+ break;
+ default:
+ signalId = SIGNAL_ID_ALL_SIGNALS;
+ }
+
+ return signalId;
+
+}
+
+/*===========================================================================
+FUNCTION get_sv_count_from_mask
+
+DESCRIPTION
+ get the sv count from bit mask
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ value of sv count
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static uint32_t get_sv_count_from_mask(uint64_t svMask, int totalSvCount)
+{
+ int index = 0;
+ uint32_t svCount = 0;
+
+ if(totalSvCount > MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION) {
+ LOC_LOGE("total SV count in this constellation %d exceeded limit %d",
+ totalSvCount, MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION);
+ }
+ for(index = 0; index < totalSvCount; index++) {
+ if(svMask & 0x1)
+ svCount += 1;
+ svMask >>= 1;
+ }
+ return svCount;
+}
+
+/*===========================================================================
+FUNCTION loc_nmea_sv_meta_init
+
+DESCRIPTION
+ Init loc_nmea_sv_meta passed in
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Pointer to loc_nmea_sv_meta
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+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,
+ GnssSignalTypeMask signalType,
+ bool needCombine)
+{
+ memset(&sv_meta, 0, sizeof(sv_meta));
+ sv_meta.svType = svType;
+
+ switch (svType)
+ {
+ case GNSS_SV_TYPE_GPS:
+ sv_meta.talker[0] = 'G';
+ sv_meta.talker[1] = 'P';
+ sv_meta.mask = sv_cache_info.gps_used_mask;
+ sv_meta.systemId = SYSTEM_ID_GPS;
+ switch (signalType) {
+ case GNSS_SIGNAL_GPS_L1CA:
+ sv_meta.svCount = sv_cache_info.gps_l1_count;
+ break;
+ case GNSS_SIGNAL_GPS_L5:
+ sv_meta.svCount = sv_cache_info.gps_l5_count;
+ break;
+ case GNSS_SIGNAL_GPS_L2:
+ sv_meta.svCount = sv_cache_info.gps_l2_count;
+ break;
+ }
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ sv_meta.talker[0] = 'G';
+ sv_meta.talker[1] = 'L';
+ sv_meta.mask = sv_cache_info.glo_used_mask;
+ // GLONASS SV ids are from 65-96
+ sv_meta.svIdOffset = GLONASS_SV_ID_OFFSET;
+ sv_meta.systemId = SYSTEM_ID_GLONASS;
+ switch (signalType) {
+ case GNSS_SIGNAL_GLONASS_G1:
+ sv_meta.svCount = sv_cache_info.glo_g1_count;
+ break;
+ case GNSS_SIGNAL_GLONASS_G2:
+ sv_meta.svCount = sv_cache_info.glo_g2_count;
+ break;
+ }
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ sv_meta.talker[0] = 'G';
+ sv_meta.talker[1] = 'A';
+ sv_meta.mask = sv_cache_info.gal_used_mask;
+ // GALILEO SV ids are from 301-336, So keep svIdOffset 300
+ sv_meta.svIdOffset = GALILEO_SV_ID_OFFSET;
+ sv_meta.systemId = SYSTEM_ID_GALILEO;
+ switch (signalType) {
+ case GNSS_SIGNAL_GALILEO_E1:
+ sv_meta.svCount = sv_cache_info.gal_e1_count;
+ break;
+ case GNSS_SIGNAL_GALILEO_E5A:
+ sv_meta.svCount = sv_cache_info.gal_e5_count;
+ break;
+ case GNSS_SIGNAL_GALILEO_E5B:
+ sv_meta.svCount = sv_cache_info.gal_e5b_count;
+ break;
+ }
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ sv_meta.talker[0] = 'G';
+ sv_meta.talker[1] = 'Q';
+ sv_meta.mask = sv_cache_info.qzss_used_mask;
+ // QZSS SV ids are from 193-197. So keep svIdOffset 192
+ sv_meta.svIdOffset = QZSS_SV_ID_OFFSET;
+ sv_meta.systemId = SYSTEM_ID_QZSS;
+ switch (signalType) {
+ case GNSS_SIGNAL_QZSS_L1CA:
+ sv_meta.svCount = sv_cache_info.qzss_l1_count;
+ break;
+ case GNSS_SIGNAL_QZSS_L2:
+ sv_meta.svCount = sv_cache_info.qzss_l2_count;
+ break;
+ case GNSS_SIGNAL_QZSS_L5:
+ sv_meta.svCount = sv_cache_info.qzss_l5_count;
+ break;
+ }
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ sv_meta.talker[0] = 'G';
+ sv_meta.talker[1] = 'B';
+ sv_meta.mask = sv_cache_info.bds_used_mask;
+ // BDS SV ids are from 201-237. So keep svIdOffset 200
+ sv_meta.svIdOffset = BDS_SV_ID_OFFSET;
+ sv_meta.systemId = SYSTEM_ID_BDS;
+ switch (signalType) {
+ case GNSS_SIGNAL_BEIDOU_B1I:
+ sv_meta.svCount = sv_cache_info.bds_b1_count;
+ break;
+ case GNSS_SIGNAL_BEIDOU_B2AI:
+ sv_meta.svCount = sv_cache_info.bds_b2_count;
+ break;
+ }
+ break;
+ case GNSS_SV_TYPE_NAVIC:
+ sv_meta.talker[0] = 'G';
+ sv_meta.talker[1] = 'I';
+ sv_meta.mask = sv_cache_info.navic_used_mask;
+ // NAVIC SV ids are from 401-414. So keep svIdOffset 0
+ sv_meta.systemId = SYSTEM_ID_NAVIC;
+ switch (signalType) {
+ case GNSS_SIGNAL_NAVIC_L5:
+ sv_meta.svCount = sv_cache_info.navic_l5_count;
+ break;
+ }
+ break;
+ default:
+ LOC_LOGE("NMEA Error unknow constellation type: %d", svType);
+ return NULL;
+ }
+ sv_meta.signalId = convert_signalType_to_signalId(signalType);
+ sv_meta.totalSvUsedCount =
+ get_sv_count_from_mask(sv_cache_info.gps_used_mask,
+ GPS_SV_PRN_MAX - GPS_SV_PRN_MIN + 1) +
+ get_sv_count_from_mask(sv_cache_info.glo_used_mask,
+ GLO_SV_PRN_MAX - GLO_SV_PRN_MIN + 1) +
+ get_sv_count_from_mask(sv_cache_info.gal_used_mask,
+ GAL_SV_PRN_MAX - GAL_SV_PRN_MIN + 1) +
+ get_sv_count_from_mask(sv_cache_info.qzss_used_mask,
+ QZSS_SV_PRN_MAX - QZSS_SV_PRN_MIN + 1) +
+ get_sv_count_from_mask(sv_cache_info.bds_used_mask,
+ BDS_SV_PRN_MAX - BDS_SV_PRN_MIN + 1) +
+ get_sv_count_from_mask(sv_cache_info.navic_used_mask,
+ NAVIC_SV_PRN_MAX - NAVIC_SV_PRN_MIN + 1);
+ if (needCombine &&
+ (sv_cache_info.gps_used_mask ? 1 : 0) +
+ (sv_cache_info.glo_used_mask ? 1 : 0) +
+ (sv_cache_info.gal_used_mask ? 1 : 0) +
+ (sv_cache_info.qzss_used_mask ? 1 : 0) +
+ (sv_cache_info.bds_used_mask ? 1 : 0) +
+ (sv_cache_info.navic_used_mask ? 1 : 0) > 1)
+ {
+ // If GPS, GLONASS, Galileo, QZSS, BDS etc. are combined
+ // to obtain the reported position solution,
+ // talker shall be set to GN, to indicate that
+ // the satellites are used in a combined solution
+ sv_meta.talker[0] = 'G';
+ sv_meta.talker[1] = 'N';
+ }
+ return &sv_meta;
+}
+
+/*===========================================================================
+FUNCTION loc_nmea_put_checksum
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Total length of the nmea sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_nmea_put_checksum(char *pNmea, int maxSize)
+{
+ uint8_t checksum = 0;
+ int length = 0;
+ if(NULL == pNmea)
+ return 0;
+
+ pNmea++; //skip the $
+ while (*pNmea != '\0')
+ {
+ checksum ^= *pNmea++;
+ length++;
+ }
+
+ // length now contains nmea sentence string length not including $ sign.
+ int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
+
+ // total length of nmea sentence is length of nmea sentence inc $ sign plus
+ // length of checksum (+1 is to cover the $ character in the length).
+ return (length + checksumLength + 1);
+}
+
+/*===========================================================================
+FUNCTION loc_nmea_generate_GSA
+
+DESCRIPTION
+ Generate NMEA GSA sentences generated based on position report
+ Currently below sentences are generated:
+ - $GPGSA : GPS DOP and active SVs
+ - $GLGSA : GLONASS DOP and active SVs
+ - $GAGSA : GALILEO DOP and active SVs
+ - $GNGSA : GNSS DOP and active SVs
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Number of SVs used
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtended,
+ char* sentence,
+ int bufSize,
+ loc_nmea_sv_meta* sv_meta_p,
+ std::vector<std::string> &nmeaArraystr)
+{
+ if (!sentence || bufSize <= 0 || !sv_meta_p)
+ {
+ LOC_LOGE("NMEA Error invalid arguments.");
+ return 0;
+ }
+
+ char* pMarker = sentence;
+ int lengthRemaining = bufSize;
+ int length = 0;
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[64] = {0};
+
+ char fixType = '\0';
+
+ const char* talker = sv_meta_p->talker;
+ uint32_t svIdOffset = sv_meta_p->svIdOffset;
+ uint64_t mask = sv_meta_p->mask;
+
+ if(sv_meta_p->svType != GNSS_SV_TYPE_GLONASS) {
+ svIdOffset = 0;
+ }
+
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 64; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i + svIdOffset;
+ mask = mask >> 1;
+ }
+
+ if (svUsedCount == 0)
+ return 0;
+
+ if (sv_meta_p->totalSvUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (sv_meta_p->totalSvUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ 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,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);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return 0;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ // Add first 12 satellite IDs
+ for (uint8_t i = 0; i < 12; i++)
+ {
+ if (i < svUsedCount)
+ length = snprintf(pMarker, lengthRemaining, "%02d,", svUsedList[i]);
+ else
+ length = snprintf(pMarker, lengthRemaining, ",");
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return 0;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ // Add the position/horizontal/vertical DOP values
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f,",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,,");
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ // system id
+ length = snprintf(pMarker, lengthRemaining, "%d", sv_meta_p->systemId);
+ pMarker += length;
+ lengthRemaining -= length;
+
+ /* Sentence is ready, add checksum and broadcast */
+ length = loc_nmea_put_checksum(sentence, bufSize);
+ nmeaArraystr.push_back(sentence);
+
+ return svUsedCount;
+}
+
+/*===========================================================================
+FUNCTION loc_nmea_generate_GSV
+
+DESCRIPTION
+ Generate NMEA GSV sentences generated based on sv report
+ Currently below sentences are generated:
+ - $GPGSV: GPS Satellites in View
+ - $GLGSV: GLONASS Satellites in View
+ - $GAGSV: GALILEO Satellites in View
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ NONE
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
+ char* sentence,
+ int bufSize,
+ loc_nmea_sv_meta* sv_meta_p,
+ std::vector<std::string> &nmeaArraystr)
+{
+ if (!sentence || bufSize <= 0)
+ {
+ LOC_LOGE("NMEA Error invalid argument.");
+ return;
+ }
+
+ char* pMarker = sentence;
+ int lengthRemaining = bufSize;
+ int length = 0;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ size_t svNumber = 1;
+
+ const char* talker = sv_meta_p->talker;
+ uint32_t svIdOffset = sv_meta_p->svIdOffset;
+ int svCount = sv_meta_p->svCount;
+ if (svCount <= 0)
+ {
+ LOC_LOGV("No SV in view for talker ID:%s, signal ID:%X", talker, sv_meta_p->signalId);
+ return;
+ }
+
+ if (GNSS_SV_TYPE_GLONASS == sv_meta_p->svType) {
+ svIdOffset = 0;
+ }
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = svCount / 4 + (svCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = bufSize;
+
+ length = snprintf(pMarker, lengthRemaining, "$%sGSV,%d,%d,%02d",
+ talker, sentenceCount, sentenceNumber, svCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svNotify.count) && (i < 4); svNumber++)
+ {
+ GnssSignalTypeMask signalType = svNotify.gnssSvs[svNumber-1].gnssSignalTypeMask;
+ if (0 == signalType) {
+ // If no signal type in report, it means default L1,G1,E1,B1I
+ switch (svNotify.gnssSvs[svNumber - 1].type)
+ {
+ case GNSS_SV_TYPE_GPS:
+ signalType = GNSS_SIGNAL_GPS_L1CA;
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ signalType = GNSS_SIGNAL_GLONASS_G1;
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ signalType = GNSS_SIGNAL_GALILEO_E1;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ signalType = GNSS_SIGNAL_QZSS_L1CA;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ signalType = GNSS_SIGNAL_BEIDOU_B1I;
+ break;
+ case GNSS_SV_TYPE_SBAS:
+ signalType = GNSS_SIGNAL_SBAS_L1;
+ break;
+ case GNSS_SV_TYPE_NAVIC:
+ signalType = GNSS_SIGNAL_NAVIC_L5;
+ break;
+ default:
+ LOC_LOGE("NMEA Error unknow constellation type: %d",
+ svNotify.gnssSvs[svNumber - 1].type);
+ continue;
+ }
+ }
+
+ if (sv_meta_p->svType == svNotify.gnssSvs[svNumber - 1].type &&
+ sv_meta_p->signalId == convert_signalType_to_signalId(signalType))
+ {
+ length = snprintf(pMarker, lengthRemaining, ",%02d,%02d,%03d,",
+ svNotify.gnssSvs[svNumber - 1].svId - svIdOffset,
+ (int)(0.5 + svNotify.gnssSvs[svNumber - 1].elevation), //float to int
+ (int)(0.5 + svNotify.gnssSvs[svNumber - 1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svNotify.gnssSvs[svNumber - 1].cN0Dbhz > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svNotify.gnssSvs[svNumber - 1].cN0Dbhz)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ // append signalId
+ length = snprintf(pMarker, lengthRemaining,",%X",sv_meta_p->signalId);
+ pMarker += length;
+ lengthRemaining -= length;
+
+ length = loc_nmea_put_checksum(sentence, bufSize);
+ nmeaArraystr.push_back(sentence);
+ sentenceNumber++;
+
+ } //while
+}
+
+/*===========================================================================
+FUNCTION loc_nmea_generate_DTM
+
+DESCRIPTION
+ Generate NMEA DTM sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ NONE
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_nmea_generate_DTM(const LocLla &ref_lla,
+ const LocLla &local_lla,
+ char *talker,
+ char *sentence,
+ int bufSize)
+{
+ char* pMarker = sentence;
+ int lengthRemaining = bufSize;
+ int length = 0;
+ int datum_type;
+ char ref_datum[4] = {0};
+ char local_datum[4] = {0};
+ double lla_offset[3] = {0};
+ char latHem, longHem;
+ double latMins, longMins;
+
+
+
+ datum_type = loc_get_datum_type();
+ switch (datum_type) {
+ case LOC_GNSS_DATUM_WGS84:
+ ref_datum[0] = 'W';
+ ref_datum[1] = '8';
+ ref_datum[2] = '4';
+ local_datum[0] = 'P';
+ local_datum[1] = '9';
+ local_datum[2] = '0';
+ break;
+ case LOC_GNSS_DATUM_PZ90:
+ ref_datum[0] = 'P';
+ ref_datum[1] = '9';
+ ref_datum[2] = '0';
+ local_datum[0] = 'W';
+ local_datum[1] = '8';
+ local_datum[2] = '4';
+ break;
+ default:
+ break;
+ }
+ length = snprintf(pMarker , lengthRemaining , "$%sDTM,%s,," , talker, local_datum);
+ if (length < 0 || length >= lengthRemaining) {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ lla_offset[0] = local_lla.lat - ref_lla.lat;
+ lla_offset[1] = fmod(local_lla.lon - ref_lla.lon, 360.0);
+ if (lla_offset[1] < -180.0) {
+ lla_offset[1] += 360.0;
+ } else if ( lla_offset[1] > 180.0) {
+ lla_offset[1] -= 360.0;
+ }
+ lla_offset[2] = local_lla.alt - ref_lla.alt;
+ if (lla_offset[0] > 0.0) {
+ latHem = 'N';
+ } else {
+ latHem = 'S';
+ lla_offset[0] *= -1.0;
+ }
+ latMins = fmod(lla_offset[0] * 60.0, 60.0);
+ if (lla_offset[1] < 0.0) {
+ longHem = 'W';
+ lla_offset[1] *= -1.0;
+ }else {
+ longHem = 'E';
+ }
+ longMins = fmod(lla_offset[1] * 60.0, 60.0);
+ length = snprintf(pMarker, lengthRemaining, "%02d%09.6lf,%c,%03d%09.6lf,%c,%.3lf,",
+ (uint8_t)floor(lla_offset[0]), latMins, latHem,
+ (uint8_t)floor(lla_offset[1]), longMins, longHem, lla_offset[2]);
+ if (length < 0 || length >= lengthRemaining) {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ length = snprintf(pMarker , lengthRemaining , "%s" , ref_datum);
+ if (length < 0 || length >= lengthRemaining) {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ length = loc_nmea_put_checksum(sentence, bufSize);
+}
+
+/*===========================================================================
+FUNCTION get_utctime_with_leapsecond_transition
+
+DESCRIPTION
+ This function returns true if the position report is generated during
+ leap second transition period. If not, then the utc timestamp returned
+ will be set to the timestamp in the position report. If it is,
+ then the utc timestamp returned will need to take into account
+ of the leap second transition so that proper calendar year/month/date
+ can be calculated from the returned utc timestamp.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ true: position report is generated in leap second transition period.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static bool get_utctime_with_leapsecond_transition(
+ const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ const LocationSystemInfo &systemInfo,
+ LocGpsUtcTime &utcPosTimestamp)
+{
+ bool inTransition = false;
+
+ // position report is not generated during leap second transition,
+ // we can use the UTC timestamp from position report as is
+ utcPosTimestamp = location.gpsLocation.timestamp;
+
+ // Check whether we are in leap second transition.
+ // If so, per NMEA spec, we need to display the extra second in format of 23:59:60
+ // with year/month/date not getting advanced.
+ if ((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GPS_TIME) &&
+ ((systemInfo.systemInfoMask & LOCATION_SYS_INFO_LEAP_SECOND) &&
+ (systemInfo.leapSecondSysInfo.leapSecondInfoMask &
+ LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT))) {
+
+ const LeapSecondChangeInfo &leapSecondChangeInfo =
+ systemInfo.leapSecondSysInfo.leapSecondChangeInfo;
+ const GnssSystemTimeStructType &gpsTimestampLsChange =
+ leapSecondChangeInfo.gpsTimestampLsChange;
+
+ uint64_t gpsTimeLsChange = gpsTimestampLsChange.systemWeek * MSEC_IN_ONE_WEEK +
+ gpsTimestampLsChange.systemMsec;
+ uint64_t gpsTimePosReport = locationExtended.gpsTime.gpsWeek * MSEC_IN_ONE_WEEK +
+ locationExtended.gpsTime.gpsTimeOfWeekMs;
+ // we are only dealing with positive leap second change, as negative
+ // leap second change has never occurred and should not occur in future
+ if (leapSecondChangeInfo.leapSecondsAfterChange >
+ leapSecondChangeInfo.leapSecondsBeforeChange) {
+ // leap second adjustment is always 1 second at a time. It can happen
+ // every quarter end and up to four times per year.
+ if ((gpsTimePosReport >= gpsTimeLsChange) &&
+ (gpsTimePosReport < (gpsTimeLsChange + 1000))) {
+ inTransition = true;
+ utcPosTimestamp = gpsTimeLsChange + UTC_GPS_OFFSET_MSECS -
+ leapSecondChangeInfo.leapSecondsBeforeChange * 1000;
+
+ // we substract 1000 milli-seconds from UTC timestmap in order to calculate the
+ // proper year, month and date during leap second transtion.
+ // Let us give an example, assuming leap second transition is scheduled on 2019,
+ // Dec 31st mid night. When leap second transition is happening,
+ // instead of outputting the time as 2020, Jan, 1st, 00 hour, 00 min, and 00 sec.
+ // The time need to be displayed as 2019, Dec, 31st, 23 hour, 59 min and 60 sec.
+ utcPosTimestamp -= 1000;
+ }
+ }
+ }
+ return inTransition;
+}
+
+/*===========================================================================
+FUNCTION loc_nmea_get_fix_quality
+
+DESCRIPTION
+ This function obtains the fix quality for GGA sentence, mode indicator
+ for RMC and VTG sentence based on nav solution mask and tech mask in
+ the postion report.
+
+DEPENDENCIES
+ NONE
+
+Output parameter
+ ggaGpsQuality: gps quality field in GGA sentence
+ rmcModeIndicator: mode indicator field in RMC sentence
+ vtgModeIndicator: mode indicator field in VTG sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_nmea_get_fix_quality(const UlpLocation & location,
+ const GpsLocationExtended & locationExtended,
+ bool custom_gga_fix_quality,
+ char ggaGpsQuality[3],
+ char & rmcModeIndicator,
+ char & vtgModeIndicator,
+ char gnsModeIndicator[7]) {
+
+ ggaGpsQuality[0] = '0'; // 0 means no fix
+ rmcModeIndicator = 'N'; // N means no fix
+ vtgModeIndicator = 'N'; // N means no fix
+ memset(gnsModeIndicator, 'N', 6); // N means no fix
+ gnsModeIndicator[6] = '\0';
+ do {
+ // GGA fix quality is defined in NMEA spec as below:
+ // https://www.trimble.com/OEM_ReceiverHelp/V4.44/en/NMEA-0183messages_GGA.html
+ // Fix quality: 0 = invalid
+ // 1 = GPS fix (SPS)
+ // 2 = DGPS fix
+ // 3 = PPS fix
+ // 4 = Real Time Kinematic
+ // 5 = Float RTK
+ // 6 = estimated (dead reckoning) (2.3 feature)
+ // 7 = Manual input mode
+ // 8 = Simulation mode
+ if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG)){
+ break;
+ }
+ // NOTE: Order of the check is important
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK) {
+ if (LOC_NAV_MASK_PPP_CORRECTION & locationExtended.navSolutionMask) {
+ ggaGpsQuality[0] = '2'; // 2 means DGPS fix
+ rmcModeIndicator = 'P'; // P means precise
+ vtgModeIndicator = 'P'; // P means precise
+ if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[0] = 'P'; // P means precise
+ if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[1] = 'P'; // P means precise
+ if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[2] = 'P'; // P means precise
+ if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[3] = 'P'; // P means precise
+ if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[4] = 'P'; // P means precise
+ if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[5] = 'P'; // P means precise
+ break;
+ } else if (LOC_NAV_MASK_RTK_FIXED_CORRECTION & locationExtended.navSolutionMask){
+ ggaGpsQuality[0] = '4'; // 4 means RTK Fixed fix
+ rmcModeIndicator = 'R'; // use R (RTK fixed)
+ vtgModeIndicator = 'D'; // use D (differential) as
+ // no RTK fixed defined for VTG in NMEA 183 spec
+ if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[0] = 'R'; // R means RTK fixed
+ if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[1] = 'R'; // R means RTK fixed
+ if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[2] = 'R'; // R means RTK fixed
+ if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[3] = 'R'; // R means RTK fixed
+ if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[4] = 'R'; // R means RTK fixed
+ if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[5] = 'R'; // R means RTK fixed
+ break;
+ } else if (LOC_NAV_MASK_RTK_CORRECTION & locationExtended.navSolutionMask){
+ ggaGpsQuality[0] = '5'; // 5 means RTK float fix
+ rmcModeIndicator = 'F'; // F means RTK float fix
+ vtgModeIndicator = 'D'; // use D (differential) as
+ // no RTK float defined for VTG in NMEA 183 spec
+ if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[0] = 'F'; // F means RTK float fix
+ if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[1] = 'F'; // F means RTK float fix
+ if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[2] = 'F'; // F means RTK float fix
+ if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[3] = 'F'; // F means RTK float fix
+ if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[4] = 'F'; // F means RTK float fix
+ if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[5] = 'F'; // F means RTK float fix
+ break;
+ } else if (LOC_NAV_MASK_DGNSS_CORRECTION & locationExtended.navSolutionMask){
+ ggaGpsQuality[0] = '2'; // 2 means DGPS fix
+ rmcModeIndicator = 'D'; // D means differential
+ vtgModeIndicator = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[0] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[1] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[2] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[3] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[4] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[5] = 'D'; // D means differential
+ break;
+ } else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask){
+ ggaGpsQuality[0] = '2'; // 2 means DGPS fix
+ rmcModeIndicator = 'D'; // D means differential
+ vtgModeIndicator = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[0] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[1] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[2] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[3] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[4] = 'D'; // D means differential
+ if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[5] = 'D'; // D means differential
+ break;
+ }
+ }
+ // NOTE: Order of the check is important
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK) {
+ if (LOC_POS_TECH_MASK_SATELLITE & locationExtended.tech_mask){
+ ggaGpsQuality[0] = '1'; // 1 means GPS
+ rmcModeIndicator = 'A'; // A means autonomous
+ vtgModeIndicator = 'A'; // A means autonomous
+ if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[0] = 'A'; // A means autonomous
+ if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[1] = 'A'; // A means autonomous
+ if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[2] = 'A'; // A means autonomous
+ if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[3] = 'A'; // A means autonomous
+ if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[4] = 'A'; // A means autonomous
+ if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
+ gnsModeIndicator[5] = 'A'; // A means autonomous
+ break;
+ } else if (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask){
+ ggaGpsQuality[0] = '6'; // 6 means estimated (dead reckoning)
+ rmcModeIndicator = 'E'; // E means estimated (dead reckoning)
+ vtgModeIndicator = 'E'; // E means estimated (dead reckoning)
+ memset(gnsModeIndicator, 'E', 6); // E means estimated (dead reckoning)
+ break;
+ }
+ }
+ } while (0);
+
+ do {
+ // check for customized nmea enabled or not
+ // with customized GGA quality enabled
+ // PPP fix w/o sensor: 59, PPP fix w/ sensor: 69
+ // DGNSS/SBAS correction fix w/o sensor: 2, w/ sensor: 62
+ // RTK fixed fix w/o sensor: 4, w/ sensor: 64
+ // RTK float fix w/o sensor: 5, w/ sensor: 65
+ // SPE fix w/o sensor: 1, and w/ sensor: 61
+ // Sensor dead reckoning fix: 6
+ if (true == custom_gga_fix_quality) {
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK) {
+ // PPP fix w/o sensor: fix quality will now be 59
+ // PPP fix w sensor: fix quality will now be 69
+ if (LOC_NAV_MASK_PPP_CORRECTION & locationExtended.navSolutionMask) {
+ if ((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK) &&
+ (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask)) {
+ ggaGpsQuality[0] = '6';
+ ggaGpsQuality[1] = '9';
+ } else {
+ ggaGpsQuality[0] = '5';
+ ggaGpsQuality[1] = '9';
+ }
+ break;
+ }
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK) {
+ if (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask){
+ char ggaQuality_copy = ggaGpsQuality[0];
+ ggaGpsQuality[0] = '6'; // 6 sensor assisted
+ // RTK fixed fix w/ sensor: fix quality will now be 64
+ // RTK float fix w/ sensor: 65
+ // DGNSS and/or SBAS correction fix and w/ sensor: 62
+ // GPS fix without correction and w/ sensor: 61
+ if ((LOC_NAV_MASK_RTK_FIXED_CORRECTION & locationExtended.navSolutionMask)||
+ (LOC_NAV_MASK_RTK_CORRECTION & locationExtended.navSolutionMask)||
+ (LOC_NAV_MASK_DGNSS_CORRECTION & locationExtended.navSolutionMask)||
+ (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)||
+ (LOC_POS_TECH_MASK_SATELLITE & locationExtended.tech_mask)) {
+ ggaGpsQuality[1] = ggaQuality_copy;
+ break;
+ }
+ }
+ }
+ }
+ } while (0);
+
+ LOC_LOGv("gps quality: %s, rmc mode indicator: %c, vtg mode indicator: %c",
+ ggaGpsQuality, rmcModeIndicator, vtgModeIndicator);
+}
+
+/*===========================================================================
+FUNCTION loc_nmea_generate_pos
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+ Currently below sentences are generated within this function:
+ - $GPGSA : GPS DOP and active SVs
+ - $GLGSA : GLONASS DOP and active SVs
+ - $GAGSA : GALILEO DOP and active SVs
+ - $GNGSA : GNSS DOP and active SVs
+ - $--VTG : Track made good and ground speed
+ - $--RMC : Recommended minimum navigation information
+ - $--GGA : Time, position and fix related data
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_nmea_generate_pos(const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ const LocationSystemInfo &systemInfo,
+ unsigned char generate_nmea,
+ bool custom_gga_fix_quality,
+ std::vector<std::string> &nmeaArraystr)
+{
+ ENTRY_LOG();
+
+ LocGpsUtcTime utcPosTimestamp = 0;
+ bool inLsTransition = false;
+
+ inLsTransition = get_utctime_with_leapsecond_transition
+ (location, locationExtended, systemInfo, utcPosTimestamp);
+
+ time_t utcTime(utcPosTimestamp/1000);
+ struct tm result;
+ tm * pTm = gmtime_r(&utcTime, &result);
+ if (NULL == pTm) {
+ LOC_LOGE("gmtime failed");
+ return;
+ }
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char sentence_DTM[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char sentence_RMC[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char sentence_GNS[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char sentence_GGA[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+ int utcYear = pTm->tm_year % 100; // 2 digit year
+ int utcMonth = pTm->tm_mon + 1; // tm_mon starts at zero
+ int utcDay = pTm->tm_mday;
+ int utcHours = pTm->tm_hour;
+ int utcMinutes = pTm->tm_min;
+ int utcSeconds = pTm->tm_sec;
+ int utcMSeconds = (location.gpsLocation.timestamp)%1000;
+ int datum_type = loc_get_datum_type();
+ LocEcef ecef_w84;
+ LocEcef ecef_p90;
+ LocLla lla_w84;
+ LocLla lla_p90;
+ LocLla ref_lla;
+ LocLla local_lla;
+
+ if (inLsTransition) {
+ // During leap second transition, we need to display the extra
+ // leap second of hour, minute, second as (23:59:60)
+ utcHours = 23;
+ utcMinutes = 59;
+ utcSeconds = 60;
+ // As UTC timestamp is freezing during leap second transition,
+ // retrieve milli-seconds portion from GPS timestamp.
+ utcMSeconds = locationExtended.gpsTime.gpsTimeOfWeekMs % 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 =
+ locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask;
+ sv_cache_info.glo_used_mask =
+ locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask;
+ sv_cache_info.gal_used_mask =
+ locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask;
+ sv_cache_info.bds_used_mask =
+ locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask;
+ sv_cache_info.qzss_used_mask =
+ locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask;
+ sv_cache_info.navic_used_mask =
+ locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask;
+ }
+
+ if (generate_nmea) {
+ char talker[3] = {'G', 'P', '\0'};
+ uint32_t svUsedCount = 0;
+ uint32_t count = 0;
+ loc_nmea_sv_meta sv_meta;
+ // -------------------
+ // ---$GPGSA/$GNGSA---
+ // -------------------
+
+ count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
+ GNSS_SIGNAL_GPS_L1CA, true), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ talker[0] = sv_meta.talker[0];
+ talker[1] = sv_meta.talker[1];
+ }
+
+ // -------------------
+ // ---$GLGSA/$GNGSA---
+ // -------------------
+
+ count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS,
+ GNSS_SIGNAL_GLONASS_G1, true), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ talker[0] = sv_meta.talker[0];
+ talker[1] = sv_meta.talker[1];
+ }
+
+ // -------------------
+ // ---$GAGSA/$GNGSA---
+ // -------------------
+
+ count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
+ GNSS_SIGNAL_GALILEO_E1, true), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ talker[0] = sv_meta.talker[0];
+ talker[1] = sv_meta.talker[1];
+ }
+
+ // ----------------------------
+ // ---$GBGSA/$GNGSA (BEIDOU)---
+ // ----------------------------
+ count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
+ GNSS_SIGNAL_BEIDOU_B1I, true), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ talker[0] = sv_meta.talker[0];
+ talker[1] = sv_meta.talker[1];
+ }
+
+ // --------------------------
+ // ---$GQGSA/$GNGSA (QZSS)---
+ // --------------------------
+
+ count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
+ GNSS_SIGNAL_QZSS_L1CA, true), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ talker[0] = sv_meta.talker[0];
+ talker[1] = sv_meta.talker[1];
+ }
+
+ // if svUsedCount is 0, it means we do not generate any GSA sentence yet.
+ // in this case, generate an empty GSA sentence
+ if (svUsedCount == 0) {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+ }
+
+ char ggaGpsQuality[3] = {'0', '\0', '\0'};
+ char rmcModeIndicator = 'N';
+ char vtgModeIndicator = 'N';
+ char gnsModeIndicator[7] = {'N', 'N', 'N', 'N', 'N', 'N', '\0'};
+ loc_nmea_get_fix_quality(location, locationExtended, custom_gga_fix_quality,
+ ggaGpsQuality, rmcModeIndicator, vtgModeIndicator, gnsModeIndicator);
+
+ // -------------------
+ // ------$--VTG-------
+ // -------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ if (location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_BEARING)
+ {
+ float magTrack = location.gpsLocation.bearing;
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_MAG_DEV)
+ {
+ float magTrack = location.gpsLocation.bearing - locationExtended.magneticDeviation;
+ if (magTrack < 0.0)
+ magTrack += 360.0;
+ else if (magTrack > 360.0)
+ magTrack -= 360.0;
+ }
+
+ length = snprintf(pMarker, lengthRemaining, "$%sVTG,%.1lf,T,%.1lf,M,", talker, location.gpsLocation.bearing, magTrack);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, "$%sVTG,,T,,M,", talker);
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_SPEED)
+ {
+ float speedKnots = location.gpsLocation.speed * (3600.0/1852.0);
+ float speedKmPerHour = location.gpsLocation.speed * 3.6;
+
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,N,%.1lf,K,", speedKnots, speedKmPerHour);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",N,,K,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ length = snprintf(pMarker, lengthRemaining, "%c", vtgModeIndicator);
+
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ memset(&ecef_w84, 0, sizeof(ecef_w84));
+ memset(&ecef_p90, 0, sizeof(ecef_p90));
+ memset(&lla_w84, 0, sizeof(lla_w84));
+ memset(&lla_p90, 0, sizeof(lla_p90));
+ memset(&ref_lla, 0, sizeof(ref_lla));
+ memset(&local_lla, 0, sizeof(local_lla));
+ lla_w84.lat = location.gpsLocation.latitude / 180.0 * M_PI;
+ lla_w84.lon = location.gpsLocation.longitude / 180.0 * M_PI;
+ lla_w84.alt = location.gpsLocation.altitude;
+
+ convert_Lla_to_Ecef(lla_w84, ecef_w84);
+ convert_WGS84_to_PZ90(ecef_w84, ecef_p90);
+ convert_Ecef_to_Lla(ecef_p90, lla_p90);
+
+ switch (datum_type) {
+ case LOC_GNSS_DATUM_WGS84:
+ ref_lla.lat = location.gpsLocation.latitude;
+ ref_lla.lon = location.gpsLocation.longitude;
+ ref_lla.alt = location.gpsLocation.altitude;
+ local_lla.lat = lla_p90.lat / M_PI * 180.0;
+ local_lla.lon = lla_p90.lon / M_PI * 180.0;
+ local_lla.alt = lla_p90.alt;
+ break;
+ case LOC_GNSS_DATUM_PZ90:
+ ref_lla.lat = lla_p90.lat / M_PI * 180.0;
+ ref_lla.lon = lla_p90.lon / M_PI * 180.0;
+ ref_lla.alt = lla_p90.alt;
+ local_lla.lat = location.gpsLocation.latitude;
+ local_lla.lon = location.gpsLocation.longitude;
+ local_lla.alt = location.gpsLocation.altitude;
+ break;
+ default:
+ break;
+ }
+
+ // -------------------
+ // ------$--DTM-------
+ // -------------------
+ loc_nmea_generate_DTM(ref_lla, local_lla, talker, sentence_DTM, sizeof(sentence_DTM));
+
+ // -------------------
+ // ------$--RMC-------
+ // -------------------
+
+ pMarker = sentence_RMC;
+ lengthRemaining = sizeof(sentence_RMC);
+
+ bool validFix = ((0 != 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));
+
+ if (validFix) {
+ length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A,",
+ talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10);
+ } else {
+ length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,V,",
+ talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10);
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = ref_lla.lat;
+ double longitude = ref_lla.lon;
+ char latHemisphere;
+ char lonHemisphere;
+ double latMinutes;
+ double lonMinutes;
+
+ if (latitude > 0)
+ {
+ latHemisphere = 'N';
+ }
+ else
+ {
+ latHemisphere = 'S';
+ latitude *= -1.0;
+ }
+
+ if (longitude < 0)
+ {
+ lonHemisphere = 'W';
+ longitude *= -1.0;
+ }
+ else
+ {
+ lonHemisphere = 'E';
+ }
+
+ latMinutes = fmod(latitude * 60.0 , 60.0);
+ lonMinutes = fmod(longitude * 60.0 , 60.0);
+
+ length = snprintf(pMarker, lengthRemaining, "%02d%09.6lf,%c,%03d%09.6lf,%c,",
+ (uint8_t)floor(latitude), latMinutes, latHemisphere,
+ (uint8_t)floor(longitude),lonMinutes, lonHemisphere);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_SPEED)
+ {
+ float speedKnots = location.gpsLocation.speed * (3600.0/1852.0);
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,", speedKnots);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_BEARING)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,", location.gpsLocation.bearing);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ length = snprintf(pMarker, lengthRemaining, "%2.2d%2.2d%2.2d,",
+ utcDay, utcMonth, utcYear);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_MAG_DEV)
+ {
+ float magneticVariation = locationExtended.magneticDeviation;
+ char direction;
+ if (magneticVariation < 0.0)
+ {
+ direction = 'W';
+ magneticVariation *= -1.0;
+ }
+ else
+ {
+ direction = 'E';
+ }
+
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,%c,",
+ magneticVariation, direction);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ length = snprintf(pMarker, lengthRemaining, "%c", rmcModeIndicator);
+ pMarker += length;
+ lengthRemaining -= length;
+
+ // hardcode Navigation Status field to 'V'
+ length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
+
+ length = loc_nmea_put_checksum(sentence_RMC, sizeof(sentence_RMC));
+
+ // -------------------
+ // ------$--GNS-------
+ // -------------------
+
+ pMarker = sentence_GNS;
+ lengthRemaining = sizeof(sentence_GNS);
+
+ length = snprintf(pMarker, lengthRemaining, "$%sGNS,%02d%02d%02d.%02d," ,
+ talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = ref_lla.lat;
+ double longitude = ref_lla.lon;
+ char latHemisphere;
+ char lonHemisphere;
+ double latMinutes;
+ double lonMinutes;
+
+ if (latitude > 0)
+ {
+ latHemisphere = 'N';
+ }
+ else
+ {
+ latHemisphere = 'S';
+ latitude *= -1.0;
+ }
+
+ if (longitude < 0)
+ {
+ lonHemisphere = 'W';
+ longitude *= -1.0;
+ }
+ else
+ {
+ lonHemisphere = 'E';
+ }
+
+ latMinutes = fmod(latitude * 60.0 , 60.0);
+ lonMinutes = fmod(longitude * 60.0 , 60.0);
+
+ length = snprintf(pMarker, lengthRemaining, "%02d%09.6lf,%c,%03d%09.6lf,%c,",
+ (uint8_t)floor(latitude), latMinutes, latHemisphere,
+ (uint8_t)floor(longitude),lonMinutes, lonHemisphere);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ length = snprintf(pMarker, lengthRemaining, "%s,", gnsModeIndicator);
+
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) {
+ length = snprintf(pMarker, lengthRemaining, "%02d,%.1f,",
+ svUsedCount, locationExtended.hdop);
+ }
+ else { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%02d,,",
+ svUsedCount);
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,",
+ locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,",
+ ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1f,",
+ (float)locationExtended.dgnssDataAgeMsec / 1000);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%04d",
+ locationExtended.dgnssRefStationId);
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ 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_GNS, sizeof(sentence_GNS));
+
+
+ // -------------------
+ // ------$--GGA-------
+ // -------------------
+
+ pMarker = sentence_GGA;
+ lengthRemaining = sizeof(sentence_GGA);
+
+ length = snprintf(pMarker, lengthRemaining, "$%sGGA,%02d%02d%02d.%02d," ,
+ talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = ref_lla.lat;
+ double longitude = ref_lla.lon;
+ char latHemisphere;
+ char lonHemisphere;
+ double latMinutes;
+ double lonMinutes;
+
+ if (latitude > 0)
+ {
+ latHemisphere = 'N';
+ }
+ else
+ {
+ latHemisphere = 'S';
+ latitude *= -1.0;
+ }
+
+ if (longitude < 0)
+ {
+ lonHemisphere = 'W';
+ longitude *= -1.0;
+ }
+ else
+ {
+ lonHemisphere = 'E';
+ }
+
+ latMinutes = fmod(latitude * 60.0 , 60.0);
+ lonMinutes = fmod(longitude * 60.0 , 60.0);
+
+ length = snprintf(pMarker, lengthRemaining, "%02d%09.6lf,%c,%03d%09.6lf,%c,",
+ (uint8_t)floor(latitude), latMinutes, latHemisphere,
+ (uint8_t)floor(longitude),lonMinutes, lonHemisphere);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ // Number of satellites in use, 00-12
+ if (svUsedCount > MAX_SATELLITES_IN_USE)
+ svUsedCount = MAX_SATELLITES_IN_USE;
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%s,%02d,%.1f,",
+ ggaGpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%s,%02d,,",
+ ggaGpsQuality, svUsedCount);
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,",
+ locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,",
+ ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1f,",
+ (float)locationExtended.dgnssDataAgeMsec / 1000);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%04d",
+ locationExtended.dgnssRefStationId);
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA));
+
+ // ------$--DTM-------
+ nmeaArraystr.push_back(sentence_DTM);
+ // ------$--RMC-------
+ nmeaArraystr.push_back(sentence_RMC);
+ if(LOC_GNSS_DATUM_PZ90 == datum_type) {
+ // ------$--DTM-------
+ nmeaArraystr.push_back(sentence_DTM);
+ }
+ // ------$--GNS-------
+ nmeaArraystr.push_back(sentence_GNS);
+ if(LOC_GNSS_DATUM_PZ90 == datum_type) {
+ // ------$--DTM-------
+ nmeaArraystr.push_back(sentence_DTM);
+ }
+ // ------$--GGA-------
+ nmeaArraystr.push_back(sentence_GGA);
+
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ strlcpy(sentence, "$GPDTM,,,,,,,,", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N,V", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ strlcpy(sentence, "$GPGNS,,,,,,N,,,,,,,V", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+ }
+
+ EXIT_LOG(%d, 0);
+}
+
+
+
+/*===========================================================================
+FUNCTION loc_nmea_generate_sv
+
+DESCRIPTION
+ Generate NMEA sentences generated based on sv report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
+ std::vector<std::string> &nmeaArraystr)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ loc_sv_cache_info sv_cache_info = {};
+
+ //Count GPS SVs for saparating GPS from GLONASS and throw others
+ for(uint32_t svOffset = 0; svOffset < svNotify.count; svOffset++) {
+ if (GNSS_SV_TYPE_GPS == svNotify.gnssSvs[svOffset].type)
+ {
+ // cache the used in fix mask, as it will be needed to send $GPGSA
+ // during the position report
+ if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
+ (svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ setSvMask(sv_cache_info.gps_used_mask, svNotify.gnssSvs[svOffset].svId);
+ }
+ if (GNSS_SIGNAL_GPS_L5 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
+ sv_cache_info.gps_l5_count++;
+ } else if (GNSS_SIGNAL_GPS_L2 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
+ sv_cache_info.gps_l2_count++;
+ } else {
+ // GNSS_SIGNAL_GPS_L1CA or default
+ // If no signal type in report, it means default L1
+ sv_cache_info.gps_l1_count++;
+ }
+ }
+ else if (GNSS_SV_TYPE_GLONASS == svNotify.gnssSvs[svOffset].type)
+ {
+ // cache the used in fix mask, as it will be needed to send $GNGSA
+ // during the position report
+ if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
+ (svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ setSvMask(sv_cache_info.glo_used_mask, svNotify.gnssSvs[svOffset].svId);
+ }
+ if (GNSS_SIGNAL_GLONASS_G2 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask){
+ sv_cache_info.glo_g2_count++;
+ } else {
+ // GNSS_SIGNAL_GLONASS_G1 or default
+ // If no signal type in report, it means default G1
+ sv_cache_info.glo_g1_count++;
+ }
+ }
+ else if (GNSS_SV_TYPE_GALILEO == svNotify.gnssSvs[svOffset].type)
+ {
+ // cache the used in fix mask, as it will be needed to send $GAGSA
+ // during the position report
+ if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
+ (svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ setSvMask(sv_cache_info.gal_used_mask, svNotify.gnssSvs[svOffset].svId);
+ }
+ if(GNSS_SIGNAL_GALILEO_E5A == svNotify.gnssSvs[svOffset].gnssSignalTypeMask){
+ sv_cache_info.gal_e5_count++;
+ } else if (GNSS_SIGNAL_GALILEO_E5B == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
+ sv_cache_info.gal_e5b_count++;
+ } else {
+ // GNSS_SIGNAL_GALILEO_E1 or default
+ // If no signal type in report, it means default E1
+ sv_cache_info.gal_e1_count++;
+ }
+ }
+ else if (GNSS_SV_TYPE_QZSS == svNotify.gnssSvs[svOffset].type)
+ {
+ // cache the used in fix mask, as it will be needed to send $PQGSA
+ // during the position report
+ if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
+ (svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ // For QZSS we adjusted SV id's in GnssAdapter, we need to re-adjust here
+ setSvMask(sv_cache_info.qzss_used_mask,
+ svNotify.gnssSvs[svOffset].svId - (QZSS_SV_PRN_MIN - 1));
+ }
+ if (GNSS_SIGNAL_QZSS_L5 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
+ sv_cache_info.qzss_l5_count++;
+ } else if (GNSS_SIGNAL_QZSS_L2 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
+ sv_cache_info.qzss_l2_count++;
+ } else {
+ // GNSS_SIGNAL_QZSS_L1CA or default
+ // If no signal type in report, it means default L1
+ sv_cache_info.qzss_l1_count++;
+ }
+ }
+ else if (GNSS_SV_TYPE_BEIDOU == svNotify.gnssSvs[svOffset].type)
+ {
+ // cache the used in fix mask, as it will be needed to send $PQGSA
+ // during the position report
+ if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
+ (svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ setSvMask(sv_cache_info.bds_used_mask, svNotify.gnssSvs[svOffset].svId);
+ }
+ if ((GNSS_SIGNAL_BEIDOU_B2AI == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) ||
+ (GNSS_SIGNAL_BEIDOU_B2AQ == svNotify.gnssSvs[svOffset].gnssSignalTypeMask)) {
+ sv_cache_info.bds_b2_count++;
+ } else {
+ // GNSS_SIGNAL_BEIDOU_B1I or default
+ // If no signal type in report, it means default B1I
+ sv_cache_info.bds_b1_count++;
+ }
+ }
+ else if (GNSS_SV_TYPE_NAVIC == svNotify.gnssSvs[svOffset].type)
+ {
+ // cache the used in fix mask, as it will be needed to send $PQGSA
+ // during the position report
+ if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
+ (svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ setSvMask(sv_cache_info.navic_used_mask, svNotify.gnssSvs[svOffset].svId);
+ }
+ // GNSS_SIGNAL_NAVIC_L5 is the only signal type for NAVIC
+ sv_cache_info.navic_l5_count++;
+ }
+ }
+
+ loc_nmea_sv_meta sv_meta;
+ // ---------------------
+ // ------$GPGSV:L1CA----
+ // ---------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
+ GNSS_SIGNAL_GPS_L1CA, false), nmeaArraystr);
+
+ // ---------------------
+ // ------$GPGSV:L5------
+ // ---------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
+ GNSS_SIGNAL_GPS_L5, false), nmeaArraystr);
+
+ // ---------------------
+ // ------$GPGSV:L2------
+ // ---------------------
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
+ GNSS_SIGNAL_GPS_L2, false), nmeaArraystr);
+
+ // ---------------------
+ // ------$GLGSV:G1------
+ // ---------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS,
+ GNSS_SIGNAL_GLONASS_G1, false), nmeaArraystr);
+
+ // ---------------------
+ // ------$GLGSV:G2------
+ // ---------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS,
+ GNSS_SIGNAL_GLONASS_G2, false), nmeaArraystr);
+
+ // ---------------------
+ // ------$GAGSV:E1------
+ // ---------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
+ GNSS_SIGNAL_GALILEO_E1, false), nmeaArraystr);
+
+ // -------------------------
+ // ------$GAGSV:E5A---------
+ // -------------------------
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
+ GNSS_SIGNAL_GALILEO_E5A, false), nmeaArraystr);
+
+ // -------------------------
+ // ------$GAGSV:E5B---------
+ // -------------------------
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
+ GNSS_SIGNAL_GALILEO_E5B, false), nmeaArraystr);
+
+ // -----------------------------
+ // ------$GQGSV (QZSS):L1CA-----
+ // -----------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
+ GNSS_SIGNAL_QZSS_L1CA, false), nmeaArraystr);
+
+ // -----------------------------
+ // ------$GQGSV (QZSS):L5-------
+ // -----------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
+ GNSS_SIGNAL_QZSS_L5, false), nmeaArraystr);
+
+ // -----------------------------
+ // ------$GQGSV (QZSS):L2-------
+ // -----------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
+ GNSS_SIGNAL_QZSS_L2, false), nmeaArraystr);
+
+ // -----------------------------
+ // ------$GBGSV (BEIDOU:B1I)----
+ // -----------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
+ GNSS_SIGNAL_BEIDOU_B1I,false), nmeaArraystr);
+
+ // -----------------------------
+ // ------$GBGSV (BEIDOU:B2AI)---
+ // -----------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
+ GNSS_SIGNAL_BEIDOU_B2AI,false), nmeaArraystr);
+
+ // -----------------------------
+ // ------$GIGSV (NAVIC:L5)------
+ // -----------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_NAVIC,
+ GNSS_SIGNAL_NAVIC_L5,false), nmeaArraystr);
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/gps/utils/loc_nmea.h b/gps/utils/loc_nmea.h
new file mode 100644
index 0000000..a9cafb7
--- /dev/null
+++ b/gps/utils/loc_nmea.h
@@ -0,0 +1,93 @@
+/* Copyright (c) 2012-2013, 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_ENG_NMEA_H
+#define LOC_ENG_NMEA_H
+
+#include <gps_extended.h>
+#include <vector>
+#include <string>
+#define NMEA_SENTENCE_MAX_LENGTH 200
+
+/** gnss datum type */
+#define LOC_GNSS_DATUM_WGS84 0
+#define LOC_GNSS_DATUM_PZ90 1
+
+/* len of semi major axis of ref ellips*/
+#define MAJA (6378137.0)
+/* flattening coef of ref ellipsoid*/
+#define FLAT (1.0/298.2572235630)
+/* 1st eccentricity squared*/
+#define ESQR (FLAT*(2.0 - FLAT))
+/*1 minus eccentricity squared*/
+#define OMES (1.0 - ESQR)
+#define MILARCSEC2RAD (4.848136811095361e-09)
+/*semi major axis */
+#define C_PZ90A (6378136.0)
+/*semi minor axis */
+#define C_PZ90B (6356751.3618)
+/* Transformation from WGS84 to PZ90
+ * Cx,Cy,Cz,Rs,Rx,Ry,Rz,C_SYS_A,C_SYS_B*/
+const double DatumConstFromWGS84[9] =
+ {+0.003, +0.001, 0.000, (1.0+(0.000*1E-6)), (-0.019*MILARCSEC2RAD),
+ (+0.042*MILARCSEC2RAD), (-0.002*MILARCSEC2RAD), C_PZ90A, C_PZ90B};
+
+/** Represents a LTP*/
+typedef struct {
+ double lat;
+ double lon;
+ double alt;
+} LocLla;
+
+/** Represents a ECEF*/
+typedef struct {
+ double X;
+ double Y;
+ double Z;
+} LocEcef;
+
+void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
+ std::vector<std::string> &nmeaArraystr);
+
+void loc_nmea_generate_pos(const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ const LocationSystemInfo &systemInfo,
+ unsigned char generate_nmea,
+ bool custom_gga_fix_quality,
+ std::vector<std::string> &nmeaArraystr);
+
+#define DEBUG_NMEA_MINSIZE 6
+#define DEBUG_NMEA_MAXSIZE 4096
+inline bool loc_nmea_is_debug(const char* nmea, int length) {
+ return ((nullptr != nmea) &&
+ (length >= DEBUG_NMEA_MINSIZE) && (length <= DEBUG_NMEA_MAXSIZE) &&
+ (nmea[0] == '$') && (nmea[1] == 'P') && (nmea[2] == 'Q') && (nmea[3] == 'W'));
+}
+
+#endif // LOC_ENG_NMEA_H
diff --git a/gps/utils/loc_target.cpp b/gps/utils/loc_target.cpp
new file mode 100644
index 0000000..3ee42e6
--- /dev/null
+++ b/gps/utils/loc_target.cpp
@@ -0,0 +1,249 @@
+/* Copyright (c) 2012-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 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 <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <log_util.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include <loc_pla.h>
+
+#define APQ8064_ID_1 "109"
+#define APQ8064_ID_2 "153"
+#define MPQ8064_ID_1 "130"
+#define MSM8930_ID_1 "142"
+#define MSM8930_ID_2 "116"
+#define APQ8030_ID_1 "157"
+#define APQ8074_ID_1 "184"
+
+#define LINE_LEN 100
+#define STR_LIQUID "Liquid"
+#define STR_SURF "Surf"
+#define STR_MTP "MTP"
+#define STR_APQ "apq"
+#define STR_SDC "sdc" // alternative string for APQ targets
+#define STR_QCS "qcs" // string for Gen9 APQ targets
+#define STR_MSM "msm"
+#define STR_SDM "sdm" // alternative string for MSM targets
+#define STR_APQ_NO_WGR "baseband_apq_nowgr"
+#define STR_AUTO "auto"
+#define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r')
+#define LENGTH(s) (sizeof(s) - 1)
+#define GPS_CHECK_NO_ERROR 0
+#define GPS_CHECK_NO_GPS_HW 1
+
+static unsigned int gTarget = (unsigned int)-1;
+
+static int read_a_line(const char * file_path, char * line, int line_size)
+{
+ FILE *fp;
+ int result = 0;
+
+ * line = '\0';
+ fp = fopen(file_path, "r" );
+ if( fp == NULL ) {
+ LOC_LOGE("open failed: %s: %s\n", file_path, strerror(errno));
+ result = -1;
+ } else {
+ int len;
+ fgets(line, line_size, fp);
+ len = strlen(line);
+ while ('\n' == line[len-1]) {
+ // If there is a new line at end of string, replace it with NULL
+ line[len-1] = '\0';
+ len--;
+ }
+ len = len < line_size - 1? len : line_size - 1;
+ line[len] = '\0';
+ LOC_LOGD("cat %s: %s", file_path, line);
+ fclose(fp);
+ }
+ return result;
+}
+
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+void loc_get_target_baseband(char *baseband, int array_length)
+{
+ if(baseband && (array_length >= PROPERTY_VALUE_MAX)) {
+ property_get("ro.baseband", baseband, "");
+ LOC_LOGD("%s:%d]: Baseband: %s\n", __func__, __LINE__, baseband);
+ }
+ else {
+ LOC_LOGE("%s:%d]: NULL parameter or array length less than PROPERTY_VALUE_MAX\n",
+ __func__, __LINE__);
+ }
+}
+
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+void loc_get_platform_name(char *platform_name, int array_length)
+{
+ if(platform_name && (array_length >= PROPERTY_VALUE_MAX)) {
+ property_get("ro.board.platform", platform_name, "");
+ LOC_LOGD("%s:%d]: Target name: %s\n", __func__, __LINE__, platform_name);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Null parameter or array length less than PROPERTY_VALUE_MAX\n",
+ __func__, __LINE__);
+ }
+}
+
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+void loc_get_auto_platform_name(char *platform_name, int array_length)
+{
+ if(platform_name && (array_length >= PROPERTY_VALUE_MAX)) {
+ property_get("ro.hardware.type", platform_name, "");
+ LOC_LOGD("%s:%d]: Autoplatform name: %s\n", __func__, __LINE__, platform_name);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Null parameter or array length less than PROPERTY_VALUE_MAX\n",
+ __func__, __LINE__);
+ }
+}
+
+/*Reads the property ro.config.low_ram to identify if this is a low ram target
+ Returns:
+ 0 if not a low ram target
+ 1 if this is a low ram target
+*/
+int loc_identify_low_ram_target()
+{
+ int ret = 0;
+ char low_ram_target[PROPERTY_VALUE_MAX];
+ property_get("ro.config.low_ram", low_ram_target, "");
+ LOC_LOGd("low ram target: %s\n", low_ram_target);
+ return !(strncmp(low_ram_target, "true", PROPERTY_VALUE_MAX));
+}
+
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+/* Reads the soc_id node and return the soc_id value */
+void loc_get_device_soc_id(char *soc_id_value, int array_length)
+{
+ static const char soc_id[] = "/sys/devices/soc0/soc_id";
+ static const char soc_id_dep[] = "/sys/devices/system/soc/soc0/id";
+ int return_val = 0;
+
+ if (soc_id_value && (array_length >= PROPERTY_VALUE_MAX)) {
+ if (!access(soc_id, F_OK)) {
+ return_val = read_a_line(soc_id, soc_id_value, array_length);
+ } else {
+ return_val = read_a_line(soc_id_dep, soc_id_value, array_length);
+ }
+ if (0 == return_val) {
+ LOC_LOGd("SOC Id value: %s\n", soc_id_value);
+ } else {
+ LOC_LOGe("Unable to read the soc_id value\n");
+ }
+ } else {
+ LOC_LOGe("Null parameter or array length less than PROPERTY_VALUE_MAX\n");
+ }
+}
+
+unsigned int loc_get_target(void)
+{
+ if (gTarget != (unsigned int)-1)
+ return gTarget;
+
+ static const char hw_platform[] = "/sys/devices/soc0/hw_platform";
+ static const char hw_platform_dep[] =
+ "/sys/devices/system/soc/soc0/hw_platform";
+ static const char mdm[] = "/target"; // mdm target we are using
+
+ char rd_hw_platform[LINE_LEN];
+ char rd_id[LINE_LEN];
+ char rd_mdm[LINE_LEN];
+ char baseband[LINE_LEN];
+ char rd_auto_platform[LINE_LEN];
+
+ loc_get_target_baseband(baseband, sizeof(baseband));
+
+ if (!access(hw_platform, F_OK)) {
+ read_a_line(hw_platform, rd_hw_platform, LINE_LEN);
+ } else {
+ read_a_line(hw_platform_dep, rd_hw_platform, LINE_LEN);
+ }
+ // Get the soc-id for this device.
+ loc_get_device_soc_id(rd_id, sizeof(rd_id));
+
+ /*check automotive platform*/
+ loc_get_auto_platform_name(rd_auto_platform, sizeof(rd_auto_platform));
+ if( !memcmp(rd_auto_platform, STR_AUTO, LENGTH(STR_AUTO)) )
+ {
+ gTarget = TARGET_AUTO;
+ goto detected;
+ }
+
+ if( !memcmp(baseband, STR_APQ_NO_WGR, LENGTH(STR_APQ_NO_WGR)) ){
+
+ gTarget = TARGET_NO_GNSS;
+ goto detected;
+ }
+
+ if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ||
+ !memcmp(baseband, STR_SDC, LENGTH(STR_SDC)) ||
+ !memcmp(baseband, STR_QCS, LENGTH(STR_QCS)) ) {
+
+ if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
+ && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
+ gTarget = TARGET_NO_GNSS;
+ else
+ gTarget = TARGET_APQ_SA;
+ } else if (((!memcmp(rd_hw_platform, STR_LIQUID, LENGTH(STR_LIQUID))
+ && IS_STR_END(rd_hw_platform[LENGTH(STR_LIQUID)])) ||
+ (!memcmp(rd_hw_platform, STR_SURF, LENGTH(STR_SURF))
+ && IS_STR_END(rd_hw_platform[LENGTH(STR_SURF)])) ||
+ (!memcmp(rd_hw_platform, STR_MTP, LENGTH(STR_MTP))
+ && IS_STR_END(rd_hw_platform[LENGTH(STR_MTP)]))) &&
+ !read_a_line( mdm, rd_mdm, LINE_LEN)) {
+ gTarget = TARGET_MDM;
+ } else if( (!memcmp(rd_id, MSM8930_ID_1, LENGTH(MSM8930_ID_1))
+ && IS_STR_END(rd_id[LENGTH(MSM8930_ID_1)])) ||
+ (!memcmp(rd_id, MSM8930_ID_2, LENGTH(MSM8930_ID_2))
+ && IS_STR_END(rd_id[LENGTH(MSM8930_ID_2)])) ) {
+ gTarget = TARGET_MSM_NO_SSC;
+ } else if ( !memcmp(baseband, STR_MSM, LENGTH(STR_MSM)) ||
+ !memcmp(baseband, STR_SDM, LENGTH(STR_SDM)) ) {
+ gTarget = TARGET_DEFAULT;
+ } else {
+ gTarget = TARGET_UNKNOWN;
+ }
+
+detected:
+ LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget);
+ return gTarget;
+}
diff --git a/gps/utils/loc_target.h b/gps/utils/loc_target.h
new file mode 100644
index 0000000..2dcd895
--- /dev/null
+++ b/gps/utils/loc_target.h
@@ -0,0 +1,82 @@
+/* Copyright (c) 2012-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_TARGET_H
+#define LOC_TARGET_H
+#define TARGET_SET(gnss,ssc) ( (gnss<<1)|ssc )
+#define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC)
+#define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC)
+#define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC)
+#define TARGET_NO_GNSS TARGET_SET(GNSS_NONE, NO_SSC)
+#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
+#define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC)
+#define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC)
+#define getTargetGnssType(target) (target>>1)
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+unsigned int loc_get_target(void);
+
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+void loc_get_target_baseband(char *baseband, int array_length);
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+void loc_get_platform_name(char *platform_name, int array_length);
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+void loc_get_auto_platform_name(char *platform_name, int array_length);
+int loc_identify_low_ram_target();
+/*The character array passed to this function should have length
+ of atleast PROPERTY_VALUE_MAX*/
+void loc_get_device_soc_id(char *soc_id_value, int array_length);
+
+/* Please remember to update 'target_name' in loc_log.cpp,
+ if do any changes to this enum. */
+typedef enum {
+ GNSS_NONE = 0,
+ GNSS_MSM,
+ GNSS_GSS,
+ GNSS_MDM,
+ GNSS_AUTO,
+ GNSS_UNKNOWN
+}GNSS_TARGET;
+
+typedef enum {
+ NO_SSC = 0,
+ HAS_SSC
+}SSC_TYPE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*LOC_TARGET_H*/
diff --git a/gps/utils/loc_timer.h b/gps/utils/loc_timer.h
new file mode 100644
index 0000000..fff0c46
--- /dev/null
+++ b/gps/utils/loc_timer.h
@@ -0,0 +1,74 @@
+/* Copyright (c) 2013,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 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_DELAY_H__
+#define __LOC_DELAY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#include <stddef.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.
+ result: 0 if timer successfully timed out; else timer failed.
+*/
+typedef void (*loc_timer_callback)(void *user_data, int32_t result);
+
+
+/*
+ delay_msec: timeout value for the timer.
+ cb_func: callback function pointer, implemented by client.
+ Can not be NULL.
+ user_data: client context pointer, passthrough. Will be
+ returned when loc_timer_callback() is called.
+ wakeOnExpire: true if to wake up CPU (if sleeping) upon timer
+ expiration and notify the client.
+ false if to wait until next time CPU wakes up (if
+ sleeping) and then notify the client.
+ Returns the handle, which can be used to stop the timer
+ NULL, if timer start fails (e.g. if cb_func is NULL).
+*/
+void* loc_timer_start(uint64_t delay_msec,
+ loc_timer_callback cb_func,
+ void *user_data,
+ bool wake_on_expire=false);
+
+/*
+ handle becomes invalid upon the return of the callback
+*/
+void loc_timer_stop(void*& handle);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_DELAY_H__
diff --git a/gps/utils/log_util.h b/gps/utils/log_util.h
new file mode 100644
index 0000000..13c08bc
--- /dev/null
+++ b/gps/utils/log_util.h
@@ -0,0 +1,254 @@
+/* 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 __LOG_UTIL_H__
+#define __LOG_UTIL_H__
+
+#include <stdbool.h>
+
+#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
+// Android and LE targets with logcat support
+#include <utils/Log.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#elif defined (USE_GLIB)
+// LE targets with no logcat support
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+#endif /* LOG_TAG */
+
+// LE targets with no logcat support
+#ifdef FEATURE_EXTERNAL_AP
+#include <syslog.h>
+#define ALOGE(...) syslog(LOG_ERR, "LOC_LOGE: " __VA_ARGS__);
+#define ALOGW(...) syslog(LOG_WARNING, "LOC_LOGW: " __VA_ARGS__);
+#define ALOGI(...) syslog(LOG_NOTICE, "LOC_LOGI: " __VA_ARGS__);
+#define ALOGD(...) syslog(LOG_DEBUG, "LOC_LOGD: " __VA_ARGS__);
+#define ALOGV(...) syslog(LOG_NOTICE, "LOC_LOGV: " __VA_ARGS__);
+#else /* FEATURE_EXTERNAL_AP */
+#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 /* FEATURE_EXTERNAL_AP */
+
+#endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+ bool LOG_BUFFER_ENABLE;
+} loc_logger_s_type;
+
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern loc_logger_s_type loc_logger;
+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
+ *
+ *============================================================================*/
+inline void loc_logger_init(unsigned long debug, unsigned long timestamp)
+{
+ loc_logger.DEBUG_LEVEL = debug;
+#ifdef TARGET_BUILD_VARIANT_USER
+ // force user builds to 2 or less
+ if (loc_logger.DEBUG_LEVEL > 2) {
+ loc_logger.DEBUG_LEVEL = 2;
+ }
+#endif
+ loc_logger.TIMESTAMP = timestamp;
+}
+
+inline void log_buffer_init(bool enabled) {
+ loc_logger.LOG_BUFFER_ENABLE = enabled;
+}
+
+extern char* get_timestamp(char* str, unsigned long buf_size);
+extern void log_buffer_insert(char *str, unsigned long buf_size, int level);
+
+/*=============================================================================
+ *
+ * LOGGING BUFFER MACROS
+ *
+ *============================================================================*/
+#ifndef LOG_NDEBUG
+#define LOG_NDEBUG 0
+#endif
+#define TOTAL_LOG_LEVELS 5
+#define LOGGING_BUFFER_MAX_LEN 1024
+#define IF_LOG_BUFFER_ENABLE if (loc_logger.LOG_BUFFER_ENABLE)
+#define INSERT_BUFFER(flag, level, format, x...) \
+{ \
+ IF_LOG_BUFFER_ENABLE { \
+ if (flag == 0) { \
+ char timestr[32]; \
+ get_timestamp(timestr, sizeof(timestr)); \
+ char log_str[LOGGING_BUFFER_MAX_LEN]; \
+ snprintf(log_str, LOGGING_BUFFER_MAX_LEN, "%s %d %ld %s :" format "\n", \
+ timestr, getpid(), syscall(SYS_gettid), LOG_TAG==NULL ? "": LOG_TAG, ##x);\
+ log_buffer_insert(log_str, sizeof(log_str), level); \
+ } \
+ } \
+}
+
+#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__); INSERT_BUFFER(LOG_NDEBUG, 0, __VA_ARGS__);}
+#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 1, __VA_ARGS__);}
+#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 2, __VA_ARGS__);}
+#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 3, __VA_ARGS__);}
+#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 4, __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_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__)
+
+#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 LOG_D(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGD, 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 high frequency callflow from Modem(TO_MODEM, __FUNCTION__, %s, "")
+#define MODEM_LOG_CALLFLOW_DEBUG(SPEC, VAL) LOG_D(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 // __LOG_UTIL_H__
diff --git a/gps/utils/msg_q.c b/gps/utils/msg_q.c
new file mode 100644
index 0000000..3383960
--- /dev/null
+++ b/gps/utils/msg_q.c
@@ -0,0 +1,380 @@
+/* Copyright (c) 2011-2012, 2014, 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.
+ */
+
+// Uncomment to log verbose logs
+#define LOG_NDEBUG 1
+#define LOG_TAG "LocSvc_utils_q"
+#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 */
+ pthread_cond_t list_cond; /* Condition variable for waiting on msg queue */
+ pthread_mutex_t list_mutex; /* Mutex for exclusive access to message queue */
+ int unblocked; /* Has this message queue been unblocked? */
+} msg_q;
+
+/*===========================================================================
+FUNCTION convert_linked_list_err_type
+
+DESCRIPTION
+ Converts from one set of enum values to another.
+
+ linked_list_val: Value to convert to msg_q_enum_type
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Corresponding linked_list_enum_type in msg_q_enum_type
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static msq_q_err_type convert_linked_list_err_type(linked_list_err_type linked_list_val)
+{
+ switch( linked_list_val )
+ {
+ case eLINKED_LIST_SUCCESS:
+ return eMSG_Q_SUCCESS;
+ case eLINKED_LIST_INVALID_PARAMETER:
+ return eMSG_Q_INVALID_PARAMETER;
+ case eLINKED_LIST_INVALID_HANDLE:
+ return eMSG_Q_INVALID_HANDLE;
+ case eLINKED_LIST_UNAVAILABLE_RESOURCE:
+ return eMSG_Q_UNAVAILABLE_RESOURCE;
+ case eLINKED_LIST_INSUFFICIENT_BUFFER:
+ return eMSG_Q_INSUFFICIENT_BUFFER;
+
+ case eLINKED_LIST_FAILURE_GENERAL:
+ default:
+ return eMSG_Q_FAILURE_GENERAL;
+ }
+}
+
+/* ----------------------- END INTERNAL FUNCTIONS ---------------------------------------- */
+
+/*===========================================================================
+
+ FUNCTION: msg_q_init
+
+ ===========================================================================*/
+msq_q_err_type msg_q_init(void** msg_q_data)
+{
+ if( msg_q_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_PARAMETER;
+ }
+
+ msg_q* tmp_msg_q;
+ tmp_msg_q = (msg_q*)calloc(1, sizeof(msg_q));
+ if( tmp_msg_q == NULL )
+ {
+ LOC_LOGE("%s: Unable to allocate space for message queue!\n", __FUNCTION__);
+ return eMSG_Q_FAILURE_GENERAL;
+ }
+
+ if( linked_list_init(&tmp_msg_q->msg_list) != 0 )
+ {
+ LOC_LOGE("%s: Unable to initialize storage list!\n", __FUNCTION__);
+ free(tmp_msg_q);
+ return eMSG_Q_FAILURE_GENERAL;
+ }
+
+ if( pthread_mutex_init(&tmp_msg_q->list_mutex, NULL) != 0 )
+ {
+ LOC_LOGE("%s: Unable to initialize list mutex!\n", __FUNCTION__);
+ linked_list_destroy(&tmp_msg_q->msg_list);
+ free(tmp_msg_q);
+ return eMSG_Q_FAILURE_GENERAL;
+ }
+
+ if( pthread_cond_init(&tmp_msg_q->list_cond, NULL) != 0 )
+ {
+ LOC_LOGE("%s: Unable to initialize msg q cond var!\n", __FUNCTION__);
+ linked_list_destroy(&tmp_msg_q->msg_list);
+ pthread_mutex_destroy(&tmp_msg_q->list_mutex);
+ free(tmp_msg_q);
+ return eMSG_Q_FAILURE_GENERAL;
+ }
+
+ tmp_msg_q->unblocked = 0;
+
+ *msg_q_data = tmp_msg_q;
+
+ return eMSG_Q_SUCCESS;
+}
+
+/*===========================================================================
+
+ FUNCTION: msg_q_init2
+
+ ===========================================================================*/
+const void* msg_q_init2()
+{
+ void* q = NULL;
+ if (eMSG_Q_SUCCESS != msg_q_init(&q)) {
+ q = NULL;
+ }
+ return q;
+}
+
+/*===========================================================================
+
+ FUNCTION: msg_q_destroy
+
+ ===========================================================================*/
+msq_q_err_type msg_q_destroy(void** msg_q_data)
+{
+ if( msg_q_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_HANDLE;
+ }
+
+ msg_q* p_msg_q = (msg_q*)*msg_q_data;
+
+ linked_list_destroy(&p_msg_q->msg_list);
+ pthread_mutex_destroy(&p_msg_q->list_mutex);
+ pthread_cond_destroy(&p_msg_q->list_cond);
+
+ p_msg_q->unblocked = 0;
+
+ free(*msg_q_data);
+ *msg_q_data = NULL;
+
+ return eMSG_Q_SUCCESS;
+}
+
+/*===========================================================================
+
+ FUNCTION: msg_q_snd
+
+ ===========================================================================*/
+msq_q_err_type msg_q_snd(void* msg_q_data, void* msg_obj, void (*dealloc)(void*))
+{
+ msq_q_err_type rv;
+ if( msg_q_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_HANDLE;
+ }
+ if( msg_obj == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_obj parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_PARAMETER;
+ }
+
+ msg_q* p_msg_q = (msg_q*)msg_q_data;
+
+ pthread_mutex_lock(&p_msg_q->list_mutex);
+ LOC_LOGV("%s: Sending message with handle = %p\n", __FUNCTION__, msg_obj);
+
+ if( p_msg_q->unblocked )
+ {
+ LOC_LOGE("%s: Message queue has been unblocked.\n", __FUNCTION__);
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+ return eMSG_Q_UNAVAILABLE_RESOURCE;
+ }
+
+ rv = convert_linked_list_err_type(linked_list_add(p_msg_q->msg_list, msg_obj, dealloc));
+
+ /* Show data is in the message queue. */
+ pthread_cond_signal(&p_msg_q->list_cond);
+
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+
+ LOC_LOGV("%s: Finished Sending message with handle = %p\n", __FUNCTION__, msg_obj);
+
+ return rv;
+}
+
+/*===========================================================================
+
+ FUNCTION: msg_q_rcv
+
+ ===========================================================================*/
+msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj)
+{
+ msq_q_err_type rv;
+ if( msg_q_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_HANDLE;
+ }
+
+ if( msg_obj == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_obj parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_PARAMETER;
+ }
+
+ msg_q* p_msg_q = (msg_q*)msg_q_data;
+
+ pthread_mutex_lock(&p_msg_q->list_mutex);
+
+ if( p_msg_q->unblocked )
+ {
+ LOC_LOGE("%s: Message queue has been unblocked.\n", __FUNCTION__);
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+ return eMSG_Q_UNAVAILABLE_RESOURCE;
+ }
+
+ /* Wait for data in the message queue */
+ while( linked_list_empty(p_msg_q->msg_list) && !p_msg_q->unblocked )
+ {
+ pthread_cond_wait(&p_msg_q->list_cond, &p_msg_q->list_mutex);
+ }
+
+ rv = convert_linked_list_err_type(linked_list_remove(p_msg_q->msg_list, msg_obj));
+
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+
+ LOC_LOGV("%s: Received message %p rv = %d\n", __FUNCTION__, *msg_obj, rv);
+
+ return rv;
+}
+
+/*===========================================================================
+
+ FUNCTION: msg_q_rmv
+
+ ===========================================================================*/
+msq_q_err_type msg_q_rmv(void* msg_q_data, void** msg_obj)
+{
+ msq_q_err_type rv;
+ if (msg_q_data == NULL) {
+ LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_HANDLE;
+ }
+
+ if (msg_obj == NULL) {
+ LOC_LOGE("%s: Invalid msg_obj parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_PARAMETER;
+ }
+
+ msg_q* p_msg_q = (msg_q*)msg_q_data;
+
+ pthread_mutex_lock(&p_msg_q->list_mutex);
+
+ if (p_msg_q->unblocked) {
+ LOC_LOGE("%s: Message queue has been unblocked.\n", __FUNCTION__);
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+ return eMSG_Q_UNAVAILABLE_RESOURCE;
+ }
+
+ if (linked_list_empty(p_msg_q->msg_list)) {
+ LOC_LOGW("%s: list is empty !!\n", __FUNCTION__);
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+ return eLINKED_LIST_EMPTY;
+ }
+
+ rv = convert_linked_list_err_type(linked_list_remove(p_msg_q->msg_list, msg_obj));
+
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+
+ LOC_LOGV("%s: Removed message %p rv = %d\n", __FUNCTION__, *msg_obj, rv);
+
+ return rv;
+}
+
+
+
+/*===========================================================================
+
+ FUNCTION: msg_q_flush
+
+ ===========================================================================*/
+msq_q_err_type msg_q_flush(void* msg_q_data)
+{
+ msq_q_err_type rv;
+ if ( msg_q_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_HANDLE;
+ }
+
+ msg_q* p_msg_q = (msg_q*)msg_q_data;
+
+ LOC_LOGD("%s: Flushing Message Queue\n", __FUNCTION__);
+
+ pthread_mutex_lock(&p_msg_q->list_mutex);
+
+ /* Remove all elements from the list */
+ rv = convert_linked_list_err_type(linked_list_flush(p_msg_q->msg_list));
+
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+
+ LOC_LOGD("%s: Message Queue flushed\n", __FUNCTION__);
+
+ return rv;
+}
+
+/*===========================================================================
+
+ FUNCTION: msg_q_unblock
+
+ ===========================================================================*/
+msq_q_err_type msg_q_unblock(void* msg_q_data)
+{
+ if ( msg_q_data == NULL )
+ {
+ LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
+ return eMSG_Q_INVALID_HANDLE;
+ }
+
+ msg_q* p_msg_q = (msg_q*)msg_q_data;
+ pthread_mutex_lock(&p_msg_q->list_mutex);
+
+ if( p_msg_q->unblocked )
+ {
+ LOC_LOGE("%s: Message queue has been unblocked.\n", __FUNCTION__);
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+ return eMSG_Q_UNAVAILABLE_RESOURCE;
+ }
+
+ LOC_LOGD("%s: Unblocking Message Queue\n", __FUNCTION__);
+ /* Unblocking message queue */
+ p_msg_q->unblocked = 1;
+
+ /* Allow all the waiters to wake up */
+ pthread_cond_broadcast(&p_msg_q->list_cond);
+
+ pthread_mutex_unlock(&p_msg_q->list_mutex);
+
+ LOC_LOGD("%s: Message Queue unblocked\n", __FUNCTION__);
+
+ return eMSG_Q_SUCCESS;
+}
diff --git a/gps/utils/msg_q.h b/gps/utils/msg_q.h
new file mode 100644
index 0000000..16df494
--- /dev/null
+++ b/gps/utils/msg_q.h
@@ -0,0 +1,230 @@
+/* Copyright (c) 2011, 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 __MSG_Q_H__
+#define __MSG_Q_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+
+/** Linked List Return Codes */
+typedef enum
+{
+ eMSG_Q_SUCCESS = 0,
+ /**< Request was successful. */
+ eMSG_Q_FAILURE_GENERAL = -1,
+ /**< Failed because of a general failure. */
+ eMSG_Q_INVALID_PARAMETER = -2,
+ /**< Failed because the request contained invalid parameters. */
+ eMSG_Q_INVALID_HANDLE = -3,
+ /**< Failed because an invalid handle was specified. */
+ eMSG_Q_UNAVAILABLE_RESOURCE = -4,
+ /**< Failed because an there were not enough resources. */
+ eMSG_Q_INSUFFICIENT_BUFFER = -5,
+ /**< Failed because an the supplied buffer was too small. */
+}msq_q_err_type;
+
+/*===========================================================================
+FUNCTION msg_q_init
+
+DESCRIPTION
+ Initializes internal structures for message queue.
+
+ msg_q_data: pointer to an opaque Q handle to be returned; NULL if fails
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+msq_q_err_type msg_q_init(void** msg_q_data);
+
+/*===========================================================================
+FUNCTION msg_q_init2
+
+DESCRIPTION
+ Initializes internal structures for message queue.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ opaque handle to the Q created; NULL if create fails
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const void* msg_q_init2();
+
+/*===========================================================================
+FUNCTION msg_q_destroy
+
+DESCRIPTION
+ Releases internal structures for message queue.
+
+ msg_q_data: State of message queue to be released.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+msq_q_err_type msg_q_destroy(void** msg_q_data);
+
+/*===========================================================================
+FUNCTION msg_q_snd
+
+DESCRIPTION
+ Sends data to the message queue. The passed in data pointer
+ is not modified or freed. Passed in msg_obj is expected to live throughout
+ the use of the msg_q (i.e. data is not allocated internally)
+
+ msg_q_data: Message Queue to add the element to.
+ msgp: Pointer to data to add into message queue.
+ dealloc: Function used to deallocate memory for this element. Pass NULL
+ if you do not want data deallocated during a flush operation
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+msq_q_err_type msg_q_snd(void* msg_q_data, void* msg_obj, void (*dealloc)(void*));
+
+/*===========================================================================
+FUNCTION msg_q_rcv
+
+DESCRIPTION
+ Retrieves data from the message queue. msg_obj is the oldest message received
+ and pointer is simply removed from message queue.
+
+ msg_q_data: Message Queue to copy data from into msgp.
+ msg_obj: Pointer to space to copy msg_q contents to.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj);
+
+/*===========================================================================
+FUNCTION msg_q_rmv
+
+DESCRIPTION
+ Remove data from the message queue. msg_obj is the oldest message received
+ and pointer is simply removed from message queue.
+
+ msg_q_data: Message Queue to copy data from into msgp.
+ msg_obj: Pointer to space to copy msg_q contents to.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+msq_q_err_type msg_q_rmv(void* msg_q_data, void** msg_obj);
+
+
+/*===========================================================================
+FUNCTION msg_q_flush
+
+DESCRIPTION
+ Function removes all elements from the message queue.
+
+ msg_q_data: Message Queue to remove elements from.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+msq_q_err_type msg_q_flush(void* msg_q_data);
+
+/*===========================================================================
+FUNCTION msg_q_unblock
+
+DESCRIPTION
+ This function will stop use of the message queue. All waiters will wake up
+ and likely receive nothing from the queue resulting in a negative return
+ value. The message queue can no longer be used until it is destroyed
+ and initialized again after calling this function.
+
+ msg_q_data: Message queue to unblock.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Look at error codes above.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+msq_q_err_type msg_q_unblock(void* msg_q_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MSG_Q_H__ */
diff --git a/location/Android.mk b/location/Android.mk
new file mode 100644
index 0000000..7e06b85
--- /dev/null
+++ b/location/Android.mk
@@ -0,0 +1,5 @@
+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
\ No newline at end of file
diff --git a/location/build/target_specific_features.mk b/location/build/target_specific_features.mk
new file mode 100644
index 0000000..70c1f11
--- /dev/null
+++ b/location/build/target_specific_features.mk
@@ -0,0 +1,20 @@
+GNSS_CFLAGS := \
+ -Werror \
+ -Wno-error=unused-parameter \
+ -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
+
+# Activate the following two lines for regression testing
+#GNSS_SANITIZE := address cfi alignment bounds null unreachable integer
+#GNSS_SANITIZE_DIAG := address cfi alignment bounds null unreachable integer
diff --git a/location/client_api/LocationClientApiDoxygen.conf b/location/client_api/LocationClientApiDoxygen.conf
new file mode 100644
index 0000000..5311225
--- /dev/null
+++ b/location/client_api/LocationClientApiDoxygen.conf
@@ -0,0 +1,2294 @@
+# Doxyfile 1.8.6
+#==========================================================================
+#Copyright (c) 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.
+#
+#==========================================================================
+
+# This file describes the settings to be used by the documentation system
+# doxygen for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "LocationClientApi"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = docs
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable documentation.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation for the list of possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system.
+# You will need version 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code.
+# For an example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian .
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian . See the section "External Indexing and Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz.
+# A graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = YES
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/location/client_api/Makefile.am b/location/client_api/Makefile.am
new file mode 100644
index 0000000..f964d85
--- /dev/null
+++ b/location/client_api/Makefile.am
@@ -0,0 +1,61 @@
+AM_CFLAGS = \
+ -DDEBUG \
+ -I src/ \
+ -I inc/ \
+ $(GPSUTILS_CFLAGS) \
+ -std=c++11
+
+ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -std=c++11
+
+requiredlibs = \
+ $(GPSUTILS_LIBS)
+
+h_sources = \
+ src/LocationClientApiImpl.h \
+ inc/LocationClientApi.h
+
+c_sources = \
+ src/LocationClientApiImpl.cpp \
+ src/LocationClientApi.cpp
+
+liblocation_client_api_la_SOURCES = \
+ $(c_sources) $(h_sources)
+liblocation_client_api_la_h_sources = $(h_sources)
+
+######################
+# Build location_client_api
+######################
+
+if USE_GLIB
+liblocation_client_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+liblocation_client_api_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+liblocation_client_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+liblocation_client_api_la_CFLAGS = $(AM_CFLAGS)
+liblocation_client_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+liblocation_client_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+if USE_EXTERNAL_AP
+AM_CFLAGS += $(LOCSOCKET_CFLAGS)
+requiredlibs += $(LOCSOCKET_LIBS)
+else
+AM_CFLAGS += $(DIAGIFACE_CFLAGS)
+AM_CFLAGS += $(DIAG_CFLAGS)
+requiredlibs += $(DIAGIFACE_LIBS)
+requiredlibs += $(DIAG_LIBS)
+h_sources += src/LocationClientApiLog.h
+c_sources += src/LocationClientApiUtils.cpp
+endif
+
+liblocation_client_api_la_LIBADD = $(requiredlibs) -lstdc++ -ldl
+
+#Create and Install libraries
+library_include_HEADERS = $(h_sources)
+lib_LTLIBRARIES = liblocation_client_api.la
+
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-client-api.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/location/client_api/README b/location/client_api/README
new file mode 100644
index 0000000..cee2c41
--- /dev/null
+++ b/location/client_api/README
@@ -0,0 +1,11 @@
+Location Client Api doc
+
+1. Steps to generate doxygen Api doc:
+run
+ mkclientapidoc.sh [output-path]
+default output-path is docs/
+default doxgen configuration file is LocationClientApiDoxygen.conf
+
+2. below file will be generated:
+ html/
+ -HTML output, where the html/index.html is the home page.
diff --git a/location/client_api/configure.ac b/location/client_api/configure.ac
new file mode 100644
index 0000000..38e1899
--- /dev/null
+++ b/location/client_api/configure.ac
@@ -0,0 +1,82 @@
+# configure.ac -- Autoconf script for gps location-client-api
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the location_client_api package version 1.0.0
+AC_INIT([location-client-api],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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([external_ap],
+ AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
+ [Using External Application Processor]),
+ [],
+ with_external_ap=no)
+
+if test "x$with_external_ap" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
+else
+ # Checks for libraries.
+ PKG_CHECK_MODULES([DIAGIFACE], [loc-diag-iface])
+ AC_SUBST([DIAGIFACE_CFLAGS])
+ AC_SUBST([DIAGIFACE_LIBS])
+
+ PKG_CHECK_MODULES([DIAG], [diag])
+ AC_SUBST([DIAG_CFLAGS])
+ AC_SUBST([DIAG_LIBS])
+fi
+
+AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "xyes")
+
+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-client-api.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/client_api/inc/LocationClientApi.h b/location/client_api/inc/LocationClientApi.h
new file mode 100644
index 0000000..e7c0400
--- /dev/null
+++ b/location/client_api/inc/LocationClientApi.h
@@ -0,0 +1,2369 @@
+/* Copyright (c) 2018-2020, 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 LOCATIONCLIENTAPI_H
+#define LOCATIONCLIENTAPI_H
+
+#include <vector>
+#include <string>
+#include <functional>
+#include <memory>
+
+using std::string;
+
+namespace location_client
+{
+class Geofence;
+
+enum LocationCapabilitiesMask {
+ /** LocationClientApi can support time-based tracking session
+ * via LocationClientApi::startPositionSession(uint32_t,
+ * LocReqEngineTypeMask, const EngineReportCbs&, ResponseCb)
+ * and LocationClientApi::startPositionSession(uint32_t, const
+ * GnssReportCbs&, ResponseCb) and
+ * LocationClientApi::startPositionSession(uint32_t, uint32_t,
+ * LocationCb, ResponseCb) with distanceInMeters set to 0.
+ * <br/> */
+ LOCATION_CAPS_TIME_BASED_TRACKING_BIT = (1<<0),
+ /** LocationClientApi can support time-based batching session
+ * via LocationClientApi::startRoutineBatchingSession() with
+ * minInterval specified. <br/> */
+ LOCATION_CAPS_TIME_BASED_BATCHING_BIT = (1<<1),
+ /** LocationClientApi can support distance based tracking
+ * session via
+ * LocationClientApi::startPositionSession(uint32_t, uint32_t,
+ * LocationCb, ResponseCb) with distanceInMeters specified.
+ * <br/> */
+ LOCATION_CAPS_DISTANCE_BASED_TRACKING_BIT = (1<<2),
+ /** LocationClientApi can support distance-based batching via
+ * LocationClientApi::startRoutineBatchingSession() with
+ * minDistance set to none-zero value. <br/> */
+ LOCATION_CAPS_DISTANCE_BASED_BATCHING_BIT = (1<<3),
+ /** LocationClientApi can support geo fence via
+ * LocationClientApi::addGeofences(). <br/> */
+ LOCATION_CAPS_GEOFENCE_BIT = (1<<4),
+ /** LocationClientApi can support trip batching via
+ * LocationClientApi::startTripBatchingSession(). <br/> */
+ LOCATION_CAPS_OUTDOOR_TRIP_BATCHING_BIT = (1<<5),
+};
+
+/**
+ * Specify the vaid fields and additional status for
+ * GnssSv. <br/>
+ */
+enum GnssSvOptionsMask {
+ /** Ephemeris is available for this SV. <br/> */
+ GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0),
+ /** Almanac is available for this SV. <br/> */
+ GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1),
+ /** This SV is used in the position fix. <br/> */
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2),
+ /** This SV has valid GnssSv::carrierFrequencyHz. <br/> */
+ GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3),
+ /** This SV has valid GnssSv::gnssSignalTypeMask. <br/> */
+ GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT = (1<<4)
+};
+
+/**
+ * Specify the valid fields in Location. <br/>
+ *
+ * User should determine whether a field in
+ * Location is valid or not by checking
+ * whether the corrsponding bit in
+ * Location::flags is set or not. <br/>
+ */
+enum LocationFlagsMask {
+ /** Location has valid Location::latitude and
+ * Location::longitude. <br/> */
+ LOCATION_HAS_LAT_LONG_BIT = (1<<0),
+ /** Location has valid Location::altitude. <br/> */
+ LOCATION_HAS_ALTITUDE_BIT = (1<<1),
+ /** Location has valid Location::speed. <br/> */
+ LOCATION_HAS_SPEED_BIT = (1<<2),
+ /** Location has valid Location::bearing. <br/> */
+ LOCATION_HAS_BEARING_BIT = (1<<3),
+ /** Location has valid Location::horizontalAccuracy. <br/> */
+ LOCATION_HAS_ACCURACY_BIT = (1<<4),
+ /** Location has valid Location::verticalAccuracy. <br/> */
+ LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5),
+ /** Location has valid Location::speedAccuracy. <br/> */
+ LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6),
+ /** Location has valid Location::bearingAccuracy. <br/> */
+ LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7),
+ /** Location has valid Location::timestamp. <br/> */
+ LOCATION_HAS_TIMESTAMP_BIT = (1<<8)
+};
+
+/**
+ * Specify the set of technologies that contribute to Location.
+ * <br/>
+ */
+enum LocationTechnologyMask {
+ /** GNSS-based technology was used to calculate
+ * Location. <br/> */
+ LOCATION_TECHNOLOGY_GNSS_BIT = (1<<0),
+ /** Cell-based technology was used to calculate
+ * Location. <br/> */
+ LOCATION_TECHNOLOGY_CELL_BIT = (1<<1),
+ /** WiFi-based technology was used to calculate
+ * Location. <br/> */
+ LOCATION_TECHNOLOGY_WIFI_BIT = (1<<2),
+ /** Sensor-based technology was used to calculate
+ * Location. <br/> */
+ LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3)
+};
+
+/** Specify the set of navigation solutions that contribute
+ * to GnssLocation. <br/> */
+enum GnssLocationNavSolutionMask {
+ /** SBAS ionospheric correction was used to calculate
+ * GnssLocation. <br/> */
+ LOCATION_SBAS_CORRECTION_IONO_BIT = (1<<0),
+ /** SBAS fast correction was used to calculate
+ * GnssLocation. <br/> */
+ LOCATION_SBAS_CORRECTION_FAST_BIT = (1<<1),
+ /** SBAS long-tem correction was used to calculate
+ * GnssLocation. <br/> */
+ LOCATION_SBAS_CORRECTION_LONG_BIT = (1<<2),
+ /** SBAS integrity information was used to calculate
+ * GnssLocation. <br/> */
+ LOCATION_SBAS_INTEGRITY_BIT = (1<<3),
+ /** DGNSS corretion was used to calculate
+ * GnssLocation. <br/> */
+ LOCATION_NAV_CORRECTION_DGNSS_BIT = (1<<4),
+ /** RTK corretion was used to calculate
+ * GnssLocation. <br/> */
+ LOCATION_NAV_CORRECTION_RTK_BIT = (1<<5),
+ /** PPP correction was used to calculate
+ * GnssLocation. <br/> */
+ LOCATION_NAV_CORRECTION_PPP_BIT = (1<<6)
+};
+
+/**
+ * Specify the set of technologies that contribute to
+ * GnssLocation. <br/>
+ */
+enum GnssLocationPosTechMask {
+ /** Technology used to generate GnssLocation
+ * is unknown. <br/> */
+ LOCATION_POS_TECH_DEFAULT_BIT = 0,
+ /** Satellites-based technology was used to generate
+ * GnssLocation. <br/> */
+ LOCATION_POS_TECH_SATELLITE_BIT = (1<<0),
+ /** Cell towers were used to generate
+ * GnssLocation. <br/> */
+ LOCATION_POS_TECH_CELLID_BIT = (1<<1),
+ /** Wi-Fi access points were used to generate
+ * GnssLocation. <br/> */
+ LOCATION_POS_TECH_WIFI_BIT = (1<<2),
+ /** Sensors were used to generate
+ * GnssLocation. <br/> */
+ LOCATION_POS_TECH_SENSORS_BIT = (1<<3),
+ /** Reference location was used to generate GnssLocation.
+ * <br/> */
+ LOCATION_POS_TECH_REFERENCE_LOCATION_BIT = (1<<4),
+ /** Coarse position injected into the location engine was used to
+ * generate GnssLocation. <br/> */
+ LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5),
+ /** AFLT was used to generate GnssLocation. <br/> */
+ LOCATION_POS_TECH_AFLT_BIT = (1<<6),
+ /** GNSS and network-provided measurements were used to generate
+ * GnssLocation. <br/> */
+ LOCATION_POS_TECH_HYBRID_BIT = (1<<7),
+ /** Precise position engine was used to generate
+ * GnssLocation. <br/> */
+ LOCATION_POS_TECH_PPE_BIT = (1<<8)
+};
+
+/** Specify the valid fields in
+ * GnssLocationPositionDynamics. <br/> */
+enum GnssLocationPosDataMask {
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::longAccel. <br/> */
+ LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT = (1<<0),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::latAccel. <br/> */
+ LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT = (1<<1),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::vertAccel. <br/> */
+ LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT = (1<<2),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::yawRate. <br/> */
+ LOCATION_NAV_DATA_HAS_YAW_RATE_BIT = (1<<3),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::pitch. <br/> */
+ LOCATION_NAV_DATA_HAS_PITCH_BIT = (1<<4),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::longAccelUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT = (1<<5),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::latAccelUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT = (1<<6),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::vertAccelUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT = (1<<7),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::yawRateUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT = (1<<8),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::pitchUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT = (1<<9),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::pitchRate. <br/> */
+ LOCATION_NAV_DATA_HAS_PITCH_RATE_BIT = (1<<10),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::pitchRateUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_PITCH_RATE_UNC_BIT = (1<<11),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::roll. <br/> */
+ LOCATION_NAV_DATA_HAS_ROLL_BIT = (1<<12),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::rollUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_ROLL_UNC_BIT = (1<<13),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::rollRate. <br/> */
+ LOCATION_NAV_DATA_HAS_ROLL_RATE_BIT = (1<<14),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::rollRateUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_ROLL_RATE_UNC_BIT = (1<<15),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::yaw. <br/> */
+ LOCATION_NAV_DATA_HAS_YAW_BIT = (1<<16),
+ /** GnssLocationPositionDynamics has valid
+ * GnssLocationPositionDynamics::yawUnc. <br/> */
+ LOCATION_NAV_DATA_HAS_YAW_UNC_BIT = (1<<17),
+};
+
+/** Specify the mask for available GNSS signal type and RF band
+ * used in GnssSv::gnssSignalTypeMask and
+ * GnssMeasUsageInfo::gnssSignalType. <br/> */
+enum GnssSignalTypeMask {
+ /** GNSS signal is of GPS L1CA RF band. <br/> */
+ GNSS_SIGNAL_GPS_L1CA_BIT = (1<<0),
+ /** GNSS signal is of GPS L1C RF band. <br/> */
+ GNSS_SIGNAL_GPS_L1C_BIT = (1<<1),
+ /** GNSS signal is of GPS L2 RF band. <br/> */
+ GNSS_SIGNAL_GPS_L2_BIT = (1<<2),
+ /** GNSS signal is of GPS L5 RF band. <br/> */
+ GNSS_SIGNAL_GPS_L5_BIT = (1<<3),
+ /** GNSS signal is of GLONASS G1 (L1OF) RF band. <br/> */
+ GNSS_SIGNAL_GLONASS_G1_BIT = (1<<4),
+ /** GNSS signal is of GLONASS G2 (L2OF) RF band. <br/> */
+ GNSS_SIGNAL_GLONASS_G2_BIT = (1<<5),
+ /** GNSS signal is of GALILEO E1 RF band. <br/> */
+ GNSS_SIGNAL_GALILEO_E1_BIT = (1<<6),
+ /** GNSS signal is of GALILEO E5A RF band. <br/> */
+ GNSS_SIGNAL_GALILEO_E5A_BIT = (1<<7),
+ /** GNSS signal is of GALILEO E5B RF band. <br/> */
+ GNSS_SIGNAL_GALILEO_E5B_BIT = (1<<8),
+ /** GNSS signal is of BEIDOU B1 RF band. <br/> */
+ GNSS_SIGNAL_BEIDOU_B1_BIT = (1<<9),
+ /** GNSS signal is of BEIDOU B2 RF band. <br/> */
+ GNSS_SIGNAL_BEIDOU_B2_BIT = (1<<10),
+ /** GNSS signal is of QZSS L1CA RF band. <br/> */
+ GNSS_SIGNAL_QZSS_L1CA_BIT = (1<<11),
+ /** GNSS signal is of QZSS L1S RF band. <br/> */
+ GNSS_SIGNAL_QZSS_L1S_BIT = (1<<12),
+ /** GNSS signal is of QZSS L2 RF band. <br/> */
+ GNSS_SIGNAL_QZSS_L2_BIT = (1<<13),
+ /** GNSS signal is of QZSS L5 RF band. <br/> */
+ GNSS_SIGNAL_QZSS_L5_BIT = (1<<14),
+ /** GNSS signal is of SBAS L1 RF band. <br/> */
+ GNSS_SIGNAL_SBAS_L1_BIT = (1<<15),
+ /** GNSS signal is of BEIDOU B1I RF band. <br/> */
+ GNSS_SIGNAL_BEIDOU_B1I_BIT = (1<<16),
+ /** GNSS signal is of BEIDOU B1C RF band. <br/> */
+ GNSS_SIGNAL_BEIDOU_B1C_BIT = (1<<17),
+ /** GNSS signal is of BEIDOU B2I RF band. <br/> */
+ GNSS_SIGNAL_BEIDOU_B2I_BIT = (1<<18),
+ /** GNSS signal is of BEIDOU B2AI RF band. <br/> */
+ GNSS_SIGNAL_BEIDOU_B2AI_BIT = (1<<19),
+ /** GNSS signal is of NAVIC L5 RF band. <br/> */
+ GNSS_SIGNAL_NAVIC_L5_BIT = (1<<20),
+ /** GNSS signal is of BEIDOU B2A_Q RF band. <br/> */
+ GNSS_SIGNAL_BEIDOU_B2AQ_BIT = (1<<21),
+};
+
+/** Specify LocationClientApi function call processing status.
+ * The status is returned via ResponseCb. <br/> */
+enum LocationResponse {
+ /** LocationClientApi call is successful. <br/> */
+ LOCATION_RESPONSE_SUCCESS = 0,
+ /** LocationClientApi call has failed. <br/> */
+ LOCATION_RESPONSE_UNKOWN_FAILURE = 1,
+ /** LocationClientApi call is not supported. <br/> */
+ LOCATION_RESPONSE_NOT_SUPPORTED = 2,
+ /** LocationClientApi call has invalid parameter. <br/> */
+ LOCATION_RESPONSE_PARAM_INVALID = 3,
+};
+
+/** Specify the SV constellation type in GnssSv
+ * and GnssMeasurementsData. <br/> */
+enum GnssSvType {
+ /** SV is of unknown constellation. <br/> */
+ GNSS_SV_TYPE_UNKNOWN = 0,
+ /** SV is of GPS constellation. <br/> */
+ GNSS_SV_TYPE_GPS = 1,
+ /** SV is of SBAS constellation. <br/> */
+ GNSS_SV_TYPE_SBAS = 2,
+ /** SV is of GLONASS constellation. <br/> */
+ GNSS_SV_TYPE_GLONASS = 3,
+ /** SV is of QZSS constellation. <br/> */
+ GNSS_SV_TYPE_QZSS = 4,
+ /** SV is of BEIDOU constellation. <br/> */
+ GNSS_SV_TYPE_BEIDOU = 5,
+ /** SV is of GALILEO constellation. <br/> */
+ GNSS_SV_TYPE_GALILEO = 6,
+ /** SV is of NAVIC constellation. <br/> */
+ GNSS_SV_TYPE_NAVIC = 7,
+};
+
+/** Specify the valid fields in GnssLocation.
+ * <br/>
+ *
+ * User should determine whether a field in
+ * GnssLocation is valid or not by checking
+ * whether the corrsponding bit in
+ * GnssLocation::gnssInfoFlags is set or
+ * not. <br/> */
+enum GnssLocationInfoFlagMask {
+ /** GnssLocation has valid
+ * GnssLocation::altitudeMeanSeaLevel. <br/> */
+ GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT = (1<<0),
+ /** GnssLocation has valid
+ * GnssLocation::pdop,
+ * GnssLocation::hdop and
+ * GnssLocation::vdop. <br/> */
+ GNSS_LOCATION_INFO_DOP_BIT = (1<<1),
+ /** GnssLocation has valid
+ * GnssLocation::magneticDeviation. <br/> */
+ GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT = (1<<2),
+ /** GnssLocation has valid
+ * GnssLocation::horReliability. <br/> */
+ GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT = (1<<3),
+ /** GnssLocation has valid
+ * GnssLocation::verReliability. <br/> */
+ GNSS_LOCATION_INFO_VER_RELIABILITY_BIT = (1<<4),
+ /** GnssLocation has valid
+ * GnssLocation::horUncEllipseSemiMajor. <br/> */
+ GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5),
+ /** GnssLocation has valid
+ * GnssLocation::horUncEllipseSemiMinor. <br/> */
+ GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6),
+ /** GnssLocation has valid
+ * GnssLocation::horUncEllipseOrientAzimuth. <br/> */
+ GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7),
+ /** GnssLocation has valid
+ * GnssLocation::svUsedInPosition and
+ * GnssLocation::measUsageInfo. <br/> */
+ GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8),
+ /** GnssLocation has valid
+ * GnssLocation::navSolutionMask. <br/> */
+ GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT = (1<<9),
+ /** GnssLocation has valid
+ * GnssLocation::posTechMask. <br/> */
+ GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),
+ /** Deplicated field as there is no corresponding field in
+ * GnssLocation. <br/> */
+ GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),
+ /** GnssLocation has valid
+ * GnssLocation::altitudeMeanSeaLevel. <br/> */
+ GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT = (1<<12),
+ /** GnssLocation has valid
+ * GnssLocation::gdop and
+ * GnssLocation::tdop. <br/> */
+ GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<13),
+ /** GnssLocation has valid GnssLocation::northStdDeviation.
+ * <br/> */
+ GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT = (1<<14),
+ /** GnssLocation has valid
+ * GnssLocation::eastStdDeviation. <br/> */
+ GNSS_LOCATION_INFO_EAST_STD_DEV_BIT = (1<<15),
+ /** GnssLocation has valid
+ * GnssLocation::northVelocity. <br/> */
+ GNSS_LOCATION_INFO_NORTH_VEL_BIT = (1<<16),
+ /** GnssLocation has valid
+ * GnssLocation::eastVelocity. <br/> */
+ GNSS_LOCATION_INFO_EAST_VEL_BIT = (1<<17),
+ /** GnssLocation has valid
+ * GnssLocation::upVelocity. <br/> */
+ GNSS_LOCATION_INFO_UP_VEL_BIT = (1<<18),
+ /** GnssLocation has valid
+ * GnssLocation::northVelocityStdDeviation. <br/> */
+ GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT = (1<<19),
+ /** GnssLocation has valid
+ * GnssLocation::eastVelocityStdDeviation. <br/> */
+ GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT = (1<<20),
+ /** GnssLocation has valid
+ * GnssLocation::upVelocityStdDeviation. <br/> */
+ GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),
+ /** GnssLocation has valid
+ * GnssLocation::leapSeconds. <br/> */
+ GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),
+ /** GnssLocation has valid
+ * GnssLocation::timeUncMs. <br/> */
+ GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23),
+ /** GnssLocation has valid
+ * GnssLocation::numSvUsedInPosition. <br/> */
+ GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24),
+ /** GnssLocation has valid
+ * GnssLocation::calibrationConfidencePercent. <br/> */
+ GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_PERCENT_BIT = (1<<25),
+ /** GnssLocation has valid
+ * GnssLocation::calibrationStatus. <br/> */
+ GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT = (1<<26),
+ /** GnssLocation has valid
+ * GnssLocation::locOutputEngType. <br/> */
+ GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT = (1<<27),
+ /** GnssLocation has valid
+ * GnssLocation::locOutputEngMask. <br/> */
+ GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT = (1<<28),
+ /** GnssLocation has valid GnssLocation::conformityIndex.
+ * <br/> */
+ GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT = (1<<29),
+ /** GnssLocation has valid
+ * GnssLocation::llaVRPBased. <br/> */
+ GNSS_LOCATION_INFO_LLA_VRP_BASED_BIT = (1<<30),
+};
+
+/** Specify the reliability level of
+ * GnssLocation::horReliability and
+ * GnssLocation::verReliability. <br/> */
+enum LocationReliability {
+ /** GnssLocation reliability is not set. <br/> */
+ LOCATION_RELIABILITY_NOT_SET = 0,
+ /** GnssLocation reliability is very low. <br/>
+ * Use it at your own risk. <br/> */
+ LOCATION_RELIABILITY_VERY_LOW,
+ /** GnssLocation reliability is low. <br/>
+ * Little or no cross-checking is possible <br/> */
+ LOCATION_RELIABILITY_LOW,
+ /** GnssLocation reliability is medium. <br/>
+ * Limited cross-check has passed <br/> */
+ LOCATION_RELIABILITY_MEDIUM,
+ /** GnssLocation reliability is high. <br/>
+ * Strong cross-check passed. <br/> */
+ LOCATION_RELIABILITY_HIGH
+};
+
+/** Specify the constellation that the SV belongs to in
+ * GnssMeasUsageInfo and GnssSystemTime. <br/> */
+enum Gnss_LocSvSystemEnumType {
+ /** SV is of GPS constellation. <br/> */
+ GNSS_LOC_SV_SYSTEM_GPS = 1,
+ /** SV is of GALILEO constellation. <br/> */
+ GNSS_LOC_SV_SYSTEM_GALILEO = 2,
+ /** SV is of SBAS sconstellation. <br/> */
+ GNSS_LOC_SV_SYSTEM_SBAS = 3,
+ /** SV is of GLONASS constellation. <br/> */
+ GNSS_LOC_SV_SYSTEM_GLONASS = 4,
+ /** SV is of BDS constellation. <br/> */
+ GNSS_LOC_SV_SYSTEM_BDS = 5,
+ /** SV is of QZSS constellation. <br/> */
+ GNSS_LOC_SV_SYSTEM_QZSS = 6,
+ /** SV is of NAVIC constellation. <br/> */
+ GNSS_LOC_SV_SYSTEM_NAVIC = 7,
+};
+
+/** Specify the valid fields in GnssSystemTimeStructType.
+ * <br/> */
+enum GnssSystemTimeStructTypeFlags {
+ /** GnssSystemTimeStructType has valid
+ * GnssSystemTimeStructType::systemWeek. <br/> */
+ GNSS_SYSTEM_TIME_WEEK_VALID = (1 << 0),
+ /** GnssSystemTimeStructType has valid
+ * GnssSystemTimeStructType::systemMsec. <br/> */
+ GNSS_SYSTEM_TIME_WEEK_MS_VALID = (1 << 1),
+ /** GnssSystemTimeStructType has valid
+ * GnssSystemTimeStructType::systemClkTimeBias. <br/> */
+ GNSS_SYSTEM_CLK_TIME_BIAS_VALID = (1 << 2),
+ /** GnssSystemTimeStructType has valid
+ * GnssSystemTimeStructType::systemClkTimeUncMs. <br/> */
+ GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
+ /** GnssSystemTimeStructType has valid
+ * GnssSystemTimeStructType::refFCount. <br/> */
+ GNSS_SYSTEM_REF_FCOUNT_VALID = (1 << 4),
+ /** GnssSystemTimeStructType has valid
+ * GnssSystemTimeStructType::numClockResets. <br/> */
+ GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID = (1 << 5)
+};
+
+/** Specify the valid fields in GnssGloTimeStructType. <br/> */
+enum GnssGloTimeStructTypeFlags {
+ /** GnssGloTimeStructType has valid
+ * GnssGloTimeStructType::gloDays. <br/> */
+ GNSS_CLO_DAYS_VALID = (1 << 0),
+ /** GnssGloTimeStructType has valid
+ * GnssGloTimeStructType::gloMsec. <br/> */
+ GNSS_GLO_MSEC_VALID = (1 << 1),
+ /** GnssGloTimeStructType has valid
+ * GnssGloTimeStructType::gloClkTimeBias. <br/> */
+ GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2),
+ /** GnssGloTimeStructType has valid
+ * GnssGloTimeStructType::gloClkTimeUncMs. <br/> */
+ GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
+ /** GnssGloTimeStructType has valid
+ * GnssGloTimeStructType::refFCount. <br/> */
+ GNSS_GLO_REF_FCOUNT_VALID = (1 << 4),
+ /** GnssGloTimeStructType has valid
+ * GnssGloTimeStructType::numClockResets. <br/> */
+ GNSS_GLO_NUM_CLOCK_RESETS_VALID = (1 << 5),
+ /** GnssGloTimeStructType has valid
+ * GnssGloTimeStructType::gloClkTimeBias. <br/> */
+ GNSS_GLO_FOUR_YEAR_VALID = (1 << 6),
+};
+
+/** Specify the sensor calibrations status in
+ * GnssLocation. <br/> */
+enum DrCalibrationStatusMask {
+ /** Indicate that roll calibration is needed. <br/>
+ * Need to take more turns on level ground. <br/> */
+ DR_ROLL_CALIBRATION_NEEDED = (1<<0),
+ /** Indicate that pitch calibration is needed. <br/>
+ * Need to take more turns on level ground. <br/> */
+ DR_PITCH_CALIBRATION_NEEDED = (1<<1),
+ /** Indicate that yaw calibration is needed. <br/>
+ * Need to accelerate in a straight line. <br/> */
+ DR_YAW_CALIBRATION_NEEDED = (1<<2),
+ /** Indicate that odo calibration is needed. <br/>
+ * Need to accelerate in a straight line. <br/> */
+ DR_ODO_CALIBRATION_NEEDED = (1<<3),
+ /** Indicate that gyro calibration is needed. <br/>
+ * Need to take more turns on level ground. <br/> */
+ DR_GYRO_CALIBRATION_NEEDED = (1<<4)
+};
+
+/** Specify the set of SVs that are used to calculate
+ * GnssLocation. <br/> */
+struct GnssLocationSvUsedInPosition {
+ /** Specify the set of SVs from GPS constellation that are used
+ * to compute the position.<br/>
+ * Bit 0 to Bit 31 corresponds to GPS SV id 1 to 32. <br/> */
+ uint64_t gpsSvUsedIdsMask;
+ /** Specify the set of SVs from GLONASS constellation that are
+ * used to compute the position. <br/>
+ * Bit 0 to Bit 31 corresponds to GLO SV id 65 to 96. <br/> */
+ uint64_t gloSvUsedIdsMask;
+ /** Specify the set of SVs from GALILEO constellation that are
+ * used to compute the position. <br/>
+ * Bit 0 to Bit 35 corresponds to GAL SV id 301 to 336.
+ * <br/> */
+ uint64_t galSvUsedIdsMask;
+ /** ISpecify the set of SVs from BEIDOU constellation that are
+ * used to compute the position. <br/>
+ * Bit 0 to Bit 36 corresponds to BDS SV id 201 to 237.
+ * <br/> */
+ uint64_t bdsSvUsedIdsMask;
+ /** Specify the set of SVs from QZSS constellation that are used
+ * to compute the position. <br/>
+ * Bit 0 to Bit 4 corresponds to BDS SV id 193 to 197.
+ * <br/> */
+ uint64_t qzssSvUsedIdsMask;
+ /** Specify the set of SVs from NAVIC constellation that are
+ * used to compute the position. <br/>
+ * Bit 0 to Bit 13 corresponds to BDS SV id 401 to 414.
+ * <br/> */
+ uint64_t navicSvUsedIdsMask;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify the SV measurements that are used to calculate
+ * GnssLocation. <br/> */
+struct GnssMeasUsageInfo {
+ /** Specify GNSS Constellation Type for the SV. */
+ Gnss_LocSvSystemEnumType gnssConstellation;
+ /** Specify satellite vehicle ID number. <br/>
+ * For SV id range of each supported constellations, refer to
+ * documentation section in GnssSv::svId. <br/>
+ */
+ uint16_t gnssSvId;
+ /** Specify the signal type mask of the SV. <br/> */
+ GnssSignalTypeMask gnssSignalType;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify device body frame parameters. <br/> */
+struct GnssLocationPositionDynamics {
+ /** Bitwise OR of GnssLocationPosDataMask to specify the
+ * valid fields in GnssLocationPositionDynamics. <br/> */
+ GnssLocationPosDataMask bodyFrameDataMask;
+ /** Forward acceleration in body frame, in unit of
+ * meters/second^2. <br/> */
+ float longAccel;
+ /** Sideward acceleration in body frame, in unit of
+ * meters/second^2. <br/> */
+ float latAccel;
+ /** Vertical acceleration in body frame, in unit of
+ * meters/second^2. <br/> */
+ float vertAccel;
+ /** Heading rate, in unit of radians/second. <br/> */
+ float yawRate;
+ /** Body pitch, in unit of radians. <br/> */
+ float pitch;
+ /** Uncertainty of forward acceleration in body frame, in unit
+ * of meters/second^2. <br/> */
+ float longAccelUnc;
+ /** Uncertainty of side-ward acceleration in body frame, in unit
+ * of meters/second^2. <br/> */
+ float latAccelUnc;
+ /** Uncertainty of vertical acceleration in body frame, in unit
+ * of meters/second^2. <br/> */
+ float vertAccelUnc;
+ /** Uncertainty of heading rate, in unit of radians/second.
+ * <br/> */
+ float yawRateUnc;
+ /** Uncertainty of body pitch, in unit of radians. <br/> */
+ float pitchUnc;
+ /** Body pitch rate, in unit of radians/second. <br/> */
+ float pitchRate;
+ /** Uncertainty of pitch rate, in unit of radians/second. <br/> */
+ float pitchRateUnc;
+ /** Roll of body frame, clockwise is positive, in unit of
+ * radian. <br/> */
+ float roll;
+ /** Uncertainty of roll, 68% confidence level, in unit of
+ radian. <br/> */
+ float rollUnc;
+ /** Roll rate of body frame, clockwise is
+ positive, in unit of radian/second. <br/> */
+ float rollRate;
+ /** Uncertainty of roll rate, 68% confidence level, in unit of
+ * radian/second. <br/> */
+ float rollRateUnc;
+ /** Yaw of body frame, clockwise is positive, in unit of
+ * radian. <br/> */
+ float yaw;
+ /** Uncertainty of yaw, 68% confidence level, in unit of radian.
+ * <br/> */
+ float yawUnc;
+ /** Heading rate, in unit of radians/second. <br/> */
+ float yawRate;
+ /** Uncertainty of heading rate, in unit of radians/second.
+ * <br/> */
+ float yawRateUnc;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify none-Glonass GNSS system time info. */
+struct GnssSystemTimeStructType {
+ /** Bitwise OR of GnssSystemTimeStructTypeFlags to specify
+ * valid fields in GnssSystemTimeStructType. */
+ GnssSystemTimeStructTypeFlags validityMask;
+ /** Extended week number at reference tick, in unit of week.
+ * <br/>
+ * Set to 65535 if week number is unknown. <br/>
+ *
+ * For GPS: calculated from midnight, Jan. 6, 1980. OTA decoded
+ * 10 bit GPS week is extended to map between: [NV6264 to
+ * (NV6264 + 1023)] <br/>
+ *
+ * For BDS: calculated from 00:00:00 on January 1, 2006 of
+ * Coordinated Universal Time (UTC). <br/>
+ *
+ * For GAL: calculated from 00:00 UT on Sunday August 22, 1999
+ * (midnight between August 21 and August 22). <br/>
+ */
+ uint16_t systemWeek;
+ /** Time in to the current week at reference tick, in unit of
+ * milliseconds. <br/>
+ * Range is 0 to 604799999. <br/> */
+ uint32_t systemMsec;
+ /** System clock time bias, in unit of milliseconds. <br/>
+ * Note: System time (TOW Millisecond) = systemMsec - systemClkTimeBias. <br/> */
+ float systemClkTimeBias;
+ /** Single sided maximum time bias uncertainty, in unit of
+ * milliseconds. <br/> */
+ float systemClkTimeUncMs;
+ /** FCount (free running HW timer) value, in unit of
+ * milliseconds. <br/>
+ * Don't use for relative time purpose due to possible
+ * discontinuities. <br/> */
+ uint32_t refFCount;
+ /** Number of clock resets/discontinuities detected, which
+ * affects the local hardware counter value. <br/> */
+ uint32_t numClockResets;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify Glonass system time info. <br/> */
+struct GnssGloTimeStructType {
+ /** Bitwise OR of GnssGloTimeStructTypeFlags to specify the
+ * valid fields in GnssGloTimeStructType. <br/> */
+ GnssGloTimeStructTypeFlags validityMask;
+ /** GLONASS four year number from 1996. Refer to GLONASS ICD. <br/>
+ * Applicable only for GLONASS and shall be ignored for
+ * other constellations. <br/> */
+ uint8_t gloFourYear;
+ /** GLONASS day number in four years. Refer to GLONASS ICD.
+ * <br/>
+ * If unknown shall be set to 65535. <br/> */
+ uint16_t gloDays;
+ /** GLONASS time of day in unit of millisecond. Refer to GLONASS
+ * ICD. <br/> */
+ uint32_t gloMsec;
+ /** GLONASS clock time bias, in unit of millisecond. <br/>
+ * Note: GLO time (TOD Millisecond) = gloMsec -
+ * gloClkTimeBias.<br/>
+ * Check for gloClkTimeUncMs before use. <br/> */
+ float gloClkTimeBias;
+ /** Single sided maximum time bias uncertainty, in unit of
+ * milliseconds. <br/> */
+ float gloClkTimeUncMs;
+ /** FCount (free running HW timer) value, in unit of
+ * milliseconds. <br/>
+ * Don't use for relative time purpose due to possible
+ * discontinuities. <br/> */
+ uint32_t refFCount;
+ /** Number of clock resets/discontinuities detected,
+ * affecting the local hardware counter value. <br/> */
+ uint32_t numClockResets;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Union to hold GNSS system time from different
+ * constellations in GnssSystemTime <br/> */
+union SystemTimeStructUnion {
+ /** System time info from GPS constellation. <br/> */
+ GnssSystemTimeStructType gpsSystemTime;
+ /** System time info from GALILEO constellation. <br/> */
+ GnssSystemTimeStructType galSystemTime;
+ /** System time info from BEIDOU constellation. <br/> */
+ GnssSystemTimeStructType bdsSystemTime;
+ /** System time info from QZSS constellation. <br/> */
+ GnssSystemTimeStructType qzssSystemTime;
+ /** System time info from GLONASS constellation. <br/> */
+ GnssGloTimeStructType gloSystemTime;
+ /** System time info from NAVIC constellation. <br/> */
+ GnssSystemTimeStructType navicSystemTime;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** GNSS system time in GnssLocation. <br/>
+*/
+struct GnssSystemTime {
+ /** Specify the source constellation for GNSS system time.
+ * <br/> */
+ Gnss_LocSvSystemEnumType gnssSystemTimeSrc;
+ /** Specify the GNSS system time corresponding to the source.
+ * <br/> */
+ SystemTimeStructUnion u;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify the set of engines whose position reports are
+ requested via startPositionSession(uint32_t,
+ LocReqEngineTypeMask, const EngineReportCbs&,ResponseCb).
+ <br/>
+*/
+enum LocReqEngineTypeMask {
+ /** Mask to indicate that client requests the fused/default
+ position via registering location_client::EngineLocationsCb
+ for the tracking session. <br/>
+ The default position is the propagated/aggregated reports from
+ all engines running on the system (e.g.: DR/SPE/PPE). <br/>
+ */
+ LOC_REQ_ENGINE_FUSED_BIT = (1<<0),
+ /** Mask to indicate that client requests the unmodified SPE
+ position via registering location_client::EngineLocationsCb
+ for the tracking session. <br/>
+ */
+ LOC_REQ_ENGINE_SPE_BIT = (1<<1),
+ /** Mask to indicate that the client requests unmodified PPE
+ position via registering location_client::EngineLocationsCb
+ for the tracking session. <br/>
+ */
+ LOC_REQ_ENGINE_PPE_BIT = (1<<2),
+};
+
+/** Specify the position engine type that produced GnssLocation. <br/> */
+enum LocOutputEngineType {
+ /** This is the propagated/aggregated report from the fixes of
+ * all engines running on the system (e.g.: DR/SPE/PPE).
+ * <br/> */
+ LOC_OUTPUT_ENGINE_FUSED = 0,
+ /** This fix is the unmodified fix from modem GNSS engine.
+ * <br/> */
+ LOC_OUTPUT_ENGINE_SPE = 1,
+ /** This is the unmodified fix from PPE engine. <br/> */
+ LOC_OUTPUT_ENGINE_PPE = 2,
+ /** This is the entry count of this enum. <br/> */
+ LOC_OUTPUT_ENGINE_COUNT,
+};
+
+
+/** Specify the set of position engines supported by
+ * LocationClientAPI. <br/> */
+enum PositioningEngineMask {
+ /** Mask for standard GNSS position engine. <br/> */
+ STANDARD_POSITIONING_ENGINE = (1 << 0),
+ /** Mask for dead reckoning position engine. <br/> */
+ DEAD_RECKONING_ENGINE = (1 << 1),
+ /** Mask for precise position engine. <br/> */
+ PRECISE_POSITIONING_ENGINE = (1 << 2)
+};
+
+/** Specify the location info received by client via
+ * startPositionSession(uint32_t, uint32_t
+ * LocationCb, ResponseCb). <br/> */
+struct Location {
+ /** Bitwise OR of LocationFlagsMask to specify the valid
+ * fields. <br/> */
+ LocationFlagsMask flags;
+ /** UTC timestamp for location fix since January 1, 1970, in
+ * unit of milliseconds. <br/> */
+ uint64_t timestamp;
+ /** Latitude, in unit of degrees, range [-90.0, 90.0]. <br/> */
+ double latitude;
+ /** Longitude, in unit of degrees, range [-180.0, 180.0].
+ * <br/> */
+ double longitude;
+ /** Altitude above the WGS 84 reference ellipsoid, in unit of
+ * meters. <br/> */
+ double altitude;
+ /** Horizontal speed, in meters/second. <br/> */
+ float speed;
+ /** Bearing, in unit of degrees, range [0, 360) <br/> */
+ float bearing;
+ /** Horizontal accuracy, in unit of meters. <br/> */
+ float horizontalAccuracy;
+ /** Vertial accuracy, in uint of meters. <br/> */
+ float verticalAccuracy;
+ /** Speed uncertainty, in unit meters/second. <br/> */
+ float speedAccuracy;
+ /** Bearing uncertainty, in unit of degrees, range (0 to
+ * 359.999). <br/> */
+ float bearingAccuracy;
+ /** Sets of technology that contributed to the fix. <br/> */
+ LocationTechnologyMask techMask;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify latitude, longitude and altitude info of location.
+ * <br/>
+ */
+typedef struct {
+ /** Latitude, in unit of degrees, range [-90.0, 90.0]. <br/> */
+ double latitude;
+
+ /** Longitude, in unit of degrees, range [-180.0, 180.0]. <br/>
+ */
+ double longitude;
+
+ /** Altitude above the WGS 84 reference ellipsoid, in unit
+ of meters. <br/> */
+ float altitude;
+} LLAInfo;
+
+/** Specify the location info received by client via
+ * startPositionSession(uint32_t, const
+ * GnssReportCbs&, ResponseCb) and
+ * startPositionSession(uint32_t,
+ * LocReqEngineTypeMask, const EngineReportCbs&, ResponseCb).
+ * <br/>
+ */
+struct GnssLocation : public Location {
+ /** Bitwise OR of GnssLocationInfoFlagMask for param
+ * validity. <br/> */
+ GnssLocationInfoFlagMask gnssInfoFlags;
+ /** Altitude wrt mean sea level, in unit of meters. <br/> */
+ float altitudeMeanSeaLevel;
+ /** Position dilusion of precision, range: 0 (highest accuracy)
+ * to 50 (lowest accuracy). <br/> */
+ float pdop;
+ /** Horizontal dilusion of precision, range: 0 (highest
+ * accuracy) to 50 (lowest accuracy). <br/> */
+ float hdop;
+ /** Vertical dilusion of precision, range: 0 (highest accuracy)
+ * to 50 (lowest accuracy). <br/> */
+ float vdop;
+ /** Geometric dilution of precision range: 0 (highest accuracy)
+ * to 50 (lowest accuracy). <br/> */
+ float gdop;
+ /** Time dilution of precision range: 0 (highest accuracy) to 50
+ * (lowest accuracy). <br/> */
+ float tdop;
+ /** Difference between the bearing to true
+ * north and the bearing shown on a magnetic compass. <br/>
+ * The deviation is positive when the magnetic north is east of
+ * true north. <br/> */
+ float magneticDeviation;
+ /** Horizontal reliability. <br/> */
+ LocationReliability horReliability;
+ /** Vertical reliability. <br/> */
+ LocationReliability verReliability;
+ /** Horizontal elliptical accuracy semi-major axis, in unit of
+ * meters. <br/> */
+ float horUncEllipseSemiMajor;
+ /** Horizontal elliptical accuracy semi-minor axis, in unit of
+ * meters. <br/> <br/> */
+ float horUncEllipseSemiMinor;
+ /** Horizontal elliptical accuracy azimuth, in unit of degrees,
+ * range [0, 180]. <br/> */
+ float horUncEllipseOrientAzimuth;
+ /** North standard deviation, in unit of meters. <br/> */
+ float northStdDeviation;
+ /** East standard deviation, in unit of meters. <br/> */
+ float eastStdDeviation;
+ /** North velocity, in unit of meters/sec. <br/> */
+ float northVelocity;
+ /** East velocity, in unit of meters/sec. <br/> */
+ float eastVelocity;
+ /** Up velocity, in unit of meters/sec. <br/> */
+ float upVelocity;
+ /** North velocity uncertainty, in unit of meters/sec. <br/> */
+ float northVelocityStdDeviation;
+ /** East velocity uncertainty, in unit of meters/sec <br/> */
+ float eastVelocityStdDeviation;
+ /** Up velocity uncertainty, in unit of meters/sec. <br/> */
+ float upVelocityStdDeviation;
+ /** Number of SV used in position report. <br/> */
+ uint16_t numSvUsedInPosition;
+ /** GNSS sv used in position data. <br/> */
+ GnssLocationSvUsedInPosition svUsedInPosition;
+ /** Navigation solutions that are used to calculate the position
+ * report. <br/> */
+ GnssLocationNavSolutionMask navSolutionMask;
+ /** Position technology used in computing this fix. */
+ GnssLocationPosTechMask posTechMask;
+ /** Body frame dynamics info. <br/> */
+ GnssLocationPositionDynamics bodyFrameData;
+ /** GNSS system time when this position is calculated. <br/> */
+ GnssSystemTime gnssSystemTime;
+ /** GNSS measurement usage info. <br/> */
+ std::vector<GnssMeasUsageInfo> measUsageInfo;
+ /** Number of leap Seconds at time when this position is
+ * generated. */
+ uint8_t leapSeconds;
+ /** Time uncertainty, in unit of milliseconds. <br/> */
+ float timeUncMs;
+ /** Sensor calibration confidence percent, range [0, 100].
+ * <br/> */
+ uint8_t calibrationConfidencePercent;
+ /** Sensor calibration status. */
+ DrCalibrationStatusMask calibrationStatus;
+ /** Location engine type. <br/>
+ When this field is set to LOC_ENGINE_SRC_FUSED, the fix is
+ the propagated/aggregated reports from all engines running
+ on the system (e.g.: DR/SPE/PPE).<br/>
+ To check which location engine contributes to the fused
+ output, check for locOutputEngMask. <br/> */
+ LocOutputEngineType locOutputEngType;
+ /** When loc output eng type is set to fused, this field
+ * indicates the set of engines contribute to the fix. <br/> */
+ PositioningEngineMask locOutputEngMask;
+ /** When robust location is enabled, this field
+ * will indicate how well the various input data considered for
+ * navigation solution conform to expectations.
+ * Range: [0.0, 1.0], with 0.0 for least conforming and 1.0 for
+ * most conforming. </br> */
+ float conformityIndex;
+ /** VRR-based latitude/longitude/altitude. <br/> */
+ LLAInfo llaVRPBased;
+
+ /* Default constructor to initalize GnssLocation structure */
+ inline GnssLocation() :
+ Location({}), gnssInfoFlags((GnssLocationInfoFlagMask)0),
+ altitudeMeanSeaLevel(0.0f), pdop(0.0f), hdop(0.0f),
+ vdop(0.0f), gdop(0.0f), tdop(0.0f), magneticDeviation(0.0f),
+ horReliability(LOCATION_RELIABILITY_NOT_SET),
+ verReliability(LOCATION_RELIABILITY_NOT_SET),
+ horUncEllipseSemiMajor(0.0f), horUncEllipseSemiMinor(0.0f),
+ horUncEllipseOrientAzimuth(0.0f), northStdDeviation(0.0f),
+ eastStdDeviation(0.0f), northVelocity(0.0f), eastVelocity(0.0f),
+ upVelocity(0.0f), northVelocityStdDeviation(0.0f),
+ eastVelocityStdDeviation(0.0f), upVelocityStdDeviation(0.0f),
+ numSvUsedInPosition(0), svUsedInPosition({}),
+ navSolutionMask((GnssLocationNavSolutionMask)0),
+ posTechMask((GnssLocationPosTechMask)0),
+ bodyFrameData({}),
+ gnssSystemTime({}), measUsageInfo(), leapSeconds(0),
+ timeUncMs(0.0f), calibrationConfidencePercent(0),
+ calibrationStatus((DrCalibrationStatusMask)0),
+ locOutputEngType ((LocOutputEngineType)0),
+ locOutputEngMask((PositioningEngineMask)0),
+ conformityIndex(0.0f),
+ llaVRPBased({}) {
+ }
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** GNSS SV report that comes when clients registers for
+ * location_client::GnssSvCb. */
+struct GnssSv {
+ /** Unique SV Identifier. This field is always valid. <br/>
+ * SV Range for supported constellation is specified as below:
+ * <br/>
+ * - For GPS: 1 to 32 <br/>
+ * - For GLONASS: 65 to 96 <br/>
+ * - For SBAS: 120 to 158 and 183 to 191 <br/>
+ * - For QZSS: 193 to 197 <br/>
+ * - For BDS: 201 to 237 <br/>
+ * - For GAL: 301 to 336 <br/>
+ * - For NAVIC: 401 to 414 <br/> */
+ uint16_t svId;
+ /** Constellation type of the SV (GPS, SBAS, GLONASS, QZSS,
+ * BEIDOU, GALILEO). <br/>
+ * This field is always valid. <br/> */
+ GnssSvType type;
+ /** Signal-to-noise ratio at antenna of the SV, in unit of
+ * dB-Hz. <br/>
+ * This field is always valid. <br/> */
+ float cN0Dbhz;
+ /** Elevation of the SV, in unit of degrees. <br/> This field is
+ * always valid. <br/> */
+ float elevation;
+ /** Azimuth of the SV, in unit of degrees. <br/> This field is
+ * always valid. <br/> */
+ float azimuth;
+ /** Bitwise OR of GnssSvOptionsMask to specify additional
+ * info and valid fields in GnssSv. <br/>
+ * This field is always valid. <br/> */
+ GnssSvOptionsMask gnssSvOptionsMask;
+ /** Carrier frequency of the signal tracked. <br/> This field is
+ * valid if gnssSvOptionsMask has
+ * GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT set. <br/> */
+ float carrierFrequencyHz;
+ /** GNSS signal type mask of the SV. <br/>
+ * This field is valid if gnssSvOptionsMask has
+ * GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT. <br/> */
+ GnssSignalTypeMask gnssSignalTypeMask;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify the GNSS signal type and RF band for jammer info and
+- * automatic gain control metric in GnssData. <br/>
+- * To find out the jammer info and automatic gain control
+- * metric for a particular GNSS signal type, refer to the array
+- * element with index set to the signal type. <br/>
+- */
+enum GnssSignalTypes {
+ /** GNSS signal is of GPS L1CA RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GPS_L1CA = 0,
+ /** GNSS signal is of GPS L1C RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GPS_L1C = 1,
+ /** GNSS signal is of GPS L2C_L RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GPS_L2C_L = 2,
+ /** GNSS signal is of GPS L5_Q RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GPS_L5_Q = 3,
+ /** GNSS signal is of GLONASS G1 (L1OF) RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GLONASS_G1 = 4,
+ /** GNSS signal is of GLONASS G2 (L2OF) RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GLONASS_G2 = 5,
+ /** GNSS signal is of GALILEO E1_C RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GALILEO_E1_C = 6,
+ /** GNSS signal is of GALILEO E5A_Q RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GALILEO_E5A_Q = 7,
+ /** GNSS signal is of GALILEO E5B_Q RF band. <br/> */
+ GNSS_SIGNAL_TYPE_GALILEO_E5B_Q = 8,
+ /** GNSS signal is of BEIDOU B1_I RF band. <br/> */
+ GNSS_SIGNAL_TYPE_BEIDOU_B1_I = 9,
+ /** GNSS signal is of BEIDOU B1C RF band. <br/> */
+ GNSS_SIGNAL_TYPE_BEIDOU_B1C = 10,
+ /** GNSS signal is of BEIDOU B2_I RF band. <br/> */
+ GNSS_SIGNAL_TYPE_BEIDOU_B2_I = 11,
+ /** GNSS signal is of BEIDOU B2A_I RF band. <br/> */
+ GNSS_SIGNAL_TYPE_BEIDOU_B2A_I = 12,
+ /** GNSS signal is of QZSS L1CA RF band. <br/> */
+ GNSS_SIGNAL_TYPE_QZSS_L1CA = 13,
+ /** GNSS signal is of QZSS L1S RF band. <br/> */
+ GNSS_SIGNAL_TYPE_QZSS_L1S = 14,
+ /** GNSS signal is of QZSS L2C_L RF band. <br/> */
+ GNSS_SIGNAL_TYPE_QZSS_L2C_L = 15,
+ /** GNSS signal is of QZSS L5_Q RF band. <br/> */
+ GNSS_SIGNAL_TYPE_QZSS_L5_Q = 16,
+ /** GNSS signal is of SBAS L1_CA RF band. <br/> */
+ GNSS_SIGNAL_TYPE_SBAS_L1_CA = 17,
+ /** GNSS signal is of NAVIC L5 RF band. <br/> */
+ GNSS_SIGNAL_TYPE_NAVIC_L5 = 18,
+ /** GNSS signal is of BEIDOU B2A_Q RF band. <br/> */
+ GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q = 19,
+ /** Maximum number of signal types. <br/> */
+ GNSS_MAX_NUMBER_OF_SIGNAL_TYPES
+};
+
+/** Specify valid mask of data fields in
+ * GnssData. <br/> */
+enum GnssDataMask {
+ /** Jammer Indicator is available. <br/> */
+ GNSS_DATA_JAMMER_IND_BIT = (1ULL << 0),
+ /** AGC is available. <br/> */
+ GNSS_DATA_AGC_BIT = (1ULL << 1)
+};
+
+/** Specify the additional GNSS data that can be provided
+ * during a tracking session, currently jammer and automatic
+ * gain control data are available. <br/>
+ *
+ * To find out the jammer info and automatic gain control
+ * metric for a particular GNSS signal type, refer to the array
+ * element with index set to the interested RF band. <br/>
+ *
+ * For a particular RF band, user can determine
+ * GnssData::jammerInd is valid or not by checking the element
+ * at index of the specified RF band in
+ * GnssData::gnssDataMask has
+ * GNSS_DATA_JAMMER_IND_BIT set. <br/>
+ *
+ * For a particular RF band, user can determine GnssData::agc
+ * is valid or not by checking the element at index of the
+ * specified RF band in GnssData::gnssDataMask has
+ * GNSS_DATA_AGC_BIT set. <br/>
+ */
+struct GnssData {
+ /** Bitwise OR of GnssDataMask to indicate the valid data
+ * fields. <br/> */
+ GnssDataMask gnssDataMask[GNSS_MAX_NUMBER_OF_SIGNAL_TYPES];
+ /** Jammer Indication for each GNSS signal. <br/> */
+ double jammerInd[GNSS_MAX_NUMBER_OF_SIGNAL_TYPES];
+ /** Automatic gain control metric, in unit of dB. <br/> */
+ double agc[GNSS_MAX_NUMBER_OF_SIGNAL_TYPES];
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify valid fields in
+ * GnssMeasurementsData. <br/> */
+enum GnssMeasurementsDataFlagsMask{
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::svId. <br/> */
+ GNSS_MEASUREMENTS_DATA_SV_ID_BIT = (1<<0),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::svType. <br/> */
+ GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT = (1<<1),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::stateMask. <br/> */
+ GNSS_MEASUREMENTS_DATA_STATE_BIT = (1<<2),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::receivedSvTimeNs. <br/> */
+ GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT = (1<<3),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::receivedSvTimeUncertaintyNs. <br/> */
+ GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::carrierToNoiseDbHz. <br/> */
+ GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT = (1<<5),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::pseudorangeRateMps. <br/> */
+ GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT = (1<<6),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::pseudorangeRateUncertaintyMps.
+ * <br/> */
+ GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::adrStateMask. <br/> */
+ GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT = (1<<8),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::adrMeters. <br/> */
+ GNSS_MEASUREMENTS_DATA_ADR_BIT = (1<<9),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::adrUncertaintyMeters. <br/> */
+ GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT = (1<<10),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::carrierFrequencyHz. <br/> */
+ GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT = (1<<11),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::carrierCycles. <br/> */
+ GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT = (1<<12),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::carrierPhase. <br/> */
+ GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT = (1<<13),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::carrierPhaseUncertainty. <br/> */
+ GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT = (1<<14),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::multipathIndicator. <br/> */
+ GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT = (1<<15),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::signalToNoiseRatioDb. <br/> */
+ GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT = (1<<16),
+ /** GnssMeasurementsData has valid
+ * GnssMeasurementsData::agcLevelDb. <br/> */
+ GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT = (1<<17),
+};
+
+/** Specify GNSS measurement state in
+ * GnssMeasurementsData::stateMask. <br/> */
+enum GnssMeasurementsStateMask {
+ /** GNSS measurement state is unknown. <br/> */
+ GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT = 0,
+ /** GNSS measurement state is "code lock". <br/> */
+ GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT = (1<<0),
+ /** GNSS measurement state is "bit sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT = (1<<1),
+ /** GNSS measurement state is "subframe sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT = (1<<2),
+ /** GNSS measurement state is "tow decoded". <br/> */
+ GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT = (1<<3),
+ /** GNSS measurement state is "msec ambiguous". <br/> */
+ GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT = (1<<4),
+ /** GNSS measurement state is "symbol sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT = (1<<5),
+ /** GNSS measurement state is "GLONASS string sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT = (1<<6),
+ /** GNSS measurement state is "GLONASS TOD decoded". <br/> */
+ GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT = (1<<7),
+ /** GNSS measurement state is "BDS D2 bit sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT = (1<<8),
+ /** GNSS measurement state is "BDS D2 subframe sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT = (1<<9),
+ /** GNSS measurement state is "Galileo E1BC code lock". <br/> */
+ GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT = (1<<10),
+ /** GNSS measurement state is "Galileo E1C second code lock". */
+ GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11),
+ /** GNSS measurement state is "Galileo E1B page sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT = (1<<12),
+ /** GNSS measurement state is "SBAS sync". <br/> */
+ GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT = (1<<13),
+};
+
+/** Specify accumulated delta range state in
+ * GnssMeasurementsData::adrStateMask. <br/> */
+enum GnssMeasurementsAdrStateMask {
+ /** Accumulated delta range state is unknown. <br/> */
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN = 0,
+ /** Accumulated delta range state is valid. <br/> */
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT = (1<<0),
+ /** Accumulated delta range state is "reset". <br/> */
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT = (1<<1),
+ /** Accumulated delta range state is "cycle slip". <br/> */
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT = (1<<2),
+};
+
+/** Specify the GNSS multipath indicator state in
+ * GnssMeasurementsData::multipathIndicator. <br/> */
+enum GnssMeasurementsMultipathIndicator {
+ /** Multipath indicator is unknown. <br/> */
+ GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0,
+ /** Multipath indicator is present. <br/> */
+ GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT,
+ /** Multipath indicator is not present. <br/> */
+ GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT,
+};
+
+/** Specify the valid fields in
+ * GnssMeasurementsClock. <br/>
+ */
+enum GnssMeasurementsClockFlagsMask {
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::leapSecond. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT = (1<<0),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::timeNs. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT = (1<<1),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::timeUncertaintyNs. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT = (1<<2),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::fullBiasNs. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT = (1<<3),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::biasNs. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT = (1<<4),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::biasUncertaintyNs. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT = (1<<5),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::driftNsps. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT = (1<<6),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::driftUncertaintyNsps. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT = (1<<7),
+ /** GnssMeasurementsClock has valid
+ * GnssMeasurementsClock::hwClockDiscontinuityCount. <br/> */
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8),
+};
+
+/** Specify the SV pseudo range and carrier phase measurement
+ * from GNSS positioning engine. <br/>
+ *
+ * User should determine whether a field in
+ * GnssMeasurementsClock is valid or not by
+ * checking whether the corrsponding bit in
+ * GnssMeasurementsClock::flags is set or
+ * not. <br/> */
+struct GnssMeasurementsData {
+ /** Bitwise OR of GnssMeasurementsDataFlagsMask to specify the
+ * valid fields in GnssMeasurementsData. */
+ GnssMeasurementsDataFlagsMask flags;
+ /** Specify satellite vehicle ID number. <br/>
+ * For SV id range of each supported constellations, refer to
+ * documentation in GnssSv::svId. <br/>
+ */
+ int16_t svId;
+ /** SV constellation type. <br/> */
+ GnssSvType svType;
+ /** Time offset when the measurement was taken,
+ * in unit of nanoseconds. <br/> */
+ double timeOffsetNs;
+ /** Bitwise OR of GnssMeasurementsStateMask to specify the
+ * GNSS measurement state. <br/> */
+ GnssMeasurementsStateMask stateMask;
+ /** Received GNSS time of the week in nanoseconds when the
+ * measurement was taken. <br/> */
+ int64_t receivedSvTimeNs;
+ /** Satellite time. <br/>
+ * All SV times in the current measurement block are already
+ * propagated to a common reference time epoch, in unit of
+ * nano seconds. <br/> */
+ int64_t receivedSvTimeUncertaintyNs;
+ /** Signal strength, carrier to noise ratio, in unit of dB-Hz
+ * <br/> */
+ double carrierToNoiseDbHz;
+ /** Uncorrected pseudorange rate, in unit of metres/second
+ * <br/> */
+ double pseudorangeRateMps;
+ /** Uncorrected pseudorange rate uncertainty, in unit of
+ * meters/second <br/> */
+ double pseudorangeRateUncertaintyMps;
+ /** Bitwise OR of GnssMeasurementsAdrStateMask. <br/> */
+ GnssMeasurementsAdrStateMask adrStateMask;
+ /** Accumulated delta range, in unit of meters <br/> */
+ double adrMeters;
+ /** Accumulated delta range uncertainty, in unit of meters
+ * <br/> */
+ double adrUncertaintyMeters;
+ /** Carrier frequency of the tracked signal, in unit of Hertz
+ * <br/> */
+ float carrierFrequencyHz;
+ /** The number of full carrier cycles between the receiver and
+ * the satellite. <br/> */
+ int64_t carrierCycles;
+ /** The RF carrier phase that the receiver has detected.
+ * <br/> */
+ double carrierPhase;
+ /** The RF carrier phase uncertainty. <br/> */
+ double carrierPhaseUncertainty;
+ /** Multipath indicator, could be unknown, present or not
+ * present. <br/> */
+ GnssMeasurementsMultipathIndicator multipathIndicator;
+ /** Signal to noise ratio, in unit of dB <br/> */
+ double signalToNoiseRatioDb;
+ /** Automatic gain control level, in unit of dB <br/> */
+ double agcLevelDb;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify GNSS measurements clock. <br/>
+ * The main equation describing the relationship between
+ * various components is: <br/>
+ * utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond *
+ * 1,000,000,000 <br/> */
+struct GnssMeasurementsClock {
+ /** Bitwise OR of GnssMeasurementsClockFlagsMask. <br/> */
+ GnssMeasurementsClockFlagsMask flags;
+ /** Leap second, in unit of seconds. <br/> */
+ int16_t leapSecond;
+ /** Time, monotonically increasing as long as the power is on,
+ * in unit of nanoseconds. <br/> */
+ int64_t timeNs;
+ /** Time uncertainty (one sigma), in unit of nanoseconds
+ * <br/> */
+ double timeUncertaintyNs;
+ /** Full bias, in uint of nanoseconds. <br/> */
+ int64_t fullBiasNs;
+ /** Sub-nanoseconds bias, in unit of nonoseconds <br/> */
+ double biasNs;
+ /** Bias uncertainty (one sigma), in unit of nanoseconds
+ * <br/> */
+ double biasUncertaintyNs;
+ /** Clock drift, in unit of nanoseconds/second <br/> */
+ double driftNsps;
+ /** Clock drift uncertainty (one sigma), in unit of
+ * nanoseconds/second <br/> */
+ double driftUncertaintyNsps;
+ /** HW clock discontinuity count - incremented
+ * for each discontinuity in HW clock. <br/> */
+ uint32_t hwClockDiscontinuityCount;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify GNSS measurements clock and data. <br/> */
+struct GnssMeasurements {
+ /** GNSS measurements clock info. <br/> */
+ GnssMeasurementsClock clock;
+ /** GNSS measurements data. <br/> */
+ std::vector<GnssMeasurementsData> measurements;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify the valid fields in LeapSecondSystemInfo. <br/> */
+enum LeapSecondSysInfoMask{
+ /** LeapSecondSystemInfo has valid
+ * LeapSecondSystemInfo::leapSecondCurrent. <br/> */
+ LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT = (1ULL << 0),
+ /** LeapSecondSystemInfo has valid
+ * LeapSecondSystemInfo::leapSecondChangeInfo. <br/> */
+ LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT = (1ULL << 1)
+};
+
+/** Specify leap second change event info as part of
+ * LeapSecondSystemInfo. <br/> */
+struct LeapSecondChangeInfo {
+ /** GPS timestamp that corrresponds to the last known leap
+ second change event. <br/>
+ The info can be available on two scenario: <br/>
+ 1: this leap second change event has been scheduled and yet
+ to happen <br/>
+ 2: this leap second change event has already happened and
+ next leap second change event has not yet been
+ scheduled. <br/> */
+ GnssSystemTimeStructType gpsTimestampLsChange;
+ /** Number of leap seconds prior to the leap second change event
+ * that corresponds to the timestamp at gpsTimestampLsChange.
+ * <br/>
+ * In unit of seconds. <br/> */
+ uint8_t leapSecondsBeforeChange;
+ /** Number of leap seconds after the leap second change event
+ * that corresponds to the timestamp at gpsTimestampLsChange.
+ * <br/>
+ * In unit of seconds. <br/> */
+ uint8_t leapSecondsAfterChange;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify leap second system info, including current leap
+ * second and leap second change event info if available. <br/>
+ *
+ * User should determine whether a field in
+ * LeapSecondSystemInfo is valid or not by
+ * checking whether the corrsponding bit in
+ * LeapSecondSystemInfo::leapSecondInfoMask is
+ * set or not. <br/> */
+struct LeapSecondSystemInfo {
+ /** Bitwise OR of LeapSecondSystemInfo::LeapSecondSysInfoMask to
+ * specify valid fields in LeapSecondSystemInfo. */
+ LeapSecondSysInfoMask leapSecondInfoMask;
+ /** Current leap seconds, in unit of seconds. <br/>
+ * This info will only be available if the leap second change
+ * info is not available. <br/> */
+ uint8_t leapSecondCurrent;
+ /** Leap second change event info. The info can be available on
+ two scenario: <br/>
+ 1: this leap second change event has been scheduled and yet
+ to happen <br/>
+ 2: this leap second change event has already happened and
+ next leap second change event has not yet been scheduled.
+ <br/>
+
+ If leap second change info is avaiable, to figure out the
+ current leap second info, compare current gps time with
+ LeapSecondChangeInfo::gpsTimestampLsChange to know whether
+ to choose leapSecondBefore or leapSecondAfter as current
+ leap second. <br/> */
+ LeapSecondChangeInfo leapSecondChangeInfo;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+/** Specify the set of valid fields in
+ * LocationSystemInfo. <br/> */
+enum LocationSystemInfoMask {
+ /** LocationSystemInfo has valid
+ * LocationSystemInfo::leapSecondSysInfo. <br/> */
+ LOC_SYS_INFO_LEAP_SECOND = (1ULL << 0),
+};
+
+/** Specify the location system info that can be received via
+ * LocationSystemInfoCb. <br/>
+ *
+ * User should determine whether a field in
+ * LocationSystemInfo is valid or not by
+ * checking whether the corrsponding bit in
+ * LocationSystemInfo::flags is set or not.
+ * <br/> */
+struct LocationSystemInfo {
+ /** Bitwise OR of LocationSystemInfoDataMask to indicate the
+ * valid fields in LocationSystemInfo. <br/> */
+ LocationSystemInfoMask systemInfoMask;
+ /** Current leap second and leap second info. <br/> */
+ LeapSecondSystemInfo leapSecondSysInfo;
+ /** Method to print the struct to human readable form, for logging.
+ * <br/> */
+ string toString();
+};
+
+enum BatchingStatus {
+ BATCHING_STATUS_INACTIVE = 0,
+ BATCHING_STATUS_ACTIVE = 1,
+ BATCHING_STATUS_DONE = 2
+};
+
+enum GeofenceBreachTypeMask {
+ GEOFENCE_BREACH_ENTER_BIT = (1<<0),
+ GEOFENCE_BREACH_EXIT_BIT = (1<<1),
+ GEOFENCE_BREACH_DWELL_IN_BIT = (1<<2),
+ GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3),
+};
+
+/** @brief Provides the capabilities of the system. <br/>
+
+ @param capsMask: Bitwise OR of LocationCapabilitiesMask
+ <br/>
+*/
+typedef std::function<void(
+ LocationCapabilitiesMask capsMask
+)> CapabilitiesCb;
+
+/** @brief Callback to be invoked to inform the processing
+ status of the the LocationClientApi function calls.
+ <br/>
+
+ @param response: if not LOCATION_RESPONSE_SUCCESS, then the
+ last API call failed. <br/>
+*/
+typedef std::function<void(
+ LocationResponse response
+)> ResponseCb;
+
+/** @brief
+ LocationCb is for receiving Location when
+ LocationClientApi is in a positioning session. <br/>
+
+ When there are multiple engines running on the system, the
+ received Location is fused report from all engines. <br/>
+
+ When there is only standard SPE engine running on the
+ system, the received Location is from modem GNSS engine.
+ <br/>
+
+ @param location: received basic location info. <br/>
+*/
+typedef std::function<void(
+ const Location& location
+)> LocationCb;
+
+/** @brief
+ GnssLocationCb is for receiving GnssLocation which contains
+ richer info than Location when LocationClientApi is
+ in a positioning session. <br/>
+
+ When there are multiple engines running on the system, the
+ received GnssLocation is fused report from all engines.
+ <br/>
+
+ When there is only standard SPE engine running on the
+ system, the received GnssLocation is from modem GNSS engine.
+ <br/>
+
+ @param gnssLocation: rich GnssLocation. <br/>
+*/
+typedef std::function<void(
+ const GnssLocation& gnssLocation
+)> GnssLocationCb;
+
+/** @brief
+ EngineLocationsCb is for receiving GnssLocation from
+ selected position engines when LocationClientApi is in a
+ positioning session. <br/>
+
+ @param engLocations: rich GnssLocation from requested
+ position engines <br/>
+*/
+typedef std::function<void(
+ const std::vector<GnssLocation> & engLocations
+)> EngineLocationsCb;
+
+
+/** @brief
+ GnssSvCb is for receiving GnssSv when LocationClientApi is
+ in a positioning session. <br/>
+
+ @param gnssSvs: GNSS SV report. <br/>
+*/
+typedef std::function<void(
+ const std::vector<GnssSv>& gnssSvs
+)> GnssSvCb;
+
+/** @brief
+ GnssNmeaCb is for receiving NMEA sentences when
+ LocationClientApi is in a positioning session. <br/>
+
+ @param timestamp: timestamp that NMEA sentence is
+ generated. <br/>
+
+ @param nmea: nmea strings generated from position and SV
+ report. <br/>
+*/
+typedef std::function<void(
+ uint64_t timestamp, const std::string& nmea
+)> GnssNmeaCb;
+
+/** @brief
+ GnssDataCb is for receiving GnssData, e.g.:
+ jammer information when LocationClientApi is in a
+ positioning session. <br/>
+
+ @param gnssData: GNSS jammer and agc info. <br/>
+*/
+typedef std::function<void(
+ const GnssData& gnssData
+)> GnssDataCb;
+
+/** @brief
+ GnssMeasurementsCb is for receiving GnssMeasurements
+ information when LocationClientApi is in a positioning
+ session. <br/>
+
+ @param gnssMeasurements: GNSS SV measurements. <br/>
+*/
+typedef std::function<void(
+ const GnssMeasurements& gnssMeasurements
+)> GnssMeasurementsCb;
+
+/** @brief
+ LocationSystemInfoCb is for receiving rare occuring location
+ system information update as defined in
+ LocationSystemInfo. <br/>
+ @param locationSystemInfo: rare location system event, e.g.:
+ leap second change. <br/>
+*/
+typedef std::function<void(
+ const LocationSystemInfo & locationSystemInfo
+)> LocationSystemInfoCb;
+
+/** @brief
+ BatchingCb is for delivering locations in a batching
+ session.
+ @param locations: the locations batched in a session
+ @param batchStatus: BatchingStatus of the batching session, which is
+ BATCHING_STATUS_INACTIVE when unable to compute positions for batching;
+ BATCHING_STATUS_DONE when trip distance has been traversed for tripBatching;
+ BATCHING_STATUS_ACTIVE when able to compute positions for batching.
+*/
+typedef std::function<void(
+ const std::vector<Location>& locations,
+ BatchingStatus batchStatus
+)> BatchingCb;
+
+/** @brief Used by geofence APIs
+
+ @param responses: include Geofence objects and correponding responses.
+*/
+class Geofence;
+typedef std::function<void(
+ std::vector<std::pair<Geofence, LocationResponse>>& responses
+)> CollectiveResponseCb;
+
+/** @brief
+ GeofenceBreachCb is for receiving geofences that have a
+ state change.
+ @param geofences: array of geofence objects that have breached
+ @param location: location associated with breach
+ @param type: type of breach
+ @param timestamp: timestamp of breach
+*/
+typedef std::function<void(
+ const std::vector<Geofence>& geofences,
+ Location location,
+ GeofenceBreachTypeMask type,
+ uint64_t timestamp
+)> GeofenceBreachCb;
+
+
+/** Specify the set of callbacks to receive the reports when
+ * invoking startPositionSession(uint32_t,
+ * LocReqEngineTypeMask, const GnssReportCbs&, ResponseCb) with
+ * intervalInMs specified. <br/> */
+struct GnssReportCbs {
+ /** Callback to receive GnssLocation. <br/>
+ When there are multiple engines running on the system, the
+ received Location is fused report from all engines. <br/>
+ When there is only standard SPE engine running on the
+ system, the received Location is from modem GNSS engine. <br/>
+ */
+ GnssLocationCb gnssLocationCallback;
+ /** Callback to receive GnssSv from modem GNSS engine. <br/> */
+ GnssSvCb gnssSvCallback;
+ /** Callback to receive NMEA sentences. <br/> */
+ GnssNmeaCb gnssNmeaCallback;
+ /** Callback to receive GnssData from modem GNSS engine.
+ * <br/> */
+ GnssDataCb gnssDataCallback;
+ /** Callback to receive GnssMeasurements modem GNSS engine. <br/> */
+ GnssMeasurementsCb gnssMeasurementsCallback;
+};
+
+/** Specify the set of callbacks to receive the reports when
+ * invoking startPositionSession(uint32_t,
+ * LocReqEngineTypeMask, const EngineReportCbs&, ResponseCb)
+ * with intervalInMs specified. */
+struct EngineReportCbs {
+ /** Callback to receive GnssLocation from selected engines.
+ * <br/> */
+ EngineLocationsCb engLocationsCallback;
+ /** Callback to receive GnssSv from modem GNSS engine. <br/> */
+ GnssSvCb gnssSvCallback;
+ /** Callback to receive NMEA sentences. <br/>
+ * NMEA will be generated from GnssSv and position report.
+ * <br/>
+ * When there are multiple engines running on the system,
+ * position related NMEA sentences will be generated from the
+ * fused position report. <br/>
+ * When there is only SPE engine running on the system,
+ * position related NMEA sentences will be generated from the
+ * position report from modem GNSS engine report. <br/> */
+ GnssNmeaCb gnssNmeaCallback;
+ /** Callback to receive GnssData from modem GNSS engine.
+ * <br/> */
+ GnssDataCb gnssDataCallback;
+ /** Callback to receive GnssMeasurements from modem GNSS engine.
+ * <br/> */
+ GnssMeasurementsCb gnssMeasurementsCallback;
+};
+
+/**
+ * Specify the valid fields in GnssEnergyConsumedInfo. */
+enum GnssEnergyConsumedInfoMask {
+ /** GnssEnergyConsumedInfo has valid
+ * GnssEnergyConsumedInfo::totalEnergyConsumedSinceFirstBoot.
+ * <br/>
+ */
+ ENERGY_CONSUMED_SINCE_FIRST_BOOT_BIT = (1<<0),
+};
+
+/** Specify the info regarding energy consumed by GNSS
+ * engine. <br/> */
+struct GnssEnergyConsumedInfo {
+ /** Bitwise OR of GnssEnergyConsumedInfoMask to
+ * specify the valid fields in GnssEnergyConsumedInfo. <br/> */
+ GnssEnergyConsumedInfoMask flags;
+
+ /** Energy consumed by the modem GNSS engine since device first
+ * ever bootup, in unit of 0.1 milli watt seconds.
+ * A value of 0xffffffffffffffff indicates an invalid reading.
+ * <br/>
+ */
+ uint64_t totalEnergyConsumedSinceFirstBoot;
+};
+
+/** @fn
+ @brief Used to retrieve energy consumed by modem GNSS
+ engine as defined in GnssEnergyConsumedInfo. <br/>
+
+ @param gnssEneryConsumed: info regarding energy consumed by
+ modem GNSS engine. <br/>
+*/
+typedef std::function<void(
+ const GnssEnergyConsumedInfo& gnssEneryConsumed
+)> GnssEnergyConsumedCb;
+
+class LocationClientApiImpl;
+class LocationClientApi
+{
+public:
+ /** @brief
+ Creates an instance of LocationClientApi object. <br/>
+ If capsCallback is not nullptr, capsCallback will be invoked
+ to report the capabilities of the underlying system. <br/>
+
+ @param
+ capsCallback: If this callback is not null,
+ location_client::LocationCapabilitiesMask will
+ be reported via this callback after the
+ construction of the object. <br/>
+ This callback is allowed to be be null. <br/>
+ */
+ LocationClientApi(CapabilitiesCb capsCallback);
+
+ /** @brief Default destructor */
+ virtual ~LocationClientApi();
+
+ /* ================================== POSITIONING ================================== */
+
+ /** @brief Start or update a session with specified
+ parameters to receive basic location report in format of
+ Location.
+ <br/>
+
+ If locationCallback is nullptr, this call is no op. <br/>
+ Otherwise, if this API is called for first time or after
+ stopPositionSession(), a position session will be started
+ with the specified parameters and callbacks. <br/>
+
+ If called during a session (no matter from which
+ location_client::startPositionSession()), parameters and
+ callbacks will be updated, and the session continues but
+ with the new set of parameters and callbacks. <br/>
+
+ @param intervalInMs <br/>
+ Time between fixes, or TBF, in milliseconds. <br/>
+ The actual interval of reports recieved will be determined
+ by the underlying system. <br/>
+ For example, if intervalInMs is specified as 10
+ milliseconds, the report interval will be 100 milli-seconds
+ if the highest report rate supported by the positioning
+ engines is 10Hz. <br/>
+ Also, if there is another application in the system having a
+ session with shorter interval, this client may benefit and
+ receive reports at that interval. <br/>
+ 0 to indicate that client is interested in passive
+ listening of the registered reports for session initiated by
+ other clients. <br/>
+
+ @param distanceInMeters <br/>
+ Distance between fixes, in meters. <br/>
+ 0 to indicate don't care.<br/>
+ When distanceInMeters is set to none zero, intervalInMs
+ indicates the max latency that position report should be
+ reported after the min distance criteria has been met. For
+ example device has been static, at UTC time of x
+ millisecond, the device starts to move, at UTC time of y
+ milliseconds, the device has moved by distanceInMeters. Then
+ the location API client shall expect to get a fix no later
+ at UTC time of y+intervalInMs milliseconds. <br/>
+ The underlying system may have a minimum distance threshold
+ (e.g. 1 meter). Effective distance will not be smaller than
+ this lower bound. <br/>
+ The effective distance may have a granularity level higher
+ than 1 m, e.g. 5 m. So distanceInMeters being 59 may be
+ honored at 60 m, depending on the system. <br/>
+ Where there is anotehr application in they system having a
+ session with shorter distance, this client may benefit and
+ receive reports at that distance.<br/>
+
+ @param locationCallback
+ Callback to receive positions. <br/>
+
+ @param responseCallback
+ Callback to receive system responses. <br/>
+ This callback is allowed to be null. <br/>
+
+ @return True, if a session is successfully started. If
+ responseCallback is not null, it will then will then
+ be invoked to deliver the processing status. If the
+ processing status is LOCATION_RESPONSE_SUCCESS,
+ LocationCb will be invoked to deliver Location.
+ <br/>
+
+ @return False, if no session is started, i.e. when
+ locationCallback is nullptr. In this case,
+ ResponseCb will not be invoked. <br/>
+ */
+ bool startPositionSession(uint32_t intervalInMs, uint32_t distanceInMeters,
+ LocationCb locationCallback, ResponseCb responseCallback);
+
+ /** @brief Start or update a session to receive rich location
+ info in format of GnssLocation and other reports,
+ e.g.: SV report and NMEA report.
+ If gnssReportCallbacks is nullptr, this call is no op. <br/>
+ Otherwise, if this API is called for first time or after
+ stopPositionSession(), a position session will be started
+ with the specified parameters and callbacks. <br/>
+ If this API is called during a session (no matter from which
+ startPositionSession() API), parameters and callbacks will
+ be updated, and the session continues but with the new set
+ of parameters and callbacks. <br/>
+
+ @param intervalInMs <br/>
+ Time between fixes, or TBF, in milliseconds. <br/>
+ The actual interval of reports recieved will be determined
+ by the underlying system. <br/>
+ For example, if intervalInMs is specified as 10
+ milliseconds, the report interval will be 100 milli-seconds
+ if the highest report rate supported by the positioning
+ engines is 10Hz. <br/>
+ Also, if there is another application in the system having a
+ session with shorter interval, this client may benefit and
+ receive reports at that interval. <br/>
+ 0 to indicate that client is interested in passive
+ listening of the registered reports for session initiated by
+ other clients. <br/>
+
+ @param gnssReportCallbacks
+ Table of callbacks to receive GNSS locations / sv info /
+ nmea report / sv measurement report. <br/>
+
+ @param responseCallback
+ Callback to receive system responses. <br/>
+ This callback is allowed to be null. <br/>
+
+ @return True, if a session is successfully started. If
+ responseCallback is not null, it will then will then
+ be invoked to deliver the processing status.
+ If the processing status is
+ LOCATION_RESPONSE_SUCCESS, GnssReportCb will be
+ invoked to deliver registered reports. <br/>
+
+ @return False, if no session is started, i.e. when
+ locationCallback is nullptr. In this case,
+ ResponseCb will not be invoked. <br/>
+ */
+ bool startPositionSession(uint32_t intervalInMs,
+ const GnssReportCbs& gnssReportCallbacks,
+ ResponseCb responseCallback);
+
+ /** @brief
+ Start or update a session which may provide richer default
+ combined poisiton report and position reports from other
+ engines in format of GnssLocation together with NMEA, SV
+ report, SV measurement reports. <br/>
+
+ If EngineReportCbs is populated with nullptr only, this call
+ is no op. Otherwise...<br/>
+ If this API is called for first time or after
+ stopPositionSession(), a position session will be started
+ with the specified parameters and callbacks. <br/>
+ If this API is called during a session (no matter from which
+ startPositionSession() API), parameters / callback will be
+ updated, and the session continues but with the new set of
+ parameters / callbacks. <br/>
+
+ @param intervalInMs
+ Time between fixes, or TBF, in milliseconds. <br/>
+ The actual interval of reports recieved will be determined
+ by the underlying system. <br/>
+ For example, if intervalInMs is specified as 10
+ milliseconds, the report interval will be 100 milli-seconds
+ if the highest report rate supported by the positioning
+ engines is 10Hz. <br/>
+ Also, if there is another application in the system having a
+ session with shorter interval, this client may benefit and
+ receive reports at that interval. <br/>
+ 0 to indicate that client is interested in passive listening
+ of the registered reports for session initiated by other
+ clients. <br/>
+
+ @param locReqEngineSrcMask <br/>
+ The bit maks of the location engines that client is
+ interested to receive position report. <br/>
+ If LOC_REQ_ENGINE_FUSED_BIT is set, but SPE is the only positioning
+ engine running on the system, then the fused position will be the
+ unpropagated SPE report. <br/>
+ If LOC_REQ_ENGINE_FUSED_BIT is set, and there is at least one
+ additional engine running on the system other than SPE engine,
+ then the fused position will be the propagated report to
+ current time. <br/>
+ If LOC_REQ_ENGINE_PPE_BIT is set, but PPE is not enabled on
+ the system, then PPE position will not be returned. <br/>
+ The SPE and PPE report will be the original reports from the
+ position engine without any modification and they will be
+ send out to client as soon as avaiable. <br/>
+
+ @param engReportCallbacks
+ Table of callbacks to receive engine locations / sv report / nmea
+ report/ sv measurement report. <br/>
+
+ @param responseCallback
+ Callback to receive system responses. <br/>
+ This callback is allowed to be null. <br/>
+
+ @return True, if a session is successfully started. If
+ responseCallback is not null, it will then be
+ invoked to deliver the processing status. If the
+ processing status is LOCATION_RESPONSE_SUCCESS,
+ EngineReportCbs will be invoked to deliver
+ registered reports. <br/>
+
+ @return False, if no session is started, i.e. when
+ locationCallback is nullptr. In this case,
+ ResponseCb will not be invoked. <br/>
+ */
+ bool startPositionSession(uint32_t intervalInMs,
+ LocReqEngineTypeMask locReqEngMask,
+ const EngineReportCbs& engReportCallbacks,
+ ResponseCb responseCallback);
+
+ /** @brief Stop the ongoing positioning session and
+ * de-register the callbacks of previous
+ * startPositionSession. <br/>
+ * If ResponseCb is registerd with previous
+ * startPositionSession(), it will be invoked to deliver the
+ * processing status. <br/> */
+ void stopPositionSession();
+
+ /** @example example1:testTrackingApi
+ * <pre>
+ * <code>
+ * // Sample Code
+ * static void onCapabilitiesCb(location_client::LocationCapabilitiesMask mask) {
+ * //...
+ * }
+ * static void onResponseCb(location_client::LocationResponse response) {
+ * //...
+ * }
+ * static void onGnssLocationCb(const GnssLocation& location) {
+ * //...
+ * }
+ *
+ * static void onGnssSvCb(const std::vector<location_client::GnssSv>& gnssSvs) {
+ * //...
+ * }
+ *
+ * static void onGnssNmeaCb(uint64_t timestamp, const std::string& nmea) {
+ * //...
+ * }
+ * void testTrackingApi() {
+ * LocationClientApi *pClient = new LocationClientApi(onCapabilitiesCb);
+ * if (nullptr == pClient) {
+ * LOC_LOGe("failed to create LocationClientApi instance");
+ * return;
+ * }
+ *
+ * uint32_t option = 0x111;
+ * uint32_t interval = 1000;
+ * // set callbacks
+ * GnssReportCbs reportcbs;
+ * if (option & 1<<0) {
+ * reportcbs.gnssLocationCallback = GnssLocationCb(onGnssLocationCb);
+ * }
+ * if (option & 1<<1) {
+ * reportcbs.gnssSvCallback = GnssSvCb(onGnssSvCb);
+ * }
+ * if (option & 1<<2) {
+ * reportcbs.gnssNmeaCallback = GnssNmeaCb(onGnssNmeaCb);
+ * }
+ *
+ * // start tracking session
+ * pClient->startPositionSession(interval, reportcbs, onResponseCb);
+ * //...
+ * // stop session
+ * pClient->stopPositionSession();
+ * </code>
+ * </pre>
+ */
+
+ /* ================================== BATCHING ================================== */
+
+ /** @brief starts an outdoor trip mode batching session with specified parameters.
+ Trip mode batching completes on its own when trip distance is covered.
+ The behavior of the call is non contextual. The current state or the history of
+ actions does not influence the end result of this call. For example, calling
+ this function when idle, or calling this function after another startTripBatchingSession()
+ or startRoutineBatchingSession(), or calling this function after stopBatchingSession()
+ achieve the same result, which is one of the below:
+ If batchingCallback is nullptr, this call is no op. Otherwise...
+ If both minInterval and tripDistance are don't care, this call is no op.
+ Otherwise...
+ If called during a session (no matter from which startTripBatchingSession()/
+ startRoutineBatchingSession() API), parameters / callback will be updated,
+ and the session continues but with the new set of parameters / callback.
+ locations are reported on the batchingCallback in batches when batch is full.
+ @param minInterval
+ Time between fixes, or TBF, in milliseconds. The actual
+ interval of reports recieved will be no larger than
+ milliseconds being rounded up the next interval granularity
+ supported by the underlying system.
+ 0 to indicate don't care.
+ 1) The underlying system may have a minimum interval threshold
+ (e.g. 100 ms or 1000 ms). Effective intervals will not be smaller
+ than this lower bound.
+ 2) The effective intervals may have a granularity level higher
+ than 1 ms, e.g. 100 ms or 1000 ms. So milliseconds being 1559
+ may be honored at 1600 or 2000 ms, depending on the system.
+ 3) Where there is anotehr application in they system having a
+ session with shorter interval, this client may benefit and
+ receive reports at that interval.
+ @param tripDistance
+ the trip distance from the start of outdoor trip batching; 0 means don't care
+ @param batchingCallback
+ callback to receive batching positions and status
+ @param responseCallback
+ callback to receive system responses; optional.
+ @return True, if a batching session is successfully started.
+ False, if no session is started, i.e. when batchingCallback is nullptr.
+ */
+ bool startTripBatchingSession(uint32_t minInterval, uint32_t tripDistance,
+ BatchingCb batchingCallback, ResponseCb responseCallback);
+
+ /** @brief starts a routine mode batching session with specified parameters.
+ The behavior of the call is non contextual. The current state or the history of
+ actions does not influence the end result of this call. For example, calling
+ this function when idle, or calling this function after another startTripBatchingSession()
+ or startRoutineBatchingSession(), or calling this function after stopBatchingSession()
+ achieve the same result, which is one of the below:
+ If batchingCallback is nullptr, this call is no op. Otherwise...
+ If both minInterval and minDistance are don't care, this call is no op.
+ Otherwise...
+ If called during a session (no matter from which startTripBatchingSession()/
+ startRoutineBatchingSession() API), parameters / callback will be updated,
+ and the session continues but with the new set of parameters / callback.
+ locations are reported on the batchingCallback in batches when batch is full.
+ @param minInterval
+ Time between fixes, or TBF, in milliseconds. The actual
+ interval of reports recieved will be no larger than
+ milliseconds being rounded up the next interval granularity
+ supported by the underlying system.
+ 0 to indicate don't care.
+ 1) The underlying system may have a minimum interval threshold
+ (e.g. 100 ms or 1000 ms). Effective intervals will not be smaller
+ than this lower bound.
+ 2) The effective intervals may have a granularity level higher
+ than 1 ms, e.g. 100 ms or 1000 ms. So milliseconds being 1559
+ may be honored at 1600 or 2000 ms, depending on the system.
+ 3) Where there is anotehr application in they system having a
+ session with shorter interval, this client may benefit and
+ receive reports at that interval.
+ @param minDistance
+ specifies the minimum distance in unit of meters that should
+ be traversed before a position should be batched.
+ If 0, the positions are batched after the minInterval period expires.
+ If both minInterval and minDistance are specified, the position are batched only after
+ minInterval has expired AND minDistance has been traversed.
+ @param batchingCallback
+ callback to receive batching positions and status
+ @param responseCallback
+ callback to receive system responses; optional.
+ @return True, if a batching session is successfully started.
+ False, if no session is started, i.e. when batchingCallback is nullptr.
+ */
+ bool startRoutineBatchingSession(uint32_t minInterval, uint32_t minDistance,
+ BatchingCb batchingCallback, ResponseCb responseCallback);
+ /** @brief Stops the batching session.
+ */
+ void stopBatchingSession();
+
+ /** @example example2:testBatchingApi
+ * <pre>
+ * <code>
+ * // Sample Code
+ * static void onBatchingCb(const std::vector<location_client::Location>& locations,
+ * BatchingStatus status) {
+ * //...
+ * }
+ * void testBatchingApi() {
+ * // batching session
+ * uint32_t intervalInMs = 0;
+ * uint32_t distanceInMeters = 0;
+ * pClient->startRoutineBatchingSession(
+ * intervalInMs, distanceInMeters, onBatchingCb, onResponseCb);
+ * // ...
+ * pClient->stopBatchingSession();
+ * }
+ * </code>
+ * </pre>
+ */
+
+ /* ================================== Geofence ================================== */
+ /** @brief Adds any number of geofences. The geofenceBreachCallback will
+ deliver the status of each geofence according to the Geofence parameter for each.
+ @param geofences
+ Geofence objects, Once addGeofences returns, each Geofence object in the vector would
+ be the identifier throughout the remaining communication of that geofence.
+ Such a Geofence object can be copied or cloned, but they would all reference
+ the same geofence.
+ @param gfBreachCb
+ callback to receive geofences state change. addGeofences is no op if gfBreachCb is null
+ @param responseCallback
+ callback to receive geofence ids and system responses; optional.
+ */
+ void addGeofences(std::vector<Geofence>& geofences, GeofenceBreachCb gfBreachCb,
+ CollectiveResponseCb responseCallback);
+
+ /** @brief Removes any number of geofences.
+ @param geofences
+ Geofence objects, must be originally added to the system. Otherwise it would be no op.
+ */
+ void removeGeofences(std::vector<Geofence>& geofences);
+
+ /** @brief Modifies any number of geofences.
+ @param geofences
+ Geofence objects, must be originally added to the system. Otherwise it would be no op.
+ Modifiable fields include breachTypeMask, responsiveness and dwelltime.
+ A geofence that has been added to the system may have these fields modified.
+ But it is not going to take any effect until modifyGeofences is called with
+ the changed geofence passed in.
+ */
+ void modifyGeofences(std::vector<Geofence>& geofences);
+
+ /** @brief Pauses any number of geofences, which is similar to removeGeofences,
+ only that they can be resumed at any time.
+ @param geofences
+ Geofence objects, must be originally added to the system. Otherwise it would be no op.
+ */
+ void pauseGeofences(std::vector<Geofence>& geofences);
+
+ /** @brief Resumes any number of geofences that are currently paused.
+ @param geofences
+ Geofence objects, must be originally added to the system. Otherwise it would be no op.
+ */
+ void resumeGeofences(std::vector<Geofence>& geofences);
+
+ /** @example example3:testGeofenceApi
+ * <pre>
+ * <code>
+ * // Sample Code
+ *
+ * vector<Geofence> sGeofences;
+ * static void onGeofenceBreachCb( const std::vector<Geofence>& geofences,
+ * Location location, GeofenceBreachTypeMask type,
+ * uint64_t timestamp) {
+ * //...
+ * }
+ * static void onCollectiveResponseCb(std::vector<pair<Geofence, LocationResponse>>& responses) {
+ * //...
+ * }
+ *
+ * void testGeofenceApi() {
+ * double latitude = 32.896535;
+ * double longitude = -117.201025;
+ * double radius = 50;
+ * GeofenceBreachTypeMask type = (GeofenceBreachTypeMask)3;
+ * uint32_t responsiveness = 4000;
+ * uint32_t time = 0;
+ * Geofence gf(latitude, longitude, radius, type, responsiveness, time);
+ * sGeofences.push_back(gf);
+ *
+ * pClient->addGeofences(sGeofences, onGeofenceBreachCb, onCollectiveResponseCb);
+ * vector<Geofence> pauseGeofences;
+ * pauseGeofences.push_back(sGeofences[0]);
+ * pClient->pauseGeofences(pauseGeofences);
+ * vector<Geofence> resumeGeofences;
+ * resumeGeofences.push_back(sGeofences[0]);
+ * pClient->resumeGeofences(resumeGeofences);
+ * vector<Geofence> removeGeofences;
+ * for (int i=0; i<sGeofences.size(); ++i) {
+ * removeGeofences.push_back(sGeofences[i]);
+ * }
+ * pClient->removeGeofences(removeGeofences);
+ * }
+ * </code>
+ * </pre>
+ */
+
+ /* ================================== Other APIs ================================== */
+ /** @brief Inform LocationClientAPI of the device network
+ availability status.
+ @param available
+ True if available. <br/>
+ False otherwise. <br/> */
+ void updateNetworkAvailability(bool available);
+
+ /** @brief Get energy consumed info of modem GNSS engine. <br/>
+ If called while the previous call is still being processed,
+ then the callback will be updated, and engery consumed info
+ will be delivered via the new callbacks. <br/>
+
+ @param gnssEnergyConsumedCallback
+ Callback to receive energy consumed info by modem GNSS
+ engine. <br/>
+ @param responseCallback
+ Callback to receive the processing status of this API call.
+ <br/>
+ This callback is allowed to be null. <br/>
+
+ If the procesing status is LOCATION_RESPONSE_SUCCESS,
+ GnssEnergyConsumedCb will be invoked shortly to deliver the
+ energy consumed info. <br/> */
+ void getGnssEnergyConsumed(GnssEnergyConsumedCb gnssEnergyConsumedCallback,
+ ResponseCb responseCallback);
+
+ /** @brief
+ Register/update listener to receive location system info
+ that are not tied with positioning session, e.g.: next leap
+ second event. <br/>
+ One set of callbacks can be registered per instance of
+ LocationClientApi. <br/>
+ The callback may be invoked multiple times to update same or
+ different pieces of system info. <br/>
+
+ @param locSystemInfoCallback
+ Callback to receive system info update. <br/>
+ Pass a null callback to stop receiving the update. <br/>
+
+ @param responseCallback
+ Callback to receive the processing status of this API
+ call. <br/>
+ This callback is allowed to be null. <br>
+ */
+ void updateLocationSystemInfoListener(LocationSystemInfoCb locSystemInfoCallback,
+ ResponseCb responseCallback);
+
+private:
+ /** Internal implementation for LocationClientApi */
+ LocationClientApiImpl* mApiImpl;
+};
+
+class GeofenceImpl;
+class Geofence {
+ friend class GeofenceImpl;
+ friend class LocationClientApi;
+ std::shared_ptr<GeofenceImpl> mGeofenceImpl;
+ double mLatitude;
+ double mLongitude;
+ double mRadius;
+ GeofenceBreachTypeMask mBreachType;
+ uint32_t mResponsiveness;
+ uint32_t mDwellTime;
+public:
+ virtual ~Geofence() {}
+ inline Geofence(double lat, double lon, double r, GeofenceBreachTypeMask type,
+ uint32_t responsiveness, uint32_t time) :
+ mGeofenceImpl(nullptr), mLatitude(lat), mLongitude(lon), mRadius(r),
+ mBreachType(type), mResponsiveness(responsiveness), mDwellTime(time) {}
+ inline Geofence(const Geofence& geofence): mGeofenceImpl(geofence.mGeofenceImpl),
+ mLatitude(geofence.mLatitude), mLongitude(geofence.mLongitude),
+ mRadius(geofence.mRadius), mBreachType(geofence.mBreachType),
+ mResponsiveness(geofence.mResponsiveness), mDwellTime(geofence.mDwellTime) {}
+ // clients who extends Geofence class should implement this clone method, so that its own
+ // data stashed in the object gets copied to the new object, if desired so.
+ virtual Geofence* clone() { return new Geofence(*this); }
+ bool operator==(Geofence& other);
+ inline double getLatitude() const { return mLatitude; }
+ inline double getLongitude() const { return mLongitude; }
+ inline double getRadius() const { return mRadius; }
+ inline GeofenceBreachTypeMask getBreachType() const { return mBreachType; }
+ inline uint32_t getResponsiveness() const { return mResponsiveness; }
+ inline uint32_t getDwellTime() const { return mDwellTime; }
+ inline void setBreachType(GeofenceBreachTypeMask type) { mBreachType = type; }
+ inline void setResponsiveness(uint32_t responsiveness) { mResponsiveness = responsiveness; }
+ inline void setDwellTime(uint32_t time) { mDwellTime = time; }
+};
+
+} // namespace location_client
+
+#endif /* LOCATIONCLIENTAPI_H */
diff --git a/location/client_api/location-client-api.pc.in b/location/client_api/location-client-api.pc.in
new file mode 100644
index 0000000..4fe0296
--- /dev/null
+++ b/location/client_api/location-client-api.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-client-api
+Description: location client api library
+Version: @VERSION@
+Libs: -L${libdir} -llocation_client_api
+Cflags: -I${includedir} -I${includedir}/location-client-api
\ No newline at end of file
diff --git a/location/client_api/mkclientapidoc.sh b/location/client_api/mkclientapidoc.sh
new file mode 100644
index 0000000..994d6e7
--- /dev/null
+++ b/location/client_api/mkclientapidoc.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+#==========================================================================
+#Copyright (c) 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.
+#
+#==========================================================================
+
+#==========================================================================
+#
+# Usage:
+# mkclientapidoc.sh [output-path]
+#
+# Note, this script requires the existence of the doxygen tool -
+# This script can be called from any directory
+#==========================================================================
+
+DIR="$( cd "$( dirname "$0" )" && pwd )"
+# the default doxygen configuration is LocationClientApiDoxygen.conf
+CONFIG=$DIR/LocationClientApiDoxygen.conf
+OUT="docs"
+
+# Show help message if requested, otherwise create output folder
+if [ -n "$1" ]
+then
+ if [ "$1" == "-h" ] || [ "$1" == "--help" ]
+ then
+ echo "$0 [output-path]"
+ echo " e.g. $0"
+ echo " $0 docs"
+ exit
+ else
+ OUT=$1
+ if [ ! -d $OUT ]
+ then
+ mkdir -p $OUT
+ fi
+ fi
+fi
+
+
+which doxygen
+if [ "$?" == 0 ]
+then
+# Use ? here to seperate patterns as / in path will be regarded as splitter by default
+ sed -i "s?^OUTPUT_DIRECTORY .*?OUTPUT_DIRECTORY = $OUT?" $CONFIG
+ sed -i "s?^INPUT .*?INPUT = $DIR/inc?" $CONFIG
+ doxygen $CONFIG > /dev/null 2>&1
+else
+ echo "This script requires doxygen tool be to installed. "
+ echo "You can install is with e.g. sudo apt-get install doxygen"
+ exit 1
+fi
+
+
+if [ ! -e $OUT/html/index.html ]
+then
+ echo "Error building Location Client Api doc files."
+ exit 2
+fi
+
+echo
+echo "doxygen docs for Location Client Api available at: $OUT/html"
diff --git a/location/client_api/src/LocationClientApi.cpp b/location/client_api/src/LocationClientApi.cpp
new file mode 100644
index 0000000..5dcd0db
--- /dev/null
+++ b/location/client_api/src/LocationClientApi.cpp
@@ -0,0 +1,1145 @@
+/* Copyright (c) 2018-2020, 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.
+ */
+
+#define LOG_TAG "LocSvc_LocationClientApi"
+
+#include <loc_cfg.h>
+#include <cmath>
+#include <LocationDataTypes.h>
+#include <LocationClientApi.h>
+#include <LocationClientApiImpl.h>
+#include <LocationApiMsg.h>
+#include <log_util.h>
+#include <loc_log.h>
+#include <gps_extended_c.h>
+
+using std::string;
+
+namespace location_client {
+
+bool Geofence::operator==(Geofence& other) {
+ return mGeofenceImpl != nullptr && other.mGeofenceImpl != nullptr &&
+ mGeofenceImpl == other.mGeofenceImpl;
+}
+
+/******************************************************************************
+LocationClientApi
+******************************************************************************/
+LocationClientApi::LocationClientApi(CapabilitiesCb capabitiescb) :
+ mApiImpl(new LocationClientApiImpl(capabitiescb)) {
+}
+
+LocationClientApi::~LocationClientApi() {
+ if (mApiImpl) {
+ // two steps processes due to asynchronous message processing
+ mApiImpl->destroy();
+ // deletion of mApiImpl will be done after messages in the queue are processed
+ }
+}
+
+bool LocationClientApi::startPositionSession(
+ uint32_t intervalInMs,
+ uint32_t distanceInMeters,
+ LocationCb locationCallback,
+ ResponseCb responseCallback) {
+
+ //Input parameter check
+ if (!locationCallback) {
+ LOC_LOGe ("NULL locationCallback");
+ return false;
+ }
+
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+
+ // callback functions
+ ClientCallbacks cbs = {0};
+ cbs.responsecb = responseCallback;
+ cbs.locationcb = locationCallback;
+ mApiImpl->updateCallbackFunctions(cbs);
+
+ // callback masks
+ LocationCallbacks callbacksOption = {0};
+ callbacksOption.responseCb = [](::LocationError err, uint32_t id) {};
+ // only register for trackingCb if distance is not 0
+ if (distanceInMeters != 0) {
+ callbacksOption.trackingCb = [](::Location n) {};
+ } else {
+ // for time based, register gnss location cb
+ callbacksOption.gnssLocationInfoCb = [](::GnssLocationInfoNotification n) {};
+ }
+ mApiImpl->updateCallbacks(callbacksOption);
+
+ // options
+ LocationOptions locationOption;
+ TrackingOptions trackingOption;
+ locationOption.size = sizeof(locationOption);
+ locationOption.minInterval = intervalInMs;
+ locationOption.minDistance = distanceInMeters;
+ trackingOption.setLocationOptions(locationOption);
+ mApiImpl->startTracking(trackingOption);
+ return true;
+}
+
+bool LocationClientApi::startPositionSession(
+ uint32_t intervalInMs,
+ const GnssReportCbs& gnssReportCallbacks,
+ ResponseCb responseCallback) {
+
+ //Input parameter check
+ if (!gnssReportCallbacks.gnssLocationCallback) {
+ LOC_LOGe ("gnssLocation Callbacks can't be NULL");
+ return false;
+ }
+
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+
+ // callback functions
+ ClientCallbacks cbs = {0};
+ cbs.responsecb = responseCallback;
+ cbs.gnssreportcbs = gnssReportCallbacks;
+ mApiImpl->updateCallbackFunctions(cbs, REPORT_CB_GNSS_INFO);
+
+ // callback masks
+ LocationCallbacks callbacksOption = {0};
+ callbacksOption.responseCb = [](::LocationError err, uint32_t id) {};
+ if (gnssReportCallbacks.gnssLocationCallback) {
+ callbacksOption.gnssLocationInfoCb = [](::GnssLocationInfoNotification n) {};
+ }
+ if (gnssReportCallbacks.gnssSvCallback) {
+ callbacksOption.gnssSvCb = [](::GnssSvNotification n) {};
+ }
+ if (gnssReportCallbacks.gnssNmeaCallback) {
+ callbacksOption.gnssNmeaCb = [](::GnssNmeaNotification n) {};
+ }
+ if (gnssReportCallbacks.gnssDataCallback) {
+ callbacksOption.gnssDataCb = [] (::GnssDataNotification n) {};
+ }
+ if (gnssReportCallbacks.gnssMeasurementsCallback) {
+ callbacksOption.gnssMeasurementsCb = [](::GnssMeasurementsNotification n) {};
+ }
+ mApiImpl->updateCallbacks(callbacksOption);
+
+ // options
+ LocationOptions locationOption;
+ TrackingOptions trackingOption;
+ locationOption.size = sizeof(locationOption);
+ locationOption.minInterval = intervalInMs;
+ locationOption.minDistance = 0;
+ trackingOption.setLocationOptions(locationOption);
+ mApiImpl->startTracking(trackingOption);
+ return true;
+}
+
+bool LocationClientApi::startPositionSession(
+ uint32_t intervalInMs,
+ LocReqEngineTypeMask locEngReqMask,
+ const EngineReportCbs& engReportCallbacks,
+ ResponseCb responseCallback) {
+
+ //Input parameter check
+ if (!engReportCallbacks.engLocationsCallback) {
+ LOC_LOGe ("engLocations Callbacks can't be NULL");
+ return false;
+ }
+
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+
+ // callback functions
+ ClientCallbacks cbs = {0};
+ cbs.responsecb = responseCallback;
+ cbs.engreportcbs = engReportCallbacks;
+ mApiImpl->updateCallbackFunctions(cbs, REPORT_CB_ENGINE_INFO);
+
+ // callback masks
+ LocationCallbacks callbacksOption = {0};
+ callbacksOption.responseCb = [](::LocationError err, uint32_t id) {};
+
+ if (engReportCallbacks.engLocationsCallback) {
+ callbacksOption.engineLocationsInfoCb =
+ [](uint32_t count, ::GnssLocationInfoNotification* locArr) {};
+ }
+ if (engReportCallbacks.gnssSvCallback) {
+ callbacksOption.gnssSvCb = [](::GnssSvNotification n) {};
+ }
+ if (engReportCallbacks.gnssNmeaCallback) {
+ callbacksOption.gnssNmeaCb = [](::GnssNmeaNotification n) {};
+ }
+ if (engReportCallbacks.gnssDataCallback) {
+ callbacksOption.gnssDataCb = [] (::GnssDataNotification n) {};
+ }
+ if (engReportCallbacks.gnssMeasurementsCallback) {
+ callbacksOption.gnssMeasurementsCb = [](::GnssMeasurementsNotification n) {};
+ }
+ mApiImpl->updateCallbacks(callbacksOption);
+
+ // options
+ LocationOptions locationOption;
+ TrackingOptions trackingOption;
+ locationOption.size = sizeof(locationOption);
+ locationOption.minInterval = intervalInMs;
+ locationOption.minDistance = 0;
+ locationOption.locReqEngTypeMask =(::LocReqEngineTypeMask)locEngReqMask;
+ trackingOption.setLocationOptions(locationOption);
+
+ mApiImpl->startTracking(trackingOption);
+ return true;
+}
+
+void LocationClientApi::stopPositionSession() {
+ if (mApiImpl) {
+ mApiImpl->stopTracking(0);
+ }
+}
+
+bool LocationClientApi::startTripBatchingSession(uint32_t minInterval, uint32_t tripDistance,
+ BatchingCb batchingCallback, ResponseCb responseCallback) {
+ //Input parameter check
+ if (!batchingCallback) {
+ LOC_LOGe ("NULL batchingCallback");
+ return false;
+ }
+
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+ // callback functions
+ ClientCallbacks cbs = {0};
+ cbs.responsecb = responseCallback;
+ cbs.batchingcb = batchingCallback;
+ mApiImpl->updateCallbackFunctions(cbs);
+
+ // callback masks
+ LocationCallbacks callbacksOption = {0};
+ callbacksOption.responseCb = [](::LocationError err, uint32_t id) {};
+ callbacksOption.batchingCb = [](size_t count, ::Location* location,
+ BatchingOptions batchingOptions) {};
+ callbacksOption.batchingStatusCb = [](BatchingStatusInfo batchingStatus,
+ std::list<uint32_t>& listOfcompletedTrips) {};
+ mApiImpl->updateCallbacks(callbacksOption);
+
+ LocationOptions locOption = {};
+ locOption.size = sizeof(locOption);
+ locOption.minInterval = minInterval;
+ locOption.minDistance = tripDistance;
+ locOption.mode = GNSS_SUPL_MODE_STANDALONE;
+
+ BatchingOptions batchOption = {};
+ batchOption.size = sizeof(batchOption);
+ batchOption.batchingMode = BATCHING_MODE_TRIP;
+ batchOption.setLocationOptions(locOption);
+ mApiImpl->startBatching(batchOption);
+ return true;
+}
+
+bool LocationClientApi::startRoutineBatchingSession(uint32_t minInterval, uint32_t minDistance,
+ BatchingCb batchingCallback, ResponseCb responseCallback) {
+ //Input parameter check
+ if (!batchingCallback) {
+ LOC_LOGe ("NULL batchingCallback");
+ return false;
+ }
+
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+ // callback functions
+ ClientCallbacks cbs = {0};
+ cbs.responsecb = responseCallback;
+ cbs.batchingcb = batchingCallback;
+ mApiImpl->updateCallbackFunctions(cbs);
+
+ // callback masks
+ LocationCallbacks callbacksOption = {0};
+ callbacksOption.responseCb = [](::LocationError err, uint32_t id) {};
+ callbacksOption.batchingCb = [](size_t count, ::Location* location,
+ BatchingOptions batchingOptions) {};
+ mApiImpl->updateCallbacks(callbacksOption);
+
+ LocationOptions locOption = {};
+ locOption.size = sizeof(locOption);
+ locOption.minInterval = minInterval;
+ locOption.minDistance = minDistance;
+ locOption.mode = GNSS_SUPL_MODE_STANDALONE;
+
+ BatchingOptions batchOption = {};
+ batchOption.size = sizeof(batchOption);
+ batchOption.batchingMode = BATCHING_MODE_ROUTINE;
+ batchOption.setLocationOptions(locOption);
+ mApiImpl->startBatching(batchOption);
+ return true;
+}
+
+void LocationClientApi::stopBatchingSession() {
+ if (mApiImpl) {
+ mApiImpl->stopBatching(0);
+ }
+}
+
+void LocationClientApi::addGeofences(std::vector<Geofence>& geofences,
+ GeofenceBreachCb gfBreachCb,
+ CollectiveResponseCb responseCallback) {
+ //Input parameter check
+ if (!gfBreachCb) {
+ LOC_LOGe ("NULL GeofenceBreachCb");
+ return;
+ }
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return;
+ }
+ // callback functions
+ ClientCallbacks cbs = {0};
+ cbs.collectivecb = responseCallback;
+ cbs.gfbreachcb = gfBreachCb;
+ mApiImpl->updateCallbackFunctions(cbs);
+
+ // callback masks
+ LocationCallbacks callbacksOption = {0};
+ callbacksOption.responseCb = [](LocationError err, uint32_t id) {};
+ callbacksOption.collectiveResponseCb = [](size_t, LocationError*, uint32_t*) {};
+ callbacksOption.geofenceBreachCb = [](GeofenceBreachNotification geofenceBreachNotification)
+ {};
+ mApiImpl->updateCallbacks(callbacksOption);
+ size_t count = geofences.size();
+ mApiImpl->mLastAddedClientIds.clear();
+ if (count > 0) {
+ GeofenceOption* gfOptions = (GeofenceOption*)malloc(sizeof(GeofenceOption) * count);
+ GeofenceInfo* gfInfos = (GeofenceInfo*)malloc(sizeof(GeofenceInfo) * count);
+
+ for (int i=0; i<count; ++i) {
+ if (geofences[i].mGeofenceImpl) {
+ continue;
+ }
+ gfOptions[i].breachTypeMask = geofences[i].getBreachType();
+ gfOptions[i].responsiveness = geofences[i].getResponsiveness();
+ gfOptions[i].dwellTime = geofences[i].getDwellTime();
+ gfOptions[i].size = sizeof(gfOptions[i]);
+ gfInfos[i].latitude = geofences[i].getLatitude();
+ gfInfos[i].longitude = geofences[i].getLongitude();
+ gfInfos[i].radius = geofences[i].getRadius();
+ gfInfos[i].size = sizeof(gfInfos[i]);
+ std::shared_ptr<GeofenceImpl> gfImpl(new GeofenceImpl(&geofences[i]));
+ gfImpl->bindGeofence(&geofences[i]);
+ mApiImpl->mLastAddedClientIds.push_back(gfImpl->getClientId());
+ mApiImpl->addGeofenceMap(mApiImpl->mLastAddedClientIds[i], geofences[i]);
+ }
+
+ mApiImpl->addGeofences(geofences.size(), reinterpret_cast<GeofenceOption*>(gfOptions),
+ reinterpret_cast<GeofenceInfo*>(gfInfos));
+ }
+}
+void LocationClientApi::removeGeofences(std::vector<Geofence>& geofences) {
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return;
+ }
+ size_t count = geofences.size();
+ if (count > 0) {
+ uint32_t* gfIds = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (int i=0; i<count; ++i) {
+ if (!geofences[i].mGeofenceImpl) {
+ LOC_LOGe ("Geofence not added yet");
+ free(gfIds);
+ return;
+ }
+ gfIds[i] = geofences[i].mGeofenceImpl->getClientId();
+ }
+ if (!mApiImpl->checkGeofenceMap(geofences.size(), gfIds)) {
+ LOC_LOGe ("Wrong geofence IDs");
+ free(gfIds);
+ return;
+ }
+ mApiImpl->removeGeofences(count, gfIds);
+ }
+}
+void LocationClientApi::modifyGeofences(std::vector<Geofence>& geofences) {
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return;
+ }
+ size_t count = geofences.size();
+ if (count > 0) {
+ GeofenceOption* gfOptions = (GeofenceOption*)malloc(sizeof(GeofenceOption) * count);
+ uint32_t* gfIds = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (int i=0; i<count; ++i) {
+ gfOptions[i].breachTypeMask = geofences[i].getBreachType();
+ gfOptions[i].responsiveness = geofences[i].getResponsiveness();
+ gfOptions[i].dwellTime = geofences[i].getDwellTime();
+ gfOptions[i].size = sizeof(gfOptions[i]);
+ if (!geofences[i].mGeofenceImpl) {
+ LOC_LOGe ("Geofence not added yet");
+ free(gfIds);
+ free(gfOptions);
+ return;
+ }
+ gfIds[i] = geofences[i].mGeofenceImpl->getClientId();
+ }
+ if (!mApiImpl->checkGeofenceMap(geofences.size(), gfIds)) {
+ LOC_LOGe ("Wrong geofence IDs");
+ free(gfIds);
+ free(gfOptions);
+ return;
+ }
+ mApiImpl->modifyGeofences(geofences.size(), const_cast<uint32_t*>(gfIds),
+ reinterpret_cast<GeofenceOption*>(gfOptions));
+ }
+}
+
+void LocationClientApi::pauseGeofences(std::vector<Geofence>& geofences) {
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return;
+ }
+ size_t count = geofences.size();
+ if (count > 0) {
+ uint32_t* gfIds = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (int i=0; i<count; ++i) {
+ if (!geofences[i].mGeofenceImpl) {
+ LOC_LOGe ("Geofence not added yet");
+ free(gfIds);
+ return;
+ }
+ gfIds[i] = geofences[i].mGeofenceImpl->getClientId();
+ }
+ if (!mApiImpl->checkGeofenceMap(geofences.size(), gfIds)) {
+ LOC_LOGe ("Wrong geofence IDs");
+ free(gfIds);
+ return;
+ }
+ mApiImpl->pauseGeofences(count, gfIds);
+ }
+}
+
+void LocationClientApi::resumeGeofences(std::vector<Geofence>& geofences) {
+ if (!mApiImpl) {
+ LOC_LOGe ("NULL mApiImpl");
+ return;
+ }
+ size_t count = geofences.size();
+ if (count > 0) {
+ uint32_t* gfIds = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ for (int i=0; i<count; ++i) {
+ if (!geofences[i].mGeofenceImpl) {
+ LOC_LOGe ("Geofence not added yet");
+ free(gfIds);
+ return;
+ }
+ gfIds[i] = geofences[i].mGeofenceImpl->getClientId();
+ }
+ if (!mApiImpl->checkGeofenceMap(geofences.size(), gfIds)) {
+ LOC_LOGe ("Wrong geofence IDs");
+ free(gfIds);
+ return;
+ }
+ mApiImpl->resumeGeofences(count, gfIds);
+ }
+}
+
+void LocationClientApi::updateNetworkAvailability(bool available) {
+ if (mApiImpl) {
+ mApiImpl->updateNetworkAvailability(available);
+ }
+}
+
+void LocationClientApi::getGnssEnergyConsumed(
+ GnssEnergyConsumedCb gnssEnergyConsumedCallback,
+ ResponseCb responseCallback) {
+
+ if (mApiImpl && gnssEnergyConsumedCallback) {
+ mApiImpl->getGnssEnergyConsumed(gnssEnergyConsumedCallback,
+ responseCallback);
+ } else {
+ if (responseCallback) {
+ responseCallback(LOCATION_RESPONSE_PARAM_INVALID);
+ }
+ }
+}
+
+void LocationClientApi::updateLocationSystemInfoListener(
+ LocationSystemInfoCb locSystemInfoCallback,
+ ResponseCb responseCallback) {
+
+ if (mApiImpl && locSystemInfoCallback) {
+ mApiImpl->updateLocationSystemInfoListener(
+ locSystemInfoCallback, responseCallback);
+ } else {
+ if (responseCallback) {
+ responseCallback(LOCATION_RESPONSE_PARAM_INVALID);
+ }
+ }
+}
+
+// ============ below Section implements toString() methods of data structs ==============
+static string maskToVals(uint64_t mask, int64_t baseNum) {
+ string out;
+ while (mask > 0) {
+ baseNum += log2(loc_get_least_bit(mask));
+ out += baseNum + " ";
+ }
+ return out;
+}
+
+// LocationCapabilitiesMask
+DECLARE_TBL(LocationCapabilitiesMask) = {
+ {LOCATION_CAPS_TIME_BASED_TRACKING_BIT, "TBT"},
+ {LOCATION_CAPS_TIME_BASED_BATCHING_BIT, "TBB"},
+ {LOCATION_CAPS_DISTANCE_BASED_TRACKING_BIT, "DBT"},
+ {LOCATION_CAPS_DISTANCE_BASED_BATCHING_BIT, "DBB"},
+ {LOCATION_CAPS_GEOFENCE_BIT, "GF"},
+ {LOCATION_CAPS_OUTDOOR_TRIP_BATCHING_BIT, "OTB"}
+};
+// GnssSvOptionsMask
+DECLARE_TBL(GnssSvOptionsMask) = {
+ {GNSS_SV_OPTIONS_HAS_EPHEMER_BIT, "EPH"},
+ {GNSS_SV_OPTIONS_HAS_ALMANAC_BIT, "ALM"},
+ {GNSS_SV_OPTIONS_USED_IN_FIX_BIT, "USED_IN_FIX"},
+ {GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT, "CARRIER_FREQ"},
+ {GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT, "SIG_TYPES"}
+};
+// LocationFlagsMask
+DECLARE_TBL(LocationFlagsMask) = {
+ {LOCATION_HAS_LAT_LONG_BIT, "LAT_LON"},
+ {LOCATION_HAS_ALTITUDE_BIT, "ALT"},
+ {LOCATION_HAS_SPEED_BIT, "SPEED"},
+ {LOCATION_HAS_BEARING_BIT, "FEARING"},
+ {LOCATION_HAS_ACCURACY_BIT, "ACCURACY"},
+ {LOCATION_HAS_VERTICAL_ACCURACY_BIT, "VERT_ACCURACY"},
+ {LOCATION_HAS_SPEED_ACCURACY_BIT, "SPEED_ACCURACY"},
+ {LOCATION_HAS_BEARING_ACCURACY_BIT, "BEARING_ACCURACY"},
+ {LOCATION_HAS_BEARING_ACCURACY_BIT, "TS"}
+};
+// LocationTechnologyMask
+DECLARE_TBL(LocationTechnologyMask) = {
+ {LOCATION_TECHNOLOGY_GNSS_BIT, "GNSS"},
+ {LOCATION_TECHNOLOGY_CELL_BIT, "CELL"},
+ {LOCATION_TECHNOLOGY_WIFI_BIT, "WIFI"},
+ {LOCATION_TECHNOLOGY_SENSORS_BIT, "SENSOR"}
+};
+// GnssLocationNavSolutionMask
+DECLARE_TBL(GnssLocationNavSolutionMask) = {
+ {LOCATION_SBAS_CORRECTION_IONO_BIT, "SBAS_CORR_IONO"},
+ {LOCATION_SBAS_CORRECTION_FAST_BIT, "SBAS_CORR_FAST"},
+ {LOCATION_SBAS_CORRECTION_LONG_BIT, "SBAS_CORR_LON"},
+ {LOCATION_SBAS_INTEGRITY_BIT, "SBAS_INTEGRITY"},
+ {LOCATION_NAV_CORRECTION_DGNSS_BIT, "NAV_CORR_DGNSS"},
+ {LOCATION_NAV_CORRECTION_RTK_BIT, "NAV_CORR_RTK"},
+ {LOCATION_NAV_CORRECTION_PPP_BIT, "NAV_CORR_PPP"}
+};
+// GnssLocationPosTechMask
+DECLARE_TBL(GnssLocationPosTechMask) = {
+ {LOCATION_POS_TECH_SATELLITE_BIT, "SATELLITE"},
+ {LOCATION_POS_TECH_CELLID_BIT, "CELLID"},
+ {LOCATION_POS_TECH_WIFI_BIT, "WIFI"},
+ {LOCATION_POS_TECH_SENSORS_BIT, "SENSORS"},
+ {LOCATION_POS_TECH_REFERENCE_LOCATION_BIT, "REF_LOC"},
+ {LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT, "CPI"},
+ {LOCATION_POS_TECH_AFLT_BIT, "AFLT"},
+ {LOCATION_POS_TECH_HYBRID_BIT, "HYBRID"},
+ {LOCATION_POS_TECH_PPE_BIT, "PPE"}
+};
+// GnssLocationPosDataMask
+DECLARE_TBL(GnssLocationPosDataMask) = {
+ {LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT, "LONG_ACCEL"},
+ {LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT, "LAT_ACCEL"},
+ {LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT, "VERT_ACCEL"},
+ {LOCATION_NAV_DATA_HAS_YAW_RATE_BIT, "YAW_RATE"},
+ {LOCATION_NAV_DATA_HAS_PITCH_BIT, "PITCH"},
+ {LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT, "LONG_ACCEL_UNC"},
+ {LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT, "LAT_ACCEL_UNC"},
+ {LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT, "VERT_ACCEL_UNC"},
+ {LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT, "YAW_RATE_UNC"},
+ {LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT, "PITCH_UNC"}
+};
+// GnssSignalTypeMask
+DECLARE_TBL(GnssSignalTypeMask) = {
+ {GNSS_SIGNAL_GPS_L1CA_BIT, "GPS_L1CA"},
+ {GNSS_SIGNAL_GPS_L1C_BIT, "GPS_L1C"},
+ {GNSS_SIGNAL_GPS_L2_BIT, "GPS_L2"},
+ {GNSS_SIGNAL_GPS_L5_BIT, "GPS_L5"},
+ {GNSS_SIGNAL_GLONASS_G1_BIT, "GLO_G1"},
+ {GNSS_SIGNAL_GLONASS_G2_BIT, "GLO_G2"},
+ {GNSS_SIGNAL_GALILEO_E1_BIT, "GAL_E1"},
+ {GNSS_SIGNAL_GALILEO_E5A_BIT, "GAL_E5A"},
+ {GNSS_SIGNAL_GALILEO_E5B_BIT, "GAL_E5B"},
+ {GNSS_SIGNAL_BEIDOU_B1_BIT, "BDS_B1"},
+ {GNSS_SIGNAL_BEIDOU_B2_BIT, "BDS_B2"},
+ {GNSS_SIGNAL_QZSS_L1CA_BIT, "QZSS_L1CA"},
+ {GNSS_SIGNAL_QZSS_L1S_BIT, "QZSS_L1S"},
+ {GNSS_SIGNAL_QZSS_L2_BIT, "QZSS_L2"},
+ {GNSS_SIGNAL_QZSS_L2_BIT, "QZSS_L5"},
+ {GNSS_SIGNAL_SBAS_L1_BIT, "SBAS_L1"},
+ {GNSS_SIGNAL_BEIDOU_B1I_BIT, "BDS_B1I"},
+ {GNSS_SIGNAL_BEIDOU_B1C_BIT, "BDS_B1C"},
+ {GNSS_SIGNAL_BEIDOU_B2I_BIT, "BDS_B2I"},
+ {GNSS_SIGNAL_BEIDOU_B2AI_BIT, "BDS_B2AI"},
+ {GNSS_SIGNAL_NAVIC_L5_BIT, "NAVIC_L5"},
+ {GNSS_SIGNAL_BEIDOU_B2AQ_BIT, "BDS_B2AQ"}
+};
+// GnssSignalTypes
+DECLARE_TBL(GnssSignalTypes) = {
+ {GNSS_SIGNAL_TYPE_GPS_L1CA, "GPS_L1CA"},
+ {GNSS_SIGNAL_TYPE_GPS_L1C, "GPS_L1C"},
+ {GNSS_SIGNAL_TYPE_GPS_L2C_L, "GPS_L2_L"},
+ {GNSS_SIGNAL_TYPE_GPS_L5_Q, "GPS_L5_Q"},
+ {GNSS_SIGNAL_TYPE_GLONASS_G1, "GLO_G1"},
+ {GNSS_SIGNAL_TYPE_GLONASS_G2, "GLO_G2"},
+ {GNSS_SIGNAL_TYPE_GALILEO_E1_C, "GAL_E1_C"},
+ {GNSS_SIGNAL_TYPE_GALILEO_E5A_Q, "GAL_E5A_Q"},
+ {GNSS_SIGNAL_TYPE_GALILEO_E5B_Q, "GAL_E5B_Q"},
+ {GNSS_SIGNAL_TYPE_BEIDOU_B1_I, "BDS_B1_I"},
+ {GNSS_SIGNAL_TYPE_BEIDOU_B1C, "BDS_B1C"},
+ {GNSS_SIGNAL_TYPE_BEIDOU_B1C, "BDS_B2I"},
+ {GNSS_SIGNAL_TYPE_BEIDOU_B2A_I, "BDS_B2AI"},
+ {GNSS_SIGNAL_TYPE_QZSS_L1CA, "QZSS_L1CA"},
+ {GNSS_SIGNAL_TYPE_QZSS_L1S, "QZSS_L1S"},
+ {GNSS_SIGNAL_TYPE_QZSS_L2C_L, "QZSS_L2C_L"},
+ {GNSS_SIGNAL_TYPE_QZSS_L5_Q, "QZSS_L5"},
+ {GNSS_SIGNAL_TYPE_SBAS_L1_CA, "SBAS_L1_CA"},
+ {GNSS_SIGNAL_TYPE_NAVIC_L5, "NAVIC_L5"},
+ {GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q, "BDS_B2AQ"}
+};
+// GnssSvType
+DECLARE_TBL(GnssSvType) = {
+ {GNSS_SV_TYPE_UNKNOWN, "UNKNOWN"},
+ {GNSS_SV_TYPE_GPS, "GPS"},
+ {GNSS_SV_TYPE_SBAS, "SBAS"},
+ {GNSS_SV_TYPE_GLONASS, "GLO"},
+ {GNSS_SV_TYPE_QZSS, "QZSS"},
+ {GNSS_SV_TYPE_BEIDOU, "BDS"},
+ {GNSS_SV_TYPE_GALILEO, "GAL"},
+ {GNSS_SV_TYPE_NAVIC, "NAVIC"}
+};
+// GnssLocationInfoFlagMask
+DECLARE_TBL(GnssLocationInfoFlagMask) = {
+ {GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT, "ALT_SEA_LEVEL"},
+ {GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT, "DOP"},
+ {GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT, "MAG_DEV"},
+ {GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT, "HOR_RELIAB"},
+ {GNSS_LOCATION_INFO_VER_RELIABILITY_BIT, "VER_RELIAB"},
+ {GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT, "HOR_ACCU_ELIP_SEMI_MAJOR"},
+ {GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT, "HOR_ACCU_ELIP_SEMI_MINOR"},
+ {GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT, "HOR_ACCU_ELIP_AZIMUTH"},
+ {GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT, "GNSS_SV_USED"},
+ {GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT, "NAV_SOLUTION"},
+ {GNSS_LOCATION_INFO_POS_TECH_MASK_BIT, "POS_TECH"},
+ {GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT, "SV_SOURCE"},
+ {GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT, "POS_DYNAMICS"},
+ {GNSS_LOCATION_INFO_EXT_DOP_BIT, "EXT_DOP"},
+ {GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT, "NORTH_STD_DEV"},
+ {GNSS_LOCATION_INFO_EAST_STD_DEV_BIT, "EAST_STD_DEV"},
+ {GNSS_LOCATION_INFO_EAST_STD_DEV_BIT, "NORTH_VEL"},
+ {GNSS_LOCATION_INFO_EAST_VEL_BIT, "EAST_VEL"},
+ {GNSS_LOCATION_INFO_UP_VEL_BIT, "UP_VEL"},
+ {GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT, "NORTH_VEL_UNC"},
+ {GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT, "EAST_VEL_UNC"},
+ {GNSS_LOCATION_INFO_UP_VEL_UNC_BIT, "UP_VEL_UNC"},
+ {GNSS_LOCATION_INFO_LEAP_SECONDS_BIT, "LEAP_SECONDS"},
+ {GNSS_LOCATION_INFO_TIME_UNC_BIT, "TIME_UNC"},
+ {GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT, "NUM_SV_USED_IN_FIX"},
+ {GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_PERCENT_BIT, "CAL_CONF_PRECENT"},
+ {GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT, "CAL_STATUS"},
+ {GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT, "OUTPUT_ENG_TYPE"},
+ {GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT, "OUTPUT_ENG_MASK"},
+ {GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT, "CONFORMITY_INDEX"}
+};
+// LocationReliability
+DECLARE_TBL(LocationReliability) = {
+ {LOCATION_RELIABILITY_NOT_SET, "NOT_SET"},
+ {LOCATION_RELIABILITY_VERY_LOW, "VERY_LOW"},
+ {LOCATION_RELIABILITY_LOW, "LOW"},
+ {LOCATION_RELIABILITY_MEDIUM, "MED"},
+ {LOCATION_RELIABILITY_HIGH, "HI"}
+};
+// Gnss_LocSvSystemEnumType
+static const GnssSvType convertSvSysToType(Gnss_LocSvSystemEnumType sys) {
+ switch (sys) {
+ case GNSS_LOC_SV_SYSTEM_GPS:
+ return GNSS_SV_TYPE_GPS;
+ case GNSS_LOC_SV_SYSTEM_GALILEO:
+ return GNSS_SV_TYPE_GALILEO;
+ case GNSS_LOC_SV_SYSTEM_SBAS:
+ return GNSS_SV_TYPE_SBAS;
+ case GNSS_LOC_SV_SYSTEM_GLONASS:
+ return GNSS_SV_TYPE_GLONASS;
+ case GNSS_LOC_SV_SYSTEM_BDS:
+ return GNSS_SV_TYPE_BEIDOU;
+ case GNSS_LOC_SV_SYSTEM_QZSS:
+ return GNSS_SV_TYPE_QZSS;
+ case GNSS_LOC_SV_SYSTEM_NAVIC:
+ return GNSS_SV_TYPE_NAVIC;
+ default:
+ return GNSS_SV_TYPE_UNKNOWN;
+ }
+};
+// GnssSystemTimeStructTypeFlags
+DECLARE_TBL(GnssSystemTimeStructTypeFlags) = {
+ {GNSS_SYSTEM_TIME_WEEK_VALID, "WEEK"},
+ {GNSS_SYSTEM_TIME_WEEK_MS_VALID, "WEEK_MS"},
+ {GNSS_SYSTEM_CLK_TIME_BIAS_VALID, "CLK_BIAS"},
+ {GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID, "CLK_BIAS_UNC"},
+ {GNSS_SYSTEM_REF_FCOUNT_VALID, "REF_COUNT"},
+ {GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID, "CLK_RESET"}
+};
+// GnssGloTimeStructTypeFlags
+DECLARE_TBL(GnssGloTimeStructTypeFlags) = {
+ {GNSS_CLO_DAYS_VALID, "DAYS"},
+ {GNSS_GLO_MSEC_VALID, "MS"},
+ {GNSS_GLO_CLK_TIME_BIAS_VALID, "CLK_BIAS"},
+ {GNSS_GLO_CLK_TIME_BIAS_UNC_VALID, "CLK_BIAS_UNC"},
+ {GNSS_GLO_REF_FCOUNT_VALID, "REF_COUNT"},
+ {GNSS_GLO_NUM_CLOCK_RESETS_VALID, "CLK_RESET"},
+ {GNSS_GLO_FOUR_YEAR_VALID, "YEAR"}
+};
+// DrCalibrationStatusMask
+DECLARE_TBL(DrCalibrationStatusMask) = {
+ {DR_ROLL_CALIBRATION_NEEDED, "ROLL"},
+ {DR_PITCH_CALIBRATION_NEEDED, "PITCH"},
+ {DR_YAW_CALIBRATION_NEEDED, "YAW"},
+ {DR_ODO_CALIBRATION_NEEDED, "ODO"},
+ {DR_GYRO_CALIBRATION_NEEDED, "GYRO"}
+};
+// LocReqEngineTypeMask
+DECLARE_TBL(LocReqEngineTypeMask) = {
+ {LOC_REQ_ENGINE_FUSED_BIT, "FUSED"},
+ {LOC_REQ_ENGINE_SPE_BIT, "SPE"},
+ {LOC_REQ_ENGINE_PPE_BIT, "PPE"}
+};
+// LocOutputEngineType
+DECLARE_TBL(LocOutputEngineType) = {
+ {LOC_OUTPUT_ENGINE_FUSED, "FUSED"},
+ {LOC_OUTPUT_ENGINE_SPE, "SPE"},
+ {LOC_OUTPUT_ENGINE_PPE, "PPE"},
+ {LOC_OUTPUT_ENGINE_COUNT, "COUNT"}
+};
+// PositioningEngineMask
+DECLARE_TBL(PositioningEngineMask) = {
+ {STANDARD_POSITIONING_ENGINE, "SPE"},
+ {DEAD_RECKONING_ENGINE, "DRE"},
+ {PRECISE_POSITIONING_ENGINE, "PPE"}
+};
+// GnssDataMask
+DECLARE_TBL(GnssDataMask) = {
+ {GNSS_DATA_JAMMER_IND_BIT, "JAMMER"},
+ {GNSS_DATA_AGC_BIT, "AGC"}
+};
+// GnssMeasurementsDataFlagsMask
+DECLARE_TBL(GnssMeasurementsDataFlagsMask) = {
+ {GNSS_MEASUREMENTS_DATA_SV_ID_BIT, "svId"},
+ {GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT, "svType"},
+ {GNSS_MEASUREMENTS_DATA_STATE_BIT, "stateMask"},
+ {GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT, "receivedSvTimeNs"},
+ {GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT, "receivedSvTimeUncertaintyNs"},
+ {GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT, "carrierToNoiseDbHz"},
+ {GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT, "pseudorangeRateMps"},
+ {GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT, "pseudorangeRateUncertaintyMps"},
+ {GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT, "adrStateMask"},
+ {GNSS_MEASUREMENTS_DATA_ADR_BIT, "adrMeters"},
+ {GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT, "adrUncertaintyMeters"},
+ {GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT, "carrierFrequencyHz"},
+ {GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT, "carrierCycles"},
+ {GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT, "carrierPhase"},
+ {GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT, "carrierPhaseUncertainty"},
+ {GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT, "multipathIndicator"},
+ {GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT, "signalToNoiseRatioDb"},
+ {GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT, "agcLevelDb"}
+};
+// GnssMeasurementsStateMask
+DECLARE_TBL(GnssMeasurementsStateMask) = {
+ {GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT, "CODE_LOCK"},
+ {GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT, "BIT_SYNC"},
+ {GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT, "SUBFRAME_SYNC"},
+ {GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT, "TOW_DECODED"},
+ {GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT, "MSEC_AMBIGUOUS"},
+ {GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT, "SYMBOL_SYNC"},
+ {GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT, "GLO_STRING_SYNC"},
+ {GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT, "GLO_TOD_DECODED"},
+ {GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT, "BDS_D2_BIT_SYNC"},
+ {GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT, "BDS_D2_SUBFRAME_SYNC"},
+ {GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT, "GAL_E1BC_CODE_LOCK"},
+ {GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT, "GAL_E1C_2ND_CODE_LOCK"},
+ {GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT, "GAL_E1B_PAGE_SYNC"},
+ {GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT, "SBAS_SYNC"}
+};
+// GnssMeasurementsAdrStateMask
+DECLARE_TBL(GnssMeasurementsAdrStateMask) = {
+ {GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT, "VALID"},
+ {GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT, "RESET"},
+ {GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT, "CYCLE_SLIP"}
+};
+// GnssMeasurementsMultipathIndicator
+DECLARE_TBL(GnssMeasurementsMultipathIndicator) = {
+ {GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN, "UNKNOWN"},
+ {GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT, "PRESENT"},
+ {GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT, "NOT_PRESENT"}
+};
+// GnssMeasurementsClockFlagsMask
+DECLARE_TBL(GnssMeasurementsClockFlagsMask) = {
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT, "LEAP_SECOND"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT, "TIME"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT, "TIME_UNC"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT, "FULL_BIAS"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT, "BIAS"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT, "BIAS_UNC"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT, "DRIFT"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT, "DRIFT_UNC"},
+ {GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT, "HW_CLK_DISCONTINUITY_CNT"}
+};
+// LeapSecondSysInfoMask
+DECLARE_TBL(LeapSecondSysInfoMask) = {
+ {LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT, "CUR_LEAP_SEC"},
+ {LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT, "LEAP_SEC_CHANGE"}
+};
+// LocationSystemInfoMask
+DECLARE_TBL(LocationSystemInfoMask) = {
+ {LOC_SYS_INFO_LEAP_SECOND, "LEAP_SEC"}
+};
+
+string GnssLocationSvUsedInPosition::toString() {
+ string out;
+ out.reserve(256);
+
+ // gpsSvUsedIdsMask
+ out += FIELDVAL_HEX(gpsSvUsedIdsMask);
+ out += loc_parenthesize(maskToVals(gpsSvUsedIdsMask, GPS_SV_PRN_MIN)) + "\n";
+
+ out += FIELDVAL_HEX(gloSvUsedIdsMask);
+ out += loc_parenthesize(maskToVals(gloSvUsedIdsMask, GLO_SV_PRN_MIN)) + "\n";
+
+ out += FIELDVAL_HEX(galSvUsedIdsMask);
+ out += loc_parenthesize(maskToVals(galSvUsedIdsMask, GAL_SV_PRN_MIN)) + "\n";
+
+ out += FIELDVAL_HEX(bdsSvUsedIdsMask);
+ out += loc_parenthesize(maskToVals(bdsSvUsedIdsMask, BDS_SV_PRN_MIN)) + "\n";
+
+ out += FIELDVAL_HEX(qzssSvUsedIdsMask);
+ out += loc_parenthesize(maskToVals(qzssSvUsedIdsMask, QZSS_SV_PRN_MIN)) + "\n";
+
+ out += FIELDVAL_HEX(navicSvUsedIdsMask);
+ out += loc_parenthesize(maskToVals(navicSvUsedIdsMask, NAVIC_SV_PRN_MIN)) + "\n";
+
+ return out;
+}
+
+string GnssMeasUsageInfo::toString() {
+ string out;
+ out.reserve(256);
+
+ auto tmp = gnssConstellation;
+ // temporarily change gnssConstellation's value to converted value so we could use FIELDVAL_ENUM
+ gnssConstellation = (decltype(gnssConstellation))convertSvSysToType(gnssConstellation);
+ out += FIELDVAL_ENUM(gnssConstellation, GnssSvType_tbl);
+ // now change gnssConstellation to its original value
+ gnssConstellation = tmp;
+ out += FIELDVAL_DEC(gnssSvId);
+ out += FIELDVAL_MASK(gnssSignalType, GnssSignalTypeMask_tbl);
+
+ return out;
+}
+
+string GnssLocationPositionDynamics::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(bodyFrameDataMask, GnssLocationPosDataMask_tbl);
+ out += FIELDVAL_DEC(longAccel);
+ out += FIELDVAL_DEC(latAccel);
+ out += FIELDVAL_DEC(vertAccel);
+ out += FIELDVAL_DEC(longAccelUnc);
+ out += FIELDVAL_DEC(latAccelUnc);
+ out += FIELDVAL_DEC(vertAccelUnc);
+ out += FIELDVAL_DEC(pitch);
+ out += FIELDVAL_DEC(pitchUnc);
+ out += FIELDVAL_DEC(pitchRate);
+ out += FIELDVAL_DEC(pitchRateUnc);
+ out += FIELDVAL_DEC(roll);
+ out += FIELDVAL_DEC(rollUnc);
+ out += FIELDVAL_DEC(rollRate);
+ out += FIELDVAL_DEC(rollRateUnc);
+ out += FIELDVAL_DEC(yaw);
+ out += FIELDVAL_DEC(yawUnc);
+ out += FIELDVAL_DEC(yawRate);
+ out += FIELDVAL_DEC(yawRateUnc);
+
+ return out;
+}
+
+string GnssSystemTimeStructType::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(validityMask, GnssSystemTimeStructTypeFlags_tbl);
+ out += FIELDVAL_DEC(systemWeek);
+ out += FIELDVAL_DEC(systemMsec);
+ out += FIELDVAL_DEC(systemClkTimeBias);
+ out += FIELDVAL_DEC(systemClkTimeUncMs);
+ out += FIELDVAL_DEC(refFCount);
+ out += FIELDVAL_DEC(numClockResets);
+
+ return out;
+}
+
+string GnssGloTimeStructType::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(validityMask, GnssGloTimeStructTypeFlags_tbl);
+ out += FIELDVAL_DEC(gloFourYear);
+ out += FIELDVAL_DEC(gloDays);
+ out += FIELDVAL_DEC(gloMsec);
+ out += FIELDVAL_DEC(gloClkTimeBias);
+ out += FIELDVAL_DEC(gloClkTimeUncMs);
+ out += FIELDVAL_DEC(refFCount);
+ out += FIELDVAL_DEC(numClockResets);
+
+ return out;
+}
+
+string GnssSystemTime::toString() {
+ switch (gnssSystemTimeSrc) {
+ case GNSS_LOC_SV_SYSTEM_GPS:
+ return u.gpsSystemTime.toString();
+ case GNSS_LOC_SV_SYSTEM_GALILEO:
+ return u.galSystemTime.toString();
+ case GNSS_LOC_SV_SYSTEM_GLONASS:
+ return u.gloSystemTime.toString();
+ case GNSS_LOC_SV_SYSTEM_BDS:
+ return u.bdsSystemTime.toString();
+ case GNSS_LOC_SV_SYSTEM_QZSS:
+ return u.qzssSystemTime.toString();
+ case GNSS_LOC_SV_SYSTEM_NAVIC:
+ return u.navicSystemTime.toString();
+ default:
+ return "Unknown System ID: " + gnssSystemTimeSrc;
+ }
+}
+
+string Location::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(flags, LocationFlagsMask_tbl);
+ out += FIELDVAL_DEC(timestamp);
+ out += FIELDVAL_DEC(latitude);
+ out += FIELDVAL_DEC(longitude);
+ out += FIELDVAL_DEC(altitude);
+ out += FIELDVAL_DEC(speed);
+ out += FIELDVAL_DEC(bearing);
+ out += FIELDVAL_DEC(horizontalAccuracy);
+ out += FIELDVAL_DEC(verticalAccuracy);
+ out += FIELDVAL_DEC(speedAccuracy);
+ out += FIELDVAL_DEC(bearingAccuracy);
+ out += FIELDVAL_MASK(techMask, LocationTechnologyMask_tbl);
+
+ return out;
+}
+
+string GnssLocation::toString() {
+ string out;
+ out.reserve(1024);
+
+ out += Location::toString();
+ out += FIELDVAL_MASK(gnssInfoFlags, GnssLocationInfoFlagMask_tbl);
+ out += FIELDVAL_DEC(altitudeMeanSeaLevel);
+ out += FIELDVAL_DEC(pdop);
+ out += FIELDVAL_DEC(hdop);
+ out += FIELDVAL_DEC(vdop);
+ out += FIELDVAL_DEC(gdop);
+ out += FIELDVAL_DEC(tdop);
+ out += FIELDVAL_DEC(magneticDeviation);
+ out += FIELDVAL_ENUM(horReliability, LocationReliability_tbl);
+ out += FIELDVAL_ENUM(verReliability, LocationReliability_tbl);
+ out += FIELDVAL_DEC(horUncEllipseSemiMajor);
+ out += FIELDVAL_DEC(horUncEllipseSemiMinor);
+ out += FIELDVAL_DEC(horUncEllipseOrientAzimuth);
+ out += FIELDVAL_DEC(northStdDeviation);
+ out += FIELDVAL_DEC(eastStdDeviation);
+ out += FIELDVAL_DEC(northVelocity);
+ out += FIELDVAL_DEC(eastVelocity);
+ out += FIELDVAL_DEC(upVelocity);
+ out += FIELDVAL_DEC(northVelocityStdDeviation);
+ out += FIELDVAL_DEC(eastVelocityStdDeviation);
+ out += FIELDVAL_DEC(upVelocityStdDeviation);
+ out += FIELDVAL_DEC(numSvUsedInPosition);
+ out += svUsedInPosition.toString();
+ out += FIELDVAL_MASK(navSolutionMask, GnssLocationNavSolutionMask_tbl);
+ out += FIELDVAL_MASK(posTechMask, GnssLocationPosTechMask_tbl);
+ out += bodyFrameData.toString();
+ out += gnssSystemTime.toString();
+
+ uint32_t ind = 0;
+ for (auto measUsage : measUsageInfo) {
+ out += "measUsageInfo[";
+ out += ind;
+ out += "]: ";
+ out += measUsage.toString();
+ ind++;
+ }
+
+ out += FIELDVAL_DEC(leapSeconds);
+ out += FIELDVAL_DEC(timeUncMs);
+ out += FIELDVAL_DEC(calibrationConfidencePercent);
+ out += FIELDVAL_MASK(calibrationStatus, DrCalibrationStatusMask_tbl);
+ out += FIELDVAL_ENUM(locOutputEngType, LocOutputEngineType_tbl);
+ out += FIELDVAL_MASK(locOutputEngMask, PositioningEngineMask_tbl);
+ out += FIELDVAL_DEC(conformityIndex);
+
+ return out;
+}
+
+string GnssSv::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_DEC(svId);
+ out += FIELDVAL_ENUM(type, GnssSvType_tbl);
+ out += FIELDVAL_DEC(cN0Dbhz);
+ out += FIELDVAL_DEC(elevation);
+ out += FIELDVAL_DEC(azimuth);
+ out += FIELDVAL_MASK(gnssSvOptionsMask, GnssSvOptionsMask_tbl);
+ out += FIELDVAL_DEC(carrierFrequencyHz);
+ out += FIELDVAL_MASK(gnssSignalTypeMask, GnssSignalTypeMask_tbl);
+
+ return out;
+}
+
+string GnssData::toString() {
+ string out;
+ out.reserve(4096);
+
+ for (int i = 0; i < GNSS_MAX_NUMBER_OF_SIGNAL_TYPES; i++) {
+ out += FIELDVAL_MASK(i, GnssSignalTypes_tbl);
+ out += FIELDVAL_MASK(gnssDataMask[i], GnssDataMask_tbl);
+ out += FIELDVAL_DEC(jammerInd[i]);
+ out += FIELDVAL_DEC(agc[i]);
+ }
+
+ return out;
+}
+
+string GnssMeasurementsData::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(flags, GnssMeasurementsDataFlagsMask_tbl);
+ out += FIELDVAL_DEC(svId);
+ out += FIELDVAL_ENUM(svType, GnssSvType_tbl);
+ out += FIELDVAL_DEC(timeOffsetNs);
+ out += FIELDVAL_MASK(stateMask, GnssMeasurementsStateMask_tbl);
+ out += FIELDVAL_DEC(receivedSvTimeNs);
+ out += FIELDVAL_DEC(receivedSvTimeUncertaintyNs);
+ out += FIELDVAL_DEC(carrierToNoiseDbHz);
+ out += FIELDVAL_DEC(pseudorangeRateMps);
+ out += FIELDVAL_DEC(pseudorangeRateUncertaintyMps);
+ out += FIELDVAL_MASK(adrStateMask, GnssMeasurementsAdrStateMask_tbl);
+ out += FIELDVAL_DEC(adrMeters);
+ out += FIELDVAL_DEC(adrUncertaintyMeters);
+ out += FIELDVAL_DEC(carrierFrequencyHz);
+ out += FIELDVAL_DEC(carrierCycles);
+ out += FIELDVAL_DEC(carrierPhase);
+ out += FIELDVAL_DEC(carrierPhaseUncertainty);
+ out += FIELDVAL_ENUM(multipathIndicator, GnssMeasurementsMultipathIndicator_tbl);
+ out += FIELDVAL_DEC(signalToNoiseRatioDb);
+ out += FIELDVAL_DEC(agcLevelDb);
+
+ return out;
+}
+
+string GnssMeasurementsClock::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(flags, GnssMeasurementsClockFlagsMask_tbl);
+ out += FIELDVAL_DEC(leapSecond);
+ out += FIELDVAL_DEC(timeNs);
+ out += FIELDVAL_DEC(timeUncertaintyNs);
+ out += FIELDVAL_DEC(fullBiasNs);
+ out += FIELDVAL_DEC(biasNs);
+ out += FIELDVAL_DEC(biasUncertaintyNs);
+ out += FIELDVAL_DEC(driftNsps);
+ out += FIELDVAL_DEC(driftUncertaintyNsps);
+ out += FIELDVAL_DEC(hwClockDiscontinuityCount);
+
+ return out;
+}
+
+string GnssMeasurements::toString() {
+ string out;
+ // (number of GnssMeasurementsData in the vector + GnssMeasurementsClock) * 256
+ out.reserve((measurements.size() + 1) << 8);
+
+ out += clock.toString();
+ for (auto meas : measurements) {
+ out += meas.toString();
+ }
+
+ return out;
+}
+
+string LeapSecondChangeInfo::toString() {
+ string out;
+ out.reserve(256);
+
+ out += gpsTimestampLsChange.toString();
+ out += FIELDVAL_DEC(leapSecondsBeforeChange);
+ out += FIELDVAL_DEC(leapSecondsAfterChange);
+
+ return out;
+}
+
+string LeapSecondSystemInfo::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(leapSecondInfoMask, LeapSecondSysInfoMask_tbl);
+ out += FIELDVAL_DEC(leapSecondCurrent);
+
+ return out;
+}
+
+string LocationSystemInfo::toString() {
+ string out;
+ out.reserve(256);
+
+ out += FIELDVAL_MASK(systemInfoMask, LocationSystemInfoMask_tbl);
+ out += leapSecondSysInfo.toString();
+
+ return out;
+}
+
+} // namespace location_client
diff --git a/location/client_api/src/LocationClientApiImpl.cpp b/location/client_api/src/LocationClientApiImpl.cpp
new file mode 100644
index 0000000..8f1e20e
--- /dev/null
+++ b/location/client_api/src/LocationClientApiImpl.cpp
@@ -0,0 +1,2386 @@
+/* Copyright (c) 2018-2020, 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.
+ */
+
+#define LOG_TAG "LocSvc_LocationClientApi"
+
+#include <loc_cfg.h>
+#include <LocationClientApiImpl.h>
+#include <log_util.h>
+#include <gps_extended_c.h>
+#include <unistd.h>
+#include <sstream>
+#include <dlfcn.h>
+#include <loc_misc_utils.h>
+
+#ifndef LOG_GNSS_CLIENT_API_LOCATION_REPORT_C
+#define LOG_GNSS_CLIENT_API_LOCATION_REPORT_C (0x1C8F)
+#endif
+#ifndef LOG_GNSS_CLIENT_API_SV_REPORT_C
+#define LOG_GNSS_CLIENT_API_SV_REPORT_C (0x1C90)
+#endif
+#ifndef LOG_GNSS_CLIENT_API_NMEA_REPORT_C
+#define LOG_GNSS_CLIENT_API_NMEA_REPORT_C (0x1CB2)
+#endif
+#ifndef LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C
+#define LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C (0x1CB7)
+#endif
+#ifndef LOG_GNSS_CLIENT_API_SV_POLY_REPORT_C
+#define LOG_GNSS_CLIENT_API_SV_POLY_REPORT_C (0x1CC7)
+#endif
+
+static uint32_t gDebug = 0;
+
+static const loc_param_s_type gConfigTable[] =
+{
+ {"DEBUG_LEVEL", &gDebug, NULL, 'n'}
+};
+
+
+namespace location_client {
+
+static uint32_t gfIdGenerator = LOCATION_CLIENT_SESSION_ID_INVALID;
+mutex GeofenceImpl::mGfMutex;
+uint32_t GeofenceImpl::nextId() {
+ lock_guard<mutex> lock(mGfMutex);
+ uint32_t id = ++gfIdGenerator;
+ if (0xFFFFFFFF == id) {
+ id = 0;
+ gfIdGenerator = 0;
+ }
+ return id;
+}
+
+/******************************************************************************
+Utilities
+******************************************************************************/
+static LocationCapabilitiesMask parseCapabilitiesMask(::LocationCapabilitiesMask mask) {
+ uint64_t capsMask = 0;
+
+ LOC_LOGd ("LocationCapabilitiesMask =0x%x ", mask);
+
+ if (::LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT & mask) {
+ capsMask |= LOCATION_CAPS_TIME_BASED_TRACKING_BIT;
+ }
+ if (::LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT & mask) {
+ capsMask |= LOCATION_CAPS_TIME_BASED_BATCHING_BIT;
+ }
+ if (::LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT & mask) {
+ capsMask |= LOCATION_CAPS_DISTANCE_BASED_TRACKING_BIT;
+ }
+ if (::LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT & mask) {
+ capsMask |= LOCATION_CAPS_DISTANCE_BASED_BATCHING_BIT;
+ }
+ if (::LOCATION_CAPABILITIES_GEOFENCE_BIT & mask) {
+ capsMask |= LOCATION_CAPS_GEOFENCE_BIT;
+ }
+ if (::LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT & mask) {
+ capsMask |= LOCATION_CAPS_OUTDOOR_TRIP_BATCHING_BIT;
+ }
+
+ return static_cast<LocationCapabilitiesMask>(capsMask);
+}
+
+static Location parseLocation(const ::Location &halLocation) {
+ Location location;
+ uint32_t flags = 0;
+
+ location.timestamp = halLocation.timestamp;
+ location.latitude = halLocation.latitude;
+ location.longitude = halLocation.longitude;
+ location.altitude = halLocation.altitude;
+ location.speed = halLocation.speed;
+ location.bearing = halLocation.bearing;
+ location.horizontalAccuracy = halLocation.accuracy;
+ location.verticalAccuracy = halLocation.verticalAccuracy;
+ location.speedAccuracy = halLocation.speedAccuracy;
+ location.bearingAccuracy = halLocation.bearingAccuracy;
+
+ if (0 != halLocation.timestamp) {
+ flags |= LOCATION_HAS_TIMESTAMP_BIT;
+ }
+ if (::LOCATION_HAS_LAT_LONG_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_LAT_LONG_BIT;
+ }
+ if (::LOCATION_HAS_ALTITUDE_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_ALTITUDE_BIT;
+ }
+ if (::LOCATION_HAS_SPEED_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_SPEED_BIT;
+ }
+ if (::LOCATION_HAS_BEARING_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_BEARING_BIT;
+ }
+ if (::LOCATION_HAS_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_ACCURACY_BIT;
+ }
+ if (::LOCATION_HAS_VERTICAL_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ }
+ if (::LOCATION_HAS_SPEED_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ }
+ if (::LOCATION_HAS_BEARING_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ }
+ location.flags = (LocationFlagsMask)flags;
+
+ flags = 0;
+ if (::LOCATION_TECHNOLOGY_GNSS_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_GNSS_BIT;
+ }
+ if (::LOCATION_TECHNOLOGY_CELL_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_CELL_BIT;
+ }
+ if (::LOCATION_TECHNOLOGY_WIFI_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_WIFI_BIT;
+ }
+ if (::LOCATION_TECHNOLOGY_SENSORS_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_SENSORS_BIT;
+ }
+ location.techMask = (LocationTechnologyMask)flags;
+
+ return location;
+}
+
+static GnssLocationSvUsedInPosition parseLocationSvUsedInPosition(
+ const ::GnssLocationSvUsedInPosition &halSv) {
+
+ GnssLocationSvUsedInPosition clientSv;
+ clientSv.gpsSvUsedIdsMask = halSv.gpsSvUsedIdsMask;
+ clientSv.gloSvUsedIdsMask = halSv.gloSvUsedIdsMask;
+ clientSv.galSvUsedIdsMask = halSv.galSvUsedIdsMask;
+ clientSv.bdsSvUsedIdsMask = halSv.bdsSvUsedIdsMask;
+ clientSv.qzssSvUsedIdsMask = halSv.qzssSvUsedIdsMask;
+ clientSv.navicSvUsedIdsMask = halSv.navicSvUsedIdsMask;
+
+ return clientSv;
+}
+
+static GnssSignalTypeMask parseGnssSignalType(const ::GnssSignalTypeMask &halGnssSignalTypeMask) {
+ uint32_t gnssSignalTypeMask = 0;
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GPS_L1CA) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GPS_L1CA_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GPS_L1C) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GPS_L1C_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GPS_L2) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GPS_L2_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GPS_L5) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GPS_L5_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GLONASS_G1) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GLONASS_G1_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GLONASS_G2) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GLONASS_G2_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GALILEO_E1) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GALILEO_E1_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GALILEO_E5A) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GALILEO_E5A_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_GALILEO_E5B) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_GALILEO_E5B_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_BEIDOU_B1I) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_BEIDOU_B1I_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_BEIDOU_B1C) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_BEIDOU_B1C_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_BEIDOU_B2I) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_BEIDOU_B2I_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_BEIDOU_B2AI) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_BEIDOU_B2AI_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_QZSS_L1CA) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_QZSS_L1CA_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_QZSS_L1S) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_QZSS_L1S_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_QZSS_L2) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_QZSS_L2_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_QZSS_L5) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_QZSS_L5_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_SBAS_L1) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_SBAS_L1_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_NAVIC_L5) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_NAVIC_L5_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_BEIDOU_B2AQ) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_BEIDOU_B2AQ_BIT;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_BEIDOU_B1) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_BEIDOU_B1;
+ }
+ if (halGnssSignalTypeMask & ::GNSS_SIGNAL_BEIDOU_B2) {
+ gnssSignalTypeMask |= GNSS_SIGNAL_BEIDOU_B2;
+ }
+ return (GnssSignalTypeMask)gnssSignalTypeMask;
+}
+
+static void parseGnssMeasUsageInfo(const ::GnssLocationInfoNotification &halLocationInfo,
+ std::vector<GnssMeasUsageInfo>& clientMeasUsageInfo) {
+
+ if (halLocationInfo.numOfMeasReceived) {
+
+ for (int idx = 0; idx < halLocationInfo.numOfMeasReceived; idx++) {
+ GnssMeasUsageInfo measUsageInfo;
+
+ measUsageInfo.gnssSignalType = parseGnssSignalType(
+ halLocationInfo.measUsageInfo[idx].gnssSignalType);
+ measUsageInfo.gnssConstellation = (Gnss_LocSvSystemEnumType)
+ halLocationInfo.measUsageInfo[idx].gnssConstellation;
+ measUsageInfo.gnssSvId = halLocationInfo.measUsageInfo[idx].gnssSvId;
+ clientMeasUsageInfo.push_back(measUsageInfo);
+ }
+ }
+}
+
+static GnssLocationPositionDynamics parseLocationPositionDynamics(
+ const ::GnssLocationPositionDynamics &halPositionDynamics) {
+ GnssLocationPositionDynamics positionDynamics = {};
+ uint32_t bodyFrameDataMask = 0;
+
+ if (::LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT;
+ positionDynamics.longAccel = halPositionDynamics.longAccel;
+ }
+ if (::LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT;
+ positionDynamics.latAccel = halPositionDynamics.latAccel;
+ }
+ if (::LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT;
+ positionDynamics.vertAccel = halPositionDynamics.vertAccel;
+ }
+ if (::LOCATION_NAV_DATA_HAS_YAW_RATE_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_YAW_RATE_BIT;
+ positionDynamics.yawRate = halPositionDynamics.yawRate;
+ }
+ if (::LOCATION_NAV_DATA_HAS_PITCH_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_PITCH_BIT;
+ positionDynamics.pitch = halPositionDynamics.pitch;
+ }
+
+ if (::LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT;
+ positionDynamics.longAccelUnc = halPositionDynamics.longAccelUnc;
+ }
+ if (::LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT;
+ positionDynamics.latAccelUnc = halPositionDynamics.latAccelUnc;
+ }
+ if (::LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT;
+ positionDynamics.vertAccelUnc = halPositionDynamics.vertAccelUnc;
+ }
+ if (::LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT;
+ positionDynamics.yawRateUnc = halPositionDynamics.yawRateUnc;
+ }
+ if (::LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT & halPositionDynamics.bodyFrameDataMask) {
+ bodyFrameDataMask |= LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT;
+ positionDynamics.pitchUnc = halPositionDynamics.pitchUnc;
+ }
+
+ positionDynamics.bodyFrameDataMask = (GnssLocationPosDataMask)bodyFrameDataMask;
+
+ return positionDynamics;
+}
+
+static LocationReliability parseLocationReliability(const ::LocationReliability &halReliability) {
+
+ LocationReliability reliability;
+ switch (halReliability) {
+ case ::LOCATION_RELIABILITY_VERY_LOW:
+ reliability = LOCATION_RELIABILITY_VERY_LOW;
+ break;
+
+ case ::LOCATION_RELIABILITY_LOW:
+ reliability = LOCATION_RELIABILITY_LOW;
+ break;
+
+ case ::LOCATION_RELIABILITY_MEDIUM:
+ reliability = LOCATION_RELIABILITY_MEDIUM;
+ break;
+
+ case ::LOCATION_RELIABILITY_HIGH:
+ reliability = LOCATION_RELIABILITY_HIGH;
+ break;
+
+ default:
+ reliability = LOCATION_RELIABILITY_NOT_SET;
+ break;
+ }
+
+ return reliability;
+}
+
+static GnssSystemTimeStructType parseGnssTime(const ::GnssSystemTimeStructType &halGnssTime) {
+
+ GnssSystemTimeStructType gnssTime;
+ memset(&gnssTime, 0, sizeof(gnssTime));
+ uint32_t gnssTimeFlags = 0;
+
+ if (::GNSS_SYSTEM_TIME_WEEK_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_TIME_WEEK_VALID;
+ gnssTime.systemWeek = halGnssTime.systemWeek;
+ }
+ if (::GNSS_SYSTEM_TIME_WEEK_MS_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_TIME_WEEK_MS_VALID;
+ gnssTime.systemMsec = halGnssTime.systemMsec;
+ }
+ if (::GNSS_SYSTEM_CLK_TIME_BIAS_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_CLK_TIME_BIAS_VALID;
+ gnssTime.systemClkTimeBias = halGnssTime.systemClkTimeBias;
+ }
+ if (::GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID;
+ gnssTime.systemClkTimeUncMs = halGnssTime.systemClkTimeUncMs;
+ }
+ if (::GNSS_SYSTEM_REF_FCOUNT_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_REF_FCOUNT_VALID;
+ gnssTime.refFCount = halGnssTime.refFCount;
+ }
+ if (::GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID;
+ gnssTime.numClockResets = halGnssTime.numClockResets;
+ }
+
+ gnssTime.validityMask = (GnssSystemTimeStructTypeFlags)gnssTimeFlags;
+
+ return gnssTime;
+}
+
+static GnssGloTimeStructType parseGloTime(const ::GnssGloTimeStructType &halGloTime) {
+
+ GnssGloTimeStructType gloTime;
+ memset(&gloTime, 0, sizeof(gloTime));
+ uint32_t gloTimeFlags = 0;
+
+ if (::GNSS_CLO_DAYS_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_CLO_DAYS_VALID;
+ gloTime.gloDays = halGloTime.gloDays;
+ }
+ if (::GNSS_GLO_MSEC_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_MSEC_VALID ;
+ gloTime.gloMsec = halGloTime.gloMsec;
+ }
+ if (::GNSS_GLO_CLK_TIME_BIAS_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_CLK_TIME_BIAS_VALID;
+ gloTime.gloClkTimeBias = halGloTime.gloClkTimeBias;
+ }
+ if (::GNSS_GLO_CLK_TIME_BIAS_UNC_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_CLK_TIME_BIAS_UNC_VALID;
+ gloTime.gloClkTimeUncMs = halGloTime.gloClkTimeUncMs;
+ }
+ if (::GNSS_GLO_REF_FCOUNT_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_REF_FCOUNT_VALID;
+ gloTime.refFCount = halGloTime.refFCount;
+ }
+ if (::GNSS_GLO_NUM_CLOCK_RESETS_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_NUM_CLOCK_RESETS_VALID;
+ gloTime.numClockResets = halGloTime.numClockResets;
+ }
+ if (::GNSS_GLO_FOUR_YEAR_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_FOUR_YEAR_VALID;
+ gloTime.gloFourYear = halGloTime.gloFourYear;
+ }
+
+ gloTime.validityMask = (GnssGloTimeStructTypeFlags)gloTimeFlags;
+
+ return gloTime;
+}
+
+static GnssSystemTime parseSystemTime(const ::GnssSystemTime &halSystemTime) {
+
+ GnssSystemTime systemTime;
+ memset(&systemTime, 0x0, sizeof(GnssSystemTime));
+
+ switch (halSystemTime.gnssSystemTimeSrc) {
+ case ::GNSS_LOC_SV_SYSTEM_GPS:
+ systemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_GPS;
+ systemTime.u.gpsSystemTime = parseGnssTime(halSystemTime.u.gpsSystemTime);
+ break;
+ case ::GNSS_LOC_SV_SYSTEM_GALILEO:
+ systemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_GALILEO;
+ systemTime.u.galSystemTime = parseGnssTime(halSystemTime.u.galSystemTime);
+ break;
+ case ::GNSS_LOC_SV_SYSTEM_SBAS:
+ systemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_SBAS;
+ break;
+ case ::GNSS_LOC_SV_SYSTEM_GLONASS:
+ systemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_GLONASS;
+ systemTime.u.gloSystemTime = parseGloTime(halSystemTime.u.gloSystemTime);
+ break;
+ case ::GNSS_LOC_SV_SYSTEM_BDS:
+ systemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_BDS;
+ systemTime.u.bdsSystemTime = parseGnssTime(halSystemTime.u.bdsSystemTime);
+ break;
+ case ::GNSS_LOC_SV_SYSTEM_QZSS:
+ systemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_QZSS;
+ systemTime.u.qzssSystemTime = parseGnssTime(halSystemTime.u.qzssSystemTime);
+ break;
+ case GNSS_LOC_SV_SYSTEM_NAVIC:
+ systemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_NAVIC;
+ systemTime.u.navicSystemTime = parseGnssTime(halSystemTime.u.navicSystemTime);
+ break;
+ }
+
+ return systemTime;
+}
+
+static GnssLocation parseLocationInfo(const ::GnssLocationInfoNotification &halLocationInfo) {
+
+ GnssLocation locationInfo;
+ ::Location halLocation = halLocationInfo.location;
+ uint32_t flags = 0;
+
+ locationInfo.timestamp = halLocation.timestamp;
+ locationInfo.latitude = halLocation.latitude;
+ locationInfo.longitude = halLocation.longitude;
+ locationInfo.altitude = halLocation.altitude;
+ locationInfo.speed = halLocation.speed;
+ locationInfo.bearing = halLocation.bearing;
+ locationInfo.horizontalAccuracy = halLocation.accuracy;
+ locationInfo.verticalAccuracy = halLocation.verticalAccuracy;
+ locationInfo.speedAccuracy = halLocation.speedAccuracy;
+ locationInfo.bearingAccuracy = halLocation.bearingAccuracy;
+
+ if (0 != halLocation.timestamp) {
+ flags |= LOCATION_HAS_TIMESTAMP_BIT;
+ }
+ if (::LOCATION_HAS_LAT_LONG_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_LAT_LONG_BIT;
+ }
+ if (::LOCATION_HAS_ALTITUDE_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_ALTITUDE_BIT;
+ }
+ if (::LOCATION_HAS_SPEED_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_SPEED_BIT;
+ }
+ if (::LOCATION_HAS_BEARING_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_BEARING_BIT;
+ }
+ if (::LOCATION_HAS_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_ACCURACY_BIT;
+ }
+ if (::LOCATION_HAS_VERTICAL_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ }
+ if (::LOCATION_HAS_SPEED_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ }
+ if (::LOCATION_HAS_BEARING_ACCURACY_BIT & halLocation.flags) {
+ flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ }
+ locationInfo.flags = (LocationFlagsMask)flags;
+
+ flags = 0;
+ if (::LOCATION_TECHNOLOGY_GNSS_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_GNSS_BIT;
+ }
+ if (::LOCATION_TECHNOLOGY_CELL_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_CELL_BIT;
+ }
+ if (::LOCATION_TECHNOLOGY_WIFI_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_WIFI_BIT;
+ }
+ if (::LOCATION_TECHNOLOGY_SENSORS_BIT & halLocation.techMask) {
+ flags |= LOCATION_TECHNOLOGY_SENSORS_BIT;
+ }
+ locationInfo.techMask = (LocationTechnologyMask)flags;
+
+ flags = 0;
+ if (::GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_DOP_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_DOP_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_VER_RELIABILITY_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_VER_RELIABILITY_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_POS_TECH_MASK_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_POS_TECH_MASK_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_EXT_DOP_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_EXT_DOP_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_EAST_STD_DEV_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_EAST_STD_DEV_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_NORTH_VEL_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_NORTH_VEL_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_EAST_VEL_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_EAST_VEL_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_UP_VEL_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_UP_VEL_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_UP_VEL_UNC_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_UP_VEL_UNC_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_LEAP_SECONDS_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_LEAP_SECONDS_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_TIME_UNC_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_TIME_UNC_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_PERCENT_BIT;
+ locationInfo.calibrationConfidencePercent = halLocationInfo.calibrationConfidence;
+ }
+ if (::GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT;
+ locationInfo.calibrationStatus =
+ (DrCalibrationStatusMask)halLocationInfo.calibrationStatus;
+ }
+ if (::GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT;
+ }
+ if (::GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT;
+ }
+
+ if (::GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT & halLocationInfo.flags) {
+ flags |= GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT;
+ }
+
+ locationInfo.gnssInfoFlags = (GnssLocationInfoFlagMask)flags;
+ locationInfo.altitudeMeanSeaLevel = halLocationInfo.altitudeMeanSeaLevel;
+ locationInfo.pdop = halLocationInfo.pdop;
+ locationInfo.hdop = halLocationInfo.hdop;
+ locationInfo.vdop = halLocationInfo.vdop;
+ locationInfo.gdop = halLocationInfo.gdop;
+ locationInfo.tdop = halLocationInfo.tdop;
+ locationInfo.magneticDeviation = halLocationInfo.magneticDeviation;
+ locationInfo.horReliability = parseLocationReliability(halLocationInfo.horReliability);
+ locationInfo.verReliability = parseLocationReliability(halLocationInfo.verReliability);
+ locationInfo.horUncEllipseSemiMajor = halLocationInfo.horUncEllipseSemiMajor;
+ locationInfo.horUncEllipseSemiMinor = halLocationInfo.horUncEllipseSemiMinor;
+ locationInfo.horUncEllipseOrientAzimuth = halLocationInfo.horUncEllipseOrientAzimuth;
+ locationInfo.northStdDeviation = halLocationInfo.northStdDeviation;
+ locationInfo.eastStdDeviation = halLocationInfo.eastStdDeviation;
+ locationInfo.northVelocity = halLocationInfo.northVelocity;
+ locationInfo.eastVelocity = halLocationInfo.eastVelocity;
+ locationInfo.upVelocity = halLocationInfo.upVelocity;
+ locationInfo.northVelocityStdDeviation = halLocationInfo.northVelocityStdDeviation;
+ locationInfo.eastVelocityStdDeviation = halLocationInfo.eastVelocityStdDeviation;
+ locationInfo.upVelocityStdDeviation = halLocationInfo.upVelocityStdDeviation;
+ locationInfo.numSvUsedInPosition = halLocationInfo.numSvUsedInPosition;
+ locationInfo.svUsedInPosition =
+ parseLocationSvUsedInPosition(halLocationInfo.svUsedInPosition);
+ locationInfo.locOutputEngType =
+ (LocOutputEngineType)halLocationInfo.locOutputEngType;
+ locationInfo.locOutputEngMask =
+ (PositioningEngineMask)halLocationInfo.locOutputEngMask;
+ locationInfo.conformityIndex = halLocationInfo.conformityIndex;
+
+ parseGnssMeasUsageInfo(halLocationInfo, locationInfo.measUsageInfo);
+
+ flags = 0;
+ if (::LOCATION_SBAS_CORRECTION_IONO_BIT & halLocationInfo.navSolutionMask) {
+ flags |= LOCATION_SBAS_CORRECTION_IONO_BIT;
+ }
+ if (::LOCATION_SBAS_CORRECTION_FAST_BIT & halLocationInfo.navSolutionMask) {
+ flags |= LOCATION_SBAS_CORRECTION_FAST_BIT;
+ }
+ if (::LOCATION_SBAS_CORRECTION_LONG_BIT & halLocationInfo.navSolutionMask) {
+ flags |= LOCATION_SBAS_CORRECTION_LONG_BIT;
+ }
+ if (::LOCATION_SBAS_INTEGRITY_BIT & halLocationInfo.navSolutionMask) {
+ flags |= LOCATION_SBAS_INTEGRITY_BIT;
+ }
+ if (::LOCATION_NAV_CORRECTION_DGNSS_BIT & halLocationInfo.navSolutionMask) {
+ flags |= LOCATION_NAV_CORRECTION_DGNSS_BIT;
+ }
+ if (::LOCATION_NAV_CORRECTION_RTK_BIT & halLocationInfo.navSolutionMask) {
+ flags |= LOCATION_NAV_CORRECTION_RTK_BIT;
+ }
+ if (::LOCATION_NAV_CORRECTION_PPP_BIT & halLocationInfo.navSolutionMask) {
+ flags |= LOCATION_NAV_CORRECTION_PPP_BIT;
+ }
+ locationInfo.navSolutionMask = (GnssLocationNavSolutionMask)flags;
+
+ flags = 0;
+ if (::LOCATION_POS_TECH_DEFAULT_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_DEFAULT_BIT;
+ }
+ if (::LOCATION_POS_TECH_SATELLITE_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_SATELLITE_BIT;
+ }
+ if (::LOCATION_POS_TECH_CELLID_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_CELLID_BIT;
+ }
+ if (::LOCATION_POS_TECH_WIFI_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_WIFI_BIT;
+ }
+ if (::LOCATION_POS_TECH_SENSORS_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_SENSORS_BIT;
+ }
+ if (::LOCATION_POS_TECH_REFERENCE_LOCATION_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_REFERENCE_LOCATION_BIT;
+ }
+ if (::LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT;
+ }
+ if (::LOCATION_POS_TECH_AFLT_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_AFLT_BIT;
+ }
+ if (::LOCATION_POS_TECH_HYBRID_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_HYBRID_BIT;
+ }
+ if (::LOCATION_POS_TECH_PPE_BIT & halLocationInfo.posTechMask) {
+ flags |= LOCATION_POS_TECH_PPE_BIT;
+ }
+ locationInfo.posTechMask = (GnssLocationPosTechMask)flags;
+ locationInfo.bodyFrameData = parseLocationPositionDynamics(halLocationInfo.bodyFrameData);
+ locationInfo.gnssSystemTime = parseSystemTime(halLocationInfo.gnssSystemTime);
+ locationInfo.leapSeconds = halLocationInfo.leapSeconds;
+ locationInfo.timeUncMs = halLocationInfo.timeUncMs;
+
+ return locationInfo;
+}
+
+static GnssSv parseGnssSv(const ::GnssSv &halGnssSv) {
+ GnssSv gnssSv;
+
+ gnssSv.svId = halGnssSv.svId;
+ switch (halGnssSv.type) {
+ case ::GNSS_SV_TYPE_GPS:
+ gnssSv.type = GNSS_SV_TYPE_GPS;
+ break;
+
+ case ::GNSS_SV_TYPE_SBAS:
+ gnssSv.type = GNSS_SV_TYPE_SBAS;
+ break;
+
+ case ::GNSS_SV_TYPE_GLONASS:
+ gnssSv.type = GNSS_SV_TYPE_GLONASS;
+ break;
+
+ case ::GNSS_SV_TYPE_QZSS:
+ gnssSv.type = GNSS_SV_TYPE_QZSS;
+ break;
+
+ case ::GNSS_SV_TYPE_BEIDOU:
+ gnssSv.type = GNSS_SV_TYPE_BEIDOU;
+ break;
+
+ case ::GNSS_SV_TYPE_GALILEO:
+ gnssSv.type = GNSS_SV_TYPE_GALILEO;
+ break;
+
+ case ::GNSS_SV_TYPE_NAVIC:
+ gnssSv.type = GNSS_SV_TYPE_NAVIC;
+ break;
+
+ default:
+ gnssSv.type = GNSS_SV_TYPE_UNKNOWN;
+ break;
+ }
+ gnssSv.cN0Dbhz = halGnssSv.cN0Dbhz;
+ gnssSv.elevation = halGnssSv.elevation;
+ gnssSv.azimuth = halGnssSv.azimuth;
+
+ uint32_t gnssSvOptionsMask = 0;
+ if (::GNSS_SV_OPTIONS_HAS_EPHEMER_BIT & halGnssSv.gnssSvOptionsMask) {
+ gnssSvOptionsMask |= GNSS_SV_OPTIONS_HAS_EPHEMER_BIT;
+ }
+ if (::GNSS_SV_OPTIONS_HAS_ALMANAC_BIT & halGnssSv.gnssSvOptionsMask) {
+ gnssSvOptionsMask |= GNSS_SV_OPTIONS_HAS_ALMANAC_BIT;
+ }
+ if (::GNSS_SV_OPTIONS_USED_IN_FIX_BIT & halGnssSv.gnssSvOptionsMask) {
+ gnssSvOptionsMask |= GNSS_SV_OPTIONS_USED_IN_FIX_BIT;
+ }
+ if (::GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT & halGnssSv.gnssSvOptionsMask) {
+ gnssSvOptionsMask |= GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT;
+ }
+ if (::GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT & halGnssSv.gnssSvOptionsMask) {
+ gnssSvOptionsMask |= GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT;
+ }
+ gnssSv.gnssSvOptionsMask = (GnssSvOptionsMask)gnssSvOptionsMask;
+
+ gnssSv.carrierFrequencyHz = halGnssSv.carrierFrequencyHz;
+ gnssSv.gnssSignalTypeMask = parseGnssSignalType(halGnssSv.gnssSignalTypeMask);
+ return gnssSv;
+}
+
+static GnssData parseGnssData(const ::GnssDataNotification &halGnssData) {
+
+ GnssData gnssData;
+
+ for (int sig = GNSS_LOC_SIGNAL_TYPE_GPS_L1CA;
+ sig < GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES; sig++) {
+ gnssData.gnssDataMask[sig] =
+ (location_client::GnssDataMask) halGnssData.gnssDataMask[sig];
+ gnssData.jammerInd[sig] = halGnssData.jammerInd[sig];
+ gnssData.agc[sig] = halGnssData.agc[sig];
+ if (0 != gnssData.gnssDataMask[sig]) {
+ LOC_LOGv("gnssDataMask[%d]=0x%X", sig, gnssData.gnssDataMask[sig]);
+ LOC_LOGv("jammerInd[%d]=%f", sig, gnssData.jammerInd[sig]);
+ LOC_LOGv("agc[%d]=%f", sig, gnssData.agc[sig]);
+ }
+ }
+ return gnssData;
+}
+
+static GnssMeasurements parseGnssMeasurements(const ::GnssMeasurementsNotification
+ &halGnssMeasurements) {
+ GnssMeasurements gnssMeasurements = {};
+
+ for (int meas = 0; meas < halGnssMeasurements.count; meas++) {
+ GnssMeasurementsData measurement;
+
+ measurement.flags = (GnssMeasurementsDataFlagsMask)
+ halGnssMeasurements.measurements[meas].flags;
+ measurement.svId = halGnssMeasurements.measurements[meas].svId;
+ measurement.svType =
+ (location_client::GnssSvType)halGnssMeasurements.measurements[meas].svType;
+ measurement.timeOffsetNs = halGnssMeasurements.measurements[meas].timeOffsetNs;
+ measurement.stateMask = (GnssMeasurementsStateMask)
+ halGnssMeasurements.measurements[meas].stateMask;
+ measurement.receivedSvTimeNs = halGnssMeasurements.measurements[meas].receivedSvTimeNs;
+ measurement.receivedSvTimeUncertaintyNs =
+ halGnssMeasurements.measurements[meas].receivedSvTimeUncertaintyNs;
+ measurement.carrierToNoiseDbHz =
+ halGnssMeasurements.measurements[meas].carrierToNoiseDbHz;
+ measurement.pseudorangeRateMps =
+ halGnssMeasurements.measurements[meas].pseudorangeRateMps;
+ measurement.pseudorangeRateUncertaintyMps =
+ halGnssMeasurements.measurements[meas].pseudorangeRateUncertaintyMps;
+ measurement.adrStateMask = (GnssMeasurementsAdrStateMask)
+ halGnssMeasurements.measurements[meas].adrStateMask;
+ measurement.adrMeters = halGnssMeasurements.measurements[meas].adrMeters;
+ measurement.adrUncertaintyMeters =
+ halGnssMeasurements.measurements[meas].adrUncertaintyMeters;
+ measurement.carrierFrequencyHz =
+ halGnssMeasurements.measurements[meas].carrierFrequencyHz;
+ measurement.carrierCycles = halGnssMeasurements.measurements[meas].carrierCycles;
+ measurement.carrierPhase = halGnssMeasurements.measurements[meas].carrierPhase;
+ measurement.carrierPhaseUncertainty =
+ halGnssMeasurements.measurements[meas].carrierPhaseUncertainty;
+ measurement.multipathIndicator = (location_client::GnssMeasurementsMultipathIndicator)
+ halGnssMeasurements.measurements[meas].multipathIndicator;
+ measurement.signalToNoiseRatioDb =
+ halGnssMeasurements.measurements[meas].signalToNoiseRatioDb;
+ measurement.agcLevelDb = halGnssMeasurements.measurements[meas].agcLevelDb;
+
+ gnssMeasurements.measurements.push_back(measurement);
+ }
+ gnssMeasurements.clock.flags =
+ (GnssMeasurementsClockFlagsMask) halGnssMeasurements.clock.flags;
+ gnssMeasurements.clock.leapSecond = halGnssMeasurements.clock.leapSecond;
+ gnssMeasurements.clock.timeNs = halGnssMeasurements.clock.timeNs;
+ gnssMeasurements.clock.timeUncertaintyNs = halGnssMeasurements.clock.timeUncertaintyNs;
+ gnssMeasurements.clock.fullBiasNs = halGnssMeasurements.clock.fullBiasNs;
+ gnssMeasurements.clock.biasNs = halGnssMeasurements.clock.biasNs;
+ gnssMeasurements.clock.biasUncertaintyNs = halGnssMeasurements.clock.biasUncertaintyNs;
+ gnssMeasurements.clock.driftNsps = halGnssMeasurements.clock.driftNsps;
+ gnssMeasurements.clock.driftUncertaintyNsps = halGnssMeasurements.clock.driftUncertaintyNsps;
+ gnssMeasurements.clock.hwClockDiscontinuityCount =
+ halGnssMeasurements.clock.hwClockDiscontinuityCount;
+
+ return gnssMeasurements;
+}
+
+static LocationResponse parseLocationError(::LocationError error) {
+ LocationResponse response;
+
+ switch (error) {
+ case ::LOCATION_ERROR_SUCCESS:
+ response = LOCATION_RESPONSE_SUCCESS;
+ break;
+ case ::LOCATION_ERROR_NOT_SUPPORTED:
+ response = LOCATION_RESPONSE_NOT_SUPPORTED;
+ break;
+ default:
+ response = LOCATION_RESPONSE_UNKOWN_FAILURE;
+ break;
+ }
+
+ return response;
+}
+
+static LocationSystemInfo parseLocationSystemInfo(
+ const::LocationSystemInfo &halSystemInfo) {
+ LocationSystemInfo systemInfo = {};
+
+ systemInfo.systemInfoMask = (location_client::LocationSystemInfoMask)
+ halSystemInfo.systemInfoMask;
+ if (halSystemInfo.systemInfoMask & ::LOCATION_SYS_INFO_LEAP_SECOND) {
+ systemInfo.leapSecondSysInfo.leapSecondInfoMask = (location_client::LeapSecondSysInfoMask)
+ halSystemInfo.leapSecondSysInfo.leapSecondInfoMask;
+
+ if (halSystemInfo.leapSecondSysInfo.leapSecondInfoMask &
+ ::LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT) {
+ LeapSecondChangeInfo &clientInfo =
+ systemInfo.leapSecondSysInfo.leapSecondChangeInfo;
+ const::LeapSecondChangeInfo &halInfo =
+ halSystemInfo.leapSecondSysInfo.leapSecondChangeInfo;
+
+ clientInfo.gpsTimestampLsChange = parseGnssTime(halInfo.gpsTimestampLsChange);
+ clientInfo.leapSecondsBeforeChange = halInfo.leapSecondsBeforeChange;
+ clientInfo.leapSecondsAfterChange = halInfo.leapSecondsAfterChange;
+ }
+
+ if (halSystemInfo.leapSecondSysInfo.leapSecondInfoMask &
+ ::LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT) {
+ systemInfo.leapSecondSysInfo.leapSecondCurrent =
+ halSystemInfo.leapSecondSysInfo.leapSecondCurrent;
+ }
+ }
+
+ return systemInfo;
+}
+
+/******************************************************************************
+ILocIpcListener override
+******************************************************************************/
+class IpcListener : public ILocIpcListener {
+ MsgTask& mMsgTask;
+ LocationClientApiImpl& mApiImpl;
+public:
+ inline IpcListener(LocationClientApiImpl& apiImpl, MsgTask& msgTask) :
+ mMsgTask(msgTask), mApiImpl(apiImpl) {}
+ virtual void onListenerReady() override;
+ virtual void onReceive(const char* data, uint32_t length,
+ const LocIpcRecver* recver) override;
+};
+
+/******************************************************************************
+LocationClientApiImpl
+******************************************************************************/
+
+uint32_t LocationClientApiImpl::mClientIdGenerator = LOCATION_CLIENT_SESSION_ID_INVALID;
+
+mutex LocationClientApiImpl::mMutex;
+
+/******************************************************************************
+LocationClientApiImpl - constructors
+******************************************************************************/
+LocationClientApiImpl::LocationClientApiImpl(CapabilitiesCb capabitiescb) :
+ mSessionId(LOCATION_CLIENT_SESSION_ID_INVALID),
+ mBatchingId(LOCATION_CLIENT_SESSION_ID_INVALID),
+ mHalRegistered(false),
+ mCallbacksMask(0),
+ mCapsMask((LocationCapabilitiesMask)0),
+ mLastAddedClientIds({}),
+ mCapabilitiesCb(capabitiescb),
+ mResponseCb(nullptr),
+ mLocationCb(nullptr),
+ mGnssLocationCb(nullptr),
+ mEngLocationsCb(nullptr),
+ mGnssSvCb(nullptr),
+ mGnssNmeaCb(nullptr),
+ mGnssDataCb(nullptr),
+ mGnssMeasurementsCb(nullptr),
+ mGnssEnergyConsumedInfoCb(nullptr),
+ mGnssEnergyConsumedResponseCb(nullptr),
+ mLocationSysInfoCb(nullptr),
+ mLocationSysInfoResponseCb(nullptr),
+ mPingTestCb(nullptr)
+#ifndef FEATURE_EXTERNAL_AP
+ ,mDiagIface(nullptr)
+#endif
+{
+ // read configuration file
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, gConfigTable);
+ LOC_LOGd("gDebug=%u", gDebug);
+
+ mMsgTask = new MsgTask("ClientApiImpl", false);
+ // get pid to generate sokect name
+ uint32_t pid = (uint32_t)getpid();
+
+#ifdef FEATURE_EXTERNAL_AP
+ // The instance id is composed from pid and client id.
+ // We support up to 32 unique client api within one process.
+ // Each client id is tracked via a bit in mClientIdGenerator,
+ // which is 4 bytes now.
+ lock_guard<mutex> lock(mMutex);
+ unsigned int clientIdMask = 1;
+ // find a bit in the mClientIdGenerator that is not yet used
+ // and use that as client id
+ // client id will be from 1 to 32, as client id will be used to
+ // set session id and 0 is reserved for LOCATION_CLIENT_SESSION_ID_INVALID
+ for (mClientId = 1; mClientId <= sizeof(mClientIdGenerator) * 8; mClientId++) {
+ if ((mClientIdGenerator & (1UL << (mClientId-1))) == 0) {
+ mClientIdGenerator |= (1UL << (mClientId-1));
+ break;
+ }
+ }
+
+ if (mClientId > sizeof(mClientIdGenerator) * 8) {
+ LOC_LOGe("create Qsocket failed, already use up maximum of %d clients",
+ sizeof(mClientIdGenerator)*8);
+ return;
+ }
+
+ SockNodeEap sock(LOCATION_CLIENT_API_QSOCKET_CLIENT_SERVICE_ID,
+ pid * 100 + mClientId);
+ strlcpy(mSocketName, sock.getNodePathname().c_str(), sizeof(mSocketName));
+ unique_ptr<LocIpcRecver> recver = LocIpc::getLocIpcQrtrRecver(
+ make_shared<IpcListener>(*this, *mMsgTask), sock.getId1(), sock.getId2());
+
+ // establish an ipc sender to the hal daemon
+ mIpcSender = LocIpc::getLocIpcQrtrSender(LOCATION_CLIENT_API_QSOCKET_HALDAEMON_SERVICE_ID,
+ LOCATION_CLIENT_API_QSOCKET_HALDAEMON_INSTANCE_ID);
+ if (mIpcSender == nullptr) {
+ LOC_LOGe("create sender socket failed for service id: %d instance id: %d",
+ LOCATION_CLIENT_API_QSOCKET_HALDAEMON_SERVICE_ID, LOCATION_CLIENT_API_QSOCKET_HALDAEMON_INSTANCE_ID);
+ return;
+ }
+#else
+ // get clientId
+ lock_guard<mutex> lock(mMutex);
+ mClientId = ++mClientIdGenerator;
+ // make sure client ID is not equal to LOCATION_CLIENT_SESSION_ID_INVALID,
+ // as session id will be assigned to client ID
+ if (mClientId == LOCATION_CLIENT_SESSION_ID_INVALID) {
+ mClientId = ++mClientIdGenerator;
+ }
+
+ SockNodeLocal sock(LOCATION_CLIENT_API, pid, mClientId);
+ strlcpy(mSocketName, sock.getNodePathname().c_str(), sizeof(mSocketName));
+ unique_ptr<LocIpcRecver> recver = LocIpc::getLocIpcLocalRecver(
+ make_shared<IpcListener>(*this, *mMsgTask), mSocketName);
+
+ // establish an ipc sender to the hal daemon
+ mIpcSender = LocIpc::getLocIpcLocalSender(SOCKET_TO_LOCATION_HAL_DAEMON);
+ if (mIpcSender == nullptr) {
+ LOC_LOGe("create sender socket failed %s", SOCKET_TO_LOCATION_HAL_DAEMON);
+ return;
+ }
+#endif
+
+ LOC_LOGd("listen on socket: %s", mSocketName);
+ mIpc.startNonBlockingListening(recver);
+}
+
+LocationClientApiImpl::~LocationClientApiImpl() {
+}
+
+void LocationClientApiImpl::destroy() {
+
+ struct DestroyReq : public LocMsg {
+ DestroyReq(LocationClientApiImpl* apiImpl) :
+ mApiImpl(apiImpl) {}
+ virtual ~DestroyReq() {}
+ void proc() const {
+ // deregister
+ if (mApiImpl->mHalRegistered && (nullptr != mApiImpl->mIpcSender)) {
+ LocAPIClientDeregisterReqMsg msg(mApiImpl->mSocketName);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg), sizeof(msg));
+ LOC_LOGd(">>> DeregisterReq rc=%d\n", rc);
+ mApiImpl->mIpcSender = nullptr;
+ }
+
+ if (mApiImpl->mMsgTask) {
+ mApiImpl->mMsgTask->destroy();
+ }
+
+#ifdef FEATURE_EXTERNAL_AP
+ // get clientId
+ lock_guard<mutex> lock(mMutex);
+ mApiImpl->mClientIdGenerator &= ~(1UL << mApiImpl->mClientId);
+ LOC_LOGd("client id generarator 0x%x, id %d",
+ mApiImpl->mClientIdGenerator, mApiImpl->mClientId);
+#endif //FEATURE_EXTERNAL_AP
+ delete mApiImpl;
+ }
+ LocationClientApiImpl* mApiImpl;
+ };
+
+ mMsgTask->sendMsg(new (nothrow) DestroyReq(this));
+}
+
+/******************************************************************************
+LocationClientApiImpl - implementation
+******************************************************************************/
+void LocationClientApiImpl::updateCallbackFunctions(const ClientCallbacks& cbs,
+ ReportCbEnumType reportCbType) {
+
+ struct UpdateCallbackFunctionsReq : public LocMsg {
+ UpdateCallbackFunctionsReq(LocationClientApiImpl* apiImpl, const ClientCallbacks& cbs,
+ ReportCbEnumType reportCbType) :
+ mApiImpl(apiImpl), mCbs(cbs), mReportCbType(reportCbType) {}
+ virtual ~UpdateCallbackFunctionsReq() {}
+ void proc() const {
+ // update callback functions
+ mApiImpl->mResponseCb = mCbs.responsecb;
+ mApiImpl->mCollectiveResCb = mCbs.collectivecb;
+ mApiImpl->mLocationCb = mCbs.locationcb;
+ mApiImpl->mBatchingCb = mCbs.batchingcb;
+ mApiImpl->mGfBreachCb = mCbs.gfbreachcb;
+
+ if (REPORT_CB_GNSS_INFO == mReportCbType) {
+ mApiImpl->mGnssLocationCb = mCbs.gnssreportcbs.gnssLocationCallback;
+ mApiImpl->mGnssSvCb = mCbs.gnssreportcbs.gnssSvCallback;
+ mApiImpl->mGnssNmeaCb = mCbs.gnssreportcbs.gnssNmeaCallback;
+ mApiImpl->mGnssDataCb = mCbs.gnssreportcbs.gnssDataCallback;
+ mApiImpl->mGnssMeasurementsCb = mCbs.gnssreportcbs.gnssMeasurementsCallback;
+ } else if (REPORT_CB_ENGINE_INFO == mReportCbType) {
+ mApiImpl->mEngLocationsCb = mCbs.engreportcbs.engLocationsCallback;
+ mApiImpl->mGnssSvCb = mCbs.engreportcbs.gnssSvCallback;
+ mApiImpl->mGnssNmeaCb = mCbs.engreportcbs.gnssNmeaCallback;
+ mApiImpl->mGnssDataCb = mCbs.engreportcbs.gnssDataCallback;
+ mApiImpl->mGnssMeasurementsCb = mCbs.engreportcbs.gnssMeasurementsCallback;
+ }
+ }
+ LocationClientApiImpl* mApiImpl;
+ const ClientCallbacks mCbs;
+ ReportCbEnumType mReportCbType;
+ };
+ mMsgTask->sendMsg(new (nothrow) UpdateCallbackFunctionsReq(this, cbs, reportCbType));
+}
+
+void LocationClientApiImpl::updateCallbacks(LocationCallbacks& callbacks) {
+
+ struct UpdateCallbacksReq : public LocMsg {
+ UpdateCallbacksReq(LocationClientApiImpl* apiImpl, const LocationCallbacks& callbacks) :
+ mApiImpl(apiImpl), mCallBacks(callbacks) {}
+ virtual ~UpdateCallbacksReq() {}
+ void proc() const {
+
+ //convert callbacks to callBacksMask
+ LocationCallbacksMask callBacksMask = 0;
+ if (mCallBacks.trackingCb) {
+ callBacksMask |= E_LOC_CB_DISTANCE_BASED_TRACKING_BIT;
+ }
+ if (mCallBacks.gnssLocationInfoCb) {
+ if (mApiImpl->mLocationCb) {
+ callBacksMask |= E_LOC_CB_SIMPLE_LOCATION_INFO_BIT;
+ } else {
+ callBacksMask |= E_LOC_CB_GNSS_LOCATION_INFO_BIT;
+ }
+ }
+ if (mCallBacks.engineLocationsInfoCb) {
+ callBacksMask |= E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT;
+ }
+ if (mCallBacks.gnssSvCb) {
+ callBacksMask |= E_LOC_CB_GNSS_SV_BIT;
+ }
+ if (mCallBacks.gnssNmeaCb) {
+ callBacksMask |= E_LOC_CB_GNSS_NMEA_BIT;
+ }
+ if (mCallBacks.gnssDataCb) {
+ callBacksMask |= E_LOC_CB_GNSS_DATA_BIT;
+ }
+ if (mCallBacks.gnssMeasurementsCb) {
+ callBacksMask |= E_LOC_CB_GNSS_MEAS_BIT;
+ }
+ // handle callbacks that are not related to a fix session
+ if (mApiImpl->mLocationSysInfoCb) {
+ callBacksMask |= E_LOC_CB_SYSTEM_INFO_BIT;
+ }
+ if (mCallBacks.batchingCb) {
+ callBacksMask |= E_LOC_CB_BATCHING_BIT;
+ }
+ if (mCallBacks.batchingStatusCb) {
+ callBacksMask |= E_LOC_CB_BATCHING_STATUS_BIT;
+ }
+ if (mCallBacks.geofenceBreachCb) {
+ callBacksMask |= E_LOC_CB_GEOFENCE_BREACH_BIT;
+ }
+
+ // update callback only when changed
+ if (mApiImpl->mCallbacksMask != callBacksMask) {
+ mApiImpl->mCallbacksMask = callBacksMask;
+ if (mApiImpl->mHalRegistered) {
+ LocAPIUpdateCallbacksReqMsg msg(mApiImpl->mSocketName,
+ mApiImpl->mCallbacksMask);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> UpdateCallbacksReq callBacksMask=0x%x rc=%d",
+ mApiImpl->mCallbacksMask, rc);
+ }
+ } else {
+ LOC_LOGd("No updateCallbacks because same callBacksMask 0x%x", callBacksMask);
+ }
+ }
+ LocationClientApiImpl* mApiImpl;
+ const LocationCallbacks mCallBacks;
+ };
+ mMsgTask->sendMsg(new (nothrow) UpdateCallbacksReq(this, callbacks));
+}
+
+uint32_t LocationClientApiImpl::startTracking(TrackingOptions& option) {
+
+ struct StartTrackingReq : public LocMsg {
+ StartTrackingReq(LocationClientApiImpl* apiImpl, TrackingOptions& option) :
+ mApiImpl(apiImpl), mOption(option) {}
+ virtual ~StartTrackingReq() {}
+ void proc() const {
+ // check if option is updated
+ bool isOptionUpdated = false;
+
+ if ((mApiImpl->mLocationOptions.minInterval != mOption.minInterval) ||
+ (mApiImpl->mLocationOptions.minDistance != mOption.minDistance) ||
+ (mApiImpl->mLocationOptions.locReqEngTypeMask != mOption.locReqEngTypeMask)) {
+ isOptionUpdated = true;
+ }
+
+ if (!mApiImpl->mHalRegistered) {
+ mApiImpl->mLocationOptions = mOption;
+ // need to set session id so when hal is ready, the session can be resumed
+ mApiImpl->mSessionId = mApiImpl->mClientId;
+ LOC_LOGe(">>> startTracking - Not registered yet");
+ return;
+ }
+
+ if (LOCATION_CLIENT_SESSION_ID_INVALID == mApiImpl->mSessionId) {
+ mApiImpl->mLocationOptions = mOption;
+ //start a new tracking session
+ mApiImpl->mSessionId = mApiImpl->mClientId;
+
+ if ((0 != mApiImpl->mLocationOptions.minInterval) ||
+ (0 != mApiImpl->mLocationOptions.minDistance)) {
+ LocAPIStartTrackingReqMsg msg(mApiImpl->mSocketName,
+ mApiImpl->mLocationOptions);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> StartTrackingReq Interval=%d Distance=%d, locReqEngTypeMask=0x%x",
+ mApiImpl->mLocationOptions.minInterval,
+ mApiImpl->mLocationOptions.minDistance,
+ mApiImpl->mLocationOptions.locReqEngTypeMask);
+ }
+ } else if (isOptionUpdated) {
+ //update a tracking session, mApiImpl->mLocationOptions
+ //will be updated in updateTrackingOptionsSync
+ mApiImpl->updateTrackingOptionsSync(
+ mApiImpl, const_cast<TrackingOptions&>(mOption));
+ } else {
+ LOC_LOGd(">>> StartTrackingReq - no change in option");
+ if (mApiImpl->mResponseCb) {
+ mApiImpl->mResponseCb(LOCATION_RESPONSE_SUCCESS);
+ }
+ }
+ }
+ LocationClientApiImpl* mApiImpl;
+ TrackingOptions mOption;
+ };
+ mMsgTask->sendMsg(new (nothrow) StartTrackingReq(this, option));
+ return 0;
+}
+
+void LocationClientApiImpl::stopTracking(uint32_t) {
+
+ struct StopTrackingReq : public LocMsg {
+ StopTrackingReq(LocationClientApiImpl* apiImpl) : mApiImpl(apiImpl) {}
+ virtual ~StopTrackingReq() {}
+ void proc() const {
+ if (mApiImpl->mSessionId == mApiImpl->mClientId) {
+ if (mApiImpl->mHalRegistered &&
+ ((mApiImpl->mLocationOptions.minInterval != 0) ||
+ (mApiImpl->mLocationOptions.minDistance != 0))) {
+ LocAPIStopTrackingReqMsg msg(mApiImpl->mSocketName);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> StopTrackingReq rc=%d\n", rc);
+ }
+
+ mApiImpl->mLocationOptions.minInterval = 0;
+ mApiImpl->mLocationOptions.minDistance = 0;
+ mApiImpl->mCallbacksMask = 0;
+ // handle callback that are not tied with fix session
+ if (mApiImpl->mLocationSysInfoCb) {
+ mApiImpl->mCallbacksMask |= E_LOC_CB_SYSTEM_INFO_BIT;
+ }
+ }
+ mApiImpl->mSessionId = LOCATION_CLIENT_SESSION_ID_INVALID;
+ }
+ LocationClientApiImpl* mApiImpl;
+ };
+ mMsgTask->sendMsg(new (nothrow) StopTrackingReq(this));
+}
+
+void LocationClientApiImpl::updateTrackingOptionsSync(
+ LocationClientApiImpl* pImpl, TrackingOptions& option) {
+
+ LOC_LOGd(">>> updateTrackingOptionsSync,sessionId=%d, "
+ "new Interval=%d Distance=%d, current Interval=%d Distance=%d",
+ pImpl->mSessionId, option.minInterval,
+ option.minDistance, pImpl->mLocationOptions.minInterval,
+ pImpl->mLocationOptions.minDistance);
+
+ bool rc = true;
+ // update option to passive listening where previous option
+ // is not passive listening, in this case, we need to stop the session
+ if (((option.minInterval == 0) && (option.minDistance == 0)) &&
+ ((pImpl->mLocationOptions.minInterval != 0) ||
+ (pImpl->mLocationOptions.minDistance != 0))) {
+ LocAPIStopTrackingReqMsg msg(pImpl->mSocketName);
+ rc = pImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ } else if (((option.minInterval != 0) || (option.minDistance != 0)) &&
+ ((pImpl->mLocationOptions.minInterval == 0) &&
+ (pImpl->mLocationOptions.minDistance == 0))) {
+ // update option from passive listening to none passive listening,
+ // we need to start the session
+ LocAPIStartTrackingReqMsg msg(pImpl->mSocketName, option);
+ rc = pImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> start tracking Interval=%d Distance=%d",
+ option.minInterval, option.minDistance);
+ } else {
+ LocAPIUpdateTrackingOptionsReqMsg msg(pImpl->mSocketName, option);
+ bool rc = pImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg), sizeof(msg));
+ LOC_LOGd(">>> updateTrackingOptionsSync Interval=%d Distance=%d, reqTypeMask=0x%x",
+ option.minInterval, option.minDistance, option.locReqEngTypeMask);
+ }
+
+ pImpl->mLocationOptions = option;
+}
+
+
+//Batching
+uint32_t LocationClientApiImpl::startBatching(BatchingOptions& batchOptions) {
+ struct StartBatchingReq : public LocMsg {
+ StartBatchingReq(LocationClientApiImpl *apiImpl, BatchingOptions& batchOptions) :
+ mApiImpl(apiImpl), mBatchOptions(batchOptions) {}
+ virtual ~StartBatchingReq() {}
+ void proc() const {
+ mApiImpl->mBatchingOptions = mBatchOptions;
+ if (!mApiImpl->mHalRegistered) {
+ LOC_LOGe(">>> startBatching - Not registered yet");
+ return;
+ }
+ if (LOCATION_CLIENT_SESSION_ID_INVALID == mApiImpl->mSessionId) {
+ //start a new batching session
+ mApiImpl->mBatchingId = mApiImpl->mClientId;
+ LocAPIStartBatchingReqMsg msg(mApiImpl->mSocketName,
+ mApiImpl->mBatchingOptions.minInterval,
+ mApiImpl->mBatchingOptions.minDistance,
+ mApiImpl->mBatchingOptions.batchingMode);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> StartBatchingReq Interval=%d Distance=%d BatchingMode=%d",
+ mApiImpl->mBatchingOptions.minInterval,
+ mApiImpl->mBatchingOptions.minDistance,
+ mApiImpl->mBatchingOptions.batchingMode);
+ } else {
+ mApiImpl->updateBatchingOptions(mApiImpl->mBatchingId,
+ const_cast<BatchingOptions&>(mBatchOptions));
+ }
+ }
+ LocationClientApiImpl *mApiImpl;
+ BatchingOptions mBatchOptions;
+ };
+ mMsgTask->sendMsg(new (nothrow) StartBatchingReq(this, batchOptions));
+ return 0;
+}
+
+void LocationClientApiImpl::stopBatching(uint32_t id) {
+ struct StopBatchingReq : public LocMsg {
+ StopBatchingReq(LocationClientApiImpl *apiImpl) :
+ mApiImpl(apiImpl) {}
+ virtual ~StopBatchingReq() {}
+ void proc() const {
+ if (mApiImpl->mBatchingId == mApiImpl->mClientId) {
+ mApiImpl->mBatchingOptions = {};
+ LocAPIStopBatchingReqMsg msg(mApiImpl->mSocketName);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> StopBatchingReq rc=%d", rc);
+ }
+ mApiImpl->mBatchingId = LOCATION_CLIENT_SESSION_ID_INVALID;
+ }
+ LocationClientApiImpl *mApiImpl;
+ };
+ mMsgTask->sendMsg(new (nothrow) StopBatchingReq(this));
+}
+
+void LocationClientApiImpl::updateBatchingOptions(uint32_t id, BatchingOptions& batchOptions) {
+ struct UpdateBatchingOptionsReq : public LocMsg {
+ UpdateBatchingOptionsReq(LocationClientApiImpl* apiImpl, BatchingOptions& batchOptions) :
+ mApiImpl(apiImpl), mBatchOptions(batchOptions) {}
+ virtual ~UpdateBatchingOptionsReq() {}
+ void proc() const {
+ mApiImpl->mBatchingOptions = mBatchOptions;
+ LocAPIUpdateBatchingOptionsReqMsg msg(mApiImpl->mSocketName,
+ mApiImpl->mBatchingOptions.minInterval,
+ mApiImpl->mBatchingOptions.minDistance,
+ mApiImpl->mBatchingOptions.batchingMode);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> StartBatchingReq Interval=%d Distance=%d BatchingMode=%d",
+ mApiImpl->mBatchingOptions.minInterval,
+ mApiImpl->mBatchingOptions.minDistance,
+ mApiImpl->mBatchingOptions.batchingMode);
+ }
+ LocationClientApiImpl *mApiImpl;
+ BatchingOptions mBatchOptions;
+ };
+
+ if ((mBatchingOptions.minInterval != batchOptions.minInterval) ||
+ (mBatchingOptions.minDistance != batchOptions.minDistance) ||
+ mBatchingOptions.batchingMode != batchOptions.batchingMode) {
+ mMsgTask->sendMsg(new (nothrow) UpdateBatchingOptionsReq(this, batchOptions));
+ } else {
+ LOC_LOGd("No UpdateBatchingOptions because same Interval=%d Distance=%d, BatchingMode=%d",
+ batchOptions.minInterval, batchOptions.minDistance, batchOptions.batchingMode);
+ }
+}
+
+void LocationClientApiImpl::getBatchedLocations(uint32_t id, size_t count) {}
+
+bool LocationClientApiImpl::checkGeofenceMap(size_t count, uint32_t* ids) {
+ for (int i=0; i<count; ++i) {
+ auto got = mGeofenceMap.find(ids[i]);
+ if (got == mGeofenceMap.end()) {
+ return false;
+ }
+ }
+ return true;
+}
+void LocationClientApiImpl::addGeofenceMap(uint32_t id, Geofence& geofence) {
+ lock_guard<mutex> lock(mMutex);
+ mGeofenceMap.insert(make_pair(id, geofence));
+}
+void LocationClientApiImpl::eraseGeofenceMap(size_t count, uint32_t* ids) {
+ lock_guard<mutex> lock(mMutex);
+ for (int i=0; i<count; ++i) {
+ mGeofenceMap.erase(ids[i]);
+ }
+}
+
+uint32_t* LocationClientApiImpl::addGeofences(size_t count, GeofenceOption* options,
+ GeofenceInfo* infos) {
+ struct AddGeofencesReq : public LocMsg {
+ AddGeofencesReq(LocationClientApiImpl* apiImpl, uint32_t count, GeofenceOption* gfOptions,
+ GeofenceInfo* gfInfos, std::vector<uint32_t> clientIds) :
+ mApiImpl(apiImpl), mGfCount(count), mGfOptions(gfOptions), mGfInfos(gfInfos),
+ mClientIds(clientIds) {}
+ virtual ~AddGeofencesReq() {}
+ void proc() const {
+ if (!mApiImpl->mHalRegistered) {
+ LOC_LOGe(">>> addGeofences - Not registered yet");
+ return;
+ }
+
+ if (mGfCount > 0) {
+ //Add geofences, serialize geofence msg payload into ipc message payload
+ size_t msglen = sizeof(LocAPIAddGeofencesReqMsg) +
+ sizeof(GeofencePayload) * (mGfCount - 1);
+ uint8_t *msg = new(std::nothrow) uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ memset(msg, 0, msglen);
+ LocAPIAddGeofencesReqMsg *pMsg = reinterpret_cast<LocAPIAddGeofencesReqMsg*>(msg);
+ strlcpy(pMsg->mSocketName, mApiImpl->mSocketName, MAX_SOCKET_PATHNAME_LENGTH);
+ pMsg->msgId = E_LOCAPI_ADD_GEOFENCES_MSG_ID;
+ pMsg->geofences.count = mGfCount;
+ for (int i=0; i<mGfCount; ++i) {
+ (*(pMsg->geofences.gfPayload + i)).gfClientId = mClientIds[i];
+ (*(pMsg->geofences.gfPayload + i)).gfOption = mGfOptions[i];
+ (*(pMsg->geofences.gfPayload + i)).gfInfo = mGfInfos[i];
+ }
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(msg),
+ msglen);
+ LOC_LOGd(">>> AddGeofencesReq count=%zu", mGfCount);
+ delete[] msg;
+ free(mGfOptions);
+ free(mGfInfos);
+ }
+ }
+ LocationClientApiImpl *mApiImpl;
+ uint32_t mGfCount;
+ GeofenceOption* mGfOptions;
+ GeofenceInfo* mGfInfos;
+ std::vector<uint32_t> mClientIds;
+ };
+ mMsgTask->sendMsg(new (nothrow) AddGeofencesReq(this, count, options, infos,
+ mLastAddedClientIds));
+ return nullptr;
+}
+
+void LocationClientApiImpl::removeGeofences(size_t count, uint32_t* ids) {
+ struct RemoveGeofencesReq : public LocMsg {
+ RemoveGeofencesReq(LocationClientApiImpl* apiImpl, uint32_t count, uint32_t* gfIds) :
+ mApiImpl(apiImpl), mGfCount(count), mGfIds(gfIds) {}
+ virtual ~RemoveGeofencesReq() {}
+ void proc() const {
+ if (!mApiImpl->mHalRegistered) {
+ LOC_LOGe(">>> removeGeofences - Not registered yet");
+ return;
+ }
+ if (mGfCount > 0) {
+ //Remove geofences
+ size_t msglen = sizeof(LocAPIRemoveGeofencesReqMsg) +
+ sizeof(uint32_t) * (mGfCount - 1);
+ uint8_t* msg = new uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ LocAPIRemoveGeofencesReqMsg* pMsg = (LocAPIRemoveGeofencesReqMsg*)msg;
+ pMsg->gfClientIds.count = mGfCount;
+ memcpy(pMsg->gfClientIds.gfIds, mGfIds, sizeof(uint32_t) * mGfCount);
+ pMsg->msgId = E_LOCAPI_REMOVE_GEOFENCES_MSG_ID;
+ strlcpy(pMsg->mSocketName, mApiImpl->mSocketName, MAX_SOCKET_PATHNAME_LENGTH);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(msg),
+ msglen);
+ LOC_LOGd(">>> RemoveGeofencesReq count=%zu", mGfCount);
+ delete[] msg;
+ free(mGfIds);
+ }
+ }
+ LocationClientApiImpl *mApiImpl;
+ uint32_t mGfCount;
+ uint32_t* mGfIds;
+ };
+ mMsgTask->sendMsg(new (nothrow) RemoveGeofencesReq(this, count, ids));
+}
+
+void LocationClientApiImpl::modifyGeofences(
+ size_t count, uint32_t* ids, GeofenceOption* options) {
+ struct ModifyGeofencesReq : public LocMsg {
+ ModifyGeofencesReq(LocationClientApiImpl* apiImpl, uint32_t count, uint32_t* gfIds,
+ GeofenceOption* gfOptions) :
+ mApiImpl(apiImpl), mGfCount(count), mGfIds(gfIds), mGfOptions(gfOptions) {}
+ virtual ~ModifyGeofencesReq() {}
+ void proc() const {
+ if (!mApiImpl->mHalRegistered) {
+ LOC_LOGe(">>> modifyGeofences - Not registered yet");
+ return;
+ }
+ if (mGfCount > 0) {
+ //Modify geofences
+ size_t msglen = sizeof(LocAPIModifyGeofencesReqMsg) +
+ sizeof(GeofencePayload) * (mGfCount-1);
+ uint8_t *msg = new(std::nothrow) uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ memset(msg, 0, msglen);
+ LocAPIModifyGeofencesReqMsg *pMsg =
+ reinterpret_cast<LocAPIModifyGeofencesReqMsg*>(msg);
+ strlcpy(pMsg->mSocketName, mApiImpl->mSocketName, MAX_SOCKET_PATHNAME_LENGTH);
+ pMsg->msgId = E_LOCAPI_MODIFY_GEOFENCES_MSG_ID;
+ pMsg->geofences.count = mGfCount;
+ for (int i=0; i<mGfCount; ++i) {
+ (*(pMsg->geofences.gfPayload + i)).gfClientId = mGfIds[i];
+ (*(pMsg->geofences.gfPayload + i)).gfOption = mGfOptions[i];
+ }
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(msg),
+ msglen);
+ LOC_LOGd(">>> ModifyGeofencesReq count=%zu", mGfCount);
+ delete[] msg;
+ free(mGfIds);
+ free(mGfOptions);
+ }
+ }
+ LocationClientApiImpl *mApiImpl;
+ uint32_t mGfCount;
+ uint32_t* mGfIds;
+ GeofenceOption* mGfOptions;
+ };
+ mMsgTask->sendMsg(new (nothrow) ModifyGeofencesReq(this, count, ids, options));
+}
+
+void LocationClientApiImpl::pauseGeofences(size_t count, uint32_t* ids) {
+ struct PauseGeofencesReq : public LocMsg {
+ PauseGeofencesReq(LocationClientApiImpl* apiImpl, uint32_t count, uint32_t* gfIds) :
+ mApiImpl(apiImpl), mGfCount(count), mGfIds(gfIds) {}
+ virtual ~PauseGeofencesReq() {}
+ void proc() const {
+ if (!mApiImpl->mHalRegistered) {
+ LOC_LOGe(">>> pauseGeofences - Not registered yet");
+ return;
+ }
+ if (mGfCount > 0) {
+ //Pause geofences
+ size_t msglen = sizeof(LocAPIPauseGeofencesReqMsg) +
+ sizeof(uint32_t) * (mGfCount - 1);
+ uint8_t* msg = new uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ LocAPIPauseGeofencesReqMsg* pMsg = (LocAPIPauseGeofencesReqMsg*)msg;
+ pMsg->gfClientIds.count = mGfCount;
+ memcpy(&(pMsg->gfClientIds.gfIds[0]), mGfIds, sizeof(uint32_t) * mGfCount);
+ pMsg->msgId = E_LOCAPI_PAUSE_GEOFENCES_MSG_ID;
+ strlcpy(pMsg->mSocketName, mApiImpl->mSocketName, MAX_SOCKET_PATHNAME_LENGTH);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(msg),
+ msglen);
+ LOC_LOGd(">>> PauseGeofencesReq count=%zu", mGfCount);
+ delete[] msg;
+ free(mGfIds);
+ }
+ }
+ LocationClientApiImpl *mApiImpl;
+ uint32_t mGfCount;
+ uint32_t* mGfIds;
+ };
+ mMsgTask->sendMsg(new (nothrow) PauseGeofencesReq(this, count, ids));
+}
+
+void LocationClientApiImpl::resumeGeofences(size_t count, uint32_t* ids) {
+ struct ResumeGeofencesReq : public LocMsg {
+ ResumeGeofencesReq(LocationClientApiImpl* apiImpl, uint32_t count, uint32_t* gfIds) :
+ mApiImpl(apiImpl), mGfCount(count), mGfIds(gfIds) {}
+ virtual ~ResumeGeofencesReq() {}
+ void proc() const {
+ if (!mApiImpl->mHalRegistered) {
+ LOC_LOGe(">>> resumeGeofences - Not registered yet");
+ return;
+ }
+ if (mGfCount > 0) {
+ //Resume geofences
+ size_t msglen = sizeof(LocAPIResumeGeofencesReqMsg) +
+ sizeof(uint32_t) * (mGfCount - 1);
+ uint8_t* msg = new uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ LocAPIResumeGeofencesReqMsg* pMsg = (LocAPIResumeGeofencesReqMsg*)msg;
+ pMsg->gfClientIds.count = mGfCount;
+ memcpy(pMsg->gfClientIds.gfIds, mGfIds, sizeof(uint32_t) * mGfCount);
+ pMsg->msgId = E_LOCAPI_RESUME_GEOFENCES_MSG_ID;
+ strlcpy(pMsg->mSocketName, mApiImpl->mSocketName, MAX_SOCKET_PATHNAME_LENGTH);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(msg),
+ msglen);
+ LOC_LOGd(">>> ResumeGeofencesReq count=%zu", mGfCount);
+ delete[] msg;
+ free(mGfIds);
+ }
+ }
+ LocationClientApiImpl *mApiImpl;
+ uint32_t mGfCount;
+ uint32_t* mGfIds;
+ };
+ mMsgTask->sendMsg(new (nothrow) ResumeGeofencesReq(this, count, ids));
+}
+
+uint32_t* LocationClientApiImpl::gnssUpdateConfig(GnssConfig config) {
+
+ struct UpdateConfigReq : public LocMsg {
+ UpdateConfigReq(LocationClientApiImpl* apiImpl, GnssConfig& config) :
+ mApiImpl(apiImpl), mConfig(config) {}
+ virtual ~UpdateConfigReq() {}
+ void proc() const {
+ LocAPIUpdateConfigReqMsg msg(mApiImpl->mSocketName, const_cast<GnssConfig&>(mConfig));
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ }
+ LocationClientApiImpl* mApiImpl;
+ GnssConfig mConfig;
+ };
+ mMsgTask->sendMsg(new (nothrow) UpdateConfigReq(this, config));
+ return nullptr;
+}
+
+uint32_t LocationClientApiImpl::gnssDeleteAidingData(GnssAidingData& data) {
+
+ struct DeleteAidingDataReq : public LocMsg {
+ DeleteAidingDataReq(const LocationClientApiImpl* apiImpl, GnssAidingData& data) :
+ mApiImpl(apiImpl), mAidingData(data) {}
+ virtual ~DeleteAidingDataReq() {}
+ void proc() const {
+ LocAPIDeleteAidingDataReqMsg msg(mApiImpl->mSocketName,
+ const_cast<GnssAidingData&>(mAidingData));
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> DeleteAidingDataReq rc=%d", rc);
+ }
+ const LocationClientApiImpl* mApiImpl;
+ GnssAidingData mAidingData;
+ };
+ mMsgTask->sendMsg(new (nothrow) DeleteAidingDataReq(this, data));
+ return 0;
+}
+
+void LocationClientApiImpl::updateNetworkAvailability(bool available) {
+
+ struct UpdateNetworkAvailabilityReq : public LocMsg {
+ UpdateNetworkAvailabilityReq(const LocationClientApiImpl* apiImpl, bool available) :
+ mApiImpl(apiImpl), mAvailable(available) {}
+ virtual ~UpdateNetworkAvailabilityReq() {}
+ void proc() const {
+ LocAPIUpdateNetworkAvailabilityReqMsg msg(mApiImpl->mSocketName,
+ mAvailable);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> UpdateNetworkAvailabilityReq available=%d ", mAvailable);
+ }
+ const LocationClientApiImpl* mApiImpl;
+ const bool mAvailable;
+ };
+ mMsgTask->sendMsg(new (nothrow) UpdateNetworkAvailabilityReq(this, available));
+}
+
+void LocationClientApiImpl::getGnssEnergyConsumed(
+ GnssEnergyConsumedCb gnssEnergyConsumedCallback,
+ ResponseCb responseCallback) {
+
+ struct GetGnssEnergyConsumedReq : public LocMsg {
+ GetGnssEnergyConsumedReq(LocationClientApiImpl *apiImpl,
+ GnssEnergyConsumedCb gnssEnergyConsumedCb,
+ ResponseCb responseCb) :
+ mApiImpl(apiImpl),
+ mGnssEnergyConsumedCb(gnssEnergyConsumedCb),
+ mResponseCb(responseCb) {}
+
+ virtual ~GetGnssEnergyConsumedReq() {}
+ void proc() const {
+ mApiImpl->mGnssEnergyConsumedInfoCb = mGnssEnergyConsumedCb;
+ mApiImpl->mGnssEnergyConsumedResponseCb = mResponseCb;
+
+ // send msg to the hal daemon
+ if (nullptr != mApiImpl->mGnssEnergyConsumedInfoCb) {
+ LocAPIGetGnssEnergyConsumedReqMsg msg(mApiImpl->mSocketName);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ if (mResponseCb) {
+ if (true == rc) {
+ mResponseCb(LOCATION_RESPONSE_SUCCESS);
+ } else {
+ mResponseCb(LOCATION_RESPONSE_UNKOWN_FAILURE);
+ }
+ }
+ }
+ }
+
+ LocationClientApiImpl *mApiImpl;
+ GnssEnergyConsumedCb mGnssEnergyConsumedCb;
+ ResponseCb mResponseCb;
+ };
+
+ LOC_LOGd(">>> getGnssEnergyConsumed ");
+ mMsgTask->sendMsg(new (nothrow)GetGnssEnergyConsumedReq(
+ this, gnssEnergyConsumedCallback, responseCallback));
+}
+
+void LocationClientApiImpl::updateLocationSystemInfoListener(
+ LocationSystemInfoCb locSystemInfoCallback,
+ ResponseCb responseCallback) {
+
+ struct UpdateLocationSystemInfoListenerReq : public LocMsg {
+ UpdateLocationSystemInfoListenerReq(LocationClientApiImpl *apiImpl,
+ LocationSystemInfoCb sysInfoCb,
+ ResponseCb responseCb) :
+ mApiImpl(apiImpl),
+ mLocSysInfoCb(sysInfoCb),
+ mResponseCb(responseCb) {}
+
+ virtual ~UpdateLocationSystemInfoListenerReq() {}
+ void proc() const {
+ bool needIpc = false;
+ LocationCallbacksMask callbackMaskCopy = mApiImpl->mCallbacksMask;
+ // send msg to the hal daemon if the registration changes
+ if ((nullptr != mLocSysInfoCb) &&
+ (nullptr == mApiImpl->mLocationSysInfoCb)) {
+ // client registers for system info, set up the bit
+ mApiImpl->mCallbacksMask |= E_LOC_CB_SYSTEM_INFO_BIT;
+ needIpc = true;
+ } else if ((nullptr == mLocSysInfoCb) &&
+ (nullptr != mApiImpl->mLocationSysInfoCb)) {
+ // system info is no longer needed, clear the bit
+ mApiImpl->mCallbacksMask &= ~E_LOC_CB_SYSTEM_INFO_BIT;
+ needIpc = true;
+ }
+
+ // save the new callback
+ mApiImpl->mLocationSysInfoCb = mLocSysInfoCb;
+ mApiImpl->mLocationSysInfoResponseCb = mResponseCb;
+
+ // inform hal daemon of updated callback only when changed
+ if (needIpc == true) {
+ if (mApiImpl->mHalRegistered) {
+ LocAPIUpdateCallbacksReqMsg msg(mApiImpl->mSocketName,
+ mApiImpl->mCallbacksMask);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ LOC_LOGd(">>> UpdateCallbacksReq new callBacksMask=0x%x, "
+ "old mask =0x%x, rc=%d",
+ mApiImpl->mCallbacksMask, callbackMaskCopy, rc);
+ }
+ } else {
+ LOC_LOGd("No updateCallbacks because same callback");
+ }
+ }
+
+ LocationClientApiImpl *mApiImpl;
+ LocationSystemInfoCb mLocSysInfoCb;
+ ResponseCb mResponseCb;
+ };
+
+ LOC_LOGd(">>> updateLocationSystemInfoListener ");
+ mMsgTask->sendMsg(new (nothrow)UpdateLocationSystemInfoListenerReq(
+ this, locSystemInfoCallback, responseCallback));
+}
+
+/******************************************************************************
+LocationClientApiImpl - LocIpc onReceive handler
+******************************************************************************/
+void LocationClientApiImpl::capabilitesCallback(ELocMsgID msgId, const void* msgData) {
+
+ mHalRegistered = true;
+ const LocAPICapabilitiesIndMsg* pCapabilitiesIndMsg =
+ (LocAPICapabilitiesIndMsg*)(msgData);
+ mCapsMask = parseCapabilitiesMask(pCapabilitiesIndMsg->capabilitiesMask);
+
+ if (mCapabilitiesCb) {
+ mCapabilitiesCb(mCapsMask);
+ }
+
+ // send updatecallback request
+ if (0 != mCallbacksMask) {
+ LocAPIUpdateCallbacksReqMsg msg(mSocketName, mCallbacksMask);
+ bool rc = sendMessage(reinterpret_cast<uint8_t*>(&msg), sizeof(msg));
+ LOC_LOGd(">>> UpdateCallbacksReq callBacksMask=0x%x rc=%d", mCallbacksMask, rc);
+ }
+
+ LOC_LOGe(">>> session id %d, cap mask 0x%x", mSessionId, mCapsMask);
+ if (mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) {
+ // force mSessionId to invalid so startTracking will start the sesssion
+ // if hal deamon crashes and restarts in the middle of a session
+ mSessionId = LOCATION_CLIENT_SESSION_ID_INVALID;
+ TrackingOptions trackOption;
+ trackOption.setLocationOptions(mLocationOptions);
+ (void)startTracking(trackOption);
+ }
+}
+
+void LocationClientApiImpl::pingTest(PingTestCb pingTestCallback) {
+
+ mPingTestCb = pingTestCallback;
+
+ struct PingTestReq : public LocMsg {
+ PingTestReq(LocationClientApiImpl *apiImpl) : mApiImpl(apiImpl){}
+ virtual ~PingTestReq() {}
+ void proc() const {
+ LocAPIPingTestReqMsg msg(mApiImpl->mSocketName);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg), sizeof(msg));
+ }
+ LocationClientApiImpl *mApiImpl;
+ };
+ mMsgTask->sendMsg(new (nothrow) PingTestReq(this));
+ return;
+}
+
+void LocationClientApiImpl::diagLogGnssLocation(const GnssLocation &gnssLocation) {
+#ifndef FEATURE_EXTERNAL_AP
+ if (!mDiagIface) {
+ return;
+ }
+
+ diagBuffSrc bufferSrc = BUFFER_INVALID;
+ clientDiagGnssLocationStructType* diagGnssLocPtr = nullptr;
+ diagGnssLocPtr = (clientDiagGnssLocationStructType*)
+ mDiagIface->logAlloc(LOG_GNSS_CLIENT_API_LOCATION_REPORT_C,
+ sizeof(clientDiagGnssLocationStructType), &bufferSrc);
+ if (diagGnssLocPtr == NULL) {
+ LOC_LOGv("diag memory alloc failed");
+ return;
+ }
+ populateClientDiagLocation(diagGnssLocPtr, gnssLocation);
+ diagGnssLocPtr->version = LOG_CLIENT_LOCATION_DIAG_MSG_VERSION;
+
+ mDiagIface->logCommit(diagGnssLocPtr, bufferSrc,
+ LOG_GNSS_CLIENT_API_LOCATION_REPORT_C,
+ sizeof(clientDiagGnssLocationStructType));
+#endif // FEATURE_EXTERNAL_AP
+}
+
+/******************************************************************************
+LocationClientApiImpl -ILocIpcListener
+******************************************************************************/
+void IpcListener::onListenerReady() {
+ struct ClientRegisterReq : public LocMsg {
+ ClientRegisterReq(LocationClientApiImpl& apiImpl) : mApiImpl(apiImpl) {}
+ void proc() const {
+ LocAPIClientRegisterReqMsg msg(mApiImpl.mSocketName, LOCATION_CLIENT_API);
+ bool rc = mApiImpl.sendMessage(reinterpret_cast<uint8_t *>(&msg), sizeof(msg));
+ LOC_LOGd(">>> onListenerReady::ClientRegisterReqMsg rc=%d", rc);
+ }
+ LocationClientApiImpl& mApiImpl;
+ };
+ mMsgTask.sendMsg(new (nothrow) ClientRegisterReq(mApiImpl));
+}
+
+void IpcListener::onReceive(const char* data, uint32_t length,
+ const LocIpcRecver* recver) {
+ struct OnReceiveHandler : public LocMsg {
+#ifndef FEATURE_EXTERNAL_AP
+ OnReceiveHandler(LocationClientApiImpl& apiImpl, IpcListener& listener,
+ const char* data, uint32_t length, LocDiagIface* mDiagIface) :
+ mApiImpl(apiImpl), mListener(listener), mMsgData(data, length),
+ mDiagInterface(mDiagIface) {}
+#else
+ OnReceiveHandler(LocationClientApiImpl& apiImpl, IpcListener& listener,
+ const char* data, uint32_t length) :
+ mApiImpl(apiImpl), mListener(listener), mMsgData(data, length) {}
+#endif
+
+ virtual ~OnReceiveHandler() {}
+ void proc() const {
+ LocAPIMsgHeader *pMsg = (LocAPIMsgHeader *)(mMsgData.data());
+
+ switch (pMsg->msgId) {
+ case E_LOCAPI_CAPABILILTIES_MSG_ID:
+ {
+ LOC_LOGd("<<< capabilities indication");
+ if (sizeof(LocAPICapabilitiesIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ mApiImpl.capabilitesCallback(pMsg->msgId, (void*)pMsg);
+ break;
+ }
+
+ case E_LOCAPI_HAL_READY_MSG_ID:
+ {
+ LOC_LOGd("<<< HAL ready");
+ if (sizeof(LocAPIHalReadyIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+
+ // when hal daemon crashes, we need to find the new node/port
+ // when remote socket api is used
+ // this code can not be moved to inside of onListenerReady as
+ // onListenerReady can be invoked from other places
+ if (mApiImpl.mIpcSender != nullptr) {
+ mApiImpl.mIpcSender->informRecverRestarted();
+ }
+
+ // location hal deamon has restarted, need to set this
+ // flag to false to prevent messages to be sent to hal
+ // before registeration completes
+ mApiImpl.mHalRegistered = false;
+ mListener.onListenerReady();
+ break;
+ }
+
+ case E_LOCAPI_START_TRACKING_MSG_ID:
+ case E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID:
+ case E_LOCAPI_STOP_TRACKING_MSG_ID:
+ case E_LOCAPI_START_BATCHING_MSG_ID:
+ case E_LOCAPI_STOP_BATCHING_MSG_ID:
+ case E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID:
+ {
+ LOC_LOGd("<<< response message, msgId = %d", pMsg->msgId);
+ if (sizeof(LocAPIGenericRespMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ const LocAPIGenericRespMsg* pRespMsg = (LocAPIGenericRespMsg*)(pMsg);
+ LocationResponse response = parseLocationError(pRespMsg->err);
+ if (mApiImpl.mResponseCb) {
+ mApiImpl.mResponseCb(response);
+ }
+ break;
+ }
+ case E_LOCAPI_ADD_GEOFENCES_MSG_ID:
+ case E_LOCAPI_REMOVE_GEOFENCES_MSG_ID:
+ case E_LOCAPI_MODIFY_GEOFENCES_MSG_ID:
+ case E_LOCAPI_PAUSE_GEOFENCES_MSG_ID:
+ case E_LOCAPI_RESUME_GEOFENCES_MSG_ID:
+ {
+ LOC_LOGd("<<< collective response message, msgId = %d", pMsg->msgId);
+ const LocAPICollectiveRespMsg* pRespMsg = (LocAPICollectiveRespMsg*)(pMsg);
+ std::vector<pair<Geofence, LocationResponse>> responses{};
+ for (int i=0; i<pRespMsg->collectiveRes.count; ++i) {
+ responses.push_back(make_pair(
+ mApiImpl.mGeofenceMap.at(
+ (*(pRespMsg->collectiveRes.resp + i)).clientId),
+ parseLocationError(
+ (*(pRespMsg->collectiveRes.resp + i)).error)));
+ if (LOCATION_ERROR_SUCCESS !=
+ (*(pRespMsg->collectiveRes.resp + i)).error ||
+ E_LOCAPI_REMOVE_GEOFENCES_MSG_ID == pMsg->msgId) {
+ mApiImpl.eraseGeofenceMap(1, const_cast<uint32_t*>(
+ &((*(pRespMsg->collectiveRes.resp + i)).clientId)));
+ }
+ }
+ if (mApiImpl.mCollectiveResCb) {
+ mApiImpl.mCollectiveResCb(responses);
+ }
+ break;
+ }
+
+ // async indication messages
+ case E_LOCAPI_LOCATION_MSG_ID:
+ {
+ LOC_LOGd("<<< message = location");
+ if (sizeof(LocAPILocationIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ LocationCallbacksMask tempMask =
+ (E_LOC_CB_DISTANCE_BASED_TRACKING_BIT | E_LOC_CB_SIMPLE_LOCATION_INFO_BIT);
+ if ((mApiImpl.mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) &&
+ (mApiImpl.mCallbacksMask & tempMask)) {
+ const LocAPILocationIndMsg* pLocationIndMsg = (LocAPILocationIndMsg*)(pMsg);
+ Location location = parseLocation(pLocationIndMsg->locationNotification);
+ if (mApiImpl.mLocationCb) {
+ mApiImpl.mLocationCb(location);
+ }
+ }
+ break;
+ }
+
+ case E_LOCAPI_BATCHING_MSG_ID:
+ {
+ LOC_LOGd("<<< message = batching");
+ if (mApiImpl.mCallbacksMask & E_LOC_CB_BATCHING_BIT) {
+ const LocAPIBatchingIndMsg* pBatchingIndMsg =
+ (LocAPIBatchingIndMsg*)(pMsg);
+ std::vector<Location> locationVector;
+ BatchingStatus status = BATCHING_STATUS_INACTIVE;
+ if (BATCHING_STATUS_POSITION_AVAILABE ==
+ pBatchingIndMsg->batchNotification.status) {
+ for (int i=0; i<pBatchingIndMsg->batchNotification.count; ++i) {
+ locationVector.push_back(parseLocation(
+ *(pBatchingIndMsg->batchNotification.location +
+ i)));
+ }
+ status = BATCHING_STATUS_ACTIVE;
+ } else if (BATCHING_STATUS_TRIP_COMPLETED ==
+ pBatchingIndMsg->batchNotification.status) {
+ mApiImpl.stopBatching(0);
+ status = BATCHING_STATUS_DONE;
+ } else {
+ LOC_LOGe("invalid Batching Status!");
+ break;
+ }
+
+ if (mApiImpl.mBatchingCb) {
+ mApiImpl.mBatchingCb(locationVector, status);
+ }
+ }
+ break;
+ }
+
+ case E_LOCAPI_GEOFENCE_BREACH_MSG_ID:
+ {
+ LOC_LOGd("<<< message = geofence breach");
+ if (mApiImpl.mCallbacksMask & E_LOCAPI_GEOFENCE_BREACH_MSG_ID) {
+ const LocAPIGeofenceBreachIndMsg* pGfBreachIndMsg =
+ (LocAPIGeofenceBreachIndMsg*)(pMsg);
+ std::vector<Geofence> geofences;
+ for (int i=0; i<pGfBreachIndMsg->gfBreachNotification.count;
+ ++i) {
+ geofences.push_back(mApiImpl.mGeofenceMap.at(
+ *(pGfBreachIndMsg->gfBreachNotification.id + i)));
+ }
+ if (mApiImpl.mGfBreachCb) {
+ mApiImpl.mGfBreachCb(geofences,
+ parseLocation(
+ pGfBreachIndMsg->gfBreachNotification.location),
+ GeofenceBreachTypeMask(
+ pGfBreachIndMsg->gfBreachNotification.type),
+ pGfBreachIndMsg->gfBreachNotification.timestamp);
+ }
+ }
+ break;
+ }
+
+ case E_LOCAPI_LOCATION_INFO_MSG_ID:
+ {
+ LOC_LOGd("<<< message = location info");
+ if (sizeof(LocAPILocationInfoIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ if ((mApiImpl.mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) &&
+ (mApiImpl.mCallbacksMask & E_LOC_CB_GNSS_LOCATION_INFO_BIT)) {
+ const LocAPILocationInfoIndMsg* pLocationInfoIndMsg =
+ (LocAPILocationInfoIndMsg*)(pMsg);
+ GnssLocation gnssLocation =
+ parseLocationInfo(pLocationInfoIndMsg->gnssLocationInfoNotification);
+
+ if (mApiImpl.mGnssLocationCb) {
+ mApiImpl.mGnssLocationCb(gnssLocation);
+ }
+ mApiImpl.diagLogGnssLocation(gnssLocation);
+ }
+ break;
+ }
+ case E_LOCAPI_ENGINE_LOCATIONS_INFO_MSG_ID:
+ {
+ LOC_LOGd("<<< message = engine location info\n");
+
+ if ((mApiImpl.mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) &&
+ (mApiImpl.mCallbacksMask & E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT)) {
+ const LocAPIEngineLocationsInfoIndMsg* pEngLocationsInfoIndMsg =
+ (LocAPIEngineLocationsInfoIndMsg*)(pMsg);
+
+ if (pEngLocationsInfoIndMsg->getMsgSize() != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+
+ std::vector<GnssLocation> engLocationsVector;
+ for (int i=0; i< pEngLocationsInfoIndMsg->count; i++) {
+ GnssLocation gnssLocation =
+ parseLocationInfo(pEngLocationsInfoIndMsg->engineLocationsInfo[i]);
+ engLocationsVector.push_back(gnssLocation);
+ mApiImpl.diagLogGnssLocation(gnssLocation);
+ }
+
+ if (mApiImpl.mEngLocationsCb) {
+ mApiImpl.mEngLocationsCb(engLocationsVector);
+ }
+ }
+ break;
+ }
+
+ case E_LOCAPI_SATELLITE_VEHICLE_MSG_ID:
+ {
+ LOC_LOGd("<<< message = sv");
+ if (sizeof(LocAPISatelliteVehicleIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ if (mApiImpl.mCallbacksMask & E_LOC_CB_GNSS_SV_BIT) {
+ const LocAPISatelliteVehicleIndMsg* pSvIndMsg =
+ (LocAPISatelliteVehicleIndMsg*)(pMsg);
+ std::vector<GnssSv> gnssSvsVector;
+ for (int i=0; i< pSvIndMsg->gnssSvNotification.count; i++) {
+ GnssSv gnssSv;
+ gnssSv = parseGnssSv(pSvIndMsg->gnssSvNotification.gnssSvs[i]);
+ gnssSvsVector.push_back(gnssSv);
+ }
+ if (mApiImpl.mGnssSvCb) {
+ mApiImpl.mGnssSvCb(gnssSvsVector);
+ }
+#ifndef FEATURE_EXTERNAL_AP
+ if (!mDiagInterface) {
+ break;
+ }
+ diagBuffSrc bufferSrc = BUFFER_INVALID;
+ clientDiagGnssSvStructType* diagGnssSvPtr = nullptr;
+ diagGnssSvPtr = (clientDiagGnssSvStructType*)mDiagInterface->logAlloc(
+ LOG_GNSS_CLIENT_API_SV_REPORT_C,
+ sizeof(clientDiagGnssSvStructType), &bufferSrc);
+ if (diagGnssSvPtr == NULL) {
+ LOC_LOGv("memory alloc failed");
+ break;
+ }
+ populateClientDiagGnssSv(diagGnssSvPtr, gnssSvsVector);
+ diagGnssSvPtr->version = LOG_CLIENT_SV_REPORT_DIAG_MSG_VERSION;
+
+ mDiagInterface->logCommit(diagGnssSvPtr, bufferSrc,
+ LOG_GNSS_CLIENT_API_SV_REPORT_C,
+ sizeof(clientDiagGnssSvStructType));
+#endif // FEATURE_EXTERNAL_AP
+ }
+ break;
+ }
+
+ case E_LOCAPI_NMEA_MSG_ID:
+ {
+ if ((mApiImpl.mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) &&
+ (mApiImpl.mCallbacksMask & E_LOC_CB_GNSS_NMEA_BIT) &&
+ mApiImpl.mGnssNmeaCb) {
+ // nmea is variable length, can not be checked
+ const LocAPINmeaIndMsg* pNmeaIndMsg = (LocAPINmeaIndMsg*)(pMsg);
+ uint64_t timestamp = pNmeaIndMsg->gnssNmeaNotification.timestamp;
+ std::string nmea(pNmeaIndMsg->gnssNmeaNotification.nmea,
+ pNmeaIndMsg->gnssNmeaNotification.length);
+ LOC_LOGd("<<< message = nmea[%s]", nmea.c_str());
+ std::stringstream ss(nmea);
+ std::string each;
+ while(std::getline(ss, each, '\n')) {
+ each += '\n';
+ mApiImpl.mGnssNmeaCb(timestamp, each);
+ }
+
+#ifndef FEATURE_EXTERNAL_AP
+ if (!mDiagInterface) {
+ break;
+ }
+ size_t diagBufferSize = sizeof(clientDiagGnssNmeaStructType) +
+ pNmeaIndMsg->gnssNmeaNotification.length - 1;
+ diagBuffSrc bufferSrc = BUFFER_INVALID;
+ clientDiagGnssNmeaStructType* diagGnssNmeaPtr = nullptr;
+ diagGnssNmeaPtr = (clientDiagGnssNmeaStructType*)
+ mDiagInterface->logAlloc(LOG_GNSS_CLIENT_API_NMEA_REPORT_C,
+ diagBufferSize, &bufferSrc);
+ if (diagGnssNmeaPtr == NULL) {
+ LOC_LOGv("memory alloc failed");
+ break;
+ }
+ populateClientDiagNmea(diagGnssNmeaPtr, pNmeaIndMsg->gnssNmeaNotification);
+ diagGnssNmeaPtr->version = LOG_CLIENT_NMEA_REPORT_DIAG_MSG_VERSION;
+
+ mDiagInterface->logCommit(diagGnssNmeaPtr, bufferSrc,
+ LOG_GNSS_CLIENT_API_NMEA_REPORT_C,
+ sizeof(clientDiagGnssNmeaStructType));
+#endif // FEATURE_EXTERNAL_AP
+ }
+ break;
+ }
+
+ case E_LOCAPI_DATA_MSG_ID:
+ {
+ LOC_LOGd("<<< message = data");
+ if (sizeof(LocAPIDataIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ if ((mApiImpl.mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) &&
+ (mApiImpl.mCallbacksMask & E_LOC_CB_GNSS_DATA_BIT)) {
+ const LocAPIDataIndMsg* pDataIndMsg = (LocAPIDataIndMsg*)(pMsg);
+ GnssData gnssData =
+ parseGnssData(pDataIndMsg->gnssDataNotification);
+ if (mApiImpl.mGnssDataCb) {
+ mApiImpl.mGnssDataCb(gnssData);
+ }
+ }
+ break;
+ }
+
+ case E_LOCAPI_MEAS_MSG_ID:
+ {
+ LOC_LOGd("<<< message = measurements");
+ if (sizeof(LocAPIMeasIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ if ((mApiImpl.mSessionId != LOCATION_CLIENT_SESSION_ID_INVALID) &&
+ (mApiImpl.mCallbacksMask & E_LOC_CB_GNSS_MEAS_BIT)) {
+ const LocAPIMeasIndMsg* pMeasIndMsg = (LocAPIMeasIndMsg*)(pMsg);
+ GnssMeasurements gnssMeasurements =
+ parseGnssMeasurements(pMeasIndMsg->gnssMeasurementsNotification);
+ if (mApiImpl.mGnssMeasurementsCb) {
+ mApiImpl.mGnssMeasurementsCb(gnssMeasurements);
+ }
+#ifndef FEATURE_EXTERNAL_AP
+ if (!mDiagInterface) {
+ break;
+ }
+ diagBuffSrc bufferSrc = BUFFER_INVALID;
+ clientDiagGnssMeasurementsStructType* diagGnssMeasPtr = nullptr;
+ diagGnssMeasPtr =
+ (clientDiagGnssMeasurementsStructType*)mDiagInterface->logAlloc(
+ LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C,
+ sizeof(clientDiagGnssMeasurementsStructType),
+ &bufferSrc);
+ if (NULL == diagGnssMeasPtr) {
+ LOC_LOGv("memory alloc failed");
+ break;
+ }
+ populateClientDiagMeasurements(diagGnssMeasPtr, gnssMeasurements);
+ diagGnssMeasPtr->version = LOG_CLIENT_MEASUREMENTS_DIAG_MSG_VERSION;
+
+ mDiagInterface->logCommit(diagGnssMeasPtr, bufferSrc,
+ LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C,
+ sizeof(clientDiagGnssMeasurementsStructType));
+#endif // FEATURE_EXTERNAL_AP
+ }
+ break;
+ }
+
+ case E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID:
+ {
+ LOC_LOGd("<<< message = GNSS power consumption\n");
+ if (sizeof(LocAPIGnssEnergyConsumedIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ LocAPIGnssEnergyConsumedIndMsg* pEnergyMsg =
+ (LocAPIGnssEnergyConsumedIndMsg*) pMsg;
+ uint64_t energyNumber =
+ pEnergyMsg->totalGnssEnergyConsumedSinceFirstBoot;
+ uint32_t flags = 0;
+ if (energyNumber != 0xffffffffffffffff) {
+ flags = ENERGY_CONSUMED_SINCE_FIRST_BOOT_BIT;
+ }
+ GnssEnergyConsumedInfo energyConsumedInfo = {};
+ energyConsumedInfo.flags =
+ (location_client::GnssEnergyConsumedInfoMask) flags;
+ energyConsumedInfo.totalEnergyConsumedSinceFirstBoot = energyNumber;
+ if (flags == 0 && mApiImpl.mGnssEnergyConsumedResponseCb) {
+ mApiImpl.mGnssEnergyConsumedResponseCb(
+ LOCATION_RESPONSE_UNKOWN_FAILURE);
+ } else if (mApiImpl.mGnssEnergyConsumedInfoCb){
+ mApiImpl.mGnssEnergyConsumedInfoCb(energyConsumedInfo);
+ }
+ break;
+ }
+
+ case E_LOCAPI_LOCATION_SYSTEM_INFO_MSG_ID:
+ {
+ LOC_LOGd("<<< message = location system info");
+ if (sizeof(LocAPILocationSystemInfoIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ if (mApiImpl.mCallbacksMask & E_LOC_CB_SYSTEM_INFO_BIT) {
+ const LocAPILocationSystemInfoIndMsg * pDataIndMsg =
+ (LocAPILocationSystemInfoIndMsg*)(pMsg);
+ LocationSystemInfo locationSystemInfo =
+ parseLocationSystemInfo(pDataIndMsg->locationSystemInfo);
+ if (mApiImpl.mLocationSysInfoCb) {
+ mApiImpl.mLocationSysInfoCb(locationSystemInfo);
+ }
+ }
+ break;
+ }
+
+ case E_LOCAPI_PINGTEST_MSG_ID:
+ {
+ LOC_LOGd("<<< ping message %d", pMsg->msgId);
+ if (sizeof(LocAPIPingTestIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ const LocAPIPingTestIndMsg* pIndMsg = (LocAPIPingTestIndMsg*)(pMsg);
+ if (mApiImpl.mPingTestCb) {
+ uint32_t response = pIndMsg->data[0];
+ mApiImpl.mPingTestCb(response);
+ }
+ break;
+ }
+
+ default:
+ {
+ LOC_LOGe("<<< unknown message %d\n", pMsg->msgId);
+ break;
+ }
+ }
+ }
+ LocationClientApiImpl& mApiImpl;
+ IpcListener& mListener;
+ const string mMsgData;
+#ifndef FEATURE_EXTERNAL_AP
+ LocDiagIface* mDiagInterface;
+#endif //FEATURE_EXTERNAL_AP
+ };
+#ifndef FEATURE_EXTERNAL_AP
+ if (mApiImpl.mDiagIface == nullptr) {
+ void* libHandle = nullptr;
+ getLocDiagIface_t* getter = (getLocDiagIface_t*)dlGetSymFromLib(libHandle,
+ "liblocdiagiface.so.1.0.0", "getLocDiagIface");
+ if (getter != nullptr) {
+ mApiImpl.mDiagIface = (*getter)();
+ } else {
+ LOC_LOGe("<<< failed to load LocDiagIface library\n");
+ }
+ }
+ mMsgTask.sendMsg(new (nothrow) OnReceiveHandler(mApiImpl, *this, data, length,
+ mApiImpl.mDiagIface));
+#else
+ mMsgTask.sendMsg(new (nothrow) OnReceiveHandler(mApiImpl, *this, data, length));
+#endif // FEATURE_EXTERNAL_AP
+}
+
+/******************************************************************************
+LocationClientApiImpl - Not implemented overrides
+******************************************************************************/
+
+void LocationClientApiImpl::gnssNiResponse(uint32_t id, GnssNiResponse response) {
+}
+
+void LocationClientApiImpl::updateTrackingOptions(uint32_t id, TrackingOptions& options) {
+}
+
+uint32_t LocationClientApiImpl::resetConstellationConfig() {
+ return 0;
+}
+
+uint32_t LocationClientApiImpl::configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) {
+ return 0;
+}
+
+uint32_t LocationClientApiImpl::configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold, uint32_t energyBudget) {
+ return 0;
+}
+
+uint32_t LocationClientApiImpl::configPositionAssistedClockEstimator(bool enable) {
+ return 0;
+}
+
+uint32_t LocationClientApiImpl::configLeverArm(const LeverArmConfigInfo& configInfo) {
+ return 0;
+}
+
+uint32_t LocationClientApiImpl::configRobustLocation(bool enable, bool enableForE911) {
+ return 0;
+}
+
+} // namespace location_client
diff --git a/location/client_api/src/LocationClientApiImpl.h b/location/client_api/src/LocationClientApiImpl.h
new file mode 100644
index 0000000..a671243
--- /dev/null
+++ b/location/client_api/src/LocationClientApiImpl.h
@@ -0,0 +1,271 @@
+/* Copyright (c) 2018-2020, 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 LOCATIONCLIENTAPIIMPL_H
+#define LOCATIONCLIENTAPIIMPL_H
+
+#include <mutex>
+
+#include <loc_pla.h>
+#include <LocIpc.h>
+#include <LocationDataTypes.h>
+#include <ILocationAPI.h>
+#include <LocationClientApi.h>
+#include <MsgTask.h>
+#include <LocationApiMsg.h>
+#ifndef FEATURE_EXTERNAL_AP
+#include <LocDiagIface.h>
+#include <LocationClientApiLog.h>
+#endif
+
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <set>
+ #include <map>
+#else
+ #include <unordered_set>
+ #include <unordered_map>
+#endif
+
+using namespace std;
+using namespace loc_util;
+
+#ifndef FEATURE_EXTERNAL_AP
+typedef LocDiagIface* (getLocDiagIface_t)();
+#endif
+
+namespace location_client
+{
+#ifndef FEATURE_EXTERNAL_AP
+void translateDiagGnssLocationPositionDynamics(clientDiagGnssLocationPositionDynamics& out,
+ const GnssLocationPositionDynamics& in);
+static clientDiagGnssSystemTimeStructType parseDiagGnssTime(
+ const GnssSystemTimeStructType &halGnssTime);
+static clientDiagGnssGloTimeStructType parseDiagGloTime(const GnssGloTimeStructType &halGloTime);
+static void translateDiagSystemTime(clientDiagGnssSystemTime& out,
+ const GnssSystemTime& in);
+static clientDiagGnssLocationSvUsedInPosition parseDiagLocationSvUsedInPosition(
+ const GnssLocationSvUsedInPosition &halSv);
+static void translateDiagGnssSignalType(clientDiagGnssSignalTypeMask& out, GnssSignalTypeMask in);
+static clientDiagGnss_LocSvSystemEnumType parseDiagGnssConstellation(
+ Gnss_LocSvSystemEnumType gnssConstellation);
+static void translateDiagGnssMeasUsageInfo(clientDiagGnssMeasUsageInfo& out,
+ const GnssMeasUsageInfo& in);
+void populateClientDiagLocation(clientDiagGnssLocationStructType* diagGnssLocPtr,
+ const GnssLocation& gnssLocation);
+void populateClientDiagMeasurements(clientDiagGnssMeasurementsStructType* diagGnssMeasPtr,
+ const GnssMeasurements& gnssMeasurements);
+static void translateDiagGnssSv(clientDiagGnssSv& out, const GnssSv& in);
+void populateClientDiagGnssSv(clientDiagGnssSvStructType* diagGnssSvPtr,
+ std::vector<GnssSv>& gnssSvs);
+void populateClientDiagNmea(clientDiagGnssNmeaStructType *diagGnssNmeaPtr,
+ const LocAPINmeaSerializedPayload &nmeaSerializedPayload);
+#endif // FEATURE_EXTERNAL_AP
+
+enum ReportCbEnumType {
+ REPORT_CB_TYPE_NONE = 0,
+ /** cb for GNSS info, including location, sv info, nmea and
+ * etc */
+ REPORT_CB_GNSS_INFO = 1,
+ /** cb for GNSS info, including location, sv info, nmea and
+ * etc and also for location of other engines running in the
+ * system */
+ REPORT_CB_ENGINE_INFO = 2,
+};
+
+struct ClientCallbacks {
+ CapabilitiesCb capabilitycb;
+ ResponseCb responsecb;
+ CollectiveResponseCb collectivecb;
+ LocationCb locationcb;
+ BatchingCb batchingcb;
+ GeofenceBreachCb gfbreachcb;
+ GnssReportCbs gnssreportcbs;
+ EngineReportCbs engreportcbs;
+};
+
+typedef std::function<void(
+ uint32_t response
+)> PingTestCb;
+
+
+class GeofenceImpl: public std::enable_shared_from_this<GeofenceImpl> {
+ uint32_t mId;
+ Geofence mGeofence;
+ static uint32_t nextId();
+ static mutex mGfMutex;
+public:
+ GeofenceImpl(Geofence* geofence) : mId(nextId()), mGeofence(*geofence) {
+ }
+ void bindGeofence(Geofence* geofence) {
+ geofence->mGeofenceImpl = shared_from_this();
+ }
+ inline uint32_t getClientId() { return mId; }
+};
+
+class IpcListener;
+
+class LocationClientApiImpl : public ILocationAPI, public ILocationControlAPI {
+ friend IpcListener;
+public:
+ LocationClientApiImpl(CapabilitiesCb capabitiescb);
+ void destroy();
+
+ // Tracking
+ virtual void updateCallbacks(LocationCallbacks&) override;
+
+ virtual uint32_t startTracking(TrackingOptions&) override;
+
+ virtual void stopTracking(uint32_t id) override;
+
+ virtual void updateTrackingOptions(uint32_t id, TrackingOptions&) override;
+
+ //Batching
+ virtual uint32_t startBatching(BatchingOptions&) override;
+
+ virtual void stopBatching(uint32_t id) override;
+
+ virtual void updateBatchingOptions(uint32_t id, BatchingOptions&) override;
+
+ virtual void getBatchedLocations(uint32_t id, size_t count) override;
+
+ //Geofence
+ virtual uint32_t* addGeofences(size_t count, GeofenceOption*,
+ GeofenceInfo*) override;
+
+ virtual void removeGeofences(size_t count, uint32_t* ids) override;
+
+ virtual void modifyGeofences(size_t count, uint32_t* ids,
+ GeofenceOption* options) override;
+
+ virtual void pauseGeofences(size_t count, uint32_t* ids) override;
+
+ virtual void resumeGeofences(size_t count, uint32_t* ids) override;
+
+ //GNSS
+ virtual void gnssNiResponse(uint32_t id, GnssNiResponse response) override;
+
+ // other
+ virtual uint32_t* gnssUpdateConfig(GnssConfig config) override;
+ virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) override;
+ // config API
+ virtual uint32_t resetConstellationConfig() override;
+ virtual uint32_t configConstellations(const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) override;
+ virtual uint32_t configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold, uint32_t energyBudget) override;
+ virtual uint32_t configPositionAssistedClockEstimator(bool enable) override;
+ virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) override;
+ virtual uint32_t configRobustLocation(bool enable, bool enableForE911) override;
+
+ // other interface
+ void updateNetworkAvailability(bool available);
+ void updateCallbackFunctions(const ClientCallbacks&,
+ ReportCbEnumType reportCbType = REPORT_CB_TYPE_NONE);
+ void getGnssEnergyConsumed(GnssEnergyConsumedCb gnssEnergyConsumedCallback,
+ ResponseCb responseCallback);
+ void updateLocationSystemInfoListener(LocationSystemInfoCb locSystemInfoCallback,
+ ResponseCb responseCallback);
+ void diagLogGnssLocation(const GnssLocation &gnssLocation);
+ inline LocationCapabilitiesMask getCapabilities() {return mCapsMask;}
+
+ bool checkGeofenceMap(size_t count, uint32_t* ids);
+ void addGeofenceMap(uint32_t id, Geofence& geofence);
+ void eraseGeofenceMap(size_t count, uint32_t* ids);
+
+ std::vector<uint32_t> mLastAddedClientIds;
+ std::unordered_map<uint32_t, Geofence> mGeofenceMap; //clientId --> Geofence object
+ // convenient methods
+ inline bool sendMessage(const uint8_t* data, uint32_t length) const {
+ return (mIpcSender != nullptr) && LocIpc::send(*mIpcSender, data, length);
+ }
+
+ void pingTest(PingTestCb pingTestCallback);
+
+private:
+ ~LocationClientApiImpl();
+ void capabilitesCallback(ELocMsgID msgId, const void* msgData);
+ void updateTrackingOptionsSync(LocationClientApiImpl* pImpl, TrackingOptions& option);
+
+ // internal session parameter
+ static uint32_t mClientIdGenerator;
+ static mutex mMutex;
+ uint32_t mClientId;
+ uint32_t mSessionId;
+ uint32_t mBatchingId;
+ bool mHalRegistered;
+ // For client on different processor, socket name will start with
+ // defined constant of SOCKET_TO_EXTERANL_AP_LOCATION_CLIENT_BASE.
+ // For client on same processor, socket name will start with
+ // SOCKET_LOC_CLIENT_DIR + LOC_CLIENT_NAME_PREFIX.
+ char mSocketName[MAX_SOCKET_PATHNAME_LENGTH];
+ // for client on a different processor, 0 is invalid
+ uint32_t mInstanceId;
+ LocationCallbacksMask mCallbacksMask;
+ LocationOptions mLocationOptions;
+ BatchingOptions mBatchingOptions;
+ LocationCapabilitiesMask mCapsMask;
+
+ // callbacks
+ CapabilitiesCb mCapabilitiesCb;
+ ResponseCb mResponseCb;
+ CollectiveResponseCb mCollectiveResCb;
+ LocationCb mLocationCb;
+ BatchingCb mBatchingCb;
+ GeofenceBreachCb mGfBreachCb;
+ PingTestCb mPingTestCb;
+
+ // location callbacks
+ GnssLocationCb mGnssLocationCb;
+ EngineLocationsCb mEngLocationsCb;
+
+ // other GNSS related callback
+ GnssSvCb mGnssSvCb;
+ GnssNmeaCb mGnssNmeaCb;
+ GnssDataCb mGnssDataCb;
+ GnssMeasurementsCb mGnssMeasurementsCb;
+
+ GnssEnergyConsumedCb mGnssEnergyConsumedInfoCb;
+ ResponseCb mGnssEnergyConsumedResponseCb;
+
+ LocationSystemInfoCb mLocationSysInfoCb;
+ ResponseCb mLocationSysInfoResponseCb;
+
+ MsgTask* mMsgTask;
+
+ LocIpc mIpc;
+ shared_ptr<LocIpcSender> mIpcSender;
+
+#ifndef FEATURE_EXTERNAL_AP
+ // wrapper around diag interface to handle case when diag service starts late
+ LocDiagIface* mDiagIface;
+#endif
+};
+
+} // namespace location_client
+
+#endif /* LOCATIONCLIENTAPIIMPL_H */
diff --git a/location/client_api/src/LocationClientApiLog.h b/location/client_api/src/LocationClientApiLog.h
new file mode 100644
index 0000000..af4c4e6
--- /dev/null
+++ b/location/client_api/src/LocationClientApiLog.h
@@ -0,0 +1,834 @@
+
+/* Copyright (c) 2019-2020 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 LOCATION_CLIENT_API_LOG_H
+#define LOCATION_CLIENT_API_LOG_H
+
+#include <stdint.h>
+#include <time.h>
+#include <comdef.h>
+#include <log.h>
+#include <log_codes.h>
+#include "LocationClientApi.h"
+
+#define CLIENT_DIAG_GNSS_SV_MAX (176)
+#define CLIENT_DIAG_GNSS_MEASUREMENTS_MAX (128)
+#define LOG_CLIENT_LOCATION_DIAG_MSG_VERSION (2)
+#define LOG_CLIENT_SV_REPORT_DIAG_MSG_VERSION (2)
+#define LOG_CLIENT_NMEA_REPORT_DIAG_MSG_VERSION (1)
+#define LOG_CLIENT_MEASUREMENTS_DIAG_MSG_VERSION (1)
+
+
+#ifndef LOG_GNSS_CLIENT_API_NMEA_REPORT_C
+#define LOG_GNSS_CLIENT_API_NMEA_REPORT_C (0x1CB2)
+#endif
+
+#ifndef LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C
+#define LOG_GNSS_CLIENT_API_MEASUREMENTS_REPORT_C (0x1CB7)
+#endif
+
+namespace location_client
+{
+
+/** Flags to indicate which values are valid in a Location */
+typedef uint16_t clientDiagLocationFlagsMask;
+typedef enum {
+ /** location has valid latitude and longitude */
+ CLIENT_DIAG_LOCATION_HAS_LAT_LONG_BIT = (1<<0),
+ /** location has valid altitude */
+ CLIENT_DIAG_LOCATION_HAS_ALTITUDE_BIT = (1<<1),
+ /** location has valid speed */
+ CLIENT_DIAG_LOCATION_HAS_SPEED_BIT = (1<<2),
+ /** location has valid bearing */
+ CLIENT_DIAG_LOCATION_HAS_BEARING_BIT = (1<<3),
+ /** location has valid accuracy */
+ CLIENT_DIAG_LOCATION_HAS_ACCURACY_BIT = (1<<4),
+ /** location has valid vertical accuracy */
+ CLIENT_DIAG_LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5),
+ /** location has valid speed accuracy */
+ CLIENT_DIAG_LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6),
+ /** location has valid bearing accuracy */
+ CLIENT_DIAG_LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7),
+ /** location has valid valid timestamp */
+ CLIENT_DIAG_LOCATION_HAS_TIMESTAMP_BIT = (1<<8)
+} clientDiagLocationFlagsBits;
+
+typedef uint32_t clientDiagGnssLocationPosDataMask;
+typedef enum {
+ /** Navigation data has Forward Acceleration */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT = (1<<0),
+ /** Navigation data has Sideward Acceleration */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT = (1<<1),
+ /** Navigation data has Vertical Acceleration */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT = (1<<2),
+ /** Navigation data has Heading Rate */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_RATE_BIT = (1<<3),
+ /** Navigation data has Body pitch */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_BIT = (1<<4),
+ /** Navigation data has Forward Acceleration uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT = (1<<5),
+ /** Navigation data has Sideward Acceleration uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT = (1<<6),
+ /** Navigation data has Vertical Acceleration uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT = (1<<7),
+ /** Navigation data has Heading Rate uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT = (1<<8),
+ /** Navigation data has Body pitch uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT = (1<<9),
+ /** Navigation data has pitch rate */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_RATE_BIT = (1<<10),
+ /** Navigation data has body pitch rate uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_PITCH_RATE_UNC_BIT = (1<<11),
+ /** Navigation data has body roll */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_BIT = (1<<12),
+ /** Navigation data has body roll uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_UNC_BIT = (1<<13),
+ /** Navigation data has body rate roll */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_RATE_BIT = (1<<14),
+ /** Navigation data has body roll rate uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_ROLL_RATE_UNC_BIT = (1<<15),
+ /** Navigation data has body yaw */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_BIT = (1<<16),
+ /** Navigation data has body roll uncertainty */
+ CLIENT_DIAG_LOCATION_NAV_DATA_HAS_YAW_UNC_BIT = (1<<17)
+} clientDiagGnssLocationPosDataBits;
+
+typedef enum
+{
+ /** GPS satellite. */
+ CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GPS = 1,
+ /** GALILEO satellite. */
+ CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GALILEO = 2,
+ /** SBAS satellite. */
+ CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_SBAS = 3,
+ //Leave 4 blank for backward compatibility.
+ /** GLONASS satellite. */
+ CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GLONASS = 5,
+ /** BDS satellite. */
+ CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_BDS = 6,
+ /** QZSS satellite. */
+ CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_QZSS = 7
+} clientDiagGnss_LocSvSystemEnumType;
+
+typedef uint32_t clientDiagGnssSystemTimeStructTypeFlags;
+typedef enum {
+ CLIENT_DIAG_GNSS_SYSTEM_TIME_WEEK_VALID = (1 << 0),
+ CLIENT_DIAG_GNSS_SYSTEM_TIME_WEEK_MS_VALID = (1 << 1),
+ CLIENT_DIAG_GNSS_SYSTEM_CLK_TIME_BIAS_VALID = (1 << 2),
+ CLIENT_DIAG_GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
+ CLIENT_DIAG_GNSS_SYSTEM_REF_FCOUNT_VALID = (1 << 4),
+ CLIENT_DIAG_GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID = (1 << 5)
+} clientDiagGnssSystemTimeTypeBits;
+
+typedef uint32_t clientDiagGnssGloTimeStructTypeFlags;
+typedef enum {
+ CLIENT_DIAG_GNSS_CLO_DAYS_VALID = (1 << 0),
+ CLIENT_DIAG_GNSS_GLOS_MSEC_VALID = (1 << 1),
+ CLIENT_DIAG_GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2),
+ CLIENT_DIAG_GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
+ CLIENT_DIAG_GNSS_GLO_REF_FCOUNT_VALID = (1 << 4),
+ CLIENT_DIAG_GNSS_GLO_NUM_CLOCK_RESETS_VALID = (1 << 5),
+ CLIENT_DIAG_GNSS_GLO_FOUR_YEAR_VALID = (1 << 6)
+} clientDiagGnssGloTimeTypeBits;
+
+typedef PACKED struct PACKED_POST {
+ /** Validity mask for below fields */
+ clientDiagGnssSystemTimeStructTypeFlags validityMask;
+ /** Extended week number at reference tick.
+ Unit: Week.
+ Set to 65535 if week number is unknown.
+ For GPS:
+ Calculated from midnight, Jan. 6, 1980.
+ OTA decoded 10 bit GPS week is extended to map between:
+ [NV6264 to (NV6264 + 1023)].
+ NV6264: Minimum GPS week number configuration.
+ Default value of NV6264: 1738
+ For BDS:
+ Calculated from 00:00:00 on January 1, 2006 of Coordinated Universal Time (UTC).
+ For GAL:
+ Calculated from 00:00 UT on Sunday August 22, 1999 (midnight between August 21 and August 22).
+ */
+ uint16_t systemWeek;
+ /** Time in to the current week at reference tick.
+ Unit: Millisecond. Range: 0 to 604799999.
+ Check for systemClkTimeUncMs before use */
+ uint32_t systemMsec;
+ /** System clock time bias (sub-millisecond)
+ Units: Millisecond
+ Note: System time (TOW Millisecond) = systemMsec - systemClkTimeBias.
+ Check for systemClkTimeUncMs before use. */
+ float systemClkTimeBias;
+ /** Single sided maximum time bias uncertainty
+ Units: Millisecond */
+ float systemClkTimeUncMs;
+ /** FCount (free running HW timer) value. Don't use for relative time purpose
+ due to possible discontinuities.
+ Unit: Millisecond */
+ uint32_t refFCount;
+ /** Number of clock resets/discontinuities detected,
+ affecting the local hardware counter value. */
+ uint32_t numClockResets;
+} clientDiagGnssSystemTimeStructType;
+
+typedef PACKED struct PACKED_POST {
+ /** GLONASS day number in four years. Refer to GLONASS ICD.
+ Applicable only for GLONASS and shall be ignored for other constellations.
+ If unknown shall be set to 65535 */
+ uint16_t gloDays;
+ /** Validity mask for below fields */
+ clientDiagGnssGloTimeStructTypeFlags validityMask;
+ /** GLONASS time of day in Millisecond. Refer to GLONASS ICD.
+ Units: Millisecond
+ Check for gloClkTimeUncMs before use */
+ uint32_t gloMsec;
+ /** GLONASS clock time bias (sub-millisecond)
+ Units: Millisecond
+ Note: GLO time (TOD Millisecond) = gloMsec - gloClkTimeBias.
+ Check for gloClkTimeUncMs before use. */
+ float gloClkTimeBias;
+ /** Single sided maximum time bias uncertainty
+ Units: Millisecond */
+ float gloClkTimeUncMs;
+ /** FCount (free running HW timer) value. Don't use for relative time purpose
+ due to possible discontinuities.
+ Unit: Millisecond */
+ uint32_t refFCount;
+ /** Number of clock resets/discontinuities detected,
+ affecting the local hardware counter value. */
+ uint32_t numClockResets;
+ /** GLONASS four year number from 1996. Refer to GLONASS ICD.
+ Applicable only for GLONASS and shall be ignored for other constellations.
+ If unknown shall be set to 255 */
+ uint8_t gloFourYear;
+} clientDiagGnssGloTimeStructType;
+
+typedef PACKED union PACKED_POST {
+ clientDiagGnssSystemTimeStructType gpsSystemTime;
+ clientDiagGnssSystemTimeStructType galSystemTime;
+ clientDiagGnssSystemTimeStructType bdsSystemTime;
+ clientDiagGnssSystemTimeStructType qzssSystemTime;
+ clientDiagGnssGloTimeStructType gloSystemTime;
+} clientDiagSystemTimeStructUnion;
+
+typedef PACKED struct PACKED_POST {
+ /** Contains Body frame LocPosDataMask bits. */
+ clientDiagGnssLocationPosDataMask bodyFrameDataMask;
+ /** Forward Acceleration in body frame (m/s2)*/
+ float longAccel;
+ /** Sideward Acceleration in body frame (m/s2)*/
+ float latAccel;
+ /** Vertical Acceleration in body frame (m/s2)*/
+ float vertAccel;
+ /** Heading Rate (Radians/second) */
+ float yawRate;
+ /** Body pitch (Radians) */
+ float pitch;
+ /** Uncertainty of Forward Acceleration in body frame */
+ float longAccelUnc;
+ /** Uncertainty of Side-ward Acceleration in body frame */
+ float latAccelUnc;
+ /** Uncertainty of Vertical Acceleration in body frame */
+ float vertAccelUnc;
+ /** Uncertainty of Heading Rate */
+ float yawRateUnc;
+ /** Uncertainty of Body pitch */
+ float pitchUnc;
+ /** Body pitch rate (Radians/second) */
+ float pitchRate;
+ /** Uncertainty of pitch rate (Radians/second) */
+ float pitchRateUnc;
+ /** Roll of body frame. Clockwise positive. (Radian) */
+ float roll;
+ /** Uncertainty of Roll, 68% confidence level (radian) */
+ float rollUnc;
+ /** Roll rate of body frame. Clockwise positive. (radian/second)
+ */
+ float rollRate;
+ /** Uncertainty of Roll rate, 68% confidence level (radian/second) */
+ float rollRateUnc;
+ /** Yaw of body frame. Clockwise positive (radian) */
+ float yaw;
+ /** Uncertainty of Yaw, 68% confidence level (radian) */
+ float yawUnc;
+} clientDiagGnssLocationPositionDynamics;
+
+/** @struct
+ Time applicability of PVT report
+*/
+typedef PACKED struct PACKED_POST {
+ /** Specifies GNSS system time reported. Mandatory field */
+ clientDiagGnss_LocSvSystemEnumType gnssSystemTimeSrc;
+ /** Reporting of GPS system time is recommended.
+ If GPS time is unknown & other satellite system time is known,
+ it should be reported.
+ Mandatory field
+ */
+ clientDiagSystemTimeStructUnion u;
+} clientDiagGnssSystemTime;
+
+/** GNSS Signal Type and RF Band */
+typedef uint32_t clientDiagGnssSignalTypeMask;
+typedef enum {
+ /** GPS L1CA Signal */
+ CLIENT_DIAG_GNSS_SIGNAL_GPS_L1CA = (1<<0),
+ /** GPS L1C Signal */
+ CLIENT_DIAG_GNSS_SIGNAL_GPS_L1C = (1<<1),
+ /** GPS L2 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_GPS_L2 = (1<<2),
+ /** GPS L5 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_GPS_L5 = (1<<3),
+ /** GLONASS G1 (L1OF) RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_GLONASS_G1 = (1<<4),
+ /** GLONASS G2 (L2OF) RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_GLONASS_G2 = (1<<5),
+ /** GALILEO E1 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E1 = (1<<6),
+ /** GALILEO E5A RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E5A = (1<<7),
+ /** GALILEO E5B RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E5B = (1<<8),
+ /** BEIDOU B1 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1 = (1<<9),
+ /** BEIDOU B2 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2 = (1<<10),
+ /** QZSS L1CA RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_QZSS_L1CA = (1<<11),
+ /** QZSS L1S RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_QZSS_L1S = (1<<12),
+ /** QZSS L2 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_QZSS_L2 = (1<<13),
+ /** QZSS L5 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_QZSS_L5 = (1<<14),
+ /** SBAS L1 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_SBAS_L1 = (1<<15),
+ /** BEIDOU B1I RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1I = (1<<16),
+ /** BEIDOU B1C RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1C = (1<<17),
+ /** BEIDOU B2I RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2I = (1<<18),
+ /** BEIDOU B2AI RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2AI = (1<<19),
+ /** NAVIC L5 RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_NAVIC_L5 = (1<<20),
+ /** BEIDOU B2AQ RF Band */
+ CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2AQ = (1<<21)
+} clientDiagGnssSignalTypeBits;
+
+typedef PACKED struct PACKED_POST {
+ /** GnssSignalType mask */
+ clientDiagGnssSignalTypeMask gnssSignalType;
+ /** Specifies GNSS Constellation Type */
+ clientDiagGnss_LocSvSystemEnumType gnssConstellation;
+ /** GNSS SV ID.
+ For GPS: 1 to 32
+ For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255.
+ For SBAS: 120 to 151
+ For QZSS-L1CA:193 to 197
+ For BDS: 201 to 237
+ For GAL: 301 to 336 */
+ uint16_t gnssSvId;
+} clientDiagGnssMeasUsageInfo;
+
+typedef enum {
+ CLIENT_DIAG_GNSS_SV_TYPE_UNKNOWN = 0,
+ CLIENT_DIAG_GNSS_SV_TYPE_GPS,
+ CLIENT_DIAG_GNSS_SV_TYPE_SBAS,
+ CLIENT_DIAG_GNSS_SV_TYPE_GLONASS,
+ CLIENT_DIAG_GNSS_SV_TYPE_QZSS,
+ CLIENT_DIAG_GNSS_SV_TYPE_BEIDOU,
+ CLIENT_DIAG_GNSS_SV_TYPE_GALILEO,
+} clientDiagGnssSvType;
+
+typedef uint16_t clientDiagGnssSvOptionsMask;
+typedef enum {
+ CLIENT_DIAG_GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0),
+ CLIENT_DIAG_GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1),
+ CLIENT_DIAG_GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2),
+ CLIENT_DIAG_GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3)
+} clientDiagGnssSvOptionsBits;
+
+typedef PACKED struct PACKED_POST {
+ /** Unique Identifier */
+ uint16_t svId;
+ /** type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO) */
+ clientDiagGnssSvType type;
+ /** signal strength */
+ float cN0Dbhz;
+ /** elevation of SV (in degrees) */
+ float elevation;
+ /** azimuth of SV (in degrees) */
+ float azimuth;
+ /** Bitwise OR of GnssSvOptionsBits */
+ clientDiagGnssSvOptionsMask gnssSvOptionsMask;
+ /** carrier frequency of the signal tracked */
+ float carrierFrequencyHz;
+ /** Specifies GNSS signal type */
+ clientDiagGnssSignalTypeMask gnssSignalTypeMask;
+} clientDiagGnssSv;
+
+typedef uint16_t clientDiagLocationTechnologyMask;
+typedef enum {
+ /** location was calculated using GNSS */
+ CLIENT_DIAG_LOCATION_TECHNOLOGY_GNSS_BIT = (1<<0),
+ /** location was calculated using Cell */
+ CLIENT_DIAG_LOCATION_TECHNOLOGY_CELL_BIT = (1<<1),
+ /** location was calculated using WiFi */
+ CLIENT_DIAG_LOCATION_TECHNOLOGY_WIFI_BIT = (1<<2),
+ /** location was calculated using Sensors */
+ CLIENT_DIAG_LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3),
+} clientDiagLocationTechnologyBits;
+
+typedef uint16_t clientDiagDrCalibrationStatusMask;
+typedef enum {
+ /** Indicate that roll calibration is needed. Need to take more
+ * turns on level ground */
+ CLIENT_DIAG_DR_ROLL_CALIBRATION_NEEDED = (1<<0),
+ /** Indicate that pitch calibration is needed. Need to take more
+ * turns on level ground */
+ CLIENT_DIAG_DR_PITCH_CALIBRATION_NEEDED = (1<<1),
+ /** Indicate that yaw calibration is needed. Need to accelerate
+ * in a straight line */
+ CLIENT_DIAG_DR_YAW_CALIBRATION_NEEDED = (1<<2),
+ /** Indicate that odo calibration is needed. Need to accelerate
+ * in a straight line */
+ CLIENT_DIAG_DR_ODO_CALIBRATION_NEEDED = (1<<3),
+ /** Indicate that gyro calibration is needed. Need to take more
+ * turns on level ground */
+ CLIENT_DIAG_DR_GYRO_CALIBRATION_NEEDED = (1<<4)
+} clientDiagDrCalibrationStatusBits;
+
+typedef uint32_t clientDiagGnssLocationInfoFlagMask;
+typedef enum {
+ /** valid altitude mean sea level */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT = (1<<0),
+ /** valid pdop, hdop, and vdop */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_DOP_BIT = (1<<1),
+ /** valid magnetic deviation */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT = (1<<2),
+ /** valid horizontal reliability */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT = (1<<3),
+ /** valid vertical reliability */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_VER_RELIABILITY_BIT = (1<<4),
+ /** valid elipsode semi major */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5),
+ /** valid elipsode semi minor */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6),
+ /** valid accuracy elipsode azimuth */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7),
+ /** valid gnss sv used in pos data */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8),
+ /** valid navSolutionMask */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT = (1<<9),
+ /** valid LocPosTechMask */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),
+ /** valid LocSvInfoSource */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),
+ /** valid position dynamics data */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT = (1<<12),
+ /** valid gdop, tdop */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<13),
+ /** valid North standard deviation */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT = (1<<14),
+ /** valid East standard deviation */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_EAST_STD_DEV_BIT = (1<<15),
+ /** valid North Velocity */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_NORTH_VEL_BIT = (1<<16),
+ /** valid East Velocity */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_EAST_VEL_BIT = (1<<17),
+ /** valid Up Velocity */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_UP_VEL_BIT = (1<<18),
+ /** valid North Velocity Uncertainty */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT = (1<<19),
+ /** valid East Velocity Uncertainty */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT = (1<<20),
+ /** valid Up Velocity Uncertainty */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),
+ /** valid leap seconds */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),
+ /** valid time uncertainty */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23),
+ /** valid numSvUsedInPosition */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24),
+ /** valid calibrationConfidencePercent */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_PERCENT_BIT = (1<<25),
+ /** valid calibrationStatus */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT = (1<<26),
+ /** valid output engine type */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT = (1<<27),
+ /** valid output engine mask */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT = (1<<28),
+ /** valid output conformityIndex */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT = (1<<29),
+ /** GnssLocation has valid
+ * GnssLocation::llaVRPBased. */
+ CLIENT_DIAG_GNSS_LOCATION_INFO_LLA_VRP_BASED_BIT = (1<<30),
+} clientDiagGnssLocationInfoFlagBits;
+
+typedef enum {
+ CLIENT_DIAG_LOCATION_RELIABILITY_NOT_SET = 0,
+ CLIENT_DIAG_LOCATION_RELIABILITY_VERY_LOW,
+ CLIENT_DIAG_LOCATION_RELIABILITY_LOW,
+ CLIENT_DIAG_LOCATION_RELIABILITY_MEDIUM,
+ CLIENT_DIAG_LOCATION_RELIABILITY_HIGH,
+} clientDiagLocationReliability;
+
+typedef PACKED struct PACKED_POST {
+ uint64_t gpsSvUsedIdsMask;
+ uint64_t gloSvUsedIdsMask;
+ uint64_t galSvUsedIdsMask;
+ uint64_t bdsSvUsedIdsMask;
+ uint64_t qzssSvUsedIdsMask;
+} clientDiagGnssLocationSvUsedInPosition;
+
+typedef uint32_t clientDiagGnssLocationNavSolutionMask;
+typedef enum {
+ /** SBAS ionospheric correction is used*/
+ CLIENT_DIAG_LOCATION_SBAS_CORRECTION_IONO_BIT = (1<<0),
+ /** SBAS fast correction is used*/
+ CLIENT_DIAG_LOCATION_SBAS_CORRECTION_FAST_BIT = (1<<1),
+ /** SBAS long-tem correction is used*/
+ CLIENT_DIAG_LOCATION_SBAS_CORRECTION_LONG_BIT = (1<<2),
+ /** SBAS integrity information is used*/
+ CLIENT_DIAG_LOCATION_SBAS_INTEGRITY_BIT = (1<<3),
+ /** Position Report is DGNSS corrected*/
+ CLIENT_DIAG_LOCATION_NAV_CORRECTION_DGNSS_BIT = (1<<4),
+ /** Position Report is RTK corrected*/
+ CLIENT_DIAG_LOCATION_NAV_CORRECTION_RTK_BIT = (1<<5),
+ /** Position Report is PPP corrected*/
+ CLIENT_DIAG_LOCATION_NAV_CORRECTION_PPP_BIT = (1<<6)
+} clientDiagGnssLocationNavSolutionBits;
+
+typedef uint32_t clientDiagGnssLocationPosTechMask;
+typedef enum {
+ CLIENT_DIAG_LOCATION_POS_TECH_DEFAULT_BIT = 0,
+ CLIENT_DIAG_LOCATION_POS_TECH_SATELLITE_BIT = (1<<0),
+ CLIENT_DIAG_LOCATION_POS_TECH_CELLID_BIT = (1<<1),
+ CLIENT_DIAG_LOCATION_POS_TECH_WIFI_BIT = (1<<2),
+ CLIENT_DIAG_LOCATION_POS_TECH_SENSORS_BIT = (1<<3),
+ CLIENT_DIAG_LOCATION_POS_TECH_REFERENCE_LOCATION_BIT = (1<<4),
+ CLIENT_DIAG_LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5),
+ CLIENT_DIAG_LOCATION_POS_TECH_AFLT_BIT = (1<<6),
+ CLIENT_DIAG_LOCATION_POS_TECH_HYBRID_BIT = (1<<7),
+ CLIENT_DIAG_LOCATION_POS_TECH_PPE_BIT = (1<<8)
+} clientDiagGnssLocationPosTechBits;
+
+typedef enum {
+ /** This is the propagated/aggregated reports from all engines
+ running on the system (e.g.: DR/SPE/PPE). */
+ CLIENT_DIAG_LOC_OUTPUT_ENGINE_FUSED = 0,
+ /** This fix is the unmodified fix from modem GNSS engine */
+ CLIENT_DIAG_LOC_OUTPUT_ENGINE_SPE = 1,
+ /** This is the unmodified fix from PPP/RTK correction engine */
+ CLIENT_DIAG_LOC_OUTPUT_ENGINE_PPE = 2,
+ CLIENT_DIAG_LOC_OUTPUT_ENGINE_COUNT,
+} clientDiagLocOutputEngineType;
+
+typedef uint32_t clientDiagPositioningEngineMask;
+typedef enum {
+ CLIENT_DIAG_STANDARD_POSITIONING_ENGINE = (1 << 0),
+ CLIENT_DIAG_DEAD_RECKONING_ENGINE = (1 << 1),
+ CLIENT_DIAG_PRECISE_POSITIONING_ENGINE = (1 << 2)
+} clientDiagPositioningEngineBits;
+
+typedef PACKED struct PACKED_POST {
+ /** Latitude, in unit of degrees, range [-90.0, 90.0]. */
+ double latitude;
+
+ /** Longitude, in unit of degrees, range [-180.0, 180.0]. */
+ double longitude;
+
+ /** Altitude above the WGS 84 reference ellipsoid, in unit
+ of meters. */
+ float altitude;
+} clientDiagLLAInfo;
+
+typedef PACKED struct PACKED_POST {
+ /** Used by Logging Module
+ * Mandatory field */
+ log_hdr_type logHeader;
+ /** clientDiag Message Version
+ * Mandatory field */
+ uint8 version;
+ /** bitwise OR of LocationFlagsBits to mark which params are valid */
+ clientDiagLocationFlagsMask flags;
+ /** UTC timestamp for location fix, milliseconds since January 1, 1970 */
+ uint64_t timestamp;
+ /** in degrees; range [-90.0, 90.0] */
+ double latitude;
+ /** in degrees; range [-180.0, 180.0] */
+ double longitude;
+ /** in meters above the WGS 84 reference ellipsoid */
+ double altitude;
+ /** in meters per second */
+ float speed;
+ /** in degrees; range [0, 360) */
+ float bearing;
+ /** in meters */
+ float horizontalAccuracy;
+ /** in meters */
+ float verticalAccuracy;
+ /** in meters/second */
+ float speedAccuracy;
+ /** in degrees (0 to 359.999) */
+ float bearingAccuracy;
+ clientDiagLocationTechnologyMask techMask;
+ /** bitwise OR of GnssLocationInfoBits for param validity */
+ clientDiagGnssLocationInfoFlagMask gnssInfoFlags;
+ /** altitude wrt mean sea level */
+ float altitudeMeanSeaLevel;
+ /** position dilusion of precision */
+ float pdop;
+ /** horizontal dilusion of precision */
+ float hdop;
+ /** vertical dilusion of precision */
+ float vdop;
+ /** geometric dilution of precision */
+ float gdop;
+ /** time dilution of precision */
+ float tdop;
+ /** magnetic deviation */
+ float magneticDeviation;
+ /** horizontal reliability */
+ clientDiagLocationReliability horReliability;
+ /** vertical reliability */
+ clientDiagLocationReliability verReliability;
+ /** horizontal elliptical accuracy semi-major axis */
+ float horUncEllipseSemiMajor;
+ /** horizontal elliptical accuracy semi-minor axis */
+ float horUncEllipseSemiMinor;
+ /** horizontal elliptical accuracy azimuth */
+ float horUncEllipseOrientAzimuth;
+ /** North standard deviation Unit: Meters */
+ float northStdDeviation;
+ /** East standard deviation. Unit: Meters */
+ float eastStdDeviation;
+ /** North Velocity.Unit: Meters/sec */
+ float northVelocity;
+ /** East Velocity Unit: Meters/sec */
+ float eastVelocity;
+ /** Up Velocity Unit: Meters/sec */
+ float upVelocity;
+ float northVelocityStdDeviation;
+ float eastVelocityStdDeviation;
+ float upVelocityStdDeviation;
+ /** Gnss sv used in position data */
+ clientDiagGnssLocationSvUsedInPosition svUsedInPosition;
+ /** Nav solution mask to indicate sbas corrections */
+ clientDiagGnssLocationNavSolutionMask navSolutionMask;
+ /** Position technology used in computing this fix */
+ clientDiagGnssLocationPosTechMask posTechMask;
+ /** Body Frame Dynamics: 4wayAcceleration and pitch set with validity */
+ clientDiagGnssLocationPositionDynamics bodyFrameData;
+ /** GNSS System Time */
+ clientDiagGnssSystemTime gnssSystemTime;
+ /** Number of measurements received for use in fix */
+ uint8_t numOfMeasReceived;
+ /** Gnss measurement usage info */
+ clientDiagGnssMeasUsageInfo measUsageInfo[CLIENT_DIAG_GNSS_SV_MAX];
+ /** Leap Seconds */
+ uint8_t leapSeconds;
+ /** Time uncertainty in milliseconds */
+ float timeUncMs;
+ /** number of SV used in position report */
+ uint16_t numSvUsedInPosition;
+ /** Sensor calibration confidence percent, valid range [0,
+ * 100] */
+ uint8_t calibrationConfidencePercent;
+ /** Sensor calibration status */
+ clientDiagDrCalibrationStatusMask calibrationStatus;
+ /** boot timestamp in nano-second when this diag log packet is
+ * created and filled with the info at location client api
+ * layer */
+ uint64_t bootTimestampNs;
+ /** location engine type. When the fix. when the type is set to
+ LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
+ reports from all engines running on the system (e.g.:
+ DR/SPE/PPE). To check which location engine contributes to
+ the fused output, check for locOutputEngMask. */
+ clientDiagLocOutputEngineType locOutputEngType;
+ /** when loc output eng type is set to fused, this field
+ indicates the set of engines contribute to the fix. */
+ clientDiagPositioningEngineMask locOutputEngMask;
+ /** When robust location is enabled, this field
+ * will indicate how well the various input data considered for
+ * navigation solution conform to expectations.
+ * Range: [0.0, 1.0], with 0.0 for least conforming and 1.0 for
+ * most conforming. */
+ float conformityIndex;
+ /** VRR-based latitude/longitude/altitude. */
+ clientDiagLLAInfo llaVRPBased;
+} clientDiagGnssLocationStructType;
+
+typedef uint32_t clientDiagGnssMeasurementsDataFlagsMask;
+typedef enum {
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_SV_ID_BIT = (1 << 0),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT = (1 << 1),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_STATE_BIT = (1 << 2),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT = (1 << 3),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1 << 4),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT = (1 << 5),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT = (1 << 6),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1 << 7),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT = (1 << 8),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_ADR_BIT = (1 << 9),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT = (1 << 10),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT = (1 << 11),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT = (1 << 12),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT = (1 << 13),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT = (1 << 14),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT = (1 << 15),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT = (1 << 16),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT = (1 << 17),
+} clientDiagGnssMeasurementsDataFlagsBits;
+
+typedef uint32_t clientDiagGnssMeasurementsStateMask;
+typedef enum {
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT = 0,
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT = (1 << 0),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT = (1 << 1),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT = (1 << 2),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT = (1 << 3),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT = (1 << 4),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT = (1 << 5),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT = (1 << 6),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT = (1 << 7),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT = (1 << 8),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT = (1 << 9),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT = (1 << 10),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1 << 11),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT = (1 << 12),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT = (1 << 13),
+} clientDiagGnssMeasurementsStateBits;
+
+typedef uint16_t clientDiagGnssMeasurementsAdrStateMask;
+typedef enum {
+ CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN = 0,
+ CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT = (1 << 0),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT = (1 << 1),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT = (1 << 2),
+} clientDiagGnssMeasurementsAdrStateBits;
+
+typedef enum {
+ CLIENT_DIAG_GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0,
+ CLIENT_DIAG_GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT,
+ CLIENT_DIAG_GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT,
+} clientDiagGnssMeasurementsMultipathIndicator;
+
+typedef uint32_t clientDiagGnssMeasurementsClockFlagsMask;
+typedef enum {
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT = (1 << 0),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT = (1 << 1),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT = (1 << 2),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT = (1 << 3),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT = (1 << 4),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT = (1 << 5),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT = (1 << 6),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT = (1 << 7),
+ CLIENT_DIAG_GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1 << 8),
+} clientDiagGnssMeasurementsClockFlagsBits;
+
+typedef PACKED struct PACKED_POST {
+ clientDiagGnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits
+ int16_t svId;
+ clientDiagGnssSvType svType;
+ double timeOffsetNs;
+ clientDiagGnssMeasurementsStateMask stateMask; // bitwise OR of GnssMeasurementsStateBits
+ int64_t receivedSvTimeNs;
+ int64_t receivedSvTimeUncertaintyNs;
+ double carrierToNoiseDbHz;
+ double pseudorangeRateMps;
+ double pseudorangeRateUncertaintyMps;
+ clientDiagGnssMeasurementsAdrStateMask adrStateMask;
+ double adrMeters;
+ double adrUncertaintyMeters;
+ float carrierFrequencyHz;
+ int64_t carrierCycles;
+ double carrierPhase;
+ double carrierPhaseUncertainty;
+ clientDiagGnssMeasurementsMultipathIndicator multipathIndicator;
+ double signalToNoiseRatioDb;
+ double agcLevelDb;
+} clientDiagGnssMeasurementsData;
+
+typedef PACKED struct PACKED_POST {
+ clientDiagGnssMeasurementsClockFlagsMask flags;// bitwise OR of GnssMeasurementsClockFlagsBits
+ int16_t leapSecond;
+ int64_t timeNs;
+ double timeUncertaintyNs;
+ int64_t fullBiasNs;
+ double biasNs;
+ double biasUncertaintyNs;
+ double driftNsps;
+ double driftUncertaintyNsps;
+ uint32_t hwClockDiscontinuityCount;
+} clientDiagGnssMeasurementsClock;
+
+typedef PACKED struct PACKED_POST {
+ /** Used by Logging Module
+ * Mandatory field */
+ log_hdr_type logHeader;
+ /** clientDiag Message Version
+ * Mandatory field */
+ uint8 version;
+ uint32_t count; // number of items in GnssMeasurementsData array
+ clientDiagGnssMeasurementsClock clock; // clock
+ clientDiagGnssMeasurementsData measurements[CLIENT_DIAG_GNSS_MEASUREMENTS_MAX];
+} clientDiagGnssMeasurementsStructType;
+
+typedef PACKED struct PACKED_POST {
+ /** Used by Logging Module
+ * Mandatory field */
+ log_hdr_type logHeader;
+ /** clientDiag Message Version
+ * Mandatory field */
+ uint8 version;
+ /** number of SVs in the GnssSvs array */
+ uint32_t count;
+ clientDiagGnssSv gnssSvs[CLIENT_DIAG_GNSS_SV_MAX];
+} clientDiagGnssSvStructType;
+
+
+typedef PACKED struct PACKED_POST {
+ /** Used by Logging Module
+ * Mandatory field */
+ log_hdr_type logHeader;
+ /** clientDiag Message Version
+ * Mandatory field */
+ uint8 version;
+/** Timestamp of NMEA generation */
+ uint64_t timestamp;
+/** Length of nmea data */
+ uint32_t nmeaLength;
+/** One or more nmea strings separated by \n charachter */
+ uint8_t nmea[1];
+} clientDiagGnssNmeaStructType;
+
+}
+#endif /*LOCATION_CLIENT_API_LOG_H */
diff --git a/location/client_api/src/LocationClientApiUtils.cpp b/location/client_api/src/LocationClientApiUtils.cpp
new file mode 100644
index 0000000..6eab19c
--- /dev/null
+++ b/location/client_api/src/LocationClientApiUtils.cpp
@@ -0,0 +1,446 @@
+/* Copyright (c) 2019-2020 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 <LocationClientApiImpl.h>
+
+namespace location_client {
+
+void translateDiagGnssLocationPositionDynamics(clientDiagGnssLocationPositionDynamics& out,
+ const GnssLocationPositionDynamics& in) {
+ out.bodyFrameDataMask = in.bodyFrameDataMask;
+ out.longAccel = in.longAccel;
+ out.latAccel = in.latAccel;
+ out.vertAccel = in.vertAccel;
+ out.yawRate = in.yawRate;
+ out.pitch = in.pitch;
+ out.longAccelUnc = in.longAccelUnc;
+ out.latAccelUnc = in.latAccelUnc;
+ out.vertAccelUnc = in.vertAccelUnc;
+ out.yawRateUnc = in.yawRateUnc;
+ out.pitchUnc = in.pitchUnc;
+}
+
+clientDiagGnss_LocSvSystemEnumType parseDiagGnssConstellation(
+ Gnss_LocSvSystemEnumType gnssConstellation) {
+ clientDiagGnss_LocSvSystemEnumType constellation;
+ switch(gnssConstellation) {
+ case GNSS_LOC_SV_SYSTEM_GPS:
+ constellation = CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GPS;
+ break;
+ case GNSS_LOC_SV_SYSTEM_GALILEO:
+ constellation = CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GALILEO;
+ break;
+ case GNSS_LOC_SV_SYSTEM_SBAS:
+ constellation = CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_SBAS;
+ break;
+ case GNSS_LOC_SV_SYSTEM_GLONASS:
+ constellation = CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_GLONASS;
+ break;
+ case GNSS_LOC_SV_SYSTEM_BDS:
+ constellation = CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_BDS;
+ break;
+ case GNSS_LOC_SV_SYSTEM_QZSS:
+ constellation = CLIENT_DIAG_GNSS_LOC_SV_SYSTEM_QZSS;
+ break;
+ default:
+ constellation = (clientDiagGnss_LocSvSystemEnumType)~0;
+ break;
+ }
+ return constellation;
+}
+
+clientDiagGnssSystemTimeStructType parseDiagGnssTime(
+ const GnssSystemTimeStructType &halGnssTime) {
+
+ clientDiagGnssSystemTimeStructType gnssTime;
+ memset(&gnssTime, 0, sizeof(gnssTime));
+ uint32_t gnssTimeFlags = 0;
+
+ if (GNSS_SYSTEM_TIME_WEEK_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_TIME_WEEK_VALID;
+ gnssTime.systemWeek = halGnssTime.systemWeek;
+ }
+ if (GNSS_SYSTEM_TIME_WEEK_MS_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_TIME_WEEK_MS_VALID;
+ gnssTime.systemMsec = halGnssTime.systemMsec;
+ }
+ if (GNSS_SYSTEM_CLK_TIME_BIAS_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_CLK_TIME_BIAS_VALID;
+ gnssTime.systemClkTimeBias = halGnssTime.systemClkTimeBias;
+ }
+ if (GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID;
+ gnssTime.systemClkTimeUncMs = halGnssTime.systemClkTimeUncMs;
+ }
+ if (GNSS_SYSTEM_REF_FCOUNT_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_REF_FCOUNT_VALID;
+ gnssTime.refFCount = halGnssTime.refFCount;
+ }
+ if (GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID & halGnssTime.validityMask) {
+ gnssTimeFlags |= GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID;
+ gnssTime.numClockResets = halGnssTime.numClockResets;
+ }
+
+ gnssTime.validityMask = (clientDiagGnssSystemTimeStructTypeFlags)gnssTimeFlags;
+
+ return gnssTime;
+}
+
+clientDiagGnssGloTimeStructType parseDiagGloTime(const GnssGloTimeStructType &halGloTime) {
+
+ clientDiagGnssGloTimeStructType gloTime;
+ memset(&gloTime, 0, sizeof(gloTime));
+ uint32_t gloTimeFlags = 0;
+
+ if (GNSS_CLO_DAYS_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_CLO_DAYS_VALID;
+ gloTime.gloDays = halGloTime.gloDays;
+ }
+ if (GNSS_GLO_MSEC_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_MSEC_VALID ;
+ gloTime.gloMsec = halGloTime.gloMsec;
+ }
+ if (GNSS_GLO_CLK_TIME_BIAS_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_CLK_TIME_BIAS_VALID;
+ gloTime.gloClkTimeBias = halGloTime.gloClkTimeBias;
+ }
+ if (GNSS_GLO_CLK_TIME_BIAS_UNC_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_CLK_TIME_BIAS_UNC_VALID;
+ gloTime.gloClkTimeUncMs = halGloTime.gloClkTimeUncMs;
+ }
+ if (GNSS_GLO_REF_FCOUNT_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_REF_FCOUNT_VALID;
+ gloTime.refFCount = halGloTime.refFCount;
+ }
+ if (GNSS_GLO_NUM_CLOCK_RESETS_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_NUM_CLOCK_RESETS_VALID;
+ gloTime.numClockResets = halGloTime.numClockResets;
+ }
+ if (GNSS_GLO_FOUR_YEAR_VALID & halGloTime.validityMask) {
+ gloTimeFlags |= GNSS_GLO_FOUR_YEAR_VALID;
+ gloTime.gloFourYear = halGloTime.gloFourYear;
+ }
+
+ gloTime.validityMask = (clientDiagGnssGloTimeStructTypeFlags)gloTimeFlags;
+
+ return gloTime;
+}
+
+void translateDiagSystemTime(clientDiagGnssSystemTime& out,
+ const GnssSystemTime& in) {
+ out.gnssSystemTimeSrc = (clientDiagGnss_LocSvSystemEnumType)in.gnssSystemTimeSrc;
+ switch (in.gnssSystemTimeSrc) {
+ case GNSS_LOC_SV_SYSTEM_GPS:
+ out.u.gpsSystemTime = parseDiagGnssTime(in.u.gpsSystemTime);
+ break;
+ case GNSS_LOC_SV_SYSTEM_GALILEO:
+ out.u.galSystemTime = parseDiagGnssTime(in.u.galSystemTime);
+ break;
+ case GNSS_LOC_SV_SYSTEM_GLONASS:
+ out.u.gloSystemTime = parseDiagGloTime(in.u.gloSystemTime);
+ break;
+ case GNSS_LOC_SV_SYSTEM_BDS:
+ out.u.bdsSystemTime = parseDiagGnssTime(in.u.bdsSystemTime);
+ break;
+ case GNSS_LOC_SV_SYSTEM_QZSS:
+ out.u.qzssSystemTime = parseDiagGnssTime(in.u.qzssSystemTime);
+ break;
+ default:
+ break;
+ }
+}
+
+clientDiagGnssLocationSvUsedInPosition parseDiagLocationSvUsedInPosition(
+ const GnssLocationSvUsedInPosition &halSv) {
+
+ clientDiagGnssLocationSvUsedInPosition clientSv;
+ clientSv.gpsSvUsedIdsMask = halSv.gpsSvUsedIdsMask;
+ clientSv.gloSvUsedIdsMask = halSv.gloSvUsedIdsMask;
+ clientSv.galSvUsedIdsMask = halSv.galSvUsedIdsMask;
+ clientSv.bdsSvUsedIdsMask = halSv.bdsSvUsedIdsMask;
+ clientSv.qzssSvUsedIdsMask = halSv.qzssSvUsedIdsMask;
+
+ return clientSv;
+}
+
+void translateDiagGnssSignalType(clientDiagGnssSignalTypeMask& out, GnssSignalTypeMask in) {
+ out = (clientDiagGnssSignalTypeMask)0;
+ if (in & GNSS_SIGNAL_GPS_L1CA_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GPS_L1CA;
+ }
+ if (in & GNSS_SIGNAL_GPS_L1C_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GPS_L1C;
+ }
+ if (in & GNSS_SIGNAL_GPS_L2_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GPS_L2;
+ }
+ if (in & GNSS_SIGNAL_GPS_L5_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GPS_L5;
+ }
+ if (in & GNSS_SIGNAL_GLONASS_G1_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GLONASS_G1;
+ }
+ if (in & GNSS_SIGNAL_GLONASS_G2_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GLONASS_G2;
+ }
+ if (in & GNSS_SIGNAL_GALILEO_E1_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E1;
+ }
+ if (in & GNSS_SIGNAL_GALILEO_E5A_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E5A;
+ }
+ if (in & GNSS_SIGNAL_GALILEO_E5B_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_GALILEO_E5B;
+ }
+ if (in & GNSS_SIGNAL_BEIDOU_B1I_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1I;
+ }
+ if (in & GNSS_SIGNAL_BEIDOU_B1C_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1C;
+ }
+ if (in & GNSS_SIGNAL_BEIDOU_B2I_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2I;
+ }
+ if (in & GNSS_SIGNAL_BEIDOU_B2AI_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2AI;
+ }
+ if (in & GNSS_SIGNAL_QZSS_L1CA_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_QZSS_L1CA;
+ }
+ if (in & GNSS_SIGNAL_QZSS_L1S_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_QZSS_L1S;
+ }
+ if (in & GNSS_SIGNAL_QZSS_L2_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_QZSS_L2;
+ }
+ if (in & GNSS_SIGNAL_QZSS_L5_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_QZSS_L5;
+ }
+ if (in & GNSS_SIGNAL_SBAS_L1_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_SBAS_L1;
+ }
+ if (in & GNSS_SIGNAL_NAVIC_L5_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_NAVIC_L5;
+ }
+ if (in & GNSS_SIGNAL_BEIDOU_B2AQ_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2AQ;
+ }
+ if (in & GNSS_SIGNAL_BEIDOU_B1_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B1;
+ }
+ if (in & GNSS_SIGNAL_BEIDOU_B2_BIT) {
+ out |= CLIENT_DIAG_GNSS_SIGNAL_BEIDOU_B2;
+ }
+}
+
+void translateDiagGnssMeasUsageInfo(clientDiagGnssMeasUsageInfo& out,
+ const GnssMeasUsageInfo& in) {
+ clientDiagGnssSignalTypeMask diagGnssSignalType;
+ translateDiagGnssSignalType(diagGnssSignalType, in.gnssSignalType);
+ out.gnssSignalType = diagGnssSignalType;
+ /** Specifies GNSS Constellation Type */
+ out.gnssConstellation = parseDiagGnssConstellation(in.gnssConstellation);
+ /** GNSS SV ID.
+ For GPS: 1 to 32
+ For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255.
+ For SBAS: 120 to 151
+ For QZSS-L1CA:193 to 197
+ For BDS: 201 to 237
+ For GAL: 301 to 336 */
+ out.gnssSvId = in.gnssSvId;
+}
+
+void populateClientDiagLocation(clientDiagGnssLocationStructType* diagGnssLocPtr,
+ const GnssLocation& gnssLocation) {
+ diagGnssLocPtr->timestamp = gnssLocation.timestamp;
+ diagGnssLocPtr->latitude = gnssLocation.latitude;
+ diagGnssLocPtr->longitude = gnssLocation.longitude;
+ diagGnssLocPtr->altitude = gnssLocation.altitude;
+ diagGnssLocPtr->speed = gnssLocation.speed;
+ diagGnssLocPtr->bearing = gnssLocation.bearing;
+ diagGnssLocPtr->horizontalAccuracy = gnssLocation.horizontalAccuracy;
+ diagGnssLocPtr->verticalAccuracy = gnssLocation.verticalAccuracy;
+ diagGnssLocPtr->speedAccuracy = gnssLocation.speedAccuracy;
+ diagGnssLocPtr->bearingAccuracy = gnssLocation.bearingAccuracy;
+ diagGnssLocPtr->flags = gnssLocation.flags;
+ diagGnssLocPtr->techMask = gnssLocation.techMask;
+
+ diagGnssLocPtr->gnssInfoFlags = gnssLocation.gnssInfoFlags;
+ diagGnssLocPtr->altitudeMeanSeaLevel = gnssLocation.altitudeMeanSeaLevel;
+ diagGnssLocPtr->pdop = gnssLocation.pdop;
+ diagGnssLocPtr->hdop = gnssLocation.hdop;
+ diagGnssLocPtr->vdop = gnssLocation.vdop;
+ diagGnssLocPtr->gdop = gnssLocation.gdop;
+ diagGnssLocPtr->tdop = gnssLocation.tdop;
+ diagGnssLocPtr->magneticDeviation = gnssLocation.magneticDeviation;
+ diagGnssLocPtr->horReliability = (clientDiagLocationReliability)gnssLocation.horReliability;
+ diagGnssLocPtr->verReliability = (clientDiagLocationReliability)gnssLocation.verReliability;
+ diagGnssLocPtr->horUncEllipseSemiMajor = gnssLocation.horUncEllipseSemiMajor;
+ diagGnssLocPtr->horUncEllipseSemiMinor = gnssLocation.horUncEllipseSemiMinor;
+ diagGnssLocPtr->horUncEllipseOrientAzimuth = gnssLocation.horUncEllipseOrientAzimuth;
+ diagGnssLocPtr->northStdDeviation = gnssLocation.northStdDeviation;
+ diagGnssLocPtr->eastStdDeviation = gnssLocation.eastStdDeviation;
+ diagGnssLocPtr->northVelocity = gnssLocation.northVelocity;
+ diagGnssLocPtr->eastVelocity = gnssLocation.eastVelocity;
+ diagGnssLocPtr->upVelocity = gnssLocation.upVelocity;
+ diagGnssLocPtr->northVelocityStdDeviation = gnssLocation.northVelocityStdDeviation;
+ diagGnssLocPtr->eastVelocityStdDeviation = gnssLocation.eastVelocityStdDeviation;
+ diagGnssLocPtr->upVelocityStdDeviation = gnssLocation.upVelocityStdDeviation;
+ diagGnssLocPtr->svUsedInPosition =
+ parseDiagLocationSvUsedInPosition(gnssLocation.svUsedInPosition);
+ diagGnssLocPtr->navSolutionMask = gnssLocation.navSolutionMask;
+ diagGnssLocPtr->posTechMask = gnssLocation.posTechMask;
+ translateDiagGnssLocationPositionDynamics(diagGnssLocPtr->bodyFrameData,
+ gnssLocation.bodyFrameData);
+ translateDiagSystemTime(diagGnssLocPtr->gnssSystemTime, gnssLocation.gnssSystemTime);
+ diagGnssLocPtr->numOfMeasReceived = (uint8_t)gnssLocation.measUsageInfo.size();
+ clientDiagGnssMeasUsageInfo measUsage;
+ memset(diagGnssLocPtr->measUsageInfo, 0, sizeof(diagGnssLocPtr->measUsageInfo));
+ for (int idx = 0; idx < gnssLocation.measUsageInfo.size(); idx++) {
+ translateDiagGnssMeasUsageInfo(measUsage, gnssLocation.measUsageInfo[idx]);
+ diagGnssLocPtr->measUsageInfo[idx] = measUsage;
+ }
+ diagGnssLocPtr->leapSeconds = gnssLocation.leapSeconds;
+ diagGnssLocPtr->timeUncMs = gnssLocation.timeUncMs;
+ diagGnssLocPtr->numSvUsedInPosition = gnssLocation.numSvUsedInPosition;
+ diagGnssLocPtr->calibrationConfidencePercent = gnssLocation.calibrationConfidencePercent;
+ diagGnssLocPtr->calibrationStatus = gnssLocation.calibrationStatus;
+ diagGnssLocPtr->conformityIndex = gnssLocation.conformityIndex;
+
+ struct timespec ts;
+ clock_gettime(CLOCK_BOOTTIME, &ts);
+ diagGnssLocPtr->bootTimestampNs =
+ (ts.tv_sec * 1000000000ULL + ts.tv_nsec);
+
+ diagGnssLocPtr->locOutputEngType =
+ (clientDiagLocOutputEngineType) gnssLocation.locOutputEngType;
+ diagGnssLocPtr->locOutputEngMask =
+ (clientDiagPositioningEngineMask) gnssLocation.locOutputEngMask;
+}
+
+void populateClientDiagMeasurements(clientDiagGnssMeasurementsStructType* diagGnssMeasPtr,
+ const GnssMeasurements& gnssMeasurements) {
+ diagGnssMeasPtr->count = gnssMeasurements.measurements.size();
+
+ diagGnssMeasPtr->clock.flags =
+ (clientDiagGnssMeasurementsClockFlagsMask)gnssMeasurements.clock.flags;
+ diagGnssMeasPtr->clock.leapSecond = gnssMeasurements.clock.leapSecond;
+ diagGnssMeasPtr->clock.timeNs = gnssMeasurements.clock.timeNs;
+ diagGnssMeasPtr->clock.timeUncertaintyNs = gnssMeasurements.clock.timeUncertaintyNs;
+ diagGnssMeasPtr->clock.fullBiasNs = gnssMeasurements.clock.fullBiasNs;
+ diagGnssMeasPtr->clock.biasNs = gnssMeasurements.clock.biasNs;
+ diagGnssMeasPtr->clock.biasUncertaintyNs = gnssMeasurements.clock.biasUncertaintyNs;
+ diagGnssMeasPtr->clock.driftNsps = gnssMeasurements.clock.driftNsps;
+ diagGnssMeasPtr->clock.driftUncertaintyNsps = gnssMeasurements.clock.driftUncertaintyNsps;
+ diagGnssMeasPtr->clock.hwClockDiscontinuityCount =
+ gnssMeasurements.clock.hwClockDiscontinuityCount;
+
+ for (uint32_t idx = 0; idx < diagGnssMeasPtr->count; ++idx) {
+ diagGnssMeasPtr->measurements[idx].flags =
+ (clientDiagGnssMeasurementsDataFlagsMask)gnssMeasurements.measurements[idx].flags;
+ diagGnssMeasPtr->measurements[idx].svId = gnssMeasurements.measurements[idx].svId;
+ diagGnssMeasPtr->measurements[idx].svType =
+ (clientDiagGnssSvType)gnssMeasurements.measurements[idx].svType;
+ diagGnssMeasPtr->measurements[idx].timeOffsetNs =
+ gnssMeasurements.measurements[idx].timeOffsetNs;
+ diagGnssMeasPtr->measurements[idx].stateMask =
+ (clientDiagGnssMeasurementsStateMask)gnssMeasurements.measurements[idx].stateMask;
+ diagGnssMeasPtr->measurements[idx].receivedSvTimeNs =
+ gnssMeasurements.measurements[idx].receivedSvTimeNs;
+ diagGnssMeasPtr->measurements[idx].receivedSvTimeUncertaintyNs =
+ gnssMeasurements.measurements[idx].receivedSvTimeUncertaintyNs;
+ diagGnssMeasPtr->measurements[idx].carrierToNoiseDbHz =
+ gnssMeasurements.measurements[idx].carrierToNoiseDbHz;
+ diagGnssMeasPtr->measurements[idx].pseudorangeRateMps =
+ gnssMeasurements.measurements[idx].pseudorangeRateMps;
+ diagGnssMeasPtr->measurements[idx].pseudorangeRateUncertaintyMps =
+ gnssMeasurements.measurements[idx].pseudorangeRateUncertaintyMps;
+ diagGnssMeasPtr->measurements[idx].adrStateMask =
+ (clientDiagGnssMeasurementsAdrStateMask)
+ gnssMeasurements.measurements[idx].adrStateMask;
+ diagGnssMeasPtr->measurements[idx].adrMeters =
+ gnssMeasurements.measurements[idx].adrMeters;
+ diagGnssMeasPtr->measurements[idx].adrUncertaintyMeters =
+ gnssMeasurements.measurements[idx].adrUncertaintyMeters;
+ diagGnssMeasPtr->measurements[idx].carrierFrequencyHz =
+ gnssMeasurements.measurements[idx].carrierFrequencyHz;
+ diagGnssMeasPtr->measurements[idx].carrierCycles =
+ gnssMeasurements.measurements[idx].carrierCycles;
+ diagGnssMeasPtr->measurements[idx].carrierPhase =
+ gnssMeasurements.measurements[idx].carrierPhase;
+ diagGnssMeasPtr->measurements[idx].carrierPhaseUncertainty =
+ gnssMeasurements.measurements[idx].carrierPhaseUncertainty;
+ diagGnssMeasPtr->measurements[idx].multipathIndicator =
+ (clientDiagGnssMeasurementsMultipathIndicator)
+ gnssMeasurements.measurements[idx].multipathIndicator;
+ diagGnssMeasPtr->measurements[idx].signalToNoiseRatioDb =
+ gnssMeasurements.measurements[idx].signalToNoiseRatioDb;
+ diagGnssMeasPtr->measurements[idx].agcLevelDb =
+ gnssMeasurements.measurements[idx].agcLevelDb;
+ }
+}
+
+void translateDiagGnssSv(clientDiagGnssSv& out, const GnssSv& in) {
+
+ /** Unique Identifier */
+ out.svId = in.svId;
+ /** type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO) */
+ out.type = (clientDiagGnssSvType)in.type;
+ /** signal strength */
+ out.cN0Dbhz = in.cN0Dbhz;
+ /** elevation of SV (in degrees) */
+ out.elevation = in.elevation;
+ /** azimuth of SV (in degrees) */
+ out.azimuth = in.azimuth;
+ /** Bitwise OR of GnssSvOptionsBits */
+ out.gnssSvOptionsMask = in.gnssSvOptionsMask;
+ /** carrier frequency of SV (in Hz) */
+ out.carrierFrequencyHz = in.carrierFrequencyHz;
+ /** Bitwise OR of clientDiagGnssSignalTypeBits */
+ clientDiagGnssSignalTypeMask diagGnssSignalType;
+ translateDiagGnssSignalType(diagGnssSignalType, in.gnssSignalTypeMask);
+ out.gnssSignalTypeMask = diagGnssSignalType;
+}
+
+void populateClientDiagGnssSv(clientDiagGnssSvStructType* diagGnssSvPtr,
+ std::vector<GnssSv>& gnssSvs) {
+ clientDiagGnssSv diagGnssSv;
+ diagGnssSvPtr->count = gnssSvs.size();
+ for (int idx = 0; idx < gnssSvs.size(); ++idx) {
+ translateDiagGnssSv(diagGnssSv, gnssSvs[idx]);
+ diagGnssSvPtr->gnssSvs[idx] = diagGnssSv;
+ }
+}
+
+void populateClientDiagNmea(clientDiagGnssNmeaStructType *diagGnssNmeaPtr,
+ const LocAPINmeaSerializedPayload &nmeaSerializedPayload) {
+ diagGnssNmeaPtr->timestamp = nmeaSerializedPayload.timestamp;
+ diagGnssNmeaPtr->nmeaLength = nmeaSerializedPayload.length;
+ memcpy(&diagGnssNmeaPtr->nmea, nmeaSerializedPayload.nmea, nmeaSerializedPayload.length);
+}
+
+}
diff --git a/location/client_api_testapp/Makefile.am b/location/client_api_testapp/Makefile.am
new file mode 100644
index 0000000..885263e
--- /dev/null
+++ b/location/client_api_testapp/Makefile.am
@@ -0,0 +1,43 @@
+AM_CFLAGS = \
+ -DDEBUG \
+ -I./ \
+ $(GPSUTILS_CFLAGS) \
+ $(LOCUTILS_CFLAGS) \
+ $(LOCCLIENTAPI_CFLAGS) \
+ $(LOCINTEGRATIONAPI_CFLAGS) \
+ -std=c++11
+# HALDAEMON is requird only for msg.h
+
+ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -std=c++11
+
+requiredlibs = \
+ $(LOCCLIENTAPI_LIBS) \
+ $(LOCINTEGRATIONAPI_LIBS)
+
+h_sources =
+
+c_sources = \
+ main.cpp
+
+location_client_api_testapp_SOURCES = \
+ $(c_sources) $(h_sources)
+
+######################
+# Build location_client_api_testapp
+######################
+
+if USE_GLIB
+location_client_api_testapp_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+location_client_api_testapp_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+location_client_api_testapp_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+location_client_api_testapp_CFLAGS = $(AM_CFLAGS)
+location_client_api_testapp_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+location_client_api_testapp_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+location_client_api_testapp_LDADD = $(requiredlibs) -lstdc++ -lc -ldl
+
+bin_PROGRAMS = location_client_api_testapp
+
diff --git a/location/client_api_testapp/configure.ac b/location/client_api_testapp/configure.ac
new file mode 100644
index 0000000..a66868f
--- /dev/null
+++ b/location/client_api_testapp/configure.ac
@@ -0,0 +1,78 @@
+# configure.ac -- Autoconf script for gps location_client_api_testapp
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the location_client_api_testapp package version 1.0.0
+AC_INIT([location_client_api_testapp],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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])
+
+PKG_CHECK_MODULES([LOCCLIENTAPI], [location-client-api])
+AC_SUBST([LOCCLIENTAPI_CFLAGS])
+AC_SUBST([LOCCLIENTAPI_LIBS])
+
+PKG_CHECK_MODULES([LOCINTEGRATIONAPI], [location-integration-api])
+AC_SUBST([LOCINTEGRATIONAPI_CFLAGS])
+AC_SUBST([LOCINTEGRATIONAPI_LIBS])
+
+AC_ARG_WITH([external_ap],
+ AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
+ [Using External Application Processor]),
+ [],
+ with_external_ap=no)
+
+if test "x$with_external_ap" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
+fi
+
+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_client_api_testapp.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/client_api_testapp/location_client_api_testapp.pc.in b/location/client_api_testapp/location_client_api_testapp.pc.in
new file mode 100644
index 0000000..fa2248e
--- /dev/null
+++ b/location/client_api_testapp/location_client_api_testapp.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location_client_api_testapp
+Description: location_client_api_tesetapp
+Version: @VERSION@
+Libs: -L${libdir} -llocation_client_api
+Cflags: -I${includedir}
\ No newline at end of file
diff --git a/location/client_api_testapp/main.cpp b/location/client_api_testapp/main.cpp
new file mode 100644
index 0000000..12972b7
--- /dev/null
+++ b/location/client_api_testapp/main.cpp
@@ -0,0 +1,536 @@
+/* Copyright (c) 2019-2020 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+#include <sstream>
+#include <grp.h>
+#include <sys/types.h>
+#include <sys/prctl.h>
+#include <semaphore.h>
+#include <loc_pla.h>
+#include <loc_cfg.h>
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
+
+#include <LocationClientApi.h>
+#include <LocationIntegrationApi.h>
+
+using namespace location_client;
+using namespace location_integration;
+
+
+#define NUM_LOOP_PINGTEST (1000)
+
+// debug events counter
+static uint32_t numLocationCb = 0;
+static uint32_t numGnssLocationCb = 0;
+static uint32_t numGnssSvCb = 0;
+static uint32_t numGnssNmeaCb = 0;
+static sem_t sem_pingcbreceived;
+#define DISABLE_TUNC "disableTunc"
+#define ENABLE_TUNC "enableTunc"
+#define DISABLE_PACE "disablePACE"
+#define ENABLE_PACE "enablePACE"
+#define RESET_SV_CONFIG "resetSVConfig"
+#define CONFIG_SV "configSV"
+#define MULTI_CONFIG_SV "multiConfigSV"
+#define DELETE_ALL "deleteAll"
+#define CONFIG_LEVER_ARM "configLeverArm"
+#define CONFIG_ROBUST_LOCATION "configRobustLocation"
+#define GET_ROBUST_LOCATION_CONFIG "getRobustLocationConfig"
+
+// debug utility
+static uint64_t getTimestamp() {
+ struct timespec ts;
+ clock_gettime(CLOCK_BOOTTIME, &ts);
+ uint64_t absolute_micro =
+ ((uint64_t)(ts.tv_sec)) * 1000000ULL + ((uint64_t)(ts.tv_nsec)) / 1000ULL;
+ return absolute_micro;
+}
+
+/******************************************************************************
+Callback functions
+******************************************************************************/
+static void onCapabilitiesCb(location_client::LocationCapabilitiesMask mask) {
+ printf("<<< onCapabilitiesCb mask=0x%x\n", mask);
+}
+
+static void onResponseCb(location_client::LocationResponse response) {
+ printf("<<< onResponseCb err=%u\n", response);
+}
+
+static void onLocationCb(const location_client::Location& location) {
+ numLocationCb++;
+ printf("<<< onLocationCb cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n",
+ numLocationCb,
+ location.timestamp,
+ location.flags,
+ location.latitude,
+ location.longitude,
+ location.altitude);
+}
+
+static void onGnssLocationCb(const location_client::GnssLocation& location) {
+ numGnssLocationCb++;
+ printf("<<< onGnssLocationCb cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n",
+ numGnssLocationCb,
+ location.timestamp,
+ location.flags,
+ location.latitude,
+ location.longitude,
+ location.altitude);
+}
+
+static void onGnssSvCb(const std::vector<location_client::GnssSv>& gnssSvs) {
+ numGnssSvCb++;
+ std::stringstream ss;
+ ss << "<<< onGnssSvCb c=" << numGnssSvCb << " s=" << gnssSvs.size();
+ for (auto sv : gnssSvs) {
+ ss << " " << sv.type << ":" << sv.svId << "/" << (uint32_t)sv.cN0Dbhz;
+ }
+ printf("%s\n", ss.str().c_str());
+}
+
+static void onGnssNmeaCb(uint64_t timestamp, const std::string& nmea) {
+ numGnssNmeaCb++;
+ printf("<<< onGnssNmeaCb cnt=%u time=%" PRIu64" nmea=%s",
+ numGnssNmeaCb, timestamp, nmea.c_str());
+}
+
+static void onCapabilitiesCb2(location_client::LocationCapabilitiesMask mask) {
+ printf("<<< onCapabilitiesCb2 mask=0x%x\n", mask);
+}
+
+static void onResponseCb2(location_client::LocationResponse response) {
+ printf("<<< onResponseCb2 err=%u\n", response);
+}
+
+static void onLocationCb2(const location_client::Location& location) {
+ numLocationCb++;
+ printf("<<< onLocationCb2 cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n",
+ numLocationCb,
+ location.timestamp,
+ location.flags,
+ location.latitude,
+ location.longitude,
+ location.altitude);
+}
+
+static void onGnssLocationCb2(const location_client::GnssLocation& location) {
+ numGnssLocationCb++;
+ printf("<<< onGnssLocationCb2 cnt=%u time=%" PRIu64" mask=0x%x lat=%f lon=%f alt=%f\n",
+ numGnssLocationCb,
+ location.timestamp,
+ location.flags,
+ location.latitude,
+ location.longitude,
+ location.altitude);
+}
+
+static void onGnssSvCb2(const std::vector<location_client::GnssSv>& gnssSvs) {
+ numGnssSvCb++;
+ std::stringstream ss;
+ ss << "<<< onGnssSvCb2 c=" << numGnssSvCb << " s=" << gnssSvs.size();
+ for (auto sv : gnssSvs) {
+ ss << " " << sv.type << ":" << sv.svId << "/" << (uint32_t)sv.cN0Dbhz;
+ }
+ printf("%s\n", ss.str().c_str());
+}
+
+static void onGnssNmeaCb2(uint64_t timestamp, const std::string& nmea) {
+ numGnssNmeaCb++;
+ printf("<<< onGnssNmeaCb2 cnt=%u time=%" PRIu64" nmea=%s",
+ numGnssNmeaCb, timestamp, nmea.c_str());
+}
+
+static void onPingTestCb(uint32_t response) {
+ sem_post(&sem_pingcbreceived);
+}
+
+static void onConfigResponseCb(location_integration::LocConfigTypeEnum requestType,
+ location_integration::LocIntegrationResponse response) {
+ printf("<<< onConfigResponseCb, type %d, err %d\n", requestType, response);
+}
+
+static void onGetRobustLocationConfigCb(RobustLocationConfig robustLocationConfig) {
+ printf("<<< onGetRobustLocationConfigCb, valid flags 0x%x, enabled %d, enabledForE911 %d\n",
+ robustLocationConfig.validMask, robustLocationConfig.enabled,
+ robustLocationConfig.enabledForE911);
+}
+
+static void printHelp() {
+ printf("g: Gnss report session with 1000 ms interval\n");
+ printf("u: Update a session with 2000 ms interval\n");
+ printf("m: Interleaving fix session with 1000 and 2000 ms interval, change every 3 seconds\n");
+ printf("s: Stop a session \n");
+ printf("p: Ping test\n");
+ printf("q: Quit\n");
+ printf("r: delete client\n");
+ printf("%s tuncThreshold energyBudget: enable TUNC\n", ENABLE_TUNC);
+ printf("%s: disable TUNC\n", DISABLE_TUNC);
+ printf("%s: enable PACE\n", ENABLE_PACE);
+ printf("%s: disable PACE\n", DISABLE_PACE);
+ printf("%s: reset sv config to default\n", RESET_SV_CONFIG);
+ printf("%s: configure sv \n", CONFIG_SV);
+ printf("%s: mulitple config SV \n", MULTI_CONFIG_SV);
+ printf("%s: delete all aiding data\n", DELETE_ALL);
+ printf("%s: config lever arm\n", CONFIG_LEVER_ARM);
+ printf("%s: config robust location\n", CONFIG_ROBUST_LOCATION);
+ printf("%s: get robust location config\n", GET_ROBUST_LOCATION_CONFIG);
+}
+
+void setRequiredPermToRunAsLocClient()
+{
+#ifdef USE_GLIB
+ if (0 == getuid()) {
+ printf("Test app set perm");
+
+ // For LE, we need to also add "diag" to existing groups
+ // to run in loc client mode for diag logging.
+ // We need to add diag grpid at end, so MAX+1
+ gid_t appGrpsIds[LOC_PROCESS_MAX_NUM_GROUPS+1] = {};
+ int i = 0, numGrpIds = 0;
+
+ // Get current set of supplementary groups.
+ memset(appGrpsIds, 0, sizeof(appGrpsIds));
+ numGrpIds = getgroups(LOC_PROCESS_MAX_NUM_GROUPS, appGrpsIds);
+ if (numGrpIds == -1) {
+ printf("Could not find groups. ngroups:%d\n", numGrpIds);
+ numGrpIds = 0;
+ }
+ else {
+ printf("Curr num_groups = %d, Current GIDs: ", numGrpIds);
+ for (i=0; i<numGrpIds; i++) {
+ printf("%d ", appGrpsIds[i]);
+ }
+ }
+
+ // get group id for diag and update supplementary groups to add "diag" to its list.
+ struct group* grp = getgrnam("diag");
+ if (grp) {
+ // we added diag also to grpid array and setgroups
+ appGrpsIds[numGrpIds] = grp->gr_gid;
+ printf("Diag Group id = %d", appGrpsIds[numGrpIds]);
+ numGrpIds++;
+ i = setgroups(numGrpIds, appGrpsIds);
+ if (i == -1) {
+ printf("Could not set groups. errno:%d, %s", errno, strerror(errno));
+ } else {
+ printf("Total of %d groups set for test app", numGrpIds);
+ }
+ }
+ if (-1 == setgid(GID_LOCCLIENT)) {
+ printf("%s:%d]: Error: setgid GID_LOCCLIENT failed. %s\n",
+ __func__, __LINE__, strerror(errno));
+ }
+ if (-1 == setuid(UID_LOCCLIENT)) {
+ printf("%s:%d]: Error: setuid UID_LOCCLIENT failed. %s\n",
+ __func__, __LINE__, strerror(errno));
+ }
+ } else {
+ printf("Test app started as user: %d", getuid());
+ }
+#endif// USE_GLIB
+}
+
+void parseSVConfig (char* buf, LocConfigBlacklistedSvIdList &svList) {
+ static char *save = nullptr;
+ char* token = strtok_r(buf, " ", &save); // skip first one of "configSV"
+ token = strtok_r(NULL, " ", &save);
+ if (token == nullptr) {
+ return;
+ }
+
+ while (token != nullptr) {
+ GnssSvIdInfo svIdInfo = {};
+ svIdInfo.constellation = (GnssConstellationType) atoi(token);
+ token = strtok_r(NULL, " ", &save);
+ if (token == NULL) {
+ break;
+ }
+ svIdInfo.svId = atoi(token);
+ svList.push_back(svIdInfo);
+ token = strtok_r(NULL, " ", &save);
+ }
+}
+
+void parseLeverArm (char* buf, LeverArmParamsMap &leverArmMap) {
+ static char *save = nullptr;
+ char* token = strtok_r(buf, " ", &save); // skip first one of "configLeverArm"
+ token = strtok_r(NULL, " ", &save);
+ while (token != nullptr) {
+ LeverArmParams leverArm = {};
+ LeverArmType type = (LeverArmType) 0;
+ if (strcmp(token, "vrp") == 0) {
+ type = location_integration::LEVER_ARM_TYPE_GNSS_TO_VRP;
+ } else if (strcmp(token, "drimu") == 0) {
+ type = location_integration::LEVER_ARM_TYPE_DR_IMU_TO_GNSS;
+ } else if (strcmp(token, "veppimu") == 0) {
+ type = location_integration::LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS;
+ } else {
+ break;
+ }
+ token = strtok_r(NULL, " ", &save);
+ if (token == NULL) {
+ break;
+ }
+ leverArm.forwardOffsetMeters = atof(token);
+
+ token = strtok_r(NULL, " ", &save);
+ if (token == NULL) {
+ break;
+ }
+ leverArm.sidewaysOffsetMeters = atof(token);
+
+ token = strtok_r(NULL, " ", &save);
+ if (token == NULL) {
+ break;
+ }
+ leverArm.upOffsetMeters = atof(token);
+
+ printf("type %d, %f %f %f\n", type, leverArm.forwardOffsetMeters,
+ leverArm.sidewaysOffsetMeters, leverArm.upOffsetMeters);
+
+ leverArmMap.emplace(type, leverArm);
+ token = strtok_r(NULL, " ", &save);
+ }
+}
+
+/******************************************************************************
+Main function
+******************************************************************************/
+int main(int argc, char *argv[]) {
+
+ setRequiredPermToRunAsLocClient();
+
+ // create Location client API
+ LocationClientApi* pClient = new LocationClientApi(onCapabilitiesCb);
+
+ // callbacks
+ GnssReportCbs reportcbs;
+ reportcbs.gnssLocationCallback = GnssLocationCb(onGnssLocationCb);
+ reportcbs.gnssSvCallback = GnssSvCb(onGnssSvCb);
+ reportcbs.gnssNmeaCallback = GnssNmeaCb(onGnssNmeaCb);
+
+ LocationClientApi* pClient2 = new LocationClientApi(onCapabilitiesCb2);
+ // callbacks
+ GnssReportCbs reportcbs2;
+ reportcbs2.gnssLocationCallback = GnssLocationCb(onGnssLocationCb2);
+ reportcbs2.gnssSvCallback = GnssSvCb(onGnssSvCb2);
+ reportcbs2.gnssNmeaCallback = GnssNmeaCb(onGnssNmeaCb2);
+
+ // create location integratin API
+ LocIntegrationCbs intCbs;
+
+ intCbs.configCb = LocConfigCb(onConfigResponseCb);
+ intCbs.getRobustLocationConfigCb =
+ LocConfigGetRobustLocationConfigCb(onGetRobustLocationConfigCb);
+
+ LocConfigPriorityMap priorityMap;
+ location_integration::LocationIntegrationApi* pIntClient =
+ new LocationIntegrationApi(priorityMap, intCbs);
+
+ printHelp();
+ sleep(1); // wait for capability callback if you don't like sleep
+
+ // main loop
+ while (1) {
+ char buf[100];
+ memset (buf, 0, sizeof(buf));
+ fgets(buf, sizeof(buf), stdin);
+
+ printf("execute command %s\n", buf);
+ if (!pIntClient) {
+ pIntClient =
+ new LocationIntegrationApi(priorityMap, intCbs);
+ if (nullptr == pIntClient) {
+ printf("failed to create integration client\n");
+ break;
+ }
+ sleep(1); // wait for capability callback
+ }
+
+ if (strncmp(buf, DISABLE_TUNC, strlen(DISABLE_TUNC)) == 0) {
+ pIntClient->configConstrainedTimeUncertainty(false);
+ } else if (strncmp(buf, ENABLE_TUNC, strlen(ENABLE_TUNC)) == 0) {
+ // get tuncThreshold and energyBudget from the command line
+ static char *save = nullptr;
+ float tuncThreshold = 0.0;
+ int energyBudget = 0;
+ char* token = strtok_r(buf, " ", &save); // skip first one
+ token = strtok_r(NULL, " ", &save);
+ if (token != NULL) {
+ tuncThreshold = atof(token);
+ token = strtok_r(NULL, " ", &save);
+ if (token != NULL) {
+ energyBudget = atoi(token);
+ }
+ }
+ printf("tuncThreshold %f, energyBudget %d\n", tuncThreshold, energyBudget);
+ pIntClient->configConstrainedTimeUncertainty(
+ true, tuncThreshold, energyBudget);
+ } else if (strncmp(buf, DISABLE_PACE, strlen(DISABLE_TUNC)) == 0) {
+ pIntClient->configPositionAssistedClockEstimator(false);
+ } else if (strncmp(buf, ENABLE_PACE, strlen(ENABLE_TUNC)) == 0) {
+ pIntClient->configPositionAssistedClockEstimator(true);
+ } else if (strncmp(buf, DELETE_ALL, strlen(DELETE_ALL)) == 0) {
+ pIntClient->deleteAllAidingData();
+ } else if (strncmp(buf, RESET_SV_CONFIG, strlen(RESET_SV_CONFIG)) == 0) {
+ pIntClient->configConstellations(nullptr);
+ } else if (strncmp(buf, CONFIG_SV, strlen(CONFIG_SV)) == 0) {
+ LocConfigBlacklistedSvIdList svList;
+ parseSVConfig(buf, svList);
+ pIntClient->configConstellations(&svList);
+ } else if (strncmp(buf, MULTI_CONFIG_SV, strlen(MULTI_CONFIG_SV)) == 0) {
+ // reset
+ pIntClient->configConstellations(nullptr);
+ // disable GAL
+ LocConfigBlacklistedSvIdList galSvList;
+ GnssSvIdInfo svIdInfo = {};
+ svIdInfo.constellation = GNSS_CONSTELLATION_TYPE_GALILEO;
+ svIdInfo.svId = 0;
+ galSvList.push_back(svIdInfo);
+ pIntClient->configConstellations(&galSvList);
+
+ // disable SBAS
+ LocConfigBlacklistedSvIdList sbasSvList;
+ svIdInfo.constellation = GNSS_CONSTELLATION_TYPE_SBAS;
+ svIdInfo.svId = 0;
+ sbasSvList.push_back(svIdInfo);
+ pIntClient->configConstellations(&sbasSvList);
+ } else if (strncmp(buf, CONFIG_LEVER_ARM, strlen(CONFIG_LEVER_ARM)) == 0) {
+ LeverArmParamsMap configInfo;
+ parseLeverArm(buf, configInfo);
+ pIntClient->configLeverArm(configInfo);
+ } else if (strncmp(buf, CONFIG_ROBUST_LOCATION, strlen(CONFIG_ROBUST_LOCATION)) == 0) {
+ // get enable and enableForE911
+ static char *save = nullptr;
+ bool enable = false;
+ bool enableForE911 = false;
+ // skip first one of configRobustLocation
+ char* token = strtok_r(buf, " ", &save);
+ token = strtok_r(NULL, " ", &save);
+ if (token != NULL) {
+ enable = (atoi(token) == 1);
+ token = strtok_r(NULL, " ", &save);
+ if (token != NULL) {
+ enableForE911 = (atoi(token) == 1);
+ }
+ }
+ printf("enable %d, enableForE911 %d\n", enable, enableForE911);
+ pIntClient->configRobustLocation(enable, enableForE911);
+ } else if (strncmp(buf, GET_ROBUST_LOCATION_CONFIG,
+ strlen(GET_ROBUST_LOCATION_CONFIG)) == 0) {
+ pIntClient->getRobustLocationConfig();
+ } else {
+ int command = buf[0];
+ switch(command) {
+ case 'g':
+ if (!pClient) {
+ pClient = new LocationClientApi(onCapabilitiesCb);
+ }
+ if (pClient) {
+ pClient->startPositionSession(1000, reportcbs, onResponseCb);
+ }
+ break;
+ case 'u':
+ if (!pClient) {
+ pClient = new LocationClientApi(onCapabilitiesCb);
+ }
+ if (pClient) {
+ pClient->startPositionSession(2000, reportcbs, onResponseCb);
+ }
+ break;
+ case 's':
+ if (pClient) {
+ pClient->stopPositionSession();
+ delete pClient;
+ pClient = NULL;
+ }
+ break;
+ case 'm':
+ if (!pClient) {
+ pClient = new LocationClientApi(onCapabilitiesCb);
+ }
+ if (pClient) {
+ int i = 0;
+ do {
+ if (i%2 == 0) {
+ pClient->startPositionSession(2000, reportcbs, onResponseCb);
+ } else {
+ pClient->startPositionSession(1000, reportcbs, onResponseCb);
+ }
+ i++;
+ sleep(3);
+ } while (1);
+ }
+ break;
+ case 'r':
+ if (nullptr != pClient) {
+ delete pClient;
+ pClient = nullptr;
+ }
+ if (nullptr != pClient2) {
+ delete pClient2;
+ pClient2 = nullptr;
+ }
+ if (nullptr != pIntClient) {
+ delete pIntClient;
+ pIntClient = nullptr;
+ }
+ break;
+ case 'q':
+ goto EXIT;
+ break;
+ default:
+ printf("unknown command %s\n", buf);
+ break;
+ }
+ }
+ }//while(1)
+
+EXIT:
+ if (nullptr != pClient) {
+ delete pClient;
+ }
+
+ if (nullptr != pIntClient) {
+ delete pIntClient;
+ }
+
+ printf("Done\n");
+ exit(0);
+}
diff --git a/location/gnsspps/Android.mk b/location/gnsspps/Android.mk
new file mode 100644
index 0000000..ef43979
--- /dev/null
+++ b/location/gnsspps/Android.mk
@@ -0,0 +1,39 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libgnsspps
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+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/location/gnsspps/Makefile.am b/location/gnsspps/Makefile.am
new file mode 100644
index 0000000..c990be0
--- /dev/null
+++ b/location/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/location/gnsspps/configure.ac b/location/gnsspps/configure.ac
new file mode 100644
index 0000000..bdc85f8
--- /dev/null
+++ b/location/gnsspps/configure.ac
@@ -0,0 +1,70 @@
+# 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 lbs-core package version 1.0.0
+AC_INIT([gnsspps],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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([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],
+ 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 \
+ gnsspps.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/gnsspps/gnsspps.c b/location/gnsspps/gnsspps.c
new file mode 100644
index 0000000..b27fd77
--- /dev/null
+++ b/location/gnsspps/gnsspps.c
@@ -0,0 +1,391 @@
+/* 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>
+#include <stdbool.h>
+#include "loc_cfg.h"
+#include <inttypes.h>
+#include <time.h>
+#include <math.h>
+
+#define BILLION_NSEC (1E9)
+
+typedef struct timespec pps_sync_time;
+
+//DRsync kernel timestamp
+static struct timespec drsyncKernelTs = {0,0};
+//DRsync userspace timestamp
+static struct timespec drsyncUserTs = {0,0};
+
+static struct timespec prevDrsyncKernelTs = {0,0};
+
+//flag to stop fetching timestamp
+static int isActive = 0;
+static pps_handle handle;
+
+static pthread_mutex_t ts_lock;
+static int skipPPSPulseCnt = 0;
+static int gnssOutageInSec = 1;
+static loc_param_s_type gps_conf_param_table[] =
+{
+ {"IGNORE_PPS_PULSE_COUNT", &skipPPSPulseCnt, NULL, 'n'},
+ {"GNSS_OUTAGE_DURATION", &gnssOutageInSec, NULL, 'n'}
+};
+
+typedef enum {
+ KERNEL_REPORTED_CLOCK_BOOTTIME = 0,
+ KERNEL_REPORTED_CLOCK_REALTIME,
+ KERNEL_REPORTED_CLOCK_UNKNOWN = 0xfe,
+ KERNEL_REPORTED_CLOCK_MAX = 0xff
+} kernel_reported_time_e;
+
+ /* 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_RDONLY);
+ 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;
+}
+
+
+/* calculate the time difference between two given times in argument -
+** returns the result in timeDifference parametter*/
+static inline void calculate_time_difference(pps_sync_time time1,
+ pps_sync_time time2, pps_sync_time* timeDifference)
+{
+ if (time2.tv_nsec < time1.tv_nsec) {
+ timeDifference->tv_sec = time2.tv_sec - 1 - time1.tv_sec;
+ timeDifference->tv_nsec = BILLION_NSEC + time2.tv_nsec - time1.tv_nsec;
+ } else {
+ timeDifference->tv_sec = time2.tv_sec - time1.tv_sec;
+ timeDifference->tv_nsec = time2.tv_nsec - time1.tv_nsec;
+ }
+}
+
+/*add two timespec values and return the result in third resultTime parameter*/
+static inline void pps_sync_time_add(pps_sync_time time1,
+ pps_sync_time time2, pps_sync_time* resultTime)
+{
+ if (time2.tv_nsec + time1.tv_nsec >= BILLION_NSEC) {
+ resultTime->tv_sec = time2.tv_sec + time1.tv_sec + 1;
+ resultTime->tv_nsec = time2.tv_nsec + time1.tv_nsec - BILLION_NSEC;
+ } else {
+ resultTime->tv_sec = time2.tv_sec + time1.tv_sec;
+ resultTime->tv_nsec = time2.tv_nsec + time1.tv_nsec;
+ }
+}
+
+#define MAX_REALTIME_OFFSET_DELTA_DIFFERENCE 10
+#define MAX_PPS_KERNEL_TO_USERSPACE_LATENCY 100 /*in milli-second*/
+
+static inline double convertTimeToMilliSec(pps_sync_time timeToConvert)
+{
+ return ((double)(timeToConvert.tv_sec * 1000) + (double)(timeToConvert.tv_nsec * 0.000001));
+}
+
+/*returnValue: 1 = offsetTime OK, 0 = offsetTime NOT OK*/
+static inline bool isTimeOffsetOk(pps_sync_time offsetTime)
+{
+ double offsetInMillis = convertTimeToMilliSec(offsetTime);
+ return (fabs(offsetInMillis) <= MAX_REALTIME_OFFSET_DELTA_DIFFERENCE)? true: false;
+}
+
+/*check whether kernel PPS timestamp is a CLOCK_BOOTTIME or CLOCK_REALTIME*/
+static kernel_reported_time_e get_reported_time_type(pps_sync_time userBootTs,
+ pps_sync_time userRealTs,
+ pps_sync_time kernelTs)
+{
+ double userRealMs, userBootMs, kernelTsMs;
+ kernel_reported_time_e reportedTime = KERNEL_REPORTED_CLOCK_UNKNOWN;
+
+ userRealMs = convertTimeToMilliSec(userRealTs);
+ userBootMs = convertTimeToMilliSec(userBootTs);
+ kernelTsMs = convertTimeToMilliSec(kernelTs);
+
+ if(fabs(userBootMs - kernelTsMs) <= MAX_PPS_KERNEL_TO_USERSPACE_LATENCY) {
+ reportedTime = KERNEL_REPORTED_CLOCK_BOOTTIME;
+ } else if (fabs(userRealMs - kernelTsMs) <= MAX_PPS_KERNEL_TO_USERSPACE_LATENCY) {
+ reportedTime = KERNEL_REPORTED_CLOCK_REALTIME;
+ } else {
+ reportedTime = KERNEL_REPORTED_CLOCK_UNKNOWN;
+ }
+
+ LOC_LOGV("[%s] Detected PPS timestamp type (0:Boot, 1:Real, 0xfe:Unknown):0x%x",
+ __func__, reportedTime);
+
+ return reportedTime;
+}
+
+/*compute_real_to_boot_time - converts the kernel real time stamp to boot time reference*/
+static int compute_real_to_boot_time(pps_info ppsFetchTime)
+{
+ int retVal = 0;
+ /*Offset between REAL_TIME to BOOT_TIME*/
+ static pps_sync_time time_offset = {0, 0};
+ pps_sync_time drSyncUserRealTs, drSyncUserBootTs;
+ pps_sync_time deltaRealToBootTime = {0, 0};
+ pps_sync_time deltaOffsetTime = {0, 0};
+ kernel_reported_time_e ppsTimeType;
+
+ retVal = clock_gettime(CLOCK_BOOTTIME,&drSyncUserBootTs);
+ if (retVal != 0) {
+ LOC_LOGE("[%s]Error Reading CLOCK_BOOTTIME", __func__);
+ retVal = -1;
+ goto exit0;
+ }
+ retVal = clock_gettime(CLOCK_REALTIME,&drSyncUserRealTs);
+ if (retVal != 0){
+ LOC_LOGE("[%s]Error Reading CLOCK_REALTIME", __func__);
+ retVal = -1;
+ goto exit0;
+ }
+
+ ppsTimeType = get_reported_time_type(drSyncUserBootTs, drSyncUserRealTs, ppsFetchTime);
+
+ if (KERNEL_REPORTED_CLOCK_BOOTTIME == ppsTimeType) {
+
+ /*Store PPS kernel time*/
+ drsyncKernelTs.tv_sec = ppsFetchTime.tv_sec;
+ drsyncKernelTs.tv_nsec = ppsFetchTime.tv_nsec;
+ /*Store User PPS fetch time*/
+ drsyncUserTs.tv_sec = drSyncUserBootTs.tv_sec;
+ drsyncUserTs.tv_nsec = drSyncUserBootTs.tv_nsec;
+
+ LOC_LOGV("[compute_real_to_boot] PPS TimeType CLOCK_BOOTTIME -- report as is");
+ retVal = 0;
+ } else if (KERNEL_REPORTED_CLOCK_REALTIME == ppsTimeType) {
+
+ /* Calculate time difference between REALTIME to BOOT_TIME*/
+ calculate_time_difference(drSyncUserRealTs, drSyncUserBootTs, &deltaRealToBootTime);
+
+ /* Calculate the time difference between stored offset and computed one now*/
+ calculate_time_difference(time_offset, deltaRealToBootTime, &deltaOffsetTime);
+
+ if ((0 == time_offset.tv_sec && 0 == time_offset.tv_nsec) ||
+ (isTimeOffsetOk(deltaOffsetTime))) {
+ /* if Time Offset does not change beyond threshold then
+ ** convert to boot time*/
+ drsyncUserTs.tv_sec = drSyncUserBootTs.tv_sec;
+ drsyncUserTs.tv_nsec = drSyncUserBootTs.tv_nsec;
+ pps_sync_time_add(ppsFetchTime, deltaRealToBootTime, &drsyncKernelTs);
+ retVal = 0;
+ } else {
+ /*The offset is too high, jump detected in realTime tick, either
+ ** wall clock changed by user of NTP, skip PPS, re-sync @ next tick
+ */
+ LOC_LOGE("[%s] Jump detected in CLOCK_REALTIME - Offset %ld:%ld", __func__,
+ deltaOffsetTime.tv_sec, deltaOffsetTime.tv_nsec);
+ retVal = -1;
+ }
+ time_offset.tv_sec = deltaRealToBootTime.tv_sec;
+ time_offset.tv_nsec = deltaRealToBootTime.tv_nsec;
+
+ LOC_LOGV("[compute_real_to_boot] KernelRealTs %ld:%ld ComputedTs %ld:%ld RealTs %ld:%ld BootTs %ld:%ld Offset %ld:%ld retVal %d ",
+ ppsFetchTime.tv_sec, ppsFetchTime.tv_nsec,
+ drsyncKernelTs.tv_sec, drsyncKernelTs.tv_nsec, drSyncUserRealTs.tv_sec,
+ drSyncUserRealTs.tv_nsec, drsyncUserTs.tv_sec, drsyncUserTs.tv_nsec,
+ time_offset.tv_sec, time_offset.tv_nsec, retVal);
+ } else {
+ LOC_LOGV("[compute_real_to_boot] PPS TimeType Unknown -- KernelTs %ld:%ld userRealTs %ld:%ld userBootTs %ld:%ld",
+ ppsFetchTime.tv_sec, ppsFetchTime.tv_nsec,
+ drSyncUserRealTs.tv_sec, drSyncUserRealTs.tv_nsec,
+ drsyncUserTs.tv_sec, drsyncUserTs.tv_nsec);
+ retVal = -1;
+ }
+
+exit0:
+ return retVal;
+
+}
+
+
+/* fetches the timestamp from the PPS source */
+int read_pps(pps_handle *handle)
+{
+ struct timespec timeout;
+ pps_info infobuf;
+ int ret;
+ static bool isFirstPulseReceived = false;
+ static unsigned int skipPulseCnt = 0;
+ // 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;
+ }
+ if (!isFirstPulseReceived && (skipPPSPulseCnt > 0)) {
+ skipPulseCnt = skipPPSPulseCnt;
+ isFirstPulseReceived = true;
+ LOC_LOGV("%s:%d first pps pulse received %ld (sec) %ld (nsec)",
+ __func__, __LINE__, infobuf.tv_sec, infobuf.tv_nsec)
+ }else if (isFirstPulseReceived && (skipPPSPulseCnt > 0) &&
+ ((infobuf.tv_sec - prevDrsyncKernelTs.tv_sec) > gnssOutageInSec)) {
+ LOC_LOGV("%s:%d long RF outage detected, ignore next %d PPS Pulses",
+ __func__, __LINE__, skipPPSPulseCnt)
+ skipPulseCnt = skipPPSPulseCnt;
+ }
+ prevDrsyncKernelTs.tv_sec = infobuf.tv_sec;
+ prevDrsyncKernelTs.tv_nsec = infobuf.tv_nsec;
+ /* check if this dr sync pulse need to be ignored or not*/
+ if (skipPulseCnt > 0) {
+ LOC_LOGV("%s:%d skip pps count %d, ignoring this pps pulse %ld (sec) %ld (nsec)",
+ __func__,__LINE__, skipPulseCnt, infobuf.tv_sec, infobuf.tv_nsec);
+ skipPulseCnt--;
+ return 0;
+ }
+ /* update dr syncpulse time*/
+
+ pthread_mutex_lock(&ts_lock);
+
+ ret = compute_real_to_boot_time(infobuf);
+
+ pthread_mutex_unlock(&ts_lock);
+
+ 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;
+ }
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, gps_conf_param_table);
+ 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/location/gnsspps/gnsspps.h b/location/gnsspps/gnsspps.h
new file mode 100644
index 0000000..3642f3b
--- /dev/null
+++ b/location/gnsspps/gnsspps.h
@@ -0,0 +1,45 @@
+/* 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.
+ */
+#ifndef _GNSSPPS_H
+#define _GNSSPPS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 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
diff --git a/location/gnsspps/gnsspps.pc.in b/location/gnsspps/gnsspps.pc.in
new file mode 100644
index 0000000..8931ebd
--- /dev/null
+++ b/location/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/location/gnsspps/timepps.h b/location/gnsspps/timepps.h
new file mode 100644
index 0000000..fe0d8f0
--- /dev/null
+++ b/location/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/location/gps_vendor_product.mk b/location/gps_vendor_product.mk
new file mode 100644
index 0000000..3865d47
--- /dev/null
+++ b/location/gps_vendor_product.mk
@@ -0,0 +1,4 @@
+# vendor opensource packages
+PRODUCT_PACKAGES += libloc_api_v02
+PRODUCT_PACKAGES += libgnsspps
+PRODUCT_PACKAGES += libsynergy_loc_api
diff --git a/location/integration_api/LocationIntegrationApiDoxygen.conf b/location/integration_api/LocationIntegrationApiDoxygen.conf
new file mode 100644
index 0000000..6c1652e
--- /dev/null
+++ b/location/integration_api/LocationIntegrationApiDoxygen.conf
@@ -0,0 +1,2294 @@
+# Doxyfile 1.8.6
+#==========================================================================
+#Copyright (c) 2018-2019, 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.
+#
+#==========================================================================
+
+# This file describes the settings to be used by the documentation system
+# doxygen for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "LocationIntegrationApi"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = docs
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable documentation.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation for the list of possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system.
+# You will need version 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code.
+# For an example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian .
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian . See the section "External Indexing and Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz.
+# A graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = YES
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/location/integration_api/Makefile.am b/location/integration_api/Makefile.am
new file mode 100644
index 0000000..ca52f61
--- /dev/null
+++ b/location/integration_api/Makefile.am
@@ -0,0 +1,54 @@
+AM_CFLAGS = \
+ -DDEBUG \
+ -I src/ \
+ -I inc/ \
+ $(GPSUTILS_CFLAGS) \
+ -std=c++11
+
+ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -std=c++11
+
+requiredlibs = \
+ $(GPSUTILS_LIBS)
+
+h_sources = \
+ src/LocationIntegrationApiImpl.h \
+ inc/LocationIntegrationApi.h
+
+c_sources = \
+ src/LocationIntegrationApiImpl.cpp \
+ src/LocationIntegrationApi.cpp
+
+liblocation_integration_api_la_SOURCES = \
+ $(c_sources) $(h_sources)
+liblocation_integration_api_la_h_sources = $(h_sources)
+
+######################
+# Build location_integration_api
+######################
+
+if USE_GLIB
+liblocation_integration_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+liblocation_integration_api_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+liblocation_integration_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+liblocation_integration_api_la_CFLAGS = $(AM_CFLAGS)
+liblocation_integration_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+liblocation_integration_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+if USE_EXTERNAL_AP
+AM_CFLAGS += $(LOCSOCKET_CFLAGS)
+requiredlibs += $(LOCSOCKET_LIBS)
+endif
+
+liblocation_integration_api_la_LIBADD = $(requiredlibs) -lstdc++ -ldl
+
+#Create and Install libraries
+library_include_HEADERS = $(h_sources)
+lib_LTLIBRARIES = liblocation_integration_api.la
+
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-integration-api.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/location/integration_api/README b/location/integration_api/README
new file mode 100644
index 0000000..cee2c41
--- /dev/null
+++ b/location/integration_api/README
@@ -0,0 +1,11 @@
+Location Client Api doc
+
+1. Steps to generate doxygen Api doc:
+run
+ mkclientapidoc.sh [output-path]
+default output-path is docs/
+default doxgen configuration file is LocationClientApiDoxygen.conf
+
+2. below file will be generated:
+ html/
+ -HTML output, where the html/index.html is the home page.
diff --git a/location/integration_api/configure.ac b/location/integration_api/configure.ac
new file mode 100644
index 0000000..ef583db
--- /dev/null
+++ b/location/integration_api/configure.ac
@@ -0,0 +1,73 @@
+# configure.ac -- Autoconf script for gps location-integration-api
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the location_integration_api package version 1.0.0
+AC_INIT([location-integration-api],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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([external_ap],
+ AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
+ [Using External Application Processor]),
+ [],
+ with_external_ap=no)
+
+if test "x$with_external_ap" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
+fi
+
+AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "xyes")
+
+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-integration-api.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/integration_api/inc/LocationIntegrationApi.h b/location/integration_api/inc/LocationIntegrationApi.h
new file mode 100644
index 0000000..5836bcc
--- /dev/null
+++ b/location/integration_api/inc/LocationIntegrationApi.h
@@ -0,0 +1,519 @@
+/* Copyright (c) 2019-2020 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 LOCATION_INTEGRATION_API_H
+#define LOCATION_INTEGRATION_API_H
+
+#include <loc_pla.h>
+
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
+
+namespace location_integration
+{
+/**
+ * Configuration API types that are currently supported
+ */
+enum LocConfigTypeEnum{
+ /** Blacklist some SV constellations from being used by GNSS
+ * engine. </br> */
+ CONFIG_CONSTELLATIONS = 1,
+ /** Enable/disable the constrained time uncertainty feature and
+ * configure related parameters when the feature is
+ * enabled. </br> */
+ CONFIG_CONSTRAINED_TIME_UNCERTAINTY = 2,
+ /** Enable/disable the position assisted clock estimator
+ * feature. </br> */
+ CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR = 3,
+ /** Delete all aiding data. </br> */
+ CONFIG_AIDING_DATA_DELETION = 4,
+ /** Config lever arm parameters. </br> */
+ CONFIG_LEVER_ARM = 5,
+ /** Config robust location feature. </br> */
+ CONFIG_ROBUST_LOCATION = 6,
+ /** Get configuration regarding robust location setting used by
+ * GNSS engine. </br> */
+ GET_ROBUST_LOCATION_CONFIG = 100,
+} ;
+
+/**
+ * Specify the asynchronous response when calling location
+ * integration API. */
+enum LocIntegrationResponse {
+ /** Location integration API request is processed
+ * successfully */
+ LOC_INT_RESPONSE_SUCCESS = 1,
+ /** Location integration API request is not processed
+ * successfully */
+ LOC_INT_RESPONSE_FAILURE = 2,
+ /** Location integration API request is not supported */
+ LOC_INT_RESPONSE_NOT_SUPPORTED = 3,
+ /** Location integration API request has invalid parameter */
+ LOC_INT_RESPONSE_PARAM_INVALID = 4,
+} ;
+
+/**
+ * Define the priority to be used when the corresponding
+ * configuration API specified by type is invoked. Priority is
+ * specified via uint32_t and lower number means lower
+ * priority.
+ *
+ * Currently, all configuration requests, regardless of
+ * priority, will be honored. Priority based request
+ * honoring will come in subsequent phases and more
+ * detailed description on this will be available then.
+ */
+typedef std::unordered_map<LocConfigTypeEnum, uint32_t>
+ LocConfigPriorityMap;
+
+/** Gnss constellation type mask */
+typedef uint32_t GnssConstellationMask;
+
+/**
+ * Specify SV Constellation types that can be configured via
+ * configConstellations. </br>
+ * Please note that GPS constellation can not be disabled
+ * and thus not included in the enum list. </br> */
+enum GnssConstellationType {
+ /** GLONASS SV system */
+ GNSS_CONSTELLATION_TYPE_GLONASS = 1,
+ /** QZSS SV system */
+ GNSS_CONSTELLATION_TYPE_QZSS = 2,
+ /** BEIDOU SV system */
+ GNSS_CONSTELLATION_TYPE_BEIDOU = 3,
+ /** GALILEO SV system */
+ GNSS_CONSTELLATION_TYPE_GALILEO = 4,
+ /** SBAS SV system */
+ GNSS_CONSTELLATION_TYPE_SBAS = 5
+};
+
+/**
+ * Specify parameters related to enable/disable SVs */
+struct GnssSvIdInfo {
+ /** constellation for the sv */
+ GnssConstellationType constellation;
+ /** sv id for the constellation:
+ * GLONASS SV id range: 65 to 96
+ * QZSS SV id range: 193 to 197
+ * BDS SV id range: 201 to 237
+ * GAL SV id range: 301 to 336
+ * SBAS SV id range: 120 to 158 and 183 to 191
+ */
+ uint32_t svId;
+};
+
+/**
+ * Lever ARM type */
+enum LeverArmType {
+ /** Lever arm parameters regarding the VRP (Vehicle Reference
+ * Point) w.r.t the origin (at the GNSS Antenna) */
+ LEVER_ARM_TYPE_GNSS_TO_VRP = 1,
+ /** Lever arm regarding GNSS Antenna w.r.t the origin at the
+ * IMU (inertial measurement unit) for DR (dead reckoning
+ * engine) */
+ LEVER_ARM_TYPE_DR_IMU_TO_GNSS = 2,
+ /** Lever arm regarding GNSS Antenna w.r.t the origin at the
+ * IMU (inertial measurement unit) for VEPP (vision enhanced
+ * precise positioning engine) */
+ LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS = 3,
+};
+
+/**
+ * Specify parameters related to lever arm */
+struct LeverArmParams {
+ /** Offset along the vehicle forward axis, in unit of meters */
+ float forwardOffsetMeters;
+ /** Offset along the vehicle starboard axis, in unit of
+ * meters */
+ float sidewaysOffsetMeters;
+ /** Offset along the vehicle up axis, in unit of meters */
+ float upOffsetMeters;
+};
+
+/**
+ * Define the lever arm parameters to be used with
+ * configLeverArm function.
+ *
+ * Currently, there are two types of lever arm parameters that
+ * can be configured:
+ * 1: Lever arm regarding GNSS Antenna w.r.t the origin at the
+ * IMU (inertial measurement unit)
+ * 2: Lever arm parameters regarding the VRP (Vehicle Reference Point)
+ * w.r.t the origin (at the GNSS Antenna)
+ */
+typedef std::unordered_map<LeverArmType, LeverArmParams> LeverArmParamsMap;
+
+/**
+ * Specify the absolute set of constellations and SVs
+ * that should not be used by the GNSS engine on modem.
+ *
+ * To blacklist all SVs from one constellation, use
+ * GNSS_SV_ID_BLACKLIST_ALL as sv id for that constellation.
+ *
+ * To specify only a subset of the SVs to be blacklisted, for
+ * each SV, specify its constelaltion and the SV id and put in
+ * the vector.
+ *
+ * All SVs being blacklisted should not be used in positioning.
+ * For SBAS, SVs are not used by GNSS engine on modem by
+ * default. Blacklisting SBAS SV only blocks SBAS data demod.
+ * SBAS XCORR functionality will not be disabled for blacklisted
+ * SBAS SVs.
+ *
+ * GLONASS SV id range: 65 to 96
+ * QZSS SV id range: 193 to 197
+ * BDS SV id range: 201 to 237
+ * GAL SV id range: 301 to 336
+ * SBAS SV id range: 120 to 158 and 183 to 191
+ */
+#define GNSS_SV_ID_BLACKLIST_ALL (0)
+typedef std::vector<GnssSvIdInfo> LocConfigBlacklistedSvIdList;
+
+/** @fn
+ @brief
+ Used to get the asynchronous notification of the processing
+ status of the configuration APIs.
+
+ In order to get the notification, an instantiation
+ LocConfigCb need to be passed to the constructor of
+ LocationIntegration API. Please refer to each function for
+ details regarding how this callback will be invoked.
+
+ @param
+ response: if the response is not LOC_INT_API_RESPONSE_SUCCESS,
+ then the integration API of requestType has failed.
+*/
+typedef std::function<void(
+ /** location configuration request type */
+ LocConfigTypeEnum configType,
+ /** processing status for the location configuration request*/
+ LocIntegrationResponse response
+)> LocConfigCb;
+
+/** Specify the valid mask for robust location configuration
+ * used by GNSS engine on modem. The robust location
+ * configuraiton can be retrieved by invoking
+ * LocConfigGetRobustLocationConfigCb. <br/> */
+enum RobustLocationConfigValidMask {
+ /** RobustLocationConfig has valid
+ * RobustLocationConfig::enabled. <br/> */
+ ROBUST_LOCATION_CONFIG_VALID_ENABLED = (1<<0),
+ /** RobustLocationConfig has valid
+ * RobustLocationConfig::enabledForE911. <br/> */
+ ROBUST_LOCATION_CONFIG_VALID_ENABLED_FOR_E911 = (1<<1),
+};
+
+/** Specify the robust location configuration used by modem GNSS
+ * engine that will be returned when invoking
+ * LocConfigGetRobustLocationConfigCb. The configuration will
+ * be returned via LocConfigGetRobustLocationConfigCb. <br/> */
+struct RobustLocationConfig {
+ /** Bitwise OR of RobustLocationConfigValidMask to specify
+ * the valid fields. <br/> */
+ RobustLocationConfigValidMask validMask;
+ /** Specify whether robust location feature is enabled or
+ * not. <br/> */
+ bool enabled;
+ /** Specify whether robust location feature is enabled or not
+ * when device is on E911 call. <br/> */
+ bool enabledForE911;
+};
+
+/**
+ * Specify the callback to retrieve the robust location setting
+ * used by modem GNSS engine. The callback will be invoked
+ * for successful processing of getRobustLocationConfig().
+ * <br/>
+ *
+ * In order to receive the robust location configuration, user
+ * shall instantiate the callback and pass it to the
+ * LocationIntegrationApi constructor and then invoke
+ * getRobustLocationConfig(). <br/> */
+typedef std::function<void(
+ RobustLocationConfig robustLocationConfig
+)> LocConfigGetRobustLocationConfigCb;
+
+/**
+ * Specify the set of callbacks that can be passed to
+ * LocationIntegrationAPI constructor to receive configuration
+ * command processing status and the requested data.
+ */
+struct LocIntegrationCbs {
+ /** Callback to receive the procesings status, e.g.: success
+ * or failure. <br/> */
+ LocConfigCb configCb;
+ /** Callback to receive the robust location setting. <br/> */
+ LocConfigGetRobustLocationConfigCb getRobustLocationConfigCb;
+};
+
+class LocationIntegrationApiImpl;
+class LocationIntegrationApi
+{
+public:
+
+ /** @brief
+ Creates an instance of LocationIntegrationApi object with
+ the specified priority map and callback functions. For this
+ phase, the priority map will be ignored.
+
+ @param
+ priorityMap: specify the priority for each of the
+ configuration type that this integration API client would
+ like to control.
+
+ @param
+ integrationCbs: set of callbacks to receive info from
+ location integration API. For example, client can pass
+ LocConfigCb to receive the asynchronous processing status of
+ configuration command.
+ */
+ LocationIntegrationApi(const LocConfigPriorityMap& priorityMap,
+ LocIntegrationCbs& integrationCbs);
+
+ /** @brief Default destructor */
+ ~LocationIntegrationApi();
+
+ /** @brief
+ Blacklist some constellations or subset of SVs from the
+ constellation from being used by the GNSS engine on modem.
+
+ Please note this API call is not incremental and the new
+ setting will completely overwrite the previous call.
+ blacklistedSvList shall contain the complete list
+ of blacklisted constellations and blacklisted SVs.
+ Constellations and SVs not specified in the parameter will
+ be considered to be allowed to get used by GNSS engine.
+
+ Client should wait for the command to finish, e.g.: via
+ configCb received before issuing a second
+ configConstellations command. Behavior is not defined if
+ client issues a second request of configConstellations
+ without waiting for the finish of the previous
+ configConstellations request.
+
+ @param
+ blacklistedSvList: specify the set of constellations and SVs
+ that should not be used by the GNSS engine on modem.
+ Constellations and SVs not specified in blacklistedSvList
+ will be allowed to get used by the GNSS engine on modem.
+
+ Nullptr of blacklistedSvList will be interpreted as to reset
+ the constellation configuration to device default.
+
+ @return true, if request is successfully processed as
+ requested. When returning true, configCb will be
+ invoked to deliver asynchronous processing status.
+
+ @return false, if request is not successfully processed as
+ requested. When returning false, configCb will
+ not be invoked.
+ */
+ bool configConstellations(const LocConfigBlacklistedSvIdList*
+ blacklistedSvList=nullptr);
+
+ /** @brief
+ Enable or disable the constrained time uncertainty feature.
+
+ Client should wait for the command to finish, e.g.:
+ via configCb received before issuing a second
+ configConstrainedTimeUncertainty command. Behavior is not
+ defined if client issues a second request of
+ configConstrainedTimeUncertainty without waiting for
+ the finish of the previous configConstrainedTimeUncertainty
+ request.
+
+ @param
+ enable: true to enable the constrained time uncertainty
+ feature and false to disable the constrainted time
+ uncertainty feature.
+
+ @param
+ tuncThresholdMs: this specifies the time uncertainty
+ threshold that GNSS engine need to maintain, in units of
+ milli-seconds. Default is 0.0 meaning that modem default
+ value of time uncertainty threshold will be used. This
+ parameter is ignored when request is to disable this
+ feature.
+
+ @param
+ energyBudget: this specifies the power budget that GNSS
+ engine is allowed to spend to maintain the time uncertainty.
+ Default is 0 meaning that GPS engine is not constained by
+ power budget and can spend as much power as needed. The
+ parameter need to be specified in units of 0.1 milli watt
+ second, e.g.: an energy budget of 2.0 milli watt will be of
+ 20 units. This parameter is ignored when request is to
+ disable this feature.
+
+ @return true, if the constrained time uncertainty feature is
+ successfully enabled or disabled as requested.
+ When returning true, configCb will be invoked to
+ deliver asynchronous processing status.
+
+ @return false, if the constrained time uncertainty feature is
+ not successfully enabled or disabled as requested.
+ When returning false, configCb will not be invoked.
+ */
+ bool configConstrainedTimeUncertainty(bool enable,
+ float tuncThresholdMs = 0.0,
+ uint32_t energyBudget = 0);
+
+ /** @brief
+ Enable or disable position assisted clock estimator feature.
+
+ Client should wait for the command to finish, e.g.: via
+ configCb received before issuing a second
+ configPositionAssistedClockEstimator command. Behavior is
+ not defined if client issues a second request of
+ configPositionAssistedClockEstimator without waiting for the
+ finish of the previous configPositionAssistedClockEstimator
+ request.
+
+ @param
+ enable: true to enable position assisted clock estimator and
+ false to disable the position assisted clock estimator
+ feature.
+
+ @return true, if position assisted clock estimator is
+ successfully enabled or disabled as requested. When
+ returning true, configCb will be invoked to deliver
+ asynchronous processing status.
+
+ @return false, if position assisted clock estimator is not
+ successfully enabled or disabled as requested. When
+ returning false, configCb will not be invoked.
+ */
+ bool configPositionAssistedClockEstimator(bool enable);
+
+ /** @brief
+ Request all forms of aiding data to be deleted from all
+ position engines.
+
+ @return true, if aiding data delete request is successfully
+ performed. When returning true, configCb will be
+ invoked to deliver asynchronous processing status.
+
+ @return false, if aiding data delete request is not
+ successfully performed. When returning false,
+ configCb will not be invoked.
+ */
+ bool deleteAllAidingData();
+
+ /** @brief
+ Sets the lever arm parameters for the vehicle.
+
+ LeverArm is sytem level parameters and it is not expected to
+ change. So, it is needed to issue configLeverArm once for
+ every application processor boot-up. For multiple
+ invocations of this API, client should wait
+ for the command to finish, e.g.: via configCb received
+ before issuing a second configLeverArm command. Behavior is
+ not defined if client issues a second request of
+ cconfigLeverArm without waiting for the finish of the
+ previous configLeverArm request.
+
+ @param
+ configInfo: lever arm configuration info regarding below two
+ types of lever arm info:
+ a: GNSS Antenna w.r.t the origin at the IMU (inertial
+ measurement unit) for DR engine
+ b: GNSS Antenna w.r.t the origin at the IMU (inertial
+ measurement unit) for VEPP engine
+ c: VRP (Vehicle Reference Point) w.r.t the origin (at the
+ GNSS Antenna). Vehicle manufacturers prefer the position
+ output to be tied to a specific point in the vehicle rather
+ than where the antenna is placed (midpoint of the rear axle
+ is typical).
+
+ Caller can specify which types of lever arm info to
+ configure via the leverMarkTypeMask.
+
+ @return true, if lever arm parameters are successfully
+ configured as requested. When returning true,
+ configCb will be invoked to deliver asynchronous
+ processing status.
+
+ @return false, if lever arm parameters are not successfully
+ configured as requested. When returning false,
+ configCb will not be invoked.
+ */
+ bool configLeverArm(const LeverArmParamsMap& configInfo);
+
+
+ /** @brief
+ Enable/disable robust location feature and enable/disable
+ robust location while device is on E911.
+
+ @param
+ enable: true to enable robust location and false to disable
+ robust location.
+
+ @param
+ enableForE911: true to enable robust location when device is
+ on E911 session and false to disable on E911 session. <br/>
+ This parameter is only valid if robust location is enabled.
+ </br>
+
+ @return true, if robust location are successfully configured
+ as requested. When returning true, configCb will be
+ invoked to deliver asynchronous processing status.
+
+ @return false, if robust location are not successfully
+ configured as requested. When returning false,
+ configCb will not be invoked.
+ */
+ bool configRobustLocation(bool enable, bool enableForE911=false);
+
+ /** @brief
+ Request robust location setting used by GNSS engine. If
+ processing of the command fails, the failure status will be
+ returned via configCb. If the processing of the command is
+ successful, the successful status will be returned via
+ configCB, and the robust location config info will be
+ returned via getRobustLocationConfigCb passed via the
+ constructor.
+
+ @return true, if the API request has been accepted.
+
+ @return false, if the API request has not been accepted for
+ further processing. When returning false, configCb
+ and getRobustLocationConfigCb will not be
+ invoked.
+ */
+ bool getRobustLocationConfig();
+
+private:
+ LocationIntegrationApiImpl* mApiImpl;
+};
+
+} // namespace location_integration
+
+#endif /* LOCATION_INTEGRATION_API_H */
diff --git a/location/integration_api/location-integration-api.pc.in b/location/integration_api/location-integration-api.pc.in
new file mode 100644
index 0000000..180e7c4
--- /dev/null
+++ b/location/integration_api/location-integration-api.pc.in
@@ -0,0 +1,38 @@
+/* Copyright (c) 2019 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.
+ */
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-integration-api
+Description: location integration api library
+Version: @VERSION@
+Libs: -L${libdir} -llocation_integration_api
+Cflags: -I${includedir} -I${includedir}/location-integration-api
\ No newline at end of file
diff --git a/location/integration_api/mkintegrationapidoc.sh b/location/integration_api/mkintegrationapidoc.sh
new file mode 100644
index 0000000..4ee0380
--- /dev/null
+++ b/location/integration_api/mkintegrationapidoc.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+#==========================================================================
+#Copyright (c) 2018-2019, 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.
+#
+#==========================================================================
+
+#==========================================================================
+#
+# Usage:
+# mkintegrationapidoc.sh [output-path]
+#
+# Note, this script requires the existence of the doxygen tool -
+# This script can be called from any directory
+#==========================================================================
+
+DIR="$( cd "$( dirname "$0" )" && pwd )"
+# the default doxygen configuration is LocationIntegrationApiDoxygen.conf
+CONFIG=$DIR/LocationIntegrationApiDoxygen.conf
+OUT="docs"
+
+# Show help message if requested, otherwise create output folder
+if [ -n "$1" ]
+then
+ if [ "$1" == "-h" ] || [ "$1" == "--help" ]
+ then
+ echo "$0 [output-path]"
+ echo " e.g. $0"
+ echo " $0 docs"
+ exit
+ else
+ OUT=$1
+ if [ ! -d $OUT ]
+ then
+ mkdir -p $OUT
+ fi
+ fi
+fi
+
+
+which doxygen
+if [ "$?" == 0 ]
+then
+# Use ? here to seperate patterns as / in path will be regarded as splitter by default
+ sed -i "s?^OUTPUT_DIRECTORY .*?OUTPUT_DIRECTORY = $OUT?" $CONFIG
+ sed -i "s?^INPUT .*?INPUT = $DIR/inc?" $CONFIG
+ doxygen $CONFIG > /dev/null 2>&1
+else
+ echo "This script requires doxygen tool be to installed. "
+ echo "You can install is with e.g. sudo apt-get install doxygen"
+ exit 1
+fi
+
+
+if [ ! -e $OUT/html/index.html ]
+then
+ echo "Error building Location Client Api doc files."
+ exit 2
+fi
+
+echo
+echo "doxygen docs for Location Client Api available at: $OUT/html"
diff --git a/location/integration_api/src/LocationIntegrationApi.cpp b/location/integration_api/src/LocationIntegrationApi.cpp
new file mode 100644
index 0000000..7c2a778
--- /dev/null
+++ b/location/integration_api/src/LocationIntegrationApi.cpp
@@ -0,0 +1,270 @@
+/* Copyright (c) 2019-2020 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.
+ */
+#define LOG_TAG "LocSvc_LocationIntegrationApi"
+
+
+#include <LocationDataTypes.h>
+#include <LocationIntegrationApi.h>
+#include <LocationIntegrationApiImpl.h>
+#include <log_util.h>
+
+namespace location_integration {
+
+
+/******************************************************************************
+LocationIntegrationApi
+******************************************************************************/
+LocationIntegrationApi::LocationIntegrationApi(
+ const LocConfigPriorityMap& priorityMap,
+ LocIntegrationCbs& integrationCbs) {
+
+ mApiImpl = new LocationIntegrationApiImpl(integrationCbs);
+}
+
+LocationIntegrationApi::~LocationIntegrationApi() {
+
+ LOC_LOGd("calling destructor of LocationIntegrationApi");
+ if (mApiImpl) {
+ mApiImpl->destroy();
+ }
+}
+
+bool LocationIntegrationApi::configConstellations(
+ const LocConfigBlacklistedSvIdList* blacklistedSvIds){
+
+ bool retVal = false;
+
+ if (mApiImpl) {
+ if (nullptr == blacklistedSvIds) {
+ LOC_LOGd("reset to default");
+ mApiImpl->resetConstellationConfig();
+ retVal = true;
+ } else {
+ GnssSvTypeConfig svTypeConfig = {};
+ svTypeConfig.size = sizeof(svTypeConfig);
+ svTypeConfig.enabledSvTypesMask =
+ GNSS_SV_TYPES_MASK_GLO_BIT|GNSS_SV_TYPES_MASK_BDS_BIT|
+ GNSS_SV_TYPES_MASK_QZSS_BIT|GNSS_SV_TYPES_MASK_GAL_BIT;
+ GnssSvIdConfig svIdConfig = {};
+ svIdConfig.size = sizeof(GnssSvIdConfig);
+
+ for (GnssSvIdInfo it : *blacklistedSvIds) {
+ GnssSvTypesMask svTypeMask = (GnssSvTypesMask) 0;
+ uint64_t* svMaskPtr = NULL;
+ GnssSvId initialSvId = 0;
+ uint16_t svIndexOffset = 0;
+ switch (it.constellation) {
+ case GNSS_CONSTELLATION_TYPE_GLONASS:
+ svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_GLO_BIT;
+ svMaskPtr = &svIdConfig.gloBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_GLO_INITIAL_SV_ID;
+ break;
+ case GNSS_CONSTELLATION_TYPE_QZSS:
+ svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_QZSS_BIT;
+ svMaskPtr = &svIdConfig.qzssBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID;
+ break;
+ case GNSS_CONSTELLATION_TYPE_BEIDOU:
+ svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_BDS_BIT;
+ svMaskPtr = &svIdConfig.bdsBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_BDS_INITIAL_SV_ID;
+ break;
+ case GNSS_CONSTELLATION_TYPE_GALILEO:
+ svTypeMask = (GnssSvTypesMask) GNSS_SV_TYPES_MASK_GAL_BIT;
+ svMaskPtr = &svIdConfig.galBlacklistSvMask;
+ initialSvId = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID;
+ break;
+ case GNSS_CONSTELLATION_TYPE_SBAS:
+ // SBAS does not support enable/disable whole constellation
+ // so do not set up svTypeMask for SBAS
+ svMaskPtr = &svIdConfig.sbasBlacklistSvMask;
+ // SBAS currently has two ranges
+ // range of SV id: 183 to 191
+ if (GNSS_SV_ID_BLACKLIST_ALL == it.svId) {
+ LOC_LOGd("blacklist all SBAS SV");
+ } else if (it.svId >= GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID) {
+ initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID;
+ svIndexOffset = GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH;
+ } else if ((it.svId >= GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID) &&
+ (it.svId < (GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID +
+ GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH))){
+ // range of SV id: 120 to 158
+ initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID;
+ } else {
+ LOC_LOGe("invalid SBAS sv id %d", it.svId);
+ svMaskPtr = nullptr;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (nullptr == svMaskPtr) {
+ LOC_LOGe("Invalid constellation %d", it.constellation);
+ } else {
+ // SV ID 0 = Blacklist All SVs
+ if (GNSS_SV_ID_BLACKLIST_ALL == it.svId) {
+ // blacklist all SVs in this constellation
+ *svMaskPtr = GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK;
+ svTypeConfig.enabledSvTypesMask &= ~svTypeMask;
+ svTypeConfig.blacklistedSvTypesMask |= svTypeMask;
+ } else if (it.svId < initialSvId || it.svId >= initialSvId + 64) {
+ LOC_LOGe ("SV TYPE %d, Invalid sv id %d ", it.constellation, it.svId);
+ } else {
+ uint32_t shiftCnt = it.svId + svIndexOffset - initialSvId;
+ *svMaskPtr |= (1ULL << shiftCnt);
+ }
+ }
+ }
+
+ LOC_LOGd(">>> configConstellations, "
+ "enabled mask =0x%" PRIx64 ", "
+ "blacklisted mask =0x%" PRIx64 ",\n"
+ "glo blacklist mask =0x%" PRIx64 ", "
+ "qzss blacklist mask =0x%" PRIx64 ",\n"
+ "bds blacklist mask =0x%" PRIx64 ", "
+ "gal blacklist mask =0x%" PRIx64 ",\n"
+ "sbas blacklist mask =0x%" PRIx64 ", ",
+ svTypeConfig.enabledSvTypesMask,
+ svTypeConfig.blacklistedSvTypesMask,
+ svIdConfig.gloBlacklistSvMask,
+ svIdConfig.qzssBlacklistSvMask,
+ svIdConfig.bdsBlacklistSvMask,
+ svIdConfig.galBlacklistSvMask,
+ svIdConfig.sbasBlacklistSvMask);
+ mApiImpl->configConstellations(svTypeConfig, svIdConfig);
+ retVal = true;
+ }
+ } else {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+
+ return retVal;
+}
+
+bool LocationIntegrationApi::configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold, uint32_t energyBudget) {
+ if (mApiImpl) {
+ mApiImpl->configConstrainedTimeUncertainty(
+ enable, tuncThreshold, energyBudget);
+ return true;
+ } else {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+}
+
+bool LocationIntegrationApi::configPositionAssistedClockEstimator(bool enable) {
+
+ if (mApiImpl) {
+ mApiImpl->configPositionAssistedClockEstimator(enable);
+ return true;
+ } else {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+}
+
+bool LocationIntegrationApi::deleteAllAidingData() {
+
+ if (mApiImpl) {
+ GnssAidingData aidingData = {};
+ aidingData.deleteAll = true;
+ aidingData.posEngineMask = POSITION_ENGINE_MASK_ALL;
+ mApiImpl->gnssDeleteAidingData(aidingData);
+ return true;
+ } else {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+}
+
+bool LocationIntegrationApi::configLeverArm(const LeverArmParamsMap& configInfo) {
+
+ if (mApiImpl) {
+ LeverArmConfigInfo halLeverArmConfigInfo = {};
+ for (auto it = configInfo.begin(); it != configInfo.end(); ++it) {
+ ::LeverArmParams* params = nullptr;
+ LeverArmTypeMask mask = (LeverArmTypeMask) 0;
+ switch (it->first){
+ case LEVER_ARM_TYPE_GNSS_TO_VRP:
+ mask = LEVER_ARM_TYPE_GNSS_TO_VRP_BIT;
+ params = &halLeverArmConfigInfo.gnssToVRP;
+ break;
+ case LEVER_ARM_TYPE_DR_IMU_TO_GNSS:
+ mask = LEVER_ARM_TYPE_DR_IMU_TO_GNSS_BIT;
+ params = &halLeverArmConfigInfo.drImuToGnss;
+ break;
+ case LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS:
+ mask = LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS_BIT;
+ params = &halLeverArmConfigInfo.veppImuToGnss;
+ break;
+ default:
+ break;
+ }
+ if (nullptr != params) {
+ halLeverArmConfigInfo.leverArmValidMask |= mask;
+ params->forwardOffsetMeters = it->second.forwardOffsetMeters;
+ params->sidewaysOffsetMeters = it->second.sidewaysOffsetMeters;
+ params->upOffsetMeters = it->second.upOffsetMeters;
+ LOC_LOGd("mask 0x%x, %f %f %f", mask, params->forwardOffsetMeters,
+ params->sidewaysOffsetMeters, params->upOffsetMeters);
+ }
+ }
+ mApiImpl->configLeverArm(halLeverArmConfigInfo);
+ return true;
+ } else {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+}
+
+bool LocationIntegrationApi::configRobustLocation(bool enable, bool enableForE911) {
+
+ if (mApiImpl) {
+ mApiImpl->configRobustLocation(enable, enableForE911);
+ return true;
+ } else {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+}
+
+bool LocationIntegrationApi::getRobustLocationConfig() {
+ if (mApiImpl) {
+ // mApiImpl->getRobustLocationConfig returns none-zero when
+ // there is no callback
+ return (mApiImpl->getRobustLocationConfig() == 0);
+ } else {
+ LOC_LOGe ("NULL mApiImpl");
+ return false;
+ }
+}
+
+} // namespace location_integration
diff --git a/location/integration_api/src/LocationIntegrationApiImpl.cpp b/location/integration_api/src/LocationIntegrationApiImpl.cpp
new file mode 100644
index 0000000..03e421c
--- /dev/null
+++ b/location/integration_api/src/LocationIntegrationApiImpl.cpp
@@ -0,0 +1,706 @@
+/* Copyright (c) 2019-2020 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.
+ */
+
+#define LOG_TAG "LocSvc_LocationIntegrationApi"
+
+#include <loc_cfg.h>
+#include <LocationIntegrationApiImpl.h>
+#include <log_util.h>
+#include <gps_extended_c.h>
+
+namespace location_integration {
+
+/******************************************************************************
+Utilities
+******************************************************************************/
+
+static LocConfigTypeEnum getLocConfigTypeFromMsgId(ELocMsgID msgId) {
+ LocConfigTypeEnum configType = (LocConfigTypeEnum) 0;
+ switch (msgId) {
+ case E_INTAPI_CONFIG_CONSTRAINTED_TUNC_MSG_ID:
+ configType = CONFIG_CONSTRAINED_TIME_UNCERTAINTY;
+ break;
+ case E_INTAPI_CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR_MSG_ID:
+ configType = CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR;
+ break;
+ case E_INTAPI_CONFIG_SV_CONSTELLATION_MSG_ID:
+ configType = CONFIG_CONSTELLATIONS;
+ break;
+ case E_INTAPI_CONFIG_AIDING_DATA_DELETION_MSG_ID:
+ configType = CONFIG_AIDING_DATA_DELETION;
+ break;
+ case E_INTAPI_CONFIG_LEVER_ARM_MSG_ID:
+ configType = CONFIG_LEVER_ARM;
+ break;
+ case E_INTAPI_CONFIG_ROBUST_LOCATION_MSG_ID:
+ configType = CONFIG_ROBUST_LOCATION;
+ break;
+ case E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID:
+ case E_INTAPI_GET_ROBUST_LOCATION_CONFIG_RESP_MSG_ID:
+ configType = GET_ROBUST_LOCATION_CONFIG;
+ break;
+ default:
+ break;
+ }
+ return configType;
+}
+
+static LocIntegrationResponse getLocIntegrationResponse(::LocationError error) {
+ LocIntegrationResponse response;
+
+ switch (error) {
+ case LOCATION_ERROR_SUCCESS:
+ response = LOC_INT_RESPONSE_SUCCESS;
+ break;
+ case LOCATION_ERROR_NOT_SUPPORTED:
+ response = LOC_INT_RESPONSE_NOT_SUPPORTED;
+ break;
+ case LOCATION_ERROR_INVALID_PARAMETER:
+ response = LOC_INT_RESPONSE_PARAM_INVALID;
+ break;
+ default:
+ response = LOC_INT_RESPONSE_FAILURE;
+ break;
+ }
+
+ return response;
+}
+
+/******************************************************************************
+ILocIpcListener override
+******************************************************************************/
+class IpcListener : public ILocIpcListener {
+ MsgTask& mMsgTask;
+ LocationIntegrationApiImpl& mApiImpl;
+public:
+ inline IpcListener(LocationIntegrationApiImpl& apiImpl, MsgTask& msgTask) :
+ mMsgTask(msgTask), mApiImpl(apiImpl) {}
+ virtual void onListenerReady() override;
+ virtual void onReceive(const char* data, uint32_t length,
+ const LocIpcRecver* recver) override;
+};
+
+/******************************************************************************
+LocationIntegrationApiImpl
+******************************************************************************/
+mutex LocationIntegrationApiImpl::mMutex;
+bool LocationIntegrationApiImpl::mClientRunning = false;
+
+/******************************************************************************
+LocationIntegrationApiImpl - constructors
+******************************************************************************/
+LocationIntegrationApiImpl::LocationIntegrationApiImpl(LocIntegrationCbs& integrationCbs) :
+ mHalRegistered(false),
+ mIntegrationCbs(integrationCbs),
+ mTuncConfigInfo{},
+ mPaceConfigInfo{},
+ mSVConfigInfo{},
+ mLeverArmConfigInfo{} {
+ if (integrationClientAllowed() == false) {
+ return;
+ }
+
+ mMsgTask = new MsgTask("IntegrationApiImpl", false);
+ // get pid to generate sokect name
+ uint32_t pid = (uint32_t)getpid();
+
+#ifdef FEATURE_EXTERNAL_AP
+ SockNodeEap sock(LOCATION_CLIENT_API_QSOCKET_CLIENT_SERVICE_ID,
+ pid * 100);
+ strlcpy(mSocketName, sock.getNodePathname().c_str(), sizeof(mSocketName));
+ unique_ptr<LocIpcRecver> recver = LocIpc::getLocIpcQrtrRecver(
+ make_shared<IpcListener>(*this, *mMsgTask), sock.getId1(), sock.getId2());
+
+ // establish an ipc sender to the hal daemon
+ mIpcSender = LocIpc::getLocIpcQrtrSender(LOCATION_CLIENT_API_QSOCKET_HALDAEMON_SERVICE_ID,
+ LOCATION_CLIENT_API_QSOCKET_HALDAEMON_INSTANCE_ID);
+ if (mIpcSender == nullptr) {
+ LOC_LOGe("create sender socket failed for service id: %d instance id: %d",
+ LOCATION_CLIENT_API_QSOCKET_HALDAEMON_SERVICE_ID,
+ LOCATION_CLIENT_API_QSOCKET_HALDAEMON_INSTANCE_ID);
+ return;
+ }
+#else
+ SockNodeLocal sock(LOCATION_INTEGRATION_API, pid, 0);
+
+ strlcpy(mSocketName, sock.getNodePathname().c_str(), sizeof(mSocketName));
+ unique_ptr<LocIpcRecver> recver = LocIpc::getLocIpcLocalRecver(
+ make_shared<IpcListener>(*this, *mMsgTask), mSocketName);
+
+ LOC_LOGd("create sender socket: %s", mSocketName);
+ // establish an ipc sender to the hal daemon
+ mIpcSender = LocIpc::getLocIpcLocalSender(SOCKET_TO_LOCATION_HAL_DAEMON);
+ if (mIpcSender == nullptr) {
+ LOC_LOGe("create sender socket failed %s", SOCKET_TO_LOCATION_HAL_DAEMON);
+ return;
+ }
+#endif // FEATURE_EXTERNAL_AP
+
+ LOC_LOGd("listen on socket: %s", mSocketName);
+ mIpc.startNonBlockingListening(recver);
+}
+
+LocationIntegrationApiImpl::~LocationIntegrationApiImpl() {
+}
+
+void LocationIntegrationApiImpl::destroy() {
+
+ struct DestroyReq : public LocMsg {
+ DestroyReq(LocationIntegrationApiImpl* apiImpl) :
+ mApiImpl(apiImpl) {}
+ virtual ~DestroyReq() {}
+ void proc() const {
+ // deregister
+ if (mApiImpl->mHalRegistered && (nullptr != mApiImpl->mIpcSender)) {
+ LocAPIClientDeregisterReqMsg msg(mApiImpl->mSocketName);
+ bool rc = mApiImpl->sendMessage(reinterpret_cast<uint8_t*>(&msg), sizeof(msg));
+ LOC_LOGd(">>> DeregisterReq rc=%d", rc);
+ mApiImpl->mIpcSender = nullptr;
+ }
+
+ if (mApiImpl->mMsgTask) {
+ mApiImpl->mMsgTask->destroy();
+ }
+
+ // delete the integration client, so another integration client can be set
+ {
+ lock_guard<mutex> lock(mMutex);
+ mApiImpl->mClientRunning = false;
+ }
+ delete mApiImpl;
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ };
+
+ mMsgTask->sendMsg(new (nothrow) DestroyReq(this));
+}
+
+bool LocationIntegrationApiImpl::integrationClientAllowed() {
+ lock_guard<mutex> lock(mMutex);
+
+ // allow only one instance of integration client running per process
+ if (!mClientRunning) {
+ mClientRunning = true;
+ return true;
+ } else {
+ LOC_LOGe("there is already a running location integration api client in the process");
+ return false;
+ }
+}
+
+/******************************************************************************
+LocationIntegrationApiImpl -ILocIpcListener
+******************************************************************************/
+void IpcListener::onListenerReady() {
+ struct ClientRegisterReq : public LocMsg {
+ ClientRegisterReq(LocationIntegrationApiImpl& apiImpl) : mApiImpl(apiImpl) {}
+ void proc() const {
+ mApiImpl.sendClientRegMsgToHalDaemon();
+ }
+ LocationIntegrationApiImpl& mApiImpl;
+ };
+ mMsgTask.sendMsg(new (nothrow) ClientRegisterReq(mApiImpl));
+}
+
+void IpcListener::onReceive(const char* data, uint32_t length,
+ const LocIpcRecver* recver) {
+ struct OnReceiveHandler : public LocMsg {
+ OnReceiveHandler(LocationIntegrationApiImpl& apiImpl, IpcListener& listener,
+ const char* data, uint32_t length) :
+ mApiImpl(apiImpl), mListener(listener), mMsgData(data, length) {}
+
+ virtual ~OnReceiveHandler() {}
+ void proc() const {
+ LocAPIMsgHeader *pMsg = (LocAPIMsgHeader *)(mMsgData.data());
+ switch (pMsg->msgId) {
+ case E_LOCAPI_HAL_READY_MSG_ID:
+ LOC_LOGd("<<< HAL ready");
+ if (sizeof(LocAPIHalReadyIndMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ // location hal daemon crashed and re-started
+ mApiImpl.processHalReadyMsg();
+ break;
+
+ case E_INTAPI_CONFIG_CONSTRAINTED_TUNC_MSG_ID:
+ case E_INTAPI_CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR_MSG_ID:
+ case E_INTAPI_CONFIG_SV_CONSTELLATION_MSG_ID:
+ case E_INTAPI_CONFIG_AIDING_DATA_DELETION_MSG_ID:
+ case E_INTAPI_CONFIG_LEVER_ARM_MSG_ID:
+ case E_INTAPI_CONFIG_ROBUST_LOCATION_MSG_ID:
+ case E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID:
+ {
+ if (sizeof(LocAPIGenericRespMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ mApiImpl.processConfigRespCb((LocAPIGenericRespMsg*)pMsg);
+ break;
+ }
+
+ case E_INTAPI_GET_ROBUST_LOCATION_CONFIG_RESP_MSG_ID:
+ {
+ if (sizeof(LocConfigGetRobustLocationConfigRespMsg) != mMsgData.length()) {
+ LOC_LOGw("payload size does not match for message with id: %d",
+ pMsg->msgId);
+ }
+ mApiImpl.processGetRobustLocationConfigRespCb(
+ (LocConfigGetRobustLocationConfigRespMsg*)pMsg);
+ break;
+ }
+
+ default:
+ LOC_LOGw("<<< unknown message %d", pMsg->msgId);
+ break;
+ }
+ }
+ LocationIntegrationApiImpl& mApiImpl;
+ IpcListener& mListener;
+ const string mMsgData;
+ };
+
+ mMsgTask.sendMsg(new (nothrow) OnReceiveHandler(mApiImpl, *this, data, length));
+}
+
+/******************************************************************************
+LocationIntegrationApi - integration API implementation
+******************************************************************************/
+uint32_t LocationIntegrationApiImpl::resetConstellationConfig() {
+ struct ResetConstellationConfigReq : public LocMsg {
+ ResetConstellationConfigReq(LocationIntegrationApiImpl* apiImpl) :
+ mApiImpl(apiImpl) {}
+ virtual ~ResetConstellationConfigReq() {}
+ void proc() const {
+ GnssSvTypeConfig svTypeConfig = {};
+ GnssSvIdConfig svIdConfig = {};
+ LocConfigSvConstellationReqMsg msg(mApiImpl->mSocketName,
+ true, // resetToDefault: true
+ svTypeConfig,
+ svIdConfig);
+ mApiImpl->sendConfigMsgToHalDaemon(CONFIG_CONSTELLATIONS,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ // cache the last config to be used when hal daemon restarts
+ mApiImpl->mSVConfigInfo.isValid = true;
+ mApiImpl->mSVConfigInfo.resetToDeFault = true;
+ mApiImpl->mSVConfigInfo.svTypeConfig = {};
+ mApiImpl->mSVConfigInfo.svIdConfig = {};
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ };
+ mMsgTask->sendMsg(new (nothrow) ResetConstellationConfigReq(this));
+
+ return 0;
+}
+
+uint32_t LocationIntegrationApiImpl::configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) {
+
+ struct ConfigConstellationsReq : public LocMsg {
+ ConfigConstellationsReq(LocationIntegrationApiImpl* apiImpl,
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) :
+ mApiImpl(apiImpl),
+ mSvTypeConfig(svTypeConfig),
+ mSvIdConfig(svIdConfig) {}
+ virtual ~ConfigConstellationsReq() {}
+ void proc() const {
+ LocConfigSvConstellationReqMsg msg(mApiImpl->mSocketName,
+ false, // resetToDefault: false
+ mSvTypeConfig,
+ mSvIdConfig);
+ mApiImpl->sendConfigMsgToHalDaemon(CONFIG_CONSTELLATIONS,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ // cache the last config to be used when hal daemon restarts
+ mApiImpl->mSVConfigInfo.isValid = true;
+ mApiImpl->mSVConfigInfo.resetToDeFault = false;
+ mApiImpl->mSVConfigInfo.svTypeConfig = mSvTypeConfig;
+ mApiImpl->mSVConfigInfo.svIdConfig = mSvIdConfig;
+ }
+
+ LocationIntegrationApiImpl* mApiImpl;
+ GnssSvTypeConfig mSvTypeConfig;
+ GnssSvIdConfig mSvIdConfig;
+ };
+ mMsgTask->sendMsg(new (nothrow) ConfigConstellationsReq(
+ this, svTypeConfig, svIdConfig));
+ return 0;
+}
+
+uint32_t LocationIntegrationApiImpl::configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold, uint32_t energyBudget) {
+
+ struct ConfigConstrainedTuncReq : public LocMsg {
+ ConfigConstrainedTuncReq(LocationIntegrationApiImpl* apiImpl,
+ bool enable,
+ float tuncThreshold,
+ uint32_t energyBudget) :
+ mApiImpl(apiImpl),
+ mEnable(enable),
+ mTuncThreshold(tuncThreshold),
+ mEnergyBudget(energyBudget) {}
+ virtual ~ConfigConstrainedTuncReq() {}
+ void proc() const {
+ LocConfigConstrainedTuncReqMsg msg(mApiImpl->mSocketName,
+ mEnable, mTuncThreshold, mEnergyBudget);
+ mApiImpl->sendConfigMsgToHalDaemon(CONFIG_CONSTRAINED_TIME_UNCERTAINTY,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ // cache the last config to be used when hal daemon restarts
+ mApiImpl->mTuncConfigInfo.isValid = true;
+ mApiImpl->mTuncConfigInfo.enable = mEnable;
+ mApiImpl->mTuncConfigInfo.tuncThresholdMs = mTuncThreshold;
+ mApiImpl->mTuncConfigInfo.energyBudget = mEnergyBudget;
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ bool mEnable;
+ float mTuncThreshold;
+ uint32_t mEnergyBudget;
+ };
+ mMsgTask->sendMsg(new (nothrow)ConfigConstrainedTuncReq(
+ this, enable, tuncThreshold, energyBudget));
+
+ return 0;
+}
+
+uint32_t LocationIntegrationApiImpl::configPositionAssistedClockEstimator(bool enable) {
+
+ struct ConfigPositionAssistedClockEstimatorReq : public LocMsg {
+ ConfigPositionAssistedClockEstimatorReq(LocationIntegrationApiImpl* apiImpl,
+ bool enable) :
+ mApiImpl(apiImpl),
+ mEnable(enable) {}
+ virtual ~ConfigPositionAssistedClockEstimatorReq() {}
+ void proc() const {
+ LocConfigPositionAssistedClockEstimatorReqMsg msg(mApiImpl->mSocketName,
+ mEnable);
+ mApiImpl->sendConfigMsgToHalDaemon(CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ // cache the last config to be used when hal daemon restarts
+ mApiImpl->mPaceConfigInfo.isValid = true;
+ mApiImpl->mPaceConfigInfo.enable = mEnable;
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ bool mEnable;
+ };
+ mMsgTask->sendMsg(new (nothrow)
+ ConfigPositionAssistedClockEstimatorReq(this, enable));
+
+ return 0;
+}
+
+uint32_t LocationIntegrationApiImpl::gnssDeleteAidingData(
+ GnssAidingData& aidingData) {
+ struct DeleteAidingDataReq : public LocMsg {
+ DeleteAidingDataReq(LocationIntegrationApiImpl* apiImpl,
+ GnssAidingData& aidingData) :
+ mApiImpl(apiImpl),
+ mAidingData(aidingData) {}
+ virtual ~DeleteAidingDataReq() {}
+ void proc() const {
+ LocConfigAidingDataDeletionReqMsg msg(mApiImpl->mSocketName,
+ const_cast<GnssAidingData&>(mAidingData));
+ mApiImpl->sendConfigMsgToHalDaemon(CONFIG_AIDING_DATA_DELETION,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ GnssAidingData mAidingData;
+ };
+ mMsgTask->sendMsg(new (nothrow) DeleteAidingDataReq(this, aidingData));
+
+ return 0;
+}
+
+uint32_t LocationIntegrationApiImpl::configLeverArm(
+ const LeverArmConfigInfo& configInfo) {
+ struct ConfigLeverArmReq : public LocMsg {
+ ConfigLeverArmReq(LocationIntegrationApiImpl* apiImpl,
+ const LeverArmConfigInfo& configInfo) :
+ mApiImpl(apiImpl),
+ mConfigInfo(configInfo) {}
+ virtual ~ConfigLeverArmReq() {}
+ void proc() const {
+ LocConfigLeverArmReqMsg msg(mApiImpl->mSocketName, mConfigInfo);
+ mApiImpl->sendConfigMsgToHalDaemon(CONFIG_LEVER_ARM,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ // cache the last config to be used when hal daemon restarts
+ mApiImpl->mLeverArmConfigInfo = mConfigInfo;
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ LeverArmConfigInfo mConfigInfo;
+ };
+
+ if (configInfo.leverArmValidMask) {
+ mMsgTask->sendMsg(new (nothrow) ConfigLeverArmReq(this, configInfo));
+ }
+
+ return 0;
+}
+
+
+uint32_t LocationIntegrationApiImpl::configRobustLocation(
+ bool enable, bool enableForE911) {
+ struct ConfigRobustLocationReq : public LocMsg {
+ ConfigRobustLocationReq(LocationIntegrationApiImpl* apiImpl,
+ bool enable,
+ bool enableForE911) :
+ mApiImpl(apiImpl),
+ mEnable(enable),
+ mEnableForE911(enableForE911){}
+ virtual ~ConfigRobustLocationReq() {}
+ void proc() const {
+ LocConfigRobustLocationReqMsg msg(mApiImpl->mSocketName, mEnable, mEnableForE911);
+ mApiImpl->sendConfigMsgToHalDaemon(CONFIG_ROBUST_LOCATION,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ mApiImpl->mRobustLocationConfigInfo.isValid = true;
+ mApiImpl->mRobustLocationConfigInfo.enable = mEnable;
+ mApiImpl->mRobustLocationConfigInfo.enableForE911 = mEnableForE911;
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ bool mEnable;
+ bool mEnableForE911;
+ };
+
+ mMsgTask->sendMsg(new (nothrow)
+ ConfigRobustLocationReq(this, enable, enableForE911));
+
+ return 0;
+}
+
+uint32_t LocationIntegrationApiImpl::getRobustLocationConfig() {
+
+ struct GetRobustLocationConfigReq : public LocMsg {
+ GetRobustLocationConfigReq(LocationIntegrationApiImpl* apiImpl) :
+ mApiImpl(apiImpl) {}
+ virtual ~GetRobustLocationConfigReq() {}
+ void proc() const {
+ LocConfigGetRobustLocationConfigReqMsg msg(mApiImpl->mSocketName);
+ mApiImpl->sendConfigMsgToHalDaemon(GET_ROBUST_LOCATION_CONFIG,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ }
+ LocationIntegrationApiImpl* mApiImpl;
+ };
+
+ if (mIntegrationCbs.getRobustLocationConfigCb == nullptr) {
+ LOC_LOGe("no callback passed in constructor to receive robust location config");
+ // return 1 to signal error
+ return 1;
+ }
+ mMsgTask->sendMsg(new (nothrow) GetRobustLocationConfigReq(this));
+
+ return 0;
+}
+
+void LocationIntegrationApiImpl::sendConfigMsgToHalDaemon(
+ LocConfigTypeEnum configType, uint8_t* pMsg,
+ size_t msgSize, bool invokeResponseCb) {
+
+ bool messageSentToHal = false;
+ if (mHalRegistered) {
+ bool rc = sendMessage(pMsg, msgSize);
+ LOC_LOGd(">>> sendConfigMsgToHalDaemon, msg type=%d, rc=%d", configType, rc);
+ if (true == rc) {
+ messageSentToHal = true;
+ } else {
+ LOC_LOGe(">>> sendConfigMsgToHalDaemon, msg type=%d, rc=%d", configType, rc);
+ }
+ }
+
+ if (invokeResponseCb && mIntegrationCbs.configCb) {
+ if (true == messageSentToHal) {
+ addConfigReq(configType);
+ } else {
+ mIntegrationCbs.configCb(configType, LOC_INT_RESPONSE_FAILURE);
+ }
+ }
+}
+
+void LocationIntegrationApiImpl::sendClientRegMsgToHalDaemon(){
+
+ LocAPIClientRegisterReqMsg msg(mSocketName, LOCATION_INTEGRATION_API);
+ bool rc = sendMessage(reinterpret_cast<uint8_t *>(&msg), sizeof(msg));
+ LOC_LOGd(">>> onListenerReady::ClientRegisterReqMsg rc=%d", rc);
+ if (true == rc) {
+ mHalRegistered = true;
+ }
+}
+
+void LocationIntegrationApiImpl::processHalReadyMsg() {
+ // when location hal daemon crashes and restarts,
+ // we flush out all pending requests and notify each client
+ // that the request has failed.
+ flushConfigReqs();
+
+ // when hal daemon crashes and then restarted,
+ // we need to find the new node/port when remote socket api is used,
+ //
+ // this code can not be moved to inside of onListenerReady as
+ // onListenerReady can be invoked from other places
+ if (mIpcSender != nullptr) {
+ mIpcSender->informRecverRestarted();
+ }
+
+ // register with hal daemon
+ sendClientRegMsgToHalDaemon();
+
+ // send cached configuration to hal daemon
+ if (mSVConfigInfo.isValid) {
+ LocConfigSvConstellationReqMsg msg(mSocketName,
+ mSVConfigInfo.resetToDeFault,
+ mSVConfigInfo.svTypeConfig,
+ mSVConfigInfo.svIdConfig);
+ sendConfigMsgToHalDaemon(CONFIG_CONSTELLATIONS,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg), false);
+ }
+ if (mTuncConfigInfo.isValid) {
+ LocConfigConstrainedTuncReqMsg msg(mSocketName,
+ mTuncConfigInfo.enable,
+ mTuncConfigInfo.tuncThresholdMs,
+ mTuncConfigInfo.energyBudget);
+ sendConfigMsgToHalDaemon(CONFIG_CONSTRAINED_TIME_UNCERTAINTY,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg), false);
+ }
+ if (mPaceConfigInfo.isValid) {
+ LocConfigPositionAssistedClockEstimatorReqMsg msg(mSocketName,
+ mPaceConfigInfo.enable);
+ sendConfigMsgToHalDaemon(CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg), false);
+ }
+ if (mLeverArmConfigInfo.leverArmValidMask) {
+ LocConfigLeverArmReqMsg msg(mSocketName, mLeverArmConfigInfo);
+ sendConfigMsgToHalDaemon(CONFIG_LEVER_ARM,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ }
+ if (mRobustLocationConfigInfo.isValid) {
+ LocConfigRobustLocationReqMsg msg(mSocketName,
+ mRobustLocationConfigInfo.enable,
+ mRobustLocationConfigInfo.enableForE911);
+ sendConfigMsgToHalDaemon(CONFIG_ROBUST_LOCATION,
+ reinterpret_cast<uint8_t*>(&msg),
+ sizeof(msg));
+ }
+}
+
+void LocationIntegrationApiImpl::addConfigReq(LocConfigTypeEnum configType) {
+ LOC_LOGv("add configType %d", configType);
+
+ auto configReqData = mConfigReqCntMap.find(configType);
+ if (configReqData == std::end(mConfigReqCntMap)) {
+ mConfigReqCntMap.emplace(configType, 1);
+ } else{
+ int newCnt = configReqData->second+1;
+ mConfigReqCntMap.erase(configReqData);
+ mConfigReqCntMap.emplace(configType, newCnt);
+ }
+}
+
+void LocationIntegrationApiImpl::processConfigRespCb(const LocAPIGenericRespMsg* pRespMsg) {
+ LocConfigTypeEnum configType = getLocConfigTypeFromMsgId(pRespMsg->msgId);
+ LocIntegrationResponse intResponse = getLocIntegrationResponse(pRespMsg->err);
+ LOC_LOGd("<<< response message id: %d, msg err: %d, "
+ "config type: %d, int response %d",
+ pRespMsg->msgId, pRespMsg->err, configType, intResponse);
+
+ if (mIntegrationCbs.configCb) {
+ auto configReqData = mConfigReqCntMap.find(configType);
+ if (configReqData != std::end(mConfigReqCntMap)) {
+ int reqCnt = configReqData->second;
+ if (reqCnt > 0) {
+ mIntegrationCbs.configCb(configType, intResponse);
+ }
+ mConfigReqCntMap.erase(configReqData);
+ // there are still some request pending for this config type
+ // need to store it in the map
+ if (--reqCnt > 0) {
+ mConfigReqCntMap.emplace(configType, reqCnt);
+ }
+ }
+ }
+}
+
+// flush all the pending config request if location hal daemon has crashed
+// and restarted
+void LocationIntegrationApiImpl::flushConfigReqs() {
+ for (auto itr=mConfigReqCntMap.begin(); itr!=mConfigReqCntMap.end(); ++itr) {
+ int reqCnt = itr->second;
+ while (reqCnt-- > 0) {
+ mIntegrationCbs.configCb(itr->first, LOC_INT_RESPONSE_FAILURE);
+ }
+ }
+ mConfigReqCntMap.clear();
+}
+
+void LocationIntegrationApiImpl::processGetRobustLocationConfigRespCb(
+ const LocConfigGetRobustLocationConfigRespMsg* pRespMsg) {
+
+ LOC_LOGd("<<< response message id: %d, mask 0x%x, enabled: %d, enabledFor911: %d",
+ pRespMsg->msgId,
+ pRespMsg->mRobustLoationConfig.validMask,
+ pRespMsg->mRobustLoationConfig.enabled,
+ pRespMsg->mRobustLoationConfig.enabledForE911);
+
+ if (mIntegrationCbs.getRobustLocationConfigCb) {
+ // conversion between the enums
+ RobustLocationConfig robustConfig = {};
+ uint32_t validMask = 0;;
+ if (pRespMsg->mRobustLoationConfig.validMask &
+ GNSS_CONFIG_ROBUST_LOCATION_ENABLED_VALID_BIT) {
+ validMask |= ROBUST_LOCATION_CONFIG_VALID_ENABLED;
+ robustConfig.enabled = pRespMsg->mRobustLoationConfig.enabled;
+ }
+ if (pRespMsg->mRobustLoationConfig.validMask &
+ GNSS_CONFIG_ROBUST_LOCATION_ENABLED_FOR_E911_VALID_BIT) {
+ validMask |= ROBUST_LOCATION_CONFIG_VALID_ENABLED_FOR_E911;
+ robustConfig.enabledForE911 = pRespMsg->mRobustLoationConfig.enabledForE911;
+ }
+
+ robustConfig.validMask = (RobustLocationConfigValidMask) validMask;
+ mIntegrationCbs.getRobustLocationConfigCb(robustConfig);
+ }
+}
+
+/******************************************************************************
+LocationIntegrationApiImpl - Not implemented ILocationControlAPI functions
+******************************************************************************/
+uint32_t* LocationIntegrationApiImpl::gnssUpdateConfig(GnssConfig config) {
+ return nullptr;
+}
+
+} // namespace location_integration
diff --git a/location/integration_api/src/LocationIntegrationApiImpl.h b/location/integration_api/src/LocationIntegrationApiImpl.h
new file mode 100644
index 0000000..4741ef0
--- /dev/null
+++ b/location/integration_api/src/LocationIntegrationApiImpl.h
@@ -0,0 +1,155 @@
+/* Copyright (c) 2019-2020 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 LOCATION_INTEGRATION_API_IMPL_H
+#define LOCATION_INTEGRATION_API_IMPL_H
+
+#include <mutex>
+
+#include <LocIpc.h>
+#include <LocationDataTypes.h>
+#include <ILocationAPI.h>
+#include <LocationIntegrationApi.h>
+#include <MsgTask.h>
+#include <LocationApiMsg.h>
+
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
+
+using namespace std;
+using namespace loc_util;
+using namespace location_integration;
+
+namespace location_integration
+{
+typedef std::unordered_map<LocConfigTypeEnum, int32_t> LocConfigReqCntMap;
+
+typedef struct {
+ bool isValid;
+ bool enable;
+ float tuncThresholdMs; // need to be specified if enable is true
+ uint32_t energyBudget; // need to be specified if enable is true
+} TuncConfigInfo;
+
+typedef struct {
+ bool isValid;
+ bool enable;
+} PaceConfigInfo;
+
+typedef struct {
+ bool isValid;
+ bool resetToDeFault;
+ GnssSvTypeConfig svTypeConfig;
+ GnssSvIdConfig svIdConfig;
+} SVConfigInfo;
+
+typedef struct {
+ bool isValid;
+ bool enable;
+ bool enableForE911;
+} RobustLocationConfigInfo;
+
+class IpcListener;
+
+class LocationIntegrationApiImpl : public ILocationControlAPI {
+ friend IpcListener;
+public:
+ LocationIntegrationApiImpl(LocIntegrationCbs& integrationCbs);
+
+ void destroy();
+
+ // convenient methods
+ inline bool sendMessage(const uint8_t* data, uint32_t length) const {
+ return (mIpcSender != nullptr) && LocIpc::send(*mIpcSender, data, length);
+ }
+
+ // config API
+ virtual uint32_t resetConstellationConfig() override;
+ virtual uint32_t configConstellations(const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) override;
+ virtual uint32_t configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold, uint32_t energyBudget) override;
+ virtual uint32_t configPositionAssistedClockEstimator(bool enable) override;
+ virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) override;
+ virtual uint32_t configRobustLocation(bool enable, bool enableForE911) override;
+
+ // rest of ILocationController API that are not used in integration API
+ virtual uint32_t* gnssUpdateConfig(GnssConfig config) override;
+ virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) override;
+
+ uint32_t getRobustLocationConfig();
+
+private:
+ ~LocationIntegrationApiImpl();
+ bool integrationClientAllowed();
+ void sendConfigMsgToHalDaemon(LocConfigTypeEnum configType,
+ uint8_t* pMsg,
+ size_t msgSize,
+ bool invokeResponseCb = true);
+ void sendClientRegMsgToHalDaemon();
+ void processHalReadyMsg();
+
+ void addConfigReq(LocConfigTypeEnum configType);
+ void flushConfigReqs();
+ void processConfigRespCb(const LocAPIGenericRespMsg* pRespMsg);
+ void processGetRobustLocationConfigRespCb(
+ const LocConfigGetRobustLocationConfigRespMsg* pRespMsg);
+
+ // internal session parameter
+ static mutex mMutex;
+ static bool mClientRunning; // allow singleton int client
+ bool mHalRegistered;
+ // For client on different processor, socket name will start with
+ // defined constant of SOCKET_TO_EXTERANL_AP_LOCATION_CLIENT_BASE.
+ // For client on same processor, socket name will start with
+ // SOCKET_LOC_CLIENT_DIR + LOC_INTAPI_NAME_PREFIX.
+ char mSocketName[MAX_SOCKET_PATHNAME_LENGTH];
+
+ // cached configuration to be used when hal daemon crashes
+ // and restarts
+ TuncConfigInfo mTuncConfigInfo;
+ PaceConfigInfo mPaceConfigInfo;
+ SVConfigInfo mSVConfigInfo;
+ LeverArmConfigInfo mLeverArmConfigInfo;
+ RobustLocationConfigInfo mRobustLocationConfigInfo;
+
+ LocConfigReqCntMap mConfigReqCntMap;
+ LocIntegrationCbs mIntegrationCbs;
+
+ LocIpc mIpc;
+ shared_ptr<LocIpcSender> mIpcSender;
+
+ MsgTask* mMsgTask;
+};
+
+} // namespace location_client
+
+#endif /* LOCATION_INTEGRATION_API_IMPL_H */
diff --git a/location/izat_api/Android.mk b/location/izat_api/Android.mk
new file mode 100644
index 0000000..d225b9a
--- /dev/null
+++ b/location/izat_api/Android.mk
@@ -0,0 +1,10 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := izat_remote_api_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
diff --git a/location/izat_api/IzatRemoteApi.h b/location/izat_api/IzatRemoteApi.h
new file mode 100644
index 0000000..baa7916
--- /dev/null
+++ b/location/izat_api/IzatRemoteApi.h
@@ -0,0 +1,77 @@
+/*=============================================================================
+ Copyright (c) 2016, 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 __IZATREMOTEAPIS_H__
+#define __IZATREMOTEAPIS_H__
+
+#include <izat_remote_api.h>
+#include <string>
+#include <stdio.h>
+namespace qc_loc_fw {
+ class InPostcard;
+}
+
+namespace izat_remote_api {
+
+class IzatNotifierProxy;
+
+struct OutCard;
+
+class IzatNotifier {
+protected:
+ IzatNotifierProxy* const mNotifierProxy;
+ IzatNotifier(const char* const tag, const OutCard* subCard);
+ virtual ~IzatNotifier();
+public:
+ virtual void handleMsg(qc_loc_fw::InPostcard * const in_card) = 0;
+};
+
+class SstpUpdater : public IzatNotifier {
+ static const char* const sLatTag;
+ static const char* const sLonTag;
+ static const char* const sUncTag;
+ static const char* const sUncConfTag;
+
+protected:
+ SstpUpdater();
+ virtual inline ~SstpUpdater() {}
+public:
+ static const char sName[];
+ virtual void handleMsg(qc_loc_fw::InPostcard * const in_card) final;
+ void stop();
+ virtual void errReport(const char* errStr) = 0;
+ virtual void siteUpdate(const char* name, double lat, double lon,
+ float unc, int32_t uncConfidence) = 0;
+ virtual void mccUpdate(uint32_t mcc, const char* confidence) = 0;
+};
+
+} // izat_remote_api
+
+#endif //__IZATREMOTEAPIS_H__
+
diff --git a/location/izat_api/izat_remote_api.h b/location/izat_api/izat_remote_api.h
new file mode 100644
index 0000000..8082dc3
--- /dev/null
+++ b/location/izat_api/izat_remote_api.h
@@ -0,0 +1,116 @@
+/*=============================================================================
+ Copyright (c) 2016, 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 __IZAT_REMOTE_APIS_H__
+#define __IZAT_REMOTE_APIS_H__
+
+#include <gps_extended_c.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*locationUpdateCb)(UlpLocation *location,
+ GpsLocationExtended *locExtended,
+ void* clientData);
+
+typedef void (*svRptUpdateCb)(GnssSvNotification *svNotify,
+ void* clientData);
+
+typedef void (*nmeaUpdateCb)(UlpNmea *nmea, void* clientData);
+
+typedef struct {
+
+ locationUpdateCb locCb;
+ svRptUpdateCb svReportCb;
+ nmeaUpdateCb nmeaCb;
+
+}remoteClientInfo;
+/* registers a client callback structure for listening to final location updates
+ pClientInfo - pointer to remoteClientInfo structure
+ Can not be NULL.
+ clientData - an opaque data pointer from client. This pointer will be
+ provided back when the callbacak is called.
+ This can be used by client to store application context
+ or statemachine etc.
+ Can be NULL.
+ return: an opaque pointer that serves as a request handle. This handle
+ to be fed to the unregisterLocationUpdater() call.
+*/
+void* registerLocationUpdater(remoteClientInfo *pClientInfo, void* clientData);
+
+/* unregisters the client callback
+ locationUpdaterHandle - the opaque pointer from the return of
+ registerLocationUpdater()
+*/
+void unregisterLocationUpdater(void* locationUpdaterHandle);
+
+typedef void (*errReportCb)(const char* errStr, void* clientData);
+typedef void (*sstpSiteUpdateCb)(const char* name, double lat, double lon,
+ float unc, int32_t uncConfidence,
+ void* clientData);
+typedef void (*sstpMccUpdateCb)(uint32_t mcc, const char* confidence,
+ void* clientData);
+/* registers a client callback for listening to SSTP updates
+ siteCb - site info callback function pointer implemented by client
+ Can not be NULL.
+ mccCb - MCC info callback function pointer implemented by client
+ Can not be NULL.
+ errCb - callback to receive error report in string format, in case
+ of any error that might happen, and no siteCb or mccCb can
+ be called.
+ Can be NULL.
+ clientData - an opaque data pointer from client. This pointer will be
+ provided back when the locationCb() callbacak is called.
+ This can be used by client to store application context
+ or statemachine etc.
+ Can be NULL.
+ return: an opaque pointer that serves as a request handle. This handle
+ is to be fed to theunregisterLocationUpdater() call.
+*/
+void* registerSstpUpdater(sstpSiteUpdateCb siteCb, sstpMccUpdateCb mccCb,
+ errReportCb errCb, void* clientData);
+
+/* unregisters the client callback
+ sstpUpdaterHandle - the opaque pointer from the return of
+ registerLocationUpdater()
+*/
+void unregisterSstpUpdater(void* sstpUpdaterHandle);
+
+/* stop the current burst of SSTP updates (until next triggering event)
+ sstpUpdaterHandle - the opaque pointer from the return of
+ registerLocationUpdater()
+*/
+void stopSstpUpdate(void* sstpUpdaterHandle);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif //__IZAT_REMOTE_APIS_H__
diff --git a/location/loc_api/Android.mk b/location/loc_api/Android.mk
new file mode 100644
index 0000000..cd6b288
--- /dev/null
+++ b/location/loc_api/Android.mk
@@ -0,0 +1,60 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+
+LOCAL_PATH := $(call my-dir)
+
+#add QMI libraries for QMI targets
+QMI_BOARD_PLATFORM_LIST := msm8960
+QMI_BOARD_PLATFORM_LIST += msm8974
+QMI_BOARD_PLATFORM_LIST += msm8226
+QMI_BOARD_PLATFORM_LIST += msm8610
+QMI_BOARD_PLATFORM_LIST += apq8084
+QMI_BOARD_PLATFORM_LIST += msm8916
+QMI_BOARD_PLATFORM_LIST += msm8994
+QMI_BOARD_PLATFORM_LIST += msm8909
+QMI_BOARD_PLATFORM_LIST += msm8952
+QMI_BOARD_PLATFORM_LIST += msm8992
+QMI_BOARD_PLATFORM_LIST += msm8996
+QMI_BOARD_PLATFORM_LIST += msm8953
+QMI_BOARD_PLATFORM_LIST += msm8937
+QMI_BOARD_PLATFORM_LIST += msm8998
+QMI_BOARD_PLATFORM_LIST += apq8098_latv
+QMI_BOARD_PLATFORM_LIST += sdm660
+QMI_BOARD_PLATFORM_LIST += sdm845
+QMI_BOARD_PLATFORM_LIST += msmpeafowl
+QMI_BOARD_PLATFORM_LIST += sdm710
+QMI_BOARD_PLATFORM_LIST += qcs605
+QMI_BOARD_PLATFORM_LIST += msmnile
+QMI_BOARD_PLATFORM_LIST += sdmshrike
+QMI_BOARD_PLATFORM_LIST += $(MSMSTEPPE)
+QMI_BOARD_PLATFORM_LIST += $(TRINKET)
+QMI_BOARD_PLATFORM_LIST += kona
+QMI_BOARD_PLATFORM_LIST += lito
+QMI_BOARD_PLATFORM_LIST += bengal
+QMI_BOARD_PLATFORM_LIST += atoll
+
+ifneq (,$(filter $(QMI_BOARD_PLATFORM_LIST),$(TARGET_BOARD_PLATFORM)))
+include $(call all-subdir-makefiles)
+endif #is-board-platform-in-list
+
+# link gss.bxx files into /etc/firmware folder
+ifeq ($(call is-board-platform-in-list, msm8960),true)
+$(shell ln -sf /firmware/image/gss.b00 $(TARGET_OUT_ETC)/firmware/gss.b00)
+$(shell ln -sf /firmware/image/gss.b01 $(TARGET_OUT_ETC)/firmware/gss.b01)
+$(shell ln -sf /firmware/image/gss.b02 $(TARGET_OUT_ETC)/firmware/gss.b02)
+$(shell ln -sf /firmware/image/gss.b03 $(TARGET_OUT_ETC)/firmware/gss.b03)
+$(shell ln -sf /firmware/image/gss.b04 $(TARGET_OUT_ETC)/firmware/gss.b04)
+$(shell ln -sf /firmware/image/gss.b05 $(TARGET_OUT_ETC)/firmware/gss.b05)
+$(shell ln -sf /firmware/image/gss.b06 $(TARGET_OUT_ETC)/firmware/gss.b06)
+$(shell ln -sf /firmware/image/gss.b07 $(TARGET_OUT_ETC)/firmware/gss.b07)
+$(shell ln -sf /firmware/image/gss.b08 $(TARGET_OUT_ETC)/firmware/gss.b08)
+$(shell ln -sf /firmware/image/gss.b09 $(TARGET_OUT_ETC)/firmware/gss.b09)
+$(shell ln -sf /firmware/image/gss.b10 $(TARGET_OUT_ETC)/firmware/gss.b10)
+$(shell ln -sf /firmware/image/gss.b11 $(TARGET_OUT_ETC)/firmware/gss.b11)
+$(shell ln -sf /firmware/image/gss.b12 $(TARGET_OUT_ETC)/firmware/gss.b12)
+$(shell ln -sf /firmware/image/gss.b13 $(TARGET_OUT_ETC)/firmware/gss.b13)
+$(shell ln -sf /firmware/image/gss.b14 $(TARGET_OUT_ETC)/firmware/gss.b14)
+$(shell ln -sf /firmware/image/gss.b15 $(TARGET_OUT_ETC)/firmware/gss.b15)
+$(shell ln -sf /firmware/image/gss.mdt $(TARGET_OUT_ETC)/firmware/gss.mdt)
+endif
+
+endif#BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/location/loc_api/loc_api_v02/Android.mk b/location/loc_api/loc_api_v02/Android.mk
new file mode 100644
index 0000000..57ac120
--- /dev/null
+++ b/location/loc_api/loc_api_v02/Android.mk
@@ -0,0 +1,49 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_api_v02
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+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 \
+ libqmi_cci \
+ libqmi_common_so \
+ libloc_core \
+ libgps.utils \
+ libdl \
+ liblog
+
+LOCAL_SRC_FILES = \
+ LocApiV02.cpp \
+ loc_api_v02_log.cpp \
+ loc_api_v02_client.cpp \
+ loc_api_sync_req.cpp \
+ location_service_v02.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+## Includes
+LOCAL_C_INCLUDES := \
+ $(TARGET_OUT_HEADERS)/qmi-framework/inc \
+ $(TARGET_OUT_HEADERS)/qmi/inc
+LOCAL_HEADER_LIBRARIES := \
+ libloc_core_headers \
+ libgps.utils_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libloc_api_v02_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
diff --git a/location/loc_api/loc_api_v02/LocApiV02.cpp b/location/loc_api/loc_api_v02/LocApiV02.cpp
new file mode 100644
index 0000000..70ddcd4
--- /dev/null
+++ b/location/loc_api/loc_api_v02/LocApiV02.cpp
@@ -0,0 +1,9577 @@
+/* Copyright (c) 2011-2020, 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.
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_ApiV02"
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sstream>
+#include <math.h>
+#include <dlfcn.h>
+#include <algorithm>
+
+#include <LocApiV02.h>
+#include <loc_api_v02_log.h>
+#include <loc_api_sync_req.h>
+#include <loc_api_v02_client.h>
+#include <loc_util_log.h>
+#include <gps_extended.h>
+#include "loc_pla.h"
+#include <loc_cfg.h>
+#include <LocContext.h>
+
+using namespace std;
+using namespace loc_core;
+
+/* Doppler Conversion from M/S to NS/S */
+#define MPS_TO_NSPS (1.0/0.299792458)
+
+/* Default session id ; TBD needs incrementing for each */
+#define LOC_API_V02_DEF_SESSION_ID (1)
+
+/* UMTS CP Address key*/
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
+/* GPS SV Id offset */
+#define GPS_SV_ID_OFFSET (1)
+
+/* GLONASS SV Id offset */
+#define GLONASS_SV_ID_OFFSET (65)
+
+/* SV ID range */
+#define SV_ID_RANGE (32)
+
+#define BDS_SV_ID_OFFSET (201)
+
+/* BeiDou SV ID RANGE*/
+#define BDS_SV_ID_RANGE QMI_LOC_DELETE_MAX_BDS_SV_INFO_LENGTH_V02
+
+/* GPS week unknown*/
+#define C_GPS_WEEK_UNKNOWN (65535)
+
+/* seconds per week*/
+#define WEEK_MSECS (60*60*24*7*1000LL)
+#define DAY_MSECS (60*60*24*1000LL)
+/* Num days elapsed since GLONASS started from GPS start day 1980->1996 */
+#define GPS_GLONASS_DAYS_DIFF 5838
+/* number of glonass days in a 4-year interval */
+#define GLONASS_DAYS_IN_4YEARS 1461
+/* glonass and UTC offset: 3 hours */
+#define GLONASS_UTC_OFFSET_HOURS 3
+
+/* speed of light */
+#define SPEED_OF_LIGHT 299792458.0
+
+#define MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION 64
+
+/* number of QMI_LOC messages that need to be checked*/
+#define NUMBER_OF_MSG_TO_BE_CHECKED (3)
+
+/* the time, in seconds, to wait for user response for NI */
+#define LOC_NI_NO_RESPONSE_TIME 20
+
+#define LAT_LONG_TO_RADIANS .000005364418
+#define GF_RESPONSIVENESS_THRESHOLD_MSEC_HIGH 120000 //2 mins
+#define GF_RESPONSIVENESS_THRESHOLD_MSEC_MEDIUM 900000 //15 mins
+
+#define FLP_BATCHING_MINIMUN_INTERVAL (1000) // in msec
+#define FLP_BATCHING_MIN_TRIP_DISTANCE 1 // 1 meter
+
+template struct loc_core::LocApiResponseData<LocApiBatchData>;
+template struct loc_core::LocApiResponseData<LocApiGeofenceData>;
+template struct loc_core::LocApiResponseData<LocGpsLocation>;
+
+const float CarrierFrequencies[] = {
+ 0.0, // UNKNOWN
+ GPS_L1C_CARRIER_FREQUENCY, // L1C
+ SBAS_L1_CA_CARRIER_FREQUENCY, // SBAS_L1
+ GLONASS_G1_CARRIER_FREQUENCY, // GLONASS_G1
+ QZSS_L1CA_CARRIER_FREQUENCY, // QZSS_L1CA
+ BEIDOU_B1_I_CARRIER_FREQUENCY, // BEIDOU_B1
+ GALILEO_E1_C_CARRIER_FREQUENCY }; // GALILEO_E1
+
+/* Gaussian 2D scaling table - scale from x% to 68% confidence */
+struct conf_scaler_to_68_pair {
+ uint8_t confidence;
+ float scaler_to_68;
+};
+/* length of confScalers array */
+#define CONF_SCALER_ARRAY_MAX (3)
+const struct conf_scaler_to_68_pair confScalers[CONF_SCALER_ARRAY_MAX] = {
+ {39, 1.517}, // 0 - 39 . Index 0
+ {50, 1.287}, // 40 - 50. Index 1
+ {63, 1.072}, // 51 - 63. Index 2
+};
+
+/*fixed timestamp uncertainty 10 milli second */
+static int ap_timestamp_uncertainty = 0;
+static loc_param_s_type gps_conf_param_table[] =
+{
+ {"AP_TIMESTAMP_UNCERTAINTY",&ap_timestamp_uncertainty,NULL,'n'}
+};
+
+/* static event callbacks that call the LocApiV02 callbacks*/
+
+/* global event callback, call the eventCb function in loc api adapter v02
+ instance */
+static void globalEventCb(locClientHandleType clientHandle,
+ uint32_t eventId,
+ const locClientEventIndUnionType eventPayload,
+ void* pClientCookie)
+{
+ switch (eventId) {
+ case QMI_LOC_EVENT_POSITION_REPORT_IND_V02:
+ case QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02:
+ case QMI_LOC_EVENT_NMEA_IND_V02:
+ case QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02:
+ case QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02:
+ case QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02:
+ case QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02:
+ MODEM_LOG_CALLFLOW_DEBUG(%s, loc_get_v02_event_name(eventId));
+ break;
+ default:
+ MODEM_LOG_CALLFLOW(%s, loc_get_v02_event_name(eventId));
+ break;
+ }
+
+ LocApiV02 *locApiV02Instance = (LocApiV02 *)pClientCookie;
+
+ LOC_LOGv ("client = %p, event id = 0x%X, client cookie ptr = %p",
+ clientHandle, eventId, pClientCookie);
+
+ // return if null is passed
+ if (NULL == locApiV02Instance)
+ {
+ LOC_LOGe ("NULL object passed : client = %p, event id = 0x%X",
+ clientHandle, eventId);
+ return;
+ }
+ locApiV02Instance->eventCb(clientHandle, eventId, eventPayload);
+}
+
+/* global response callback, it calls the sync request process
+ indication function to unblock the request that is waiting on this
+ response indication*/
+static void globalRespCb(locClientHandleType clientHandle,
+ uint32_t respId,
+ const locClientRespIndUnionType respPayload,
+ uint32_t respPayloadSize,
+ void* pClientCookie)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_v02_event_name(respId));
+ LocApiV02 *locApiV02Instance =
+ (LocApiV02 *)pClientCookie;
+
+ LOC_LOGV ("%s:%d] client = %p, resp id = %d, client cookie ptr = %p\n",
+ __func__, __LINE__, clientHandle, respId, pClientCookie);
+
+ if( NULL == locApiV02Instance)
+ {
+ LOC_LOGE ("%s:%d] NULL object passed : client = %p, resp id = %d\n",
+ __func__, __LINE__, clientHandle, respId);
+ return;
+ }
+
+ switch(respId)
+ {
+ case QMI_LOC_GET_AVAILABLE_WWAN_POSITION_IND_V02:
+ if (respPayload.pGetAvailWwanPositionInd != NULL) {
+ locApiV02Instance->handleWwanZppFixIndication(*respPayload.pGetAvailWwanPositionInd);
+ }
+ break;
+ case QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02:
+ if (respPayload.pGetBestAvailablePositionInd != NULL) {
+ locApiV02Instance->handleZppBestAvailableFixIndication(
+ *respPayload.pGetBestAvailablePositionInd);
+ }
+ [[fallthrough]];
+ // Call loc_sync_process_ind below also
+ default:
+ // process the sync call
+ // use pDeleteAssistDataInd as a dummy pointer
+ loc_sync_process_ind(clientHandle, respId,
+ (void *)respPayload.pDeleteAssistDataInd, respPayloadSize);
+ break;
+ }
+}
+
+/* global error callback, it will call the handle service down
+ function in the loc api adapter instance. */
+static void globalErrorCb (locClientHandleType clientHandle,
+ locClientErrorEnumType errorId,
+ void *pClientCookie)
+{
+ LocApiV02 *locApiV02Instance =
+ (LocApiV02 *)pClientCookie;
+
+ LOC_LOGV ("%s:%d] client = %p, error id = %d\n, client cookie ptr = %p\n",
+ __func__, __LINE__, clientHandle, errorId, pClientCookie);
+ if( NULL == locApiV02Instance)
+ {
+ LOC_LOGE ("%s:%d] NULL object passed : client = %p, error id = %d\n",
+ __func__, __LINE__, clientHandle, errorId);
+ return;
+ }
+ locApiV02Instance->errorCb(clientHandle, errorId);
+}
+
+/* global structure containing the callbacks */
+locClientCallbacksType globalCallbacks =
+{
+ sizeof(locClientCallbacksType),
+ globalEventCb,
+ globalRespCb,
+ globalErrorCb
+};
+
+static void getInterSystemTimeBias(const char* interSystem,
+ Gnss_InterSystemBiasStructType &interSystemBias,
+ const qmiLocInterSystemBiasStructT_v02* pInterSysBias)
+{
+ LOC_LOGd("%s] Mask:%d, TimeBias:%f, TimeBiasUnc:%f,\n",
+ interSystem, pInterSysBias->validMask, pInterSysBias->timeBias,
+ pInterSysBias->timeBiasUnc);
+
+ interSystemBias.validMask = pInterSysBias->validMask;
+ interSystemBias.timeBias = pInterSysBias->timeBias;
+ interSystemBias.timeBiasUnc = pInterSysBias->timeBiasUnc;
+}
+
+/* Constructor for LocApiV02 */
+LocApiV02 :: LocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context):
+ LocApiBase(exMask, context),
+ clientHandle(LOC_CLIENT_INVALID_HANDLE_VALUE),
+ mQmiMask(0), mInSession(false), mPowerMode(GNSS_POWER_MODE_INVALID),
+ mEngineOn(false), mMeasurementsStarted(false),
+ mMasterRegisterNotSupported(false),
+ mCounter(0), mMinInterval(1000),
+ mGnssMeasurements(nullptr),
+ mBatchSize(0), mDesiredBatchSize(0),
+ mTripBatchSize(0), mDesiredTripBatchSize(0)
+{
+ // initialize loc_sync_req interface
+ loc_sync_req_init();
+ mADRdata.clear();
+
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF,gps_conf_param_table);
+}
+
+/* Destructor for LocApiV02 */
+LocApiV02 :: ~LocApiV02()
+{
+ close();
+}
+
+LocApiBase* getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context)
+{
+ return (LocApiBase*)LocApiV02::createLocApiV02(exMask, context);
+}
+
+LocApiBase* LocApiV02::createLocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context)
+{
+ LOC_LOGD("%s:%d]: Creating new LocApiV02", __func__, __LINE__);
+ return new LocApiV02(exMask, context);
+}
+
+/* Initialize a loc api v02 client AND
+ check which loc message are supported by modem */
+enum loc_api_adapter_err
+LocApiV02 :: open(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+
+ LOC_API_ADAPTER_EVENT_MASK_T newMask = mask & ~mExcludedMask;
+ locClientEventMaskType qmiMask = 0;
+ bool gnssMeasurementSupported = false;
+
+ LOC_LOGd("%p Enter mMask: 0x%" PRIx64 " mQmiMask: 0x%" PRIx64 " mExcludedMask: 0x%" PRIx64 "",
+ clientHandle, mMask, mQmiMask, mExcludedMask);
+
+ /* If the client is already open close it first */
+ if(LOC_CLIENT_INVALID_HANDLE_VALUE == clientHandle)
+ {
+ LOC_LOGV ("%s:%d]: reference to this = %p passed in \n",
+ __func__, __LINE__, this);
+ /* initialize the loc api v02 interface, note that
+ the locClientOpen() function will block if the
+ service is unavailable for a fixed time out */
+
+ // it is important to cap the mask here, because not all LocApi's
+ // can enable the same bits, e.g. foreground and bckground.
+ status = locClientOpen(0, &globalCallbacks, &clientHandle, (void *)this);
+ if (eLOC_CLIENT_SUCCESS != status ||
+ clientHandle == LOC_CLIENT_INVALID_HANDLE_VALUE )
+ {
+ mMask = 0;
+ mNmeaMask = 0;
+ mQmiMask = 0;
+ LOC_LOGE ("%s:%d]: locClientOpen failed, status = %s\n", __func__,
+ __LINE__, loc_get_v02_client_status_name(status));
+ rtv = LOC_API_ADAPTER_ERR_FAILURE;
+ } else {
+ uint64_t supportedMsgList = 0;
+ const uint32_t msgArray[NUMBER_OF_MSG_TO_BE_CHECKED] =
+ {
+ // For - LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING
+ QMI_LOC_GET_BATCH_SIZE_REQ_V02,
+
+ // For - LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH
+ QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02,
+
+ // For - LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING
+ QMI_LOC_START_DBT_REQ_V02
+ };
+
+ if (isMaster()) {
+ registerMasterClient();
+ gnssMeasurementSupported = cacheGnssMeasurementSupport();
+ if (gnssMeasurementSupported) {
+ /* Indicate that QMI LOC message for GNSS measurement was sent */
+ mQmiMask |= QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02;
+ }
+
+ LocContext::injectFeatureConfig(mContext);
+ }
+
+ // check the modem
+ status = locClientSupportMsgCheck(clientHandle,
+ msgArray,
+ NUMBER_OF_MSG_TO_BE_CHECKED,
+ &supportedMsgList);
+ if (eLOC_CLIENT_SUCCESS != status) {
+ LOC_LOGE("%s:%d]: Failed to checking QMI_LOC message supported. \n",
+ __func__, __LINE__);
+ }
+
+ /** if batching is supported , check if the adaptive batching or
+ distance-based batching is supported. */
+ uint32_t messageChecker = 1 << LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING;
+ if ((messageChecker & supportedMsgList) == messageChecker) {
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ qmiLocQueryAonConfigReqMsgT_v02 queryAonConfigReq;
+ qmiLocQueryAonConfigIndMsgT_v02 queryAonConfigInd;
+
+ memset(&queryAonConfigReq, 0, sizeof(queryAonConfigReq));
+ memset(&queryAonConfigInd, 0, sizeof(queryAonConfigInd));
+ queryAonConfigReq.transactionId = LOC_API_V02_DEF_SESSION_ID;
+
+ req_union.pQueryAonConfigReq = &queryAonConfigReq;
+ status = locSyncSendReq(QMI_LOC_QUERY_AON_CONFIG_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_QUERY_AON_CONFIG_IND_V02,
+ &queryAonConfigInd);
+
+ if (status == eLOC_CLIENT_FAILURE_UNSUPPORTED) {
+ LOC_LOGE("%s:%d]: Query AON config is not supported.\n", __func__, __LINE__);
+ } else {
+ if (status != eLOC_CLIENT_SUCCESS ||
+ queryAonConfigInd.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGE("%s:%d]: Query AON config failed."
+ " status: %s, ind status:%s\n",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(queryAonConfigInd.status));
+ } else {
+ LOC_LOGD("%s:%d]: Query AON config succeeded. aonCapability is %d.\n",
+ __func__, __LINE__, queryAonConfigInd.aonCapability);
+ if (queryAonConfigInd.aonCapability_valid) {
+ if (queryAonConfigInd.aonCapability |
+ QMI_LOC_MASK_AON_TIME_BASED_BATCHING_SUPPORTED_V02) {
+ LOC_LOGD("%s:%d]: LB 1.0 is supported.\n", __func__, __LINE__);
+ }
+ if (queryAonConfigInd.aonCapability |
+ QMI_LOC_MASK_AON_AUTO_BATCHING_SUPPORTED_V02) {
+ LOC_LOGD("%s:%d]: LB 1.5 is supported.\n", __func__, __LINE__);
+ supportedMsgList |=
+ (1 << LOC_API_ADAPTER_MESSAGE_ADAPTIVE_LOCATION_BATCHING);
+ }
+ if (queryAonConfigInd.aonCapability |
+ QMI_LOC_MASK_AON_DISTANCE_BASED_BATCHING_SUPPORTED_V02) {
+ LOC_LOGD("%s:%d]: LB 2.0 is supported.\n", __func__, __LINE__);
+ supportedMsgList |=
+ (1 << LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING);
+ }
+ if (queryAonConfigInd.aonCapability |
+ QMI_LOC_MASK_AON_DISTANCE_BASED_TRACKING_SUPPORTED_V02) {
+ LOC_LOGD("%s:%d]: DBT 2.0 is supported.\n", __func__, __LINE__);
+ }
+ if (queryAonConfigInd.aonCapability |
+ QMI_LOC_MASK_AON_UPDATE_TBF_SUPPORTED_V02) {
+ LOC_LOGD("%s:%d]: Updating tracking TBF on the fly is supported.\n",
+ __func__, __LINE__);
+ supportedMsgList |=
+ (1 << LOC_API_ADAPTER_MESSAGE_UPDATE_TBF_ON_THE_FLY);
+ }
+ if (queryAonConfigInd.aonCapability |
+ QMI_LOC_MASK_AON_OUTDOOR_TRIP_BATCHING_SUPPORTED_V02) {
+ LOC_LOGD("%s:%d]: OTB is supported.\n",
+ __func__, __LINE__);
+ supportedMsgList |=
+ (1 << LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING);
+ }
+ } else {
+ LOC_LOGE("%s:%d]: AON capability is invalid.\n", __func__, __LINE__);
+ }
+ }
+ }
+ }
+ LOC_LOGV("%s:%d]: supportedMsgList is %" PRIu64 ". \n",
+ __func__, __LINE__, supportedMsgList);
+
+ // Query for supported feature list
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ qmiLocGetSupportedFeatureReqMsgT_v02 getSupportedFeatureList_req;
+ qmiLocGetSupportedFeatureIndMsgT_v02 getSupportedFeatureList_ind;
+
+ memset(&getSupportedFeatureList_req, 0, sizeof(getSupportedFeatureList_req));
+ memset(&getSupportedFeatureList_ind, 0, sizeof(getSupportedFeatureList_ind));
+
+ req_union.pGetSupportedFeatureReq = &getSupportedFeatureList_req;
+ status = locSyncSendReq(QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_GET_SUPPORTED_FEATURE_IND_V02,
+ &getSupportedFeatureList_ind);
+ if (eLOC_CLIENT_SUCCESS != status) {
+ LOC_LOGE("%s:%d:%d]: Failed to get features supported from "
+ "QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02. \n", __func__, __LINE__, status);
+ } else {
+ LOC_LOGD("%s:%d:%d]: Got list of features supported of length:%d ",
+ __func__, __LINE__, status, getSupportedFeatureList_ind.feature_len);
+ for (uint32_t i = 0; i < getSupportedFeatureList_ind.feature_len; i++) {
+ LOC_LOGD("Bit-mask of supported features at index:%d is %d",i,
+ getSupportedFeatureList_ind.feature[i]);
+ }
+ }
+
+ // cache the mpss engine capabilities
+ mContext->setEngineCapabilities(supportedMsgList,
+ (getSupportedFeatureList_ind.feature_len != 0 ? getSupportedFeatureList_ind.feature:
+ NULL), gnssMeasurementSupported);
+ }
+ }
+
+ if ((eLOC_CLIENT_SUCCESS == status) && (LOC_CLIENT_INVALID_HANDLE_VALUE != clientHandle)) {
+
+ qmiMask = convertMask(newMask);
+
+ LOC_LOGd("clientHandle = %p mMask: 0x%" PRIx64 " Adapter mask: 0x%" PRIx64 " "
+ "newMask: 0x%" PRIx64 " mQmiMask: 0x%" PRIx64 " qmiMask: 0x%" PRIx64 "",
+ clientHandle, mMask, mask, newMask, mQmiMask, qmiMask);
+
+ if ((mQmiMask ^ qmiMask) & qmiMask & QMI_LOC_EVENT_MASK_WIFI_REQ_V02) {
+ wifiStatusInformSync();
+ }
+
+ if (newMask != mMask) {
+ locClientEventMaskType maskDiff = qmiMask ^ mQmiMask;
+ // it is important to cap the mask here, because not all LocApi's
+ // can enable the same bits, e.g. foreground and background.
+ registerEventMask(newMask);
+ if (isMaster()) {
+ /* Set the SV Measurement Constellation when Measurement Report or Polynomial report is set */
+ /* Check if either measurement report or sv polynomial report bit is different in the new
+ mask compared to the old mask. If yes then turn that report on or off as requested */
+ /* Later change: we need to set the SV Measurement Constellation whenever measurements
+ are supported, and that is because other clients (e.g. CHRE need to have measurements
+ enabled and those clients cannot set the SV Measurement Constellation since they are
+ not master */
+ locClientEventMaskType measOrSvPoly = QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02;
+ LOC_LOGd("clientHandle = %p isMaster(): %d measOrSvPoly: 0x%" PRIx64 \
+ " maskDiff: 0x%" PRIx64 "",
+ clientHandle, isMaster(), measOrSvPoly, maskDiff);
+ if (((maskDiff & measOrSvPoly) != 0)) {
+ if (gnssMeasurementSupported) {
+ setSvMeasurementConstellation(qmiMask | QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02);
+ } else {
+ setSvMeasurementConstellation(qmiMask & ~QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02);
+ }
+ }
+ }
+ }
+ }
+
+ LOC_LOGd("clientHandle = %p Exit mMask: 0x%" PRIx64 " mQmiMask: 0x%" PRIx64 "",
+ clientHandle, mMask, mQmiMask);
+
+ return rtv;
+}
+
+void LocApiV02 :: registerEventMask(LOC_API_ADAPTER_EVENT_MASK_T adapterMask)
+{
+ locClientEventMaskType qmiMask = adjustMaskIfNoSessionOrEngineOff(convertMask(adapterMask));
+ if ((qmiMask != mQmiMask) &&
+ (locClientRegisterEventMask(clientHandle, qmiMask, isMaster()))) {
+ mQmiMask = qmiMask;
+ }
+ LOC_LOGd("registerEventMask: mMask: %" PRIu64 " mQmiMask=%" PRIu64 " qmiMask=%" PRIu64,
+ adapterMask, mQmiMask, qmiMask);
+ mMask = adapterMask;
+}
+
+bool LocApiV02::sendRequestForAidingData(locClientEventMaskType qmiMask) {
+
+ qmiLocSetGNSSConstRepConfigReqMsgT_v02 aidingDataReq;
+ qmiLocSetGNSSConstRepConfigIndMsgT_v02 aidingDataReqInd;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ LOC_LOGd("qmiMask = 0x%" PRIx64 "\n", qmiMask);
+
+ memset(&aidingDataReq, 0, sizeof(aidingDataReq));
+
+ if (qmiMask & QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02) {
+ aidingDataReq.reportFullSvPolyDb_valid = true;
+ aidingDataReq.reportFullSvPolyDb = true;
+ }
+
+ if (qmiMask & QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02) {
+ aidingDataReq.reportFullEphemerisDb_valid = true;
+ aidingDataReq.reportFullEphemerisDb = true;
+ }
+
+ /* Note: Requesting for full KlobucharIonoModel report is based on
+ QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT_V02 bit as there is no separate QMI subscription bit for
+ iono model.*/
+ if (qmiMask & QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT_V02) {
+ aidingDataReq.reportFullIonoDb_valid = true;
+ aidingDataReq.reportFullIonoDb = true;
+ }
+
+ req_union.pSetGNSSConstRepConfigReq = &aidingDataReq;
+ memset(&aidingDataReqInd, 0, sizeof(aidingDataReqInd));
+
+ status = locSyncSendReq(QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_IND_V02,
+ &aidingDataReqInd);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ (aidingDataReqInd.status != eQMI_LOC_SUCCESS_V02 &&
+ aidingDataReqInd.status != eQMI_LOC_ENGINE_BUSY_V02)) {
+ LOC_LOGe("Request for aiding data failed status: %s, ind status:%s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(aidingDataReqInd.status));
+ }
+ else {
+ LOC_LOGd("Request for aiding data succeeded");
+ }
+
+ return true;
+
+}
+
+locClientEventMaskType LocApiV02 :: adjustMaskIfNoSessionOrEngineOff(locClientEventMaskType qmiMask)
+{
+ locClientEventMaskType oldQmiMask = qmiMask;
+ if (!mInSession) {
+ locClientEventMaskType clearMask = QMI_LOC_EVENT_MASK_POSITION_REPORT_V02 |
+ QMI_LOC_EVENT_MASK_UNPROPAGATED_POSITION_REPORT_V02 |
+ QMI_LOC_EVENT_MASK_GNSS_SV_INFO_V02 |
+ QMI_LOC_EVENT_MASK_NMEA_V02 |
+ QMI_LOC_EVENT_MASK_ENGINE_STATE_V02 |
+ QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02 |
+ QMI_LOC_EVENT_MASK_GNSS_NHZ_MEASUREMENT_REPORT_V02 |
+ QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02 |
+ QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02 |
+ QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT_V02;
+ qmiMask = qmiMask & ~clearMask;
+ } else if (!mEngineOn) {
+ locClientEventMaskType clearMask = QMI_LOC_EVENT_MASK_NMEA_V02;
+ qmiMask = qmiMask & ~clearMask;
+ }
+ LOC_LOGd("oldQmiMask=%" PRIu64 " qmiMask=%" PRIu64 " mInSession: %d mEngineOn: %d",
+ oldQmiMask, qmiMask, mInSession, mEngineOn);
+ return qmiMask;
+}
+
+enum loc_api_adapter_err LocApiV02 :: close()
+{
+ enum loc_api_adapter_err rtv =
+ // success if either client is already invalid, or
+ // we successfully close the handle
+ (LOC_CLIENT_INVALID_HANDLE_VALUE == clientHandle ||
+ eLOC_CLIENT_SUCCESS == locClientClose(&clientHandle)) ?
+ LOC_API_ADAPTER_ERR_SUCCESS : LOC_API_ADAPTER_ERR_FAILURE;
+
+ mMask = 0;
+ mQmiMask = 0;
+ mInSession = false;
+ clientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
+
+ return rtv;
+}
+
+
+/* start positioning session */
+void LocApiV02 :: startFix(const LocPosMode& fixCriteria, LocApiResponse *adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, fixCriteria, adapterResponse] () {
+
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ qmiLocStartReqMsgT_v02 start_msg;
+
+ qmiLocSetOperationModeReqMsgT_v02 set_mode_msg;
+ qmiLocSetOperationModeIndMsgT_v02 set_mode_ind;
+
+ // clear all fields, validity masks
+ memset (&start_msg, 0, sizeof(start_msg));
+ memset (&set_mode_msg, 0, sizeof(set_mode_msg));
+ memset (&set_mode_ind, 0, sizeof(set_mode_ind));
+
+ LOC_LOGV("%s:%d]: start \n", __func__, __LINE__);
+ fixCriteria.logv();
+
+ mInSession = true;
+ mMeasurementsStarted = true;
+ registerEventMask(mMask);
+
+ // fill in the start request
+ switch(fixCriteria.mode)
+ {
+ case LOC_POSITION_MODE_MS_BASED:
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_MSB_V02;
+ break;
+
+ case LOC_POSITION_MODE_MS_ASSISTED:
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_MSA_V02;
+ break;
+
+ case LOC_POSITION_MODE_RESERVED_4:
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_CELL_ID_V02;
+ break;
+
+ case LOC_POSITION_MODE_RESERVED_5:
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_WWAN_V02;
+ break;
+
+ default:
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_STANDALONE_V02;
+ break;
+ }
+
+ req_union.pSetOperationModeReq = &set_mode_msg;
+
+ // send the mode first, before the start message.
+ status = locSyncSendReq(QMI_LOC_SET_OPERATION_MODE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_OPERATION_MODE_IND_V02,
+ &set_mode_ind); // NULL?
+ //When locSyncSendReq status is time out, more likely the response was lost.
+ //startFix will continue as though it is succeeded.
+ if ((status != eLOC_CLIENT_SUCCESS && status != eLOC_CLIENT_FAILURE_TIMEOUT) ||
+ eQMI_LOC_SUCCESS_V02 != set_mode_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: set opertion mode failed status = %s, "
+ "ind..status = %s\n", __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(set_mode_ind.status));
+ } else {
+ if (status == eLOC_CLIENT_FAILURE_TIMEOUT)
+ {
+ LOC_LOGE ("%s:%d]: set operation mode timed out\n", __func__, __LINE__);
+ }
+ start_msg.minInterval_valid = 1;
+ start_msg.minInterval = fixCriteria.min_interval;
+ mMinInterval = start_msg.minInterval;
+
+ start_msg.horizontalAccuracyLevel_valid = 1;
+
+ if (fixCriteria.preferred_accuracy <= 100)
+ {
+ // fix needs high accuracy
+ start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_HIGH_V02;
+ }
+ else if (fixCriteria.preferred_accuracy <= 1000)
+ {
+ //fix needs med accuracy
+ start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_MED_V02;
+ }
+ else
+ {
+ //fix needs low accuracy
+ start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
+ // limit the scanning max time to 1 min and TBF to 10 min
+ // this is to control the power cost for gps for LOW accuracy
+ start_msg.positionReportTimeout_valid = 1;
+ start_msg.positionReportTimeout = 60000;
+ if (start_msg.minInterval < 600000) {
+ start_msg.minInterval = 600000;
+ }
+ }
+
+ start_msg.fixRecurrence_valid = 1;
+ if(LOC_GPS_POSITION_RECURRENCE_SINGLE == fixCriteria.recurrence)
+ {
+ start_msg.fixRecurrence = eQMI_LOC_RECURRENCE_SINGLE_V02;
+ }
+ else
+ {
+ start_msg.fixRecurrence = eQMI_LOC_RECURRENCE_PERIODIC_V02;
+ }
+
+ //dummy session id
+ // TBD: store session ID, check for session id in pos reports.
+ start_msg.sessionId = LOC_API_V02_DEF_SESSION_ID;
+
+ //Set whether position report can be shared with other LOC clients
+ start_msg.sharePosition_valid = 1;
+ start_msg.sharePosition = fixCriteria.share_position;
+
+ if (fixCriteria.credentials[0] != 0) {
+ int size1 = sizeof(start_msg.applicationId.applicationName);
+ int size2 = sizeof(fixCriteria.credentials);
+ int len = ((size1 < size2) ? size1 : size2) - 1;
+ memcpy(start_msg.applicationId.applicationName,
+ fixCriteria.credentials,
+ len);
+
+ size1 = sizeof(start_msg.applicationId.applicationProvider);
+ size2 = sizeof(fixCriteria.provider);
+ len = ((size1 < size2) ? size1 : size2) - 1;
+ memcpy(start_msg.applicationId.applicationProvider,
+ fixCriteria.provider,
+ len);
+
+ start_msg.applicationId_valid = 1;
+ }
+
+ // config Altitude Assumed
+ start_msg.configAltitudeAssumed_valid = 1;
+ start_msg.configAltitudeAssumed = eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_DISABLED_V02;
+
+ // set power mode details
+ mPowerMode = fixCriteria.powerMode;
+ if (GNSS_POWER_MODE_INVALID != fixCriteria.powerMode) {
+ start_msg.powerMode_valid = 1;
+ start_msg.powerMode.powerMode = convertPowerMode(fixCriteria.powerMode);
+ start_msg.powerMode.timeBetweenMeasurement =
+ fixCriteria.timeBetweenMeasurements;
+ // Force low accuracy for background power modes
+ if (GNSS_POWER_MODE_M3 == fixCriteria.powerMode ||
+ GNSS_POWER_MODE_M4 == fixCriteria.powerMode ||
+ GNSS_POWER_MODE_M5 == fixCriteria.powerMode) {
+ start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
+ }
+ // Force TBM = TBF for power mode M4
+ if (GNSS_POWER_MODE_M4 == fixCriteria.powerMode) {
+ start_msg.powerMode.timeBetweenMeasurement = start_msg.minInterval;
+ }
+ }
+
+ req_union.pStartReq = &start_msg;
+
+ status = locClientSendReq(QMI_LOC_START_REQ_V02, req_union);
+ }
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ if (eLOC_CLIENT_SUCCESS == status) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+
+}
+
+/* stop a positioning session */
+void LocApiV02 :: stopFix(LocApiResponse *adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, adapterResponse] () {
+
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ qmiLocStopReqMsgT_v02 stop_msg;
+
+ LOC_LOGD(" %s:%d]: stop called \n", __func__, __LINE__);
+
+ memset(&stop_msg, 0, sizeof(stop_msg));
+
+ // dummy session id
+ stop_msg.sessionId = LOC_API_V02_DEF_SESSION_ID;
+
+ req_union.pStopReq = &stop_msg;
+
+ status = locClientSendReq(QMI_LOC_STOP_REQ_V02, req_union);
+
+ mInSession = false;
+ mPowerMode = GNSS_POWER_MODE_INVALID;
+
+ // if engine on never happend, deregister events
+ // without waiting for Engine Off
+ if (!mEngineOn) {
+ registerEventMask(mMask);
+ }
+
+ // free the memory used to assemble SV measurement from
+ // different constellations and bands
+ if (!mGnssMeasurements) {
+ free(mGnssMeasurements);
+ mGnssMeasurements = nullptr;
+ }
+
+ if( eLOC_CLIENT_SUCCESS != status)
+ {
+ LOC_LOGE("%s:%d]: error = %s\n",__func__, __LINE__,
+ loc_get_v02_client_status_name(status));
+ }
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ if (eLOC_CLIENT_SUCCESS == status) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+/* inject time into the position engine */
+void LocApiV02 ::
+ setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ sendMsg(new LocApiMsg([this, time, timeReference, uncertainty] () {
+
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocInjectUtcTimeReqMsgT_v02 inject_time_msg;
+ qmiLocInjectUtcTimeIndMsgT_v02 inject_time_ind;
+
+ memset(&inject_time_msg, 0, sizeof(inject_time_msg));
+
+ inject_time_ind.status = eQMI_LOC_GENERAL_FAILURE_V02;
+
+ inject_time_msg.timeUtc = time;
+
+ inject_time_msg.timeUtc += (int64_t)(elapsedRealtime() - timeReference);
+
+ inject_time_msg.timeUnc = uncertainty;
+
+ req_union.pInjectUtcTimeReq = &inject_time_msg;
+
+ LOC_LOGV ("%s:%d]: uncertainty = %d\n", __func__, __LINE__,
+ uncertainty);
+
+ status = locSyncSendReq(QMI_LOC_INJECT_UTC_TIME_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_INJECT_UTC_TIME_IND_V02,
+ &inject_time_ind);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != inject_time_ind.status)
+ {
+ LOC_LOGE ("%s:%d] status = %s, ind..status = %s\n", __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(inject_time_ind.status));
+ }
+
+ }));
+}
+
+/* inject position into the position engine */
+void LocApiV02 ::
+ injectPosition(double latitude, double longitude, float accuracy)
+{
+ Location location = {};
+
+ location.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ location.latitude = latitude;
+ location.longitude = longitude;
+
+ location.flags |= LOCATION_HAS_ACCURACY_BIT;
+ location.accuracy = accuracy;
+
+ struct timespec time_info_current;
+ if(clock_gettime(CLOCK_REALTIME,&time_info_current) == 0) //success
+ {
+ location.timestamp = (time_info_current.tv_sec)*1e3 +
+ (time_info_current.tv_nsec)/1e6;
+ }
+
+ injectPosition(location, false);
+}
+
+void LocApiV02::injectPosition(const Location& location, bool onDemandCpi)
+{
+ sendMsg(new LocApiMsg([this, location, onDemandCpi] () {
+
+ qmiLocInjectPositionReqMsgT_v02 injectPositionReq;
+ memset(&injectPositionReq, 0, sizeof(injectPositionReq));
+
+ if (location.timestamp > 0) {
+ injectPositionReq.timestampUtc_valid = 1;
+ injectPositionReq.timestampUtc = location.timestamp;
+ }
+
+ if (LOCATION_HAS_LAT_LONG_BIT & location.flags) {
+ injectPositionReq.latitude_valid = 1;
+ injectPositionReq.longitude_valid = 1;
+ injectPositionReq.latitude = location.latitude;
+ injectPositionReq.longitude = location.longitude;
+ }
+
+ if (LOCATION_HAS_ACCURACY_BIT & location.flags) {
+ injectPositionReq.horUncCircular_valid = 1;
+ injectPositionReq.horUncCircular = location.accuracy;
+ injectPositionReq.horConfidence_valid = 1;
+ injectPositionReq.horConfidence = 68;
+ injectPositionReq.rawHorUncCircular_valid = 1;
+ injectPositionReq.rawHorUncCircular = location.accuracy;
+ injectPositionReq.rawHorConfidence_valid = 1;
+ injectPositionReq.rawHorConfidence = 68;
+
+ // We don't wish to advertise accuracy better than 1000 meters to Modem
+ if (injectPositionReq.horUncCircular < 1000) {
+ injectPositionReq.horUncCircular = 1000;
+ }
+ }
+
+ if (LOCATION_HAS_ALTITUDE_BIT & location.flags) {
+ injectPositionReq.altitudeWrtEllipsoid_valid = 1;
+ injectPositionReq.altitudeWrtEllipsoid = location.altitude;
+ injectPositionReq.altSourceInfo_valid = 1;
+ injectPositionReq.altSourceInfo.source = eQMI_LOC_ALT_SRC_OTHER_V02;
+ injectPositionReq.altSourceInfo.linkage = eQMI_LOC_ALT_SRC_LINKAGE_FULLY_INTERDEPENDENT_V02;
+ }
+
+ if (LOCATION_HAS_VERTICAL_ACCURACY_BIT & location.flags) {
+ injectPositionReq.vertUnc_valid = 1;
+ injectPositionReq.vertUnc = location.verticalAccuracy;
+ injectPositionReq.vertConfidence_valid = 1;
+ injectPositionReq.vertConfidence = 68;
+ }
+
+ injectPositionReq.positionSrc_valid = 1;
+ injectPositionReq.positionSrc = eQMI_LOC_POSITION_SRC_OTHER_V02;
+
+ if (onDemandCpi) {
+ injectPositionReq.onDemandCpi_valid = 1;
+ injectPositionReq.onDemandCpi = 1;
+ }
+
+ LOC_LOGv("Lat=%lf, Lon=%lf, Acc=%.2lf rawAcc=%.2lf horConfidence=%d"
+ "rawHorConfidence=%d onDemandCpi=%d",
+ injectPositionReq.latitude, injectPositionReq.longitude,
+ injectPositionReq.horUncCircular, injectPositionReq.rawHorUncCircular,
+ injectPositionReq.horConfidence, injectPositionReq.rawHorConfidence,
+ injectPositionReq.onDemandCpi);
+
+ LOC_SEND_SYNC_REQ(InjectPosition, INJECT_POSITION, injectPositionReq);
+
+ }));
+}
+
+void LocApiV02::injectPosition(const GnssLocationInfoNotification &locationInfo, bool onDemandCpi)
+{
+ sendMsg(new LocApiMsg([this, locationInfo, onDemandCpi] () {
+
+ qmiLocInjectPositionReqMsgT_v02 injectPositionReq;
+ memset(&injectPositionReq, 0, sizeof(injectPositionReq));
+ const Location &location = locationInfo.location;
+
+ if (location.timestamp > 0) {
+ injectPositionReq.timestampUtc_valid = 1;
+ injectPositionReq.timestampUtc = location.timestamp;
+ }
+
+ if (LOCATION_HAS_LAT_LONG_BIT & location.flags) {
+ injectPositionReq.latitude_valid = 1;
+ injectPositionReq.longitude_valid = 1;
+ injectPositionReq.latitude = location.latitude;
+ injectPositionReq.longitude = location.longitude;
+ }
+
+ if (LOCATION_HAS_ACCURACY_BIT & location.flags) {
+ injectPositionReq.horUncCircular_valid = 1;
+ injectPositionReq.horUncCircular = location.accuracy;
+ injectPositionReq.horConfidence_valid = 1;
+ injectPositionReq.horConfidence = 68;
+ injectPositionReq.rawHorUncCircular_valid = 1;
+ injectPositionReq.rawHorUncCircular = location.accuracy;
+ injectPositionReq.rawHorConfidence_valid = 1;
+ injectPositionReq.rawHorConfidence = 68;
+
+ // We don't wish to advertise accuracy better than 1000 meters to Modem
+ if (injectPositionReq.horUncCircular < 1000) {
+ injectPositionReq.horUncCircular = 1000;
+ }
+ }
+
+ if (LOCATION_HAS_ALTITUDE_BIT & location.flags) {
+ injectPositionReq.altitudeWrtEllipsoid_valid = 1;
+ injectPositionReq.altitudeWrtEllipsoid = location.altitude;
+ }
+
+ if (LOCATION_HAS_VERTICAL_ACCURACY_BIT & location.flags) {
+ injectPositionReq.vertUnc_valid = 1;
+ injectPositionReq.vertUnc = location.verticalAccuracy;
+ injectPositionReq.vertConfidence_valid = 1;
+ injectPositionReq.vertConfidence = 68;
+ }
+
+ // GPS time
+ if (locationInfo.gnssSystemTime.gnssSystemTimeSrc == GNSS_LOC_SV_SYSTEM_GPS) {
+ injectPositionReq.gpsTime_valid = 1;
+ injectPositionReq.gpsTime.gpsWeek =
+ locationInfo.gnssSystemTime.u.gpsSystemTime.systemWeek;
+ injectPositionReq.gpsTime.gpsTimeOfWeekMs =
+ locationInfo.gnssSystemTime.u.gpsSystemTime.systemMsec;
+ } else if (locationInfo.gnssSystemTime.gnssSystemTimeSrc == GNSS_LOC_SV_SYSTEM_GALILEO) {
+ injectPositionReq.gpsTime_valid = 1;
+ injectPositionReq.gpsTime.gpsWeek =
+ locationInfo.gnssSystemTime.u.galSystemTime.systemWeek;
+ injectPositionReq.gpsTime.gpsTimeOfWeekMs =
+ locationInfo.gnssSystemTime.u.gpsSystemTime.systemMsec;
+ } else if (locationInfo.gnssSystemTime.gnssSystemTimeSrc == GNSS_LOC_SV_SYSTEM_BDS) {
+ injectPositionReq.gpsTime_valid = 1;
+ injectPositionReq.gpsTime.gpsWeek =
+ locationInfo.gnssSystemTime.u.bdsSystemTime.systemWeek;
+ injectPositionReq.gpsTime.gpsTimeOfWeekMs =
+ locationInfo.gnssSystemTime.u.bdsSystemTime.systemMsec;
+ } else if (locationInfo.gnssSystemTime.gnssSystemTimeSrc == GNSS_LOC_SV_SYSTEM_QZSS) {
+ injectPositionReq.gpsTime_valid = 1;
+ injectPositionReq.gpsTime.gpsWeek =
+ locationInfo.gnssSystemTime.u.qzssSystemTime.systemWeek;
+ injectPositionReq.gpsTime.gpsTimeOfWeekMs =
+ locationInfo.gnssSystemTime.u.qzssSystemTime.systemMsec;
+ } else if (locationInfo.gnssSystemTime.gnssSystemTimeSrc == GNSS_LOC_SV_SYSTEM_GLONASS) {
+ if (GNSS_LOCATION_INFO_LEAP_SECONDS_BIT & locationInfo.flags) {
+ const GnssGloTimeStructType &gloSystemTime =
+ locationInfo.gnssSystemTime.u.gloSystemTime;
+ unsigned long long msecTotal =
+ gloSystemTime.gloFourYear * GLONASS_DAYS_IN_4YEARS * DAY_MSECS +
+ gloSystemTime.gloDays * DAY_MSECS +
+ gloSystemTime.gloMsec;
+ // compensate the glonnass msec with difference between GPS time
+ msecTotal += (GPS_GLONASS_DAYS_DIFF * DAY_MSECS -
+ GLONASS_UTC_OFFSET_HOURS * 3600 * 1000 +
+ locationInfo.leapSeconds * 1000);
+ injectPositionReq.gpsTime_valid = 1;
+ injectPositionReq.gpsTime.gpsWeek = msecTotal / WEEK_MSECS;
+ injectPositionReq.gpsTime.gpsTimeOfWeekMs = msecTotal % WEEK_MSECS;
+ }
+ } else if (locationInfo.gnssSystemTime.gnssSystemTimeSrc == GNSS_LOC_SV_SYSTEM_NAVIC) {
+ injectPositionReq.gpsTime_valid = 1;
+ injectPositionReq.gpsTime.gpsWeek =
+ locationInfo.gnssSystemTime.u.navicSystemTime.systemWeek;
+ injectPositionReq.gpsTime.gpsTimeOfWeekMs =
+ locationInfo.gnssSystemTime.u.navicSystemTime.systemMsec;
+ }
+
+ // velocity enu
+ if ((GNSS_LOCATION_INFO_EAST_VEL_BIT & locationInfo.flags) &&
+ (GNSS_LOCATION_INFO_NORTH_VEL_BIT & locationInfo.flags) &&
+ (GNSS_LOCATION_INFO_UP_VEL_BIT & locationInfo.flags)) {
+ injectPositionReq.velEnu_valid = 1;
+ injectPositionReq.velEnu[0] = locationInfo.eastVelocity;
+ injectPositionReq.velEnu[1] = locationInfo.northVelocity;
+ injectPositionReq.velEnu[2] = locationInfo.upVelocity;
+ }
+
+ // velocity uncertainty enu
+ if ((GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT & locationInfo.flags) &&
+ (GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT & locationInfo.flags) &&
+ (GNSS_LOCATION_INFO_UP_VEL_UNC_BIT & locationInfo.flags)) {
+ injectPositionReq.velUncEnu_valid = 1;
+ injectPositionReq.velUncEnu[0] = locationInfo.eastVelocityStdDeviation;
+ injectPositionReq.velUncEnu[1] = locationInfo.northVelocityStdDeviation;
+ injectPositionReq.velUncEnu[2] = locationInfo.upVelocityStdDeviation;
+ }
+
+ // time uncertainty
+ if (GNSS_LOCATION_INFO_TIME_UNC_BIT & locationInfo.flags) {
+ injectPositionReq.timeUnc_valid = 1;
+ injectPositionReq.timeUnc = locationInfo.timeUncMs;
+ }
+
+ // number of SV used info, this replaces expandedGnssSvUsedList as the payload
+ // for expandedGnssSvUsedList is too large
+ if (GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT & locationInfo.flags) {
+ injectPositionReq.numSvInFix = locationInfo.numSvUsedInPosition;
+ injectPositionReq.numSvInFix_valid = 1;
+ }
+
+ // mark fix as from DRE for modem to distinguish from others
+ if (LOCATION_TECHNOLOGY_SENSORS_BIT & locationInfo.location.techMask) {
+ injectPositionReq.positionSrc_valid = 1;
+ injectPositionReq.positionSrc = eQMI_LOC_POSITION_SRC_DRE_V02;
+ }
+
+ if (onDemandCpi) {
+ injectPositionReq.onDemandCpi_valid = 1;
+ injectPositionReq.onDemandCpi = 1;
+ }
+
+ LOC_LOGv("Lat=%lf, Lon=%lf, Acc=%.2lf rawAcc=%.2lf horConfidence=%d"
+ "rawHorConfidence=%d onDemandCpi=%d, position src=%d, numSVs=%d",
+ injectPositionReq.latitude, injectPositionReq.longitude,
+ injectPositionReq.horUncCircular, injectPositionReq.rawHorUncCircular,
+ injectPositionReq.horConfidence, injectPositionReq.rawHorConfidence,
+ injectPositionReq.onDemandCpi, injectPositionReq.positionSrc,
+ injectPositionReq.numSvInFix);
+
+ LOC_SEND_SYNC_REQ(InjectPosition, INJECT_POSITION, injectPositionReq);
+
+ }));
+}
+
+/* delete assistance date */
+void
+LocApiV02::deleteAidingData(const GnssAidingData& data, LocApiResponse *adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, data, adapterResponse] () {
+
+ static bool isNewApiSupported = true;
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_UNSUPPORTED;
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ // Use the new API first
+ qmiLocDeleteGNSSServiceDataReqMsgT_v02 delete_gnss_req;
+ qmiLocDeleteGNSSServiceDataIndMsgT_v02 delete_gnss_resp;
+
+ memset(&delete_gnss_req, 0, sizeof(delete_gnss_req));
+ memset(&delete_gnss_resp, 0, sizeof(delete_gnss_resp));
+
+ if (isNewApiSupported) {
+ if (data.deleteAll) {
+ delete_gnss_req.deleteAllFlag = true;
+ } else {
+ if (GNSS_AIDING_DATA_SV_EPHEMERIS_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_EPHEMERIS_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_ALMANAC_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_ALMANAC_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_HEALTH_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_SVHEALTH_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_DIRECTION_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_SVDIR_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_STEER_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_SVSTEER_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_ALM_CORR_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_BLACKLIST_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_BLACKLIST_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_SA_DATA_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_SA_DATA_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_NO_EXIST_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_SV_NO_EXIST_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_IONOSPHERE_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_IONO_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_TIME_BIT & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_TIME_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_MB_DATA & data.sv.svMask) {
+ delete_gnss_req.deleteSatelliteData_valid = 1;
+ delete_gnss_req.deleteSatelliteData.deleteSatelliteDataMask |=
+ QMI_LOC_DELETE_DATA_MASK_MB_DATA_V02;
+ }
+ if (delete_gnss_req.deleteSatelliteData_valid) {
+ if (GNSS_AIDING_DATA_SV_TYPE_GPS_BIT & data.sv.svTypeMask) {
+ delete_gnss_req.deleteSatelliteData.system |= QMI_LOC_SYSTEM_GPS_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT & data.sv.svTypeMask) {
+ delete_gnss_req.deleteSatelliteData.system |= QMI_LOC_SYSTEM_GLO_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT & data.sv.svTypeMask) {
+ delete_gnss_req.deleteSatelliteData.system |= QMI_LOC_SYSTEM_BDS_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT & data.sv.svTypeMask) {
+ delete_gnss_req.deleteSatelliteData.system |= QMI_LOC_SYSTEM_GAL_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT & data.sv.svTypeMask) {
+ delete_gnss_req.deleteSatelliteData.system |= QMI_LOC_SYSTEM_QZSS_V02;
+ }
+ if (GNSS_AIDING_DATA_SV_TYPE_NAVIC_BIT & data.sv.svTypeMask) {
+ delete_gnss_req.deleteSatelliteData.system |= QMI_LOC_SYSTEM_NAVIC_V02;
+ }
+ }
+
+ if (GNSS_AIDING_DATA_COMMON_POSITION_BIT & data.common.mask) {
+ delete_gnss_req.deleteCommonDataMask_valid = 1;
+ delete_gnss_req.deleteCommonDataMask |= QMI_LOC_DELETE_COMMON_MASK_POS_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_TIME_BIT & data.common.mask) {
+ delete_gnss_req.deleteCommonDataMask_valid = 1;
+ delete_gnss_req.deleteCommonDataMask |= QMI_LOC_DELETE_COMMON_MASK_TIME_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_UTC_BIT & data.common.mask) {
+ delete_gnss_req.deleteCommonDataMask_valid = 1;
+ delete_gnss_req.deleteCommonDataMask |= QMI_LOC_DELETE_COMMON_MASK_UTC_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_RTI_BIT & data.common.mask) {
+ delete_gnss_req.deleteCommonDataMask_valid = 1;
+ delete_gnss_req.deleteCommonDataMask |= QMI_LOC_DELETE_COMMON_MASK_RTI_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT & data.common.mask) {
+ delete_gnss_req.deleteCommonDataMask_valid = 1;
+ delete_gnss_req.deleteCommonDataMask |= QMI_LOC_DELETE_COMMON_MASK_FREQ_BIAS_EST_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_CELLDB_BIT & data.common.mask) {
+ delete_gnss_req.deleteCellDbDataMask_valid = 1;
+ delete_gnss_req.deleteCellDbDataMask =
+ (QMI_LOC_MASK_DELETE_CELLDB_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_LATEST_GPS_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_OTA_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_EXT_REF_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_TIMETAG_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_CELLID_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_CACHED_CELLID_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_LAST_SRV_CELL_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_CUR_SRV_CELL_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO_V02);
+ }
+ }
+
+ req_union.pDeleteGNSSServiceDataReq = &delete_gnss_req;
+
+ status = locSyncSendReq(QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_DELETE_GNSS_SERVICE_DATA_IND_V02,
+ &delete_gnss_resp);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != delete_gnss_resp.status)
+ {
+ LOC_LOGE("%s:%d]: error! status = %s, delete_resp.status = %s\n",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(delete_gnss_resp.status));
+ }
+ }
+
+ if (eLOC_CLIENT_FAILURE_UNSUPPORTED == status ||
+ eLOC_CLIENT_FAILURE_INTERNAL == status) {
+ // If the new API is not supported we fall back on the old one
+ // The error could be eLOC_CLIENT_FAILURE_INTERNAL if
+ // QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02 is not in the .idl file
+ LOC_LOGD("%s:%d]: QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02 not supported"
+ "We use QMI_LOC_DELETE_ASSIST_DATA_REQ_V02\n",
+ __func__, __LINE__);
+ isNewApiSupported = false;
+
+ qmiLocDeleteAssistDataReqMsgT_v02 delete_req;
+ qmiLocDeleteAssistDataIndMsgT_v02 delete_resp;
+
+ memset(&delete_req, 0, sizeof(delete_req));
+ memset(&delete_resp, 0, sizeof(delete_resp));
+
+ if (data.deleteAll) {
+ delete_req.deleteAllFlag = true;
+ } else {
+ /* to keep track of svInfoList for GPS and GLO*/
+ uint32_t curr_sv_len = 0;
+ uint32_t curr_sv_idx = 0;
+ uint32_t sv_id = 0;
+
+ if ((GNSS_AIDING_DATA_SV_EPHEMERIS_BIT & data.sv.svMask ||
+ GNSS_AIDING_DATA_SV_ALMANAC_BIT & data.sv.svMask) &&
+ GNSS_AIDING_DATA_SV_TYPE_GPS_BIT & data.sv.svTypeMask) {
+
+ /* do delete for all GPS SV's */
+ curr_sv_len += SV_ID_RANGE;
+
+ sv_id = GPS_SV_ID_OFFSET;
+
+ delete_req.deleteSvInfoList_valid = 1;
+
+ delete_req.deleteSvInfoList_len = curr_sv_len;
+
+ LOC_LOGV("%s:%d]: Delete GPS SV info for index %d to %d"
+ "and sv id %d to %d \n",
+ __func__, __LINE__, curr_sv_idx, curr_sv_len - 1,
+ sv_id, sv_id + SV_ID_RANGE - 1);
+
+ for (uint32_t i = curr_sv_idx; i < curr_sv_len; i++, sv_id++) {
+ delete_req.deleteSvInfoList[i].gnssSvId = sv_id;
+
+ delete_req.deleteSvInfoList[i].system = eQMI_LOC_SV_SYSTEM_GPS_V02;
+
+ if (GNSS_AIDING_DATA_SV_EPHEMERIS_BIT & data.sv.svMask) {
+ // set ephemeris mask for all GPS SV's
+ delete_req.deleteSvInfoList[i].deleteSvInfoMask |=
+ QMI_LOC_MASK_DELETE_EPHEMERIS_V02;
+ }
+
+ if (GNSS_AIDING_DATA_SV_ALMANAC_BIT & data.sv.svMask) {
+ delete_req.deleteSvInfoList[i].deleteSvInfoMask |=
+ QMI_LOC_MASK_DELETE_ALMANAC_V02;
+ }
+ }
+ // increment the current index
+ curr_sv_idx += SV_ID_RANGE;
+
+ }
+
+ if (GNSS_AIDING_DATA_COMMON_POSITION_BIT & data.common.mask) {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_POSITION_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_TIME_BIT & data.common.mask) {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_TIME_V02;
+ }
+ if ((GNSS_AIDING_DATA_SV_IONOSPHERE_BIT & data.sv.svMask) &&
+ (GNSS_AIDING_DATA_SV_TYPE_GPS_BIT & data.sv.svTypeMask)) {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_IONO_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_UTC_BIT & data.common.mask)
+ {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_UTC_V02;
+ }
+ if ((GNSS_AIDING_DATA_SV_HEALTH_BIT & data.sv.svMask) &&
+ (GNSS_AIDING_DATA_SV_TYPE_GPS_BIT & data.sv.svTypeMask)) {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_HEALTH_V02;
+ }
+ if ((GNSS_AIDING_DATA_SV_DIRECTION_BIT & data.sv.svMask) &&
+ (GNSS_AIDING_DATA_SV_TYPE_GPS_BIT & data.sv.svTypeMask)) {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_GPS_SVDIR_V02;
+ }
+ if ((GNSS_AIDING_DATA_SV_SA_DATA_BIT & data.sv.svMask) &&
+ (GNSS_AIDING_DATA_SV_TYPE_GPS_BIT & data.sv.svTypeMask)) {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_SADATA_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_RTI_BIT & data.common.mask) {
+ delete_req.deleteGnssDataMask_valid = 1;
+ delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_RTI_V02;
+ }
+ if (GNSS_AIDING_DATA_COMMON_CELLDB_BIT & data.common.mask) {
+ delete_req.deleteCellDbDataMask_valid = 1;
+ delete_req.deleteCellDbDataMask =
+ (QMI_LOC_MASK_DELETE_CELLDB_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_LATEST_GPS_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_OTA_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_EXT_REF_POS_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_TIMETAG_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_CELLID_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_CACHED_CELLID_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_LAST_SRV_CELL_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_CUR_SRV_CELL_V02 |
+ QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO_V02);
+
+ }
+ }
+
+ req_union.pDeleteAssistDataReq = &delete_req;
+
+ status = locSyncSendReq(QMI_LOC_DELETE_ASSIST_DATA_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_DELETE_ASSIST_DATA_IND_V02,
+ &delete_resp);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != delete_resp.status)
+ {
+ LOC_LOGE("%s:%d]: error! status = %s, delete_resp.status = %s\n",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(delete_resp.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+/* send NI user repsonse to the engine */
+void
+LocApiV02::informNiResponse(GnssNiResponse userResponse, const void* passThroughData)
+{
+ sendMsg(new LocApiMsg([this, userResponse, passThroughData] () {
+
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocNiUserRespReqMsgT_v02 ni_resp;
+ qmiLocNiUserRespIndMsgT_v02 ni_resp_ind;
+
+ qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *request_pass_back =
+ (qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *)passThroughData;
+
+ memset(&ni_resp,0, sizeof(ni_resp));
+
+ memset(&ni_resp_ind,0, sizeof(ni_resp_ind));
+
+ switch (userResponse) {
+ case GNSS_NI_RESPONSE_ACCEPT:
+ ni_resp.userResp = eQMI_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT_V02;
+ break;
+ case GNSS_NI_RESPONSE_DENY:
+ ni_resp.userResp = eQMI_LOC_NI_LCS_NOTIFY_VERIFY_DENY_V02;
+ break;
+ case GNSS_NI_RESPONSE_NO_RESPONSE:
+ ni_resp.userResp = eQMI_LOC_NI_LCS_NOTIFY_VERIFY_NORESP_V02;
+ break;
+ default:
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ free((void *)passThroughData);
+ return;
+ }
+
+ LOC_LOGv("NI response: %d", ni_resp.userResp);
+
+ ni_resp.notificationType = request_pass_back->notificationType;
+
+ // copy SUPL payload from request
+ if (1 == request_pass_back->NiSuplInd_valid) {
+ ni_resp.NiSuplPayload_valid = 1;
+ memcpy(&(ni_resp.NiSuplPayload),
+ &(request_pass_back->NiSuplInd),
+ sizeof(qmiLocNiSuplNotifyVerifyStructT_v02));
+ }
+ // should this be an "else if"?? we don't need to decide
+
+ // copy UMTS-CP payload from request
+ if (1 == request_pass_back->NiUmtsCpInd_valid) {
+ ni_resp.NiUmtsCpPayload_valid = 1;
+ memcpy(&(ni_resp.NiUmtsCpPayload),
+ &(request_pass_back->NiUmtsCpInd),
+ sizeof(qmiLocNiUmtsCpNotifyVerifyStructT_v02));
+ }
+
+ //copy Vx payload from the request
+ if (1 == request_pass_back->NiVxInd_valid) {
+ ni_resp.NiVxPayload_valid = 1;
+ memcpy(&(ni_resp.NiVxPayload),
+ &(request_pass_back->NiVxInd),
+ sizeof(qmiLocNiVxNotifyVerifyStructT_v02));
+ }
+
+ // copy Vx service interaction payload from the request
+ if (1 == request_pass_back->NiVxServiceInteractionInd_valid) {
+ ni_resp.NiVxServiceInteractionPayload_valid = 1;
+ memcpy(&(ni_resp.NiVxServiceInteractionPayload),
+ &(request_pass_back->NiVxServiceInteractionInd),
+ sizeof(qmiLocNiVxServiceInteractionStructT_v02));
+ }
+
+ // copy Network Initiated SUPL Version 2 Extension
+ if (1 == request_pass_back->NiSuplVer2ExtInd_valid) {
+ ni_resp.NiSuplVer2ExtPayload_valid = 1;
+ memcpy(&(ni_resp.NiSuplVer2ExtPayload),
+ &(request_pass_back->NiSuplVer2ExtInd),
+ sizeof(qmiLocNiSuplVer2ExtStructT_v02));
+ }
+
+ // copy SUPL Emergency Notification
+ if (request_pass_back->suplEmergencyNotification_valid) {
+ ni_resp.suplEmergencyNotification_valid = 1;
+ memcpy(&(ni_resp.suplEmergencyNotification),
+ &(request_pass_back->suplEmergencyNotification),
+ sizeof(qmiLocEmergencyNotificationStructT_v02));
+ }
+
+ req_union.pNiUserRespReq = &ni_resp;
+
+ status = locSyncSendReq(QMI_LOC_NI_USER_RESPONSE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_NI_USER_RESPONSE_IND_V02,
+ &ni_resp_ind);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != ni_resp_ind.status) {
+
+ LOC_LOGe("error! status = %s, ni_resp_ind.status = %s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(ni_resp_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ free((void *)passThroughData);
+ }));
+}
+
+void
+LocApiV02::registerMasterClient()
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocRegisterMasterClientReqMsgT_v02 reg_master_client_req;
+ qmiLocRegisterMasterClientIndMsgT_v02 reg_master_client_ind;
+
+ memset(®_master_client_req, 0, sizeof(reg_master_client_req));
+ memset(®_master_client_ind, 0, sizeof(reg_master_client_ind));
+
+ reg_master_client_req.key = 0xBAABCDEF;
+
+ req_union.pRegisterMasterClientReq = ®_master_client_req;
+
+ status = locSyncSendReq(QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_REGISTER_MASTER_CLIENT_IND_V02,
+ ®_master_client_ind);
+
+ if (eLOC_CLIENT_SUCCESS != status ||
+ eQMI_LOC_REGISTER_MASTER_CLIENT_SUCCESS_V02 != reg_master_client_ind.status) {
+ LOC_LOGw ("error status = %s, reg_master_client_ind.status = %s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_reg_mk_status_name(reg_master_client_ind.status));
+ if (eLOC_CLIENT_FAILURE_INVALID_MESSAGE_ID == status ||
+ eLOC_CLIENT_FAILURE_UNSUPPORTED == status) {
+ mMasterRegisterNotSupported = true;
+ } else {
+ mMasterRegisterNotSupported = false;
+ }
+ LOC_LOGv("mMasterRegisterNotSupported = %d", mMasterRegisterNotSupported);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+}
+
+/* Set UMTs SLP server URL */
+LocationError
+LocApiV02::setServerSync(const char* url, int len, LocServerType type)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocSetServerReqMsgT_v02 set_server_req;
+ qmiLocSetServerIndMsgT_v02 set_server_ind;
+
+ if(len < 0 || (size_t)len > sizeof(set_server_req.urlAddr))
+ {
+ LOC_LOGe("len = %d greater than max allowed url length", len);
+
+ return LOCATION_ERROR_INVALID_PARAMETER;
+ }
+
+ memset(&set_server_req, 0, sizeof(set_server_req));
+ memset(&set_server_ind, 0, sizeof(set_server_ind));
+
+ LOC_LOGd("url = %s, len = %d type=%d", url, len, type);
+
+ if (LOC_AGPS_MO_SUPL_SERVER == type) {
+ set_server_req.serverType = eQMI_LOC_SERVER_TYPE_CUSTOM_SLP_V02;
+ } else {
+ set_server_req.serverType = eQMI_LOC_SERVER_TYPE_UMTS_SLP_V02;
+ }
+
+ set_server_req.urlAddr_valid = 1;
+
+ strlcpy(set_server_req.urlAddr, url, sizeof(set_server_req.urlAddr));
+
+ req_union.pSetServerReq = &set_server_req;
+
+ status = locSyncSendReq(QMI_LOC_SET_SERVER_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_SERVER_IND_V02,
+ &set_server_ind);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != set_server_ind.status)
+ {
+ LOC_LOGe ("error status = %s, set_server_ind.status = %s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(set_server_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+LocationError
+LocApiV02::setServerSync(unsigned int ip, int port, LocServerType type)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocSetServerReqMsgT_v02 set_server_req;
+ qmiLocSetServerIndMsgT_v02 set_server_ind;
+ qmiLocServerTypeEnumT_v02 set_server_cmd;
+
+ switch (type) {
+ case LOC_AGPS_MPC_SERVER:
+ set_server_cmd = eQMI_LOC_SERVER_TYPE_CDMA_MPC_V02;
+ break;
+ case LOC_AGPS_CUSTOM_PDE_SERVER:
+ set_server_cmd = eQMI_LOC_SERVER_TYPE_CUSTOM_PDE_V02;
+ break;
+ default:
+ set_server_cmd = eQMI_LOC_SERVER_TYPE_CDMA_PDE_V02;
+ break;
+ }
+
+ memset(&set_server_req, 0, sizeof(set_server_req));
+ memset(&set_server_ind, 0, sizeof(set_server_ind));
+
+ LOC_LOGD("%s:%d]:, ip = %u, port = %d\n", __func__, __LINE__, ip, port);
+
+ set_server_req.serverType = set_server_cmd;
+ set_server_req.ipv4Addr_valid = 1;
+ set_server_req.ipv4Addr.addr = ip;
+ set_server_req.ipv4Addr.port = port;
+
+ req_union.pSetServerReq = &set_server_req;
+
+ status = locSyncSendReq(QMI_LOC_SET_SERVER_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_SERVER_IND_V02,
+ &set_server_ind);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != set_server_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: error status = %s, set_server_ind.status = %s\n",
+ __func__,__LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(set_server_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+/* Inject XTRA data, this module breaks down the XTRA
+ file into "chunks" and injects them one at a time */
+enum loc_api_adapter_err LocApiV02 :: setXtraData(
+ char* data, int length)
+{
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ uint16_t total_parts;
+ uint16_t part;
+ uint32_t len_injected;
+
+ locClientReqUnionType req_union;
+ qmiLocInjectPredictedOrbitsDataReqMsgT_v02 inject_xtra;
+ qmiLocInjectPredictedOrbitsDataIndMsgT_v02 inject_xtra_ind;
+
+ req_union.pInjectPredictedOrbitsDataReq = &inject_xtra;
+
+ LOC_LOGD("%s:%d]: xtra size = %d\n", __func__, __LINE__, length);
+
+ inject_xtra.formatType_valid = 1;
+ inject_xtra.formatType = eQMI_LOC_PREDICTED_ORBITS_XTRA_V02;
+ inject_xtra.totalSize = length;
+
+ total_parts = ((length - 1) / QMI_LOC_MAX_PREDICTED_ORBITS_PART_LEN_V02) + 1;
+
+ inject_xtra.totalParts = total_parts;
+
+ len_injected = 0; // O bytes injected
+
+ // XTRA injection starts with part 1
+ for (part = 1; part <= total_parts; part++)
+ {
+ inject_xtra.partNum = part;
+
+ if (QMI_LOC_MAX_PREDICTED_ORBITS_PART_LEN_V02 > (length - len_injected))
+ {
+ inject_xtra.partData_len = length - len_injected;
+ }
+ else
+ {
+ inject_xtra.partData_len = QMI_LOC_MAX_PREDICTED_ORBITS_PART_LEN_V02;
+ }
+
+ // copy data into the message
+ memcpy(inject_xtra.partData, data+len_injected, inject_xtra.partData_len);
+
+ LOC_LOGD("[%s:%d] part %d/%d, len = %d, total injected = %d\n",
+ __func__, __LINE__,
+ inject_xtra.partNum, total_parts, inject_xtra.partData_len,
+ len_injected);
+
+ memset(&inject_xtra_ind, 0, sizeof(inject_xtra_ind));
+ status = locSyncSendReq(QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02,
+ &inject_xtra_ind);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != inject_xtra_ind.status ||
+ inject_xtra.partNum != inject_xtra_ind.partNum)
+ {
+ LOC_LOGE ("%s:%d]: failed status = %s, inject_pos_ind.status = %s,"
+ " part num = %d, ind.partNum = %d\n", __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(inject_xtra_ind.status),
+ inject_xtra.partNum, inject_xtra_ind.partNum);
+ } else {
+ len_injected += inject_xtra.partData_len;
+ LOC_LOGD("%s:%d]: XTRA injected length: %d\n", __func__, __LINE__,
+ len_injected);
+ }
+ }
+
+ return convertErr(status);
+}
+
+/* Request the Xtra Server Url from the modem */
+enum loc_api_adapter_err LocApiV02 :: requestXtraServer()
+{
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+
+ locClientReqUnionType req_union;
+ qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02 request_xtra_server_ind;
+
+ memset(&request_xtra_server_ind, 0, sizeof(request_xtra_server_ind));
+
+ status = locSyncSendReq(QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_IND_V02,
+ &request_xtra_server_ind);
+
+ if (status == eLOC_CLIENT_SUCCESS &&
+ eQMI_LOC_SUCCESS_V02 == request_xtra_server_ind.status &&
+ false != request_xtra_server_ind.serverList_valid &&
+ 0 != request_xtra_server_ind.serverList.serverList_len)
+ {
+ if (request_xtra_server_ind.serverList.serverList_len == 1)
+ {
+ reportXtraServer(request_xtra_server_ind.serverList.serverList[0].serverUrl,
+ "",
+ "",
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02);
+ }
+ else if (request_xtra_server_ind.serverList.serverList_len == 2)
+ {
+ reportXtraServer(request_xtra_server_ind.serverList.serverList[0].serverUrl,
+ request_xtra_server_ind.serverList.serverList[1].serverUrl,
+ "",
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02);
+ }
+ else
+ {
+ reportXtraServer(request_xtra_server_ind.serverList.serverList[0].serverUrl,
+ request_xtra_server_ind.serverList.serverList[1].serverUrl,
+ request_xtra_server_ind.serverList.serverList[2].serverUrl,
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02);
+ }
+ }
+
+ return convertErr(status);
+}
+
+void LocApiV02 :: atlOpenStatus(
+ int handle, int is_succ, char* apn, uint32_t apnLen, AGpsBearerType bear,
+ LocAGpsType /*agpsType*/, LocApnTypeMask apnTypeMask)
+{
+ sendMsg(new LocApiMsg([this, handle, is_succ,
+ apnStr=std::string(apn, apnLen),
+ bear, apnTypeMask] () {
+
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ qmiLocInformLocationServerConnStatusReqMsgT_v02 conn_status_req;
+ qmiLocInformLocationServerConnStatusIndMsgT_v02 conn_status_ind;
+
+ LOC_LOGd("ATL open handle = %d, is_succ = %d, APN = [%s], bearer = %d, "
+ "apnTypeMask 0x%X" PRIx32, handle, is_succ, apnStr.c_str(),
+ bear, apnTypeMask);
+
+ memset(&conn_status_req, 0, sizeof(conn_status_req));
+ memset(&conn_status_ind, 0, sizeof(conn_status_ind));
+
+ // Fill in data
+ conn_status_req.connHandle = handle;
+
+ conn_status_req.requestType = eQMI_LOC_SERVER_REQUEST_OPEN_V02;
+
+ if(is_succ)
+ {
+ conn_status_req.statusType = eQMI_LOC_SERVER_REQ_STATUS_SUCCESS_V02;
+
+ if(!apnStr.empty()) {
+ strlcpy(conn_status_req.apnProfile.apnName, apnStr.c_str(),
+ sizeof(conn_status_req.apnProfile.apnName) );
+ }
+
+ switch(bear)
+ {
+ case AGPS_APN_BEARER_IPV4:
+ conn_status_req.apnProfile.pdnType =
+ eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4_V02;
+ conn_status_req.apnProfile_valid = 1;
+ break;
+
+ case AGPS_APN_BEARER_IPV6:
+ conn_status_req.apnProfile.pdnType =
+ eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV6_V02;
+ conn_status_req.apnProfile_valid = 1;
+ break;
+
+ case AGPS_APN_BEARER_IPV4V6:
+ conn_status_req.apnProfile.pdnType =
+ eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4V6_V02;
+ conn_status_req.apnProfile_valid = 1;
+ break;
+
+ case AGPS_APN_BEARER_INVALID:
+ conn_status_req.apnProfile_valid = 0;
+ break;
+
+ default:
+ LOC_LOGE("%s:%d]:invalid bearer type\n",__func__,__LINE__);
+ conn_status_req.apnProfile_valid = 0;
+ return;
+ }
+
+ // Populate apnTypeMask
+ if (0 != apnTypeMask) {
+ conn_status_req.apnTypeMask_valid = true;
+ conn_status_req.apnTypeMask = convertLocApnTypeMask(apnTypeMask);
+ }
+
+ }
+ else
+ {
+ conn_status_req.statusType = eQMI_LOC_SERVER_REQ_STATUS_FAILURE_V02;
+ }
+
+ req_union.pInformLocationServerConnStatusReq = &conn_status_req;
+
+ result = locSyncSendReq(QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02,
+ &conn_status_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != conn_status_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(conn_status_ind.status));
+ }
+
+ }));
+}
+
+
+/* close atl connection */
+void LocApiV02 :: atlCloseStatus(int handle, int is_succ)
+{
+ sendMsg(new LocApiMsg([this, handle, is_succ] () {
+
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ qmiLocInformLocationServerConnStatusReqMsgT_v02 conn_status_req;
+ qmiLocInformLocationServerConnStatusIndMsgT_v02 conn_status_ind;
+
+ LOC_LOGD("%s:%d]: ATL close handle = %d, is_succ = %d\n",
+ __func__, __LINE__, handle, is_succ);
+
+ memset(&conn_status_req, 0, sizeof(conn_status_req));
+ memset(&conn_status_ind, 0, sizeof(conn_status_ind));
+
+ // Fill in data
+ conn_status_req.connHandle = handle;
+
+ conn_status_req.requestType = eQMI_LOC_SERVER_REQUEST_CLOSE_V02;
+
+ if(is_succ)
+ {
+ conn_status_req.statusType = eQMI_LOC_SERVER_REQ_STATUS_SUCCESS_V02;
+ }
+ else
+ {
+ conn_status_req.statusType = eQMI_LOC_SERVER_REQ_STATUS_FAILURE_V02;
+ }
+
+ req_union.pInformLocationServerConnStatusReq = &conn_status_req;
+
+ result = locSyncSendReq(QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02,
+ &conn_status_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != conn_status_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(conn_status_ind.status));
+ }
+ }));
+}
+
+/* set the SUPL version */
+LocationError
+LocApiV02::setSUPLVersionSync(GnssConfigSuplVersion version)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+
+ qmiLocSetProtocolConfigParametersReqMsgT_v02 supl_config_req;
+ qmiLocSetProtocolConfigParametersIndMsgT_v02 supl_config_ind;
+
+ LOC_LOGD("%s:%d]: supl version = %d\n", __func__, __LINE__, version);
+
+
+ memset(&supl_config_req, 0, sizeof(supl_config_req));
+ memset(&supl_config_ind, 0, sizeof(supl_config_ind));
+
+ supl_config_req.suplVersion_valid = 1;
+
+ switch (version) {
+ case GNSS_CONFIG_SUPL_VERSION_2_0_4:
+ supl_config_req.suplVersion = eQMI_LOC_SUPL_VERSION_2_0_4_V02;
+ break;
+ case GNSS_CONFIG_SUPL_VERSION_2_0_2:
+ supl_config_req.suplVersion = eQMI_LOC_SUPL_VERSION_2_0_2_V02;
+ break;
+ case GNSS_CONFIG_SUPL_VERSION_2_0_0:
+ supl_config_req.suplVersion = eQMI_LOC_SUPL_VERSION_2_0_V02;
+ break;
+ case GNSS_CONFIG_SUPL_VERSION_1_0_0:
+ default:
+ supl_config_req.suplVersion = eQMI_LOC_SUPL_VERSION_1_0_V02;
+ break;
+ }
+
+ req_union.pSetProtocolConfigParametersReq = &supl_config_req;
+
+ result = locSyncSendReq(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ &supl_config_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != supl_config_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(supl_config_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+/* set the NMEA types mask */
+enum loc_api_adapter_err LocApiV02 :: setNMEATypesSync(uint32_t typesMask)
+{
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+
+ qmiLocSetNmeaTypesReqMsgT_v02 setNmeaTypesReqMsg;
+ qmiLocSetNmeaTypesIndMsgT_v02 setNmeaTypesIndMsg;
+
+ LOC_LOGD(" %s:%d]: setNMEATypes, mask = 0x%X", __func__, __LINE__, typesMask);
+
+ if (typesMask != mNmeaMask) {
+ memset(&setNmeaTypesReqMsg, 0, sizeof(setNmeaTypesReqMsg));
+ memset(&setNmeaTypesIndMsg, 0, sizeof(setNmeaTypesIndMsg));
+
+ setNmeaTypesReqMsg.nmeaSentenceType = typesMask;
+
+ req_union.pSetNmeaTypesReq = &setNmeaTypesReqMsg;
+
+ LOC_LOGD(" %s:%d]: Setting mask = 0x%X", __func__, __LINE__, typesMask);
+ result = locSyncSendReq(QMI_LOC_SET_NMEA_TYPES_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_NMEA_TYPES_IND_V02,
+ &setNmeaTypesIndMsg);
+
+ // if success
+ if (result != eLOC_CLIENT_SUCCESS)
+ {
+ LOC_LOGE("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(setNmeaTypesIndMsg.status));
+ }
+ mNmeaMask = typesMask;
+ }
+
+ return convertErr(result);
+}
+
+/* set the configuration for LTE positioning profile (LPP) */
+LocationError
+LocApiV02::setLPPConfigSync(GnssConfigLppProfile profile)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ qmiLocSetProtocolConfigParametersReqMsgT_v02 lpp_config_req;
+ qmiLocSetProtocolConfigParametersIndMsgT_v02 lpp_config_ind;
+
+ LOC_LOGD("%s:%d]: lpp profile = %u", __func__, __LINE__, profile);
+
+ memset(&lpp_config_req, 0, sizeof(lpp_config_req));
+ memset(&lpp_config_ind, 0, sizeof(lpp_config_ind));
+
+ lpp_config_req.lppConfig_valid = 1;
+ switch (profile) {
+ case GNSS_CONFIG_LPP_PROFILE_USER_PLANE:
+ lpp_config_req.lppConfig = QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE_V02;
+ break;
+ case GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE:
+ lpp_config_req.lppConfig = QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE_V02;
+ break;
+ case GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE:
+ lpp_config_req.lppConfig = QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE_V02 |
+ QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE_V02;
+ break;
+ case GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE:
+ default:
+ lpp_config_req.lppConfig = 0;
+ break;
+ }
+
+ req_union.pSetProtocolConfigParametersReq = &lpp_config_req;
+
+ result = locSyncSendReq(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ &lpp_config_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != lpp_config_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(lpp_config_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+
+/* set the Sensor Properties */
+enum loc_api_adapter_err LocApiV02 :: setSensorPropertiesSync(
+ bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
+ bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
+ bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
+ bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
+ bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk)
+{
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+
+ qmiLocSetSensorPropertiesReqMsgT_v02 sensor_prop_req;
+ qmiLocSetSensorPropertiesIndMsgT_v02 sensor_prop_ind;
+
+ LOC_LOGI("%s:%d]: sensors prop: gyroBiasRandomWalk = %f, accelRandomWalk = %f, "
+ "angleRandomWalk = %f, rateRandomWalk = %f, velocityRandomWalk = %f\n",
+ __func__, __LINE__, gyroBiasVarianceRandomWalk, accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk, rateBiasVarianceRandomWalk, velocityBiasVarianceRandomWalk);
+
+ memset(&sensor_prop_req, 0, sizeof(sensor_prop_req));
+ memset(&sensor_prop_ind, 0, sizeof(sensor_prop_ind));
+
+ /* Set the validity bit and value for each sensor property */
+ sensor_prop_req.gyroBiasVarianceRandomWalk_valid = gyroBiasVarianceRandomWalk_valid;
+ sensor_prop_req.gyroBiasVarianceRandomWalk = gyroBiasVarianceRandomWalk;
+
+ sensor_prop_req.accelerationRandomWalkSpectralDensity_valid = accelBiasVarianceRandomWalk_valid;
+ sensor_prop_req.accelerationRandomWalkSpectralDensity = accelBiasVarianceRandomWalk;
+
+ sensor_prop_req.angleRandomWalkSpectralDensity_valid = angleBiasVarianceRandomWalk_valid;
+ sensor_prop_req.angleRandomWalkSpectralDensity = angleBiasVarianceRandomWalk;
+
+ sensor_prop_req.rateRandomWalkSpectralDensity_valid = rateBiasVarianceRandomWalk_valid;
+ sensor_prop_req.rateRandomWalkSpectralDensity = rateBiasVarianceRandomWalk;
+
+ sensor_prop_req.velocityRandomWalkSpectralDensity_valid = velocityBiasVarianceRandomWalk_valid;
+ sensor_prop_req.velocityRandomWalkSpectralDensity = velocityBiasVarianceRandomWalk;
+
+ req_union.pSetSensorPropertiesReq = &sensor_prop_req;
+
+ result = locSyncSendReq(QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_SENSOR_PROPERTIES_IND_V02,
+ &sensor_prop_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != sensor_prop_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(sensor_prop_ind.status));
+ }
+
+ return convertErr(result);
+}
+
+/* set the Sensor Performance Config */
+enum loc_api_adapter_err LocApiV02 :: setSensorPerfControlConfigSync(int controlMode,
+ int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh,
+ int algorithmConfig)
+{
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+
+ qmiLocSetSensorPerformanceControlConfigReqMsgT_v02 sensor_perf_config_req;
+ qmiLocSetSensorPerformanceControlConfigIndMsgT_v02 sensor_perf_config_ind;
+
+ LOC_LOGD("%s:%d]: Sensor Perf Control Config (performanceControlMode)(%u) "
+ "accel(#smp,#batches) (%u,%u) gyro(#smp,#batches) (%u,%u) "
+ "accel_high(#smp,#batches) (%u,%u) gyro_high(#smp,#batches) (%u,%u) "
+ "algorithmConfig(%u)\n",
+ __FUNCTION__,
+ __LINE__,
+ controlMode,
+ accelSamplesPerBatch,
+ accelBatchesPerSec,
+ gyroSamplesPerBatch,
+ gyroBatchesPerSec,
+ accelSamplesPerBatchHigh,
+ accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh,
+ gyroBatchesPerSecHigh,
+ algorithmConfig
+ );
+
+ memset(&sensor_perf_config_req, 0, sizeof(sensor_perf_config_req));
+ memset(&sensor_perf_config_ind, 0, sizeof(sensor_perf_config_ind));
+
+ sensor_perf_config_req.performanceControlMode_valid = (controlMode == 2) ? 0 : 1;
+ sensor_perf_config_req.performanceControlMode = (qmiLocSensorPerformanceControlModeEnumT_v02)controlMode;
+ sensor_perf_config_req.accelSamplingSpec_valid = 1;
+ sensor_perf_config_req.accelSamplingSpec.batchesPerSecond = accelBatchesPerSec;
+ sensor_perf_config_req.accelSamplingSpec.samplesPerBatch = accelSamplesPerBatch;
+ sensor_perf_config_req.gyroSamplingSpec_valid = 1;
+ sensor_perf_config_req.gyroSamplingSpec.batchesPerSecond = gyroBatchesPerSec;
+ sensor_perf_config_req.gyroSamplingSpec.samplesPerBatch = gyroSamplesPerBatch;
+ sensor_perf_config_req.accelSamplingSpecHigh_valid = 1;
+ sensor_perf_config_req.accelSamplingSpecHigh.batchesPerSecond = accelBatchesPerSecHigh;
+ sensor_perf_config_req.accelSamplingSpecHigh.samplesPerBatch = accelSamplesPerBatchHigh;
+ sensor_perf_config_req.gyroSamplingSpecHigh_valid = 1;
+ sensor_perf_config_req.gyroSamplingSpecHigh.batchesPerSecond = gyroBatchesPerSecHigh;
+ sensor_perf_config_req.gyroSamplingSpecHigh.samplesPerBatch = gyroSamplesPerBatchHigh;
+ sensor_perf_config_req.algorithmConfig_valid = 1;
+ sensor_perf_config_req.algorithmConfig = algorithmConfig;
+
+ req_union.pSetSensorPerformanceControlConfigReq = &sensor_perf_config_req;
+
+ result = locSyncSendReq(QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02,
+ &sensor_perf_config_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != sensor_perf_config_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(sensor_perf_config_ind.status));
+ }
+
+ return convertErr(result);
+}
+
+/* set the Positioning Protocol on A-GLONASS system */
+LocationError
+LocApiV02::setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ qmiLocSetProtocolConfigParametersReqMsgT_v02 aGlonassProtocol_req;
+ qmiLocSetProtocolConfigParametersIndMsgT_v02 aGlonassProtocol_ind;
+
+ memset(&aGlonassProtocol_req, 0, sizeof(aGlonassProtocol_req));
+ memset(&aGlonassProtocol_ind, 0, sizeof(aGlonassProtocol_ind));
+
+ aGlonassProtocol_req.assistedGlonassProtocolMask_valid = 1;
+ if (GNSS_CONFIG_RRC_CONTROL_PLANE_BIT & aGlonassProtocol) {
+ aGlonassProtocol_req.assistedGlonassProtocolMask |=
+ QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRC_CP_V02 ;
+ }
+ if (GNSS_CONFIG_RRLP_USER_PLANE_BIT & aGlonassProtocol) {
+ aGlonassProtocol_req.assistedGlonassProtocolMask |=
+ QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRLP_UP_V02;
+ }
+ if (GNSS_CONFIG_LLP_USER_PLANE_BIT & aGlonassProtocol) {
+ aGlonassProtocol_req.assistedGlonassProtocolMask |=
+ QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_UP_V02;
+ }
+ if (GNSS_CONFIG_LLP_CONTROL_PLANE_BIT & aGlonassProtocol) {
+ aGlonassProtocol_req.assistedGlonassProtocolMask |=
+ QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_CP_V02;
+ }
+
+ req_union.pSetProtocolConfigParametersReq = &aGlonassProtocol_req;
+
+ LOC_LOGD("%s:%d]: aGlonassProtocolMask = 0x%x", __func__, __LINE__,
+ aGlonassProtocol_req.assistedGlonassProtocolMask);
+
+ result = locSyncSendReq(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ &aGlonassProtocol_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != aGlonassProtocol_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(aGlonassProtocol_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+LocationError
+LocApiV02::setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ qmiLocSetProtocolConfigParametersReqMsgT_v02 lppe_req;
+ qmiLocSetProtocolConfigParametersIndMsgT_v02 lppe_ind;
+
+ memset(&lppe_req, 0, sizeof(lppe_req));
+ memset(&lppe_ind, 0, sizeof(lppe_ind));
+
+ lppe_req.lppeCpConfig_valid = 1;
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT & lppeCP) {
+ lppe_req.lppeCpConfig |= QMI_LOC_LPPE_MASK_CP_DBH_V02;
+ }
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT & lppeCP) {
+ lppe_req.lppeCpConfig |= QMI_LOC_LPPE_MASK_CP_AP_WIFI_MEASUREMENT_V02;
+ }
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT & lppeCP) {
+ lppe_req.lppeCpConfig |= QMI_LOC_LPPE_MASK_CP_AP_SRN_BTLE_MEASUREMENT_V02;
+ }
+ if (GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT & lppeCP) {
+ lppe_req.lppeCpConfig |= QMI_LOC_LPPE_MASK_CP_UBP_V02;
+ }
+
+ req_union.pSetProtocolConfigParametersReq = &lppe_req;
+
+ LOC_LOGD("%s:%d]: lppeCpConfig = 0x%" PRIx64, __func__, __LINE__,
+ lppe_req.lppeCpConfig);
+
+ result = locSyncSendReq(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ &lppe_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != lppe_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(lppe_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+LocationError
+LocApiV02::setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ qmiLocSetProtocolConfigParametersReqMsgT_v02 lppe_req;
+ qmiLocSetProtocolConfigParametersIndMsgT_v02 lppe_ind;
+
+ memset(&lppe_req, 0, sizeof(lppe_req));
+ memset(&lppe_ind, 0, sizeof(lppe_ind));
+ memset(&req_union, 0, sizeof(req_union));
+
+ lppe_req.lppeUpConfig_valid = 1;
+ if (GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT & lppeUP) {
+ lppe_req.lppeUpConfig |= QMI_LOC_LPPE_MASK_UP_DBH_V02;
+ }
+ if (GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT & lppeUP) {
+ lppe_req.lppeUpConfig |= QMI_LOC_LPPE_MASK_UP_AP_WIFI_MEASUREMENT_V02;
+ }
+ if (GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT & lppeUP) {
+ lppe_req.lppeUpConfig |= QMI_LOC_LPPE_MASK_UP_AP_SRN_BTLE_MEASUREMENT_V02;
+ }
+ if (GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT & lppeUP) {
+ lppe_req.lppeUpConfig |= QMI_LOC_LPPE_MASK_UP_UBP_V02;
+ }
+
+ req_union.pSetProtocolConfigParametersReq = &lppe_req;
+
+ LOC_LOGD("%s:%d]: lppeUpConfig = 0x%" PRIx64, __func__, __LINE__,
+ lppe_req.lppeUpConfig);
+
+ result = locSyncSendReq(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ &lppe_ind);
+
+ if(result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != lppe_ind.status)
+ {
+ LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(lppe_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+/* Convert event mask from loc eng to loc_api_v02 format */
+locClientEventMaskType LocApiV02 :: convertMask(
+ LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ locClientEventMaskType eventMask = 0;
+ LOC_LOGd("adapter mask = 0x%" PRIx64, mask);
+
+ if (mask & LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT)
+ eventMask |= QMI_LOC_EVENT_MASK_POSITION_REPORT_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT)
+ eventMask |= QMI_LOC_EVENT_MASK_UNPROPAGATED_POSITION_REPORT_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_SATELLITE_REPORT)
+ eventMask |= QMI_LOC_EVENT_MASK_GNSS_SV_INFO_V02;
+
+ /* treat NMEA_1Hz and NMEA_POSITION_REPORT the same*/
+ if ((mask & LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT) ||
+ (mask & LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT) ) {
+ eventMask |= QMI_LOC_EVENT_MASK_NMEA_V02;
+ // if registering for NMEA event, also register for ENGINE STATE event so that we can
+ // register for NMEA event when Engine turns ON and deregister when Engine turns OFF
+ eventMask |= QMI_LOC_EVENT_MASK_ENGINE_STATE_V02;
+ }
+
+ if (mask & LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST)
+ eventMask |= QMI_LOC_EVENT_MASK_NI_NOTIFY_VERIFY_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST)
+ {
+ eventMask |= QMI_LOC_EVENT_MASK_INJECT_PREDICTED_ORBITS_REQ_V02;
+ eventMask |= QMI_LOC_EVENT_MASK_INJECT_TIME_REQ_V02;
+ }
+
+ if (mask & LOC_API_ADAPTER_BIT_POSITION_INJECTION_REQUEST)
+ eventMask |= QMI_LOC_EVENT_MASK_INJECT_POSITION_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_STATUS_REPORT)
+ {
+ eventMask |= (QMI_LOC_EVENT_MASK_ENGINE_STATE_V02);
+ }
+
+ if (mask & LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST)
+ eventMask |= QMI_LOC_EVENT_MASK_LOCATION_SERVER_CONNECTION_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_REQUEST_WIFI)
+ eventMask |= QMI_LOC_EVENT_MASK_WIFI_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_SENSOR_STATUS)
+ eventMask |= QMI_LOC_EVENT_MASK_SENSOR_STREAMING_READY_STATUS_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC)
+ eventMask |= QMI_LOC_EVENT_MASK_TIME_SYNC_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_REPORT_SPI)
+ eventMask |= QMI_LOC_EVENT_MASK_SET_SPI_STREAMING_REPORT_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE)
+ eventMask |= QMI_LOC_EVENT_MASK_NI_GEOFENCE_NOTIFICATION_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT)
+ eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_GEN_ALERT_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH)
+ eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT) {
+ if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH)) {
+ eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_BREACH_NOTIFICATION_V02;
+ } else {
+ eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION_V02;
+ }
+ }
+
+ if (mask & LOC_API_ADAPTER_BIT_PEDOMETER_CTRL)
+ eventMask |= QMI_LOC_EVENT_MASK_PEDOMETER_CONTROL_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL)
+ eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_DWELL_NOTIFICATION_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_MOTION_CTRL)
+ eventMask |= QMI_LOC_EVENT_MASK_MOTION_DATA_CONTROL_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA)
+ eventMask |= QMI_LOC_EVENT_MASK_INJECT_WIFI_AP_DATA_REQ_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_BATCH_FULL)
+ eventMask |= QMI_LOC_EVENT_MASK_BATCH_FULL_NOTIFICATION_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_BATCH_STATUS)
+ eventMask |= QMI_LOC_EVENT_MASK_BATCHING_STATUS_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT)
+ eventMask |= QMI_LOC_EVENT_MASK_LIVE_BATCHED_POSITION_REPORT_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT)
+ eventMask |= QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT)
+ eventMask |= QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT)
+ eventMask |= QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02;
+
+ // for GDT
+ if(mask & LOC_API_ADAPTER_BIT_GDT_UPLOAD_BEGIN_REQ)
+ eventMask |= QMI_LOC_EVENT_MASK_GDT_UPLOAD_BEGIN_REQ_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ)
+ eventMask |= QMI_LOC_EVENT_MASK_GDT_UPLOAD_END_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT)
+ eventMask |= QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_REQUEST_TIMEZONE)
+ eventMask |= QMI_LOC_EVENT_MASK_GET_TIME_ZONE_REQ_V02;
+
+ if(mask & LOC_API_ADAPTER_BIT_REQUEST_SRN_DATA)
+ eventMask |= QMI_LOC_EVENT_MASK_INJECT_SRN_AP_DATA_REQ_V02 ;
+
+ if (mask & LOC_API_ADAPTER_BIT_FDCL_SERVICE_REQ)
+ eventMask |= QMI_LOC_EVENT_MASK_FDCL_SERVICE_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_BS_OBS_DATA_SERVICE_REQ)
+ eventMask |= QMI_LOC_EVENT_MASK_BS_OBS_DATA_SERVICE_REQ_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO)
+ eventMask |= QMI_LOC_EVENT_MASK_NEXT_LS_INFO_REPORT_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO)
+ eventMask |= QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT_V02;
+
+ if (mask & LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT) {
+ eventMask |= QMI_LOC_EVENT_MASK_GNSS_NHZ_MEASUREMENT_REPORT_V02;
+ }
+
+ return eventMask;
+}
+
+qmiLocLockEnumT_v02 LocApiV02 ::convertGpsLockFromAPItoQMI(GnssConfigGpsLock lock)
+{
+ switch (lock)
+ {
+ case GNSS_CONFIG_GPS_LOCK_MO_AND_NI:
+ return eQMI_LOC_LOCK_ALL_V02;
+ case GNSS_CONFIG_GPS_LOCK_MO:
+ return eQMI_LOC_LOCK_MI_V02;
+ case GNSS_CONFIG_GPS_LOCK_NI:
+ return eQMI_LOC_LOCK_MT_V02;
+ case GNSS_CONFIG_GPS_LOCK_NONE:
+ default:
+ return eQMI_LOC_LOCK_NONE_V02;
+ }
+}
+
+GnssConfigGpsLock LocApiV02::convertGpsLockFromQMItoAPI(qmiLocLockEnumT_v02 lock)
+{
+ switch (lock) {
+ case eQMI_LOC_LOCK_MI_V02:
+ return GNSS_CONFIG_GPS_LOCK_MO;
+ case eQMI_LOC_LOCK_MT_V02:
+ return GNSS_CONFIG_GPS_LOCK_NI;
+ case eQMI_LOC_LOCK_ALL_V02:
+ return GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
+ case eQMI_LOC_LOCK_NONE_V02:
+ default:
+ return GNSS_CONFIG_GPS_LOCK_NONE;
+ }
+}
+
+/* Convert error from loc_api_v02 to loc eng format*/
+enum loc_api_adapter_err LocApiV02 :: convertErr(
+ locClientStatusEnumType status)
+{
+ switch( status)
+ {
+ case eLOC_CLIENT_SUCCESS:
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+
+ case eLOC_CLIENT_FAILURE_GENERAL:
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+
+ case eLOC_CLIENT_FAILURE_UNSUPPORTED:
+ return LOC_API_ADAPTER_ERR_UNSUPPORTED;
+
+ case eLOC_CLIENT_FAILURE_INVALID_PARAMETER:
+ return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
+
+ case eLOC_CLIENT_FAILURE_ENGINE_BUSY:
+ return LOC_API_ADAPTER_ERR_ENGINE_BUSY;
+
+ case eLOC_CLIENT_FAILURE_PHONE_OFFLINE:
+ return LOC_API_ADAPTER_ERR_PHONE_OFFLINE;
+
+ case eLOC_CLIENT_FAILURE_TIMEOUT:
+ return LOC_API_ADAPTER_ERR_TIMEOUT;
+
+ case eLOC_CLIENT_FAILURE_INVALID_HANDLE:
+ return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+
+ case eLOC_CLIENT_FAILURE_SERVICE_NOT_PRESENT:
+ return LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT;
+
+ case eLOC_CLIENT_FAILURE_INTERNAL:
+ return LOC_API_ADAPTER_ERR_INTERNAL;
+
+ default:
+ return LOC_API_ADAPTER_ERR_FAILURE;
+ }
+}
+
+/* convert position report to loc eng format and send the converted
+ position to loc eng */
+
+void LocApiV02 :: reportPosition (
+ const qmiLocEventPositionReportIndMsgT_v02 *location_report_ptr,
+ bool unpropagatedPosition)
+{
+ UlpLocation location;
+ LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
+ LOC_LOGD("Reporting position from V2 Adapter\n");
+ memset(&location, 0, sizeof (UlpLocation));
+ location.size = sizeof(location);
+ location.unpropagatedPosition = unpropagatedPosition;
+ GnssDataNotification dataNotify = {};
+ int msInWeek = -1;
+
+ GpsLocationExtended locationExtended;
+ memset(&locationExtended, 0, sizeof (GpsLocationExtended));
+ locationExtended.size = sizeof(locationExtended);
+
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE;
+ locationExtended.locOutputEngType = LOC_OUTPUT_ENGINE_SPE;
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK;
+ locationExtended.locOutputEngMask = STANDARD_POSITIONING_ENGINE;
+
+ struct timespec apTimestamp;
+ if( clock_gettime( CLOCK_BOOTTIME, &apTimestamp)== 0)
+ {
+ locationExtended.timeStamp.apTimeStamp.tv_sec = apTimestamp.tv_sec;
+ locationExtended.timeStamp.apTimeStamp.tv_nsec = apTimestamp.tv_nsec;
+ locationExtended.timeStamp.apTimeStampUncertaintyMs = (float)ap_timestamp_uncertainty;
+ }
+ else
+ {
+ locationExtended.timeStamp.apTimeStampUncertaintyMs = FLT_MAX;
+ LOC_LOGE("%s:%d Error in clock_gettime() ",__func__, __LINE__);
+ }
+ LOC_LOGd("QMI_PosPacketTime %" PRIu32 "(sec) %" PRIu32 "(nsec), QMI_spoofReportMask %" PRIu64,
+ locationExtended.timeStamp.apTimeStamp.tv_sec,
+ locationExtended.timeStamp.apTimeStamp.tv_nsec,
+ location_report_ptr->spoofReportMask);
+
+ // Process the position from final and intermediate reports
+ memset(&dataNotify, 0, sizeof(dataNotify));
+ msInWeek = (int)location_report_ptr->gpsTime.gpsTimeOfWeekMs;
+
+ if (location_report_ptr->jammerIndicatorList_valid) {
+ LOC_LOGV("%s:%d jammerIndicator is present len=%d",
+ __func__, __LINE__,
+ location_report_ptr->jammerIndicatorList_len);
+ for (uint32_t i = 1; i < location_report_ptr->jammerIndicatorList_len; i++) {
+ dataNotify.gnssDataMask[i-1] = 0;
+ dataNotify.agc[i-1] = 0.0;
+ dataNotify.jammerInd[i-1] = 0.0;
+ if (GNSS_INVALID_JAMMER_IND !=
+ location_report_ptr->jammerIndicatorList[i].agcMetricDb) {
+ LOC_LOGv("agcMetricDb[%d]=0x%X",
+ i, location_report_ptr->jammerIndicatorList[i].agcMetricDb);
+ dataNotify.gnssDataMask[i-1] |= GNSS_LOC_DATA_AGC_BIT;
+ dataNotify.agc[i-1] =
+ (double)location_report_ptr->jammerIndicatorList[i].agcMetricDb / 100.0;
+ msInWeek = -1;
+ }
+ if (GNSS_INVALID_JAMMER_IND !=
+ location_report_ptr->jammerIndicatorList[i].bpMetricDb) {
+ LOC_LOGv("bpMetricDb[%d]=0x%X",
+ i, location_report_ptr->jammerIndicatorList[i].bpMetricDb);
+ dataNotify.gnssDataMask[i-1] |= GNSS_LOC_DATA_JAMMER_IND_BIT;
+ dataNotify.jammerInd[i-1] =
+ (double)location_report_ptr->jammerIndicatorList[i].bpMetricDb / 100.0;
+ msInWeek = -1;
+ }
+ }
+ } else {
+ LOC_LOGd("jammerIndicator is not present");
+ }
+
+ if ((location_report_ptr->sessionStatus == eQMI_LOC_SESS_STATUS_SUCCESS_V02) ||
+ (location_report_ptr->sessionStatus == eQMI_LOC_SESS_STATUS_IN_PROGRESS_V02)
+ )
+ {
+ // Latitude & Longitude
+ if ((1 == location_report_ptr->latitude_valid) &&
+ (1 == location_report_ptr->longitude_valid))
+ {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_LAT_LONG;
+ location.gpsLocation.latitude = location_report_ptr->latitude;
+ location.gpsLocation.longitude = location_report_ptr->longitude;
+ } else {
+ LocApiBase::reportData(dataNotify, msInWeek);
+ }
+
+ // Time stamp (UTC)
+ if (location_report_ptr->timestampUtc_valid == 1)
+ {
+ location.gpsLocation.timestamp = location_report_ptr->timestampUtc;
+ }
+
+ // Altitude
+ if (location_report_ptr->altitudeWrtEllipsoid_valid == 1 )
+ {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_ALTITUDE;
+ location.gpsLocation.altitude = location_report_ptr->altitudeWrtEllipsoid;
+ }
+
+ // Speed
+ if (location_report_ptr->speedHorizontal_valid == 1)
+ {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_SPEED;
+ location.gpsLocation.speed = location_report_ptr->speedHorizontal;
+ }
+
+ // Heading
+ if (location_report_ptr->heading_valid == 1)
+ {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_BEARING;
+ location.gpsLocation.bearing = location_report_ptr->heading;
+ }
+
+ // Uncertainty (circular)
+ if (location_report_ptr->horUncCircular_valid) {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy = location_report_ptr->horUncCircular;
+ } else if (location_report_ptr->horUncEllipseSemiMinor_valid &&
+ location_report_ptr->horUncEllipseSemiMajor_valid) {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy =
+ sqrt((location_report_ptr->horUncEllipseSemiMinor *
+ location_report_ptr->horUncEllipseSemiMinor) +
+ (location_report_ptr->horUncEllipseSemiMajor *
+ location_report_ptr->horUncEllipseSemiMajor));
+ }
+
+ // If horConfidence_valid is true, and horConfidence value is less than 68%
+ // then scale the accuracy value to 68% confidence.
+ if (location_report_ptr->horConfidence_valid)
+ {
+ bool is_CircUnc = (location_report_ptr->horUncCircular_valid) ?
+ true : false;
+ scaleAccuracyTo68PercentConfidence(location_report_ptr->horConfidence,
+ location.gpsLocation,
+ is_CircUnc);
+ }
+
+ // Technology Mask
+ tech_Mask |= location_report_ptr->technologyMask;
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK;
+ locationExtended.tech_mask = convertPosTechMask(location_report_ptr->technologyMask);
+
+ //Mark the location source as from GNSS
+ location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
+ location.position_source = ULP_LOCATION_IS_FROM_GNSS;
+
+ if (location_report_ptr->spoofReportMask_valid)
+ {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_SPOOF_MASK;
+ location.gpsLocation.spoof_mask = (uint32_t)location_report_ptr->spoofReportMask;
+ }
+
+ if (location_report_ptr->magneticDeviation_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
+ locationExtended.magneticDeviation = location_report_ptr->magneticDeviation;
+ }
+
+ if (location_report_ptr->DOP_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
+ locationExtended.pdop = location_report_ptr->DOP.PDOP;
+ locationExtended.hdop = location_report_ptr->DOP.HDOP;
+ locationExtended.vdop = location_report_ptr->DOP.VDOP;
+ }
+
+ if (location_report_ptr->conformityIndex_valid) {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_CONFORMITY_INDEX;
+ locationExtended.conformityIndex = location_report_ptr->conformityIndex;
+ }
+
+ if (location_report_ptr->altitudeWrtMeanSeaLevel_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
+ locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitudeWrtMeanSeaLevel;
+ }
+
+ if (location_report_ptr->vertUnc_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ locationExtended.vert_unc = location_report_ptr->vertUnc;
+ }
+
+ if (location_report_ptr->speedUnc_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ locationExtended.speed_unc = location_report_ptr->speedUnc;
+ }
+ if (location_report_ptr->headingUnc_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_BEARING_UNC;
+ locationExtended.bearing_unc = location_report_ptr->headingUnc;
+ }
+ if (location_report_ptr->horReliability_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY;
+ switch (location_report_ptr->horReliability)
+ {
+ case eQMI_LOC_RELIABILITY_NOT_SET_V02 :
+ locationExtended.horizontal_reliability = LOC_RELIABILITY_NOT_SET;
+ break;
+ case eQMI_LOC_RELIABILITY_VERY_LOW_V02 :
+ locationExtended.horizontal_reliability = LOC_RELIABILITY_VERY_LOW;
+ break;
+ case eQMI_LOC_RELIABILITY_LOW_V02 :
+ locationExtended.horizontal_reliability = LOC_RELIABILITY_LOW;
+ break;
+ case eQMI_LOC_RELIABILITY_MEDIUM_V02 :
+ locationExtended.horizontal_reliability = LOC_RELIABILITY_MEDIUM;
+ break;
+ case eQMI_LOC_RELIABILITY_HIGH_V02 :
+ locationExtended.horizontal_reliability = LOC_RELIABILITY_HIGH;
+ break;
+ default:
+ locationExtended.horizontal_reliability = LOC_RELIABILITY_NOT_SET;
+ break;
+ }
+ }
+ if (location_report_ptr->vertReliability_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY;
+ switch (location_report_ptr->vertReliability)
+ {
+ case eQMI_LOC_RELIABILITY_NOT_SET_V02 :
+ locationExtended.vertical_reliability = LOC_RELIABILITY_NOT_SET;
+ break;
+ case eQMI_LOC_RELIABILITY_VERY_LOW_V02 :
+ locationExtended.vertical_reliability = LOC_RELIABILITY_VERY_LOW;
+ break;
+ case eQMI_LOC_RELIABILITY_LOW_V02 :
+ locationExtended.vertical_reliability = LOC_RELIABILITY_LOW;
+ break;
+ case eQMI_LOC_RELIABILITY_MEDIUM_V02 :
+ locationExtended.vertical_reliability = LOC_RELIABILITY_MEDIUM;
+ break;
+ case eQMI_LOC_RELIABILITY_HIGH_V02 :
+ locationExtended.vertical_reliability = LOC_RELIABILITY_HIGH;
+ break;
+ default:
+ locationExtended.vertical_reliability = LOC_RELIABILITY_NOT_SET;
+ break;
+ }
+ }
+
+ if (location_report_ptr->horUncEllipseSemiMajor_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR;
+ locationExtended.horUncEllipseSemiMajor = location_report_ptr->horUncEllipseSemiMajor;
+ }
+ if (location_report_ptr->horUncEllipseSemiMinor_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR;
+ locationExtended.horUncEllipseSemiMinor = location_report_ptr->horUncEllipseSemiMinor;
+ }
+ if (location_report_ptr->horUncEllipseOrientAzimuth_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH;
+ locationExtended.horUncEllipseOrientAzimuth =
+ location_report_ptr->horUncEllipseOrientAzimuth;
+ }
+
+ // If the horizontal uncertainty ellipse info is available,
+ // calculate the horizontal uncertainty along north and east
+ if (location_report_ptr->horUncEllipseSemiMajor_valid &&
+ location_report_ptr->horUncEllipseSemiMinor_valid &&
+ location_report_ptr->horUncEllipseOrientAzimuth_valid)
+ {
+ double cosVal = cos((double)locationExtended.horUncEllipseOrientAzimuth);
+ double sinVal = sin((double)locationExtended.horUncEllipseOrientAzimuth);
+ double major = locationExtended.horUncEllipseSemiMajor;
+ double minor = locationExtended.horUncEllipseSemiMinor;
+
+ double northSquare = major*major * cosVal*cosVal + minor*minor * sinVal*sinVal;
+ double eastSquare = major*major * sinVal*sinVal + minor*minor * cosVal*cosVal;
+
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV;
+ locationExtended.northStdDeviation = sqrt(northSquare);
+
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV;
+ locationExtended.eastStdDeviation = sqrt(eastSquare);
+ }
+
+ if (((location_report_ptr->expandedGnssSvUsedList_valid) &&
+ (location_report_ptr->expandedGnssSvUsedList_len != 0)) ||
+ ((location_report_ptr->gnssSvUsedList_valid) &&
+ (location_report_ptr->gnssSvUsedList_len != 0)))
+ {
+ uint32_t idx=0;
+ uint32_t gnssSvUsedList_len = 0;
+ uint16_t gnssSvIdUsed = 0;
+ const uint16_t *svUsedList;
+ bool multiBandTypesAvailable = false;
+
+ if (location_report_ptr->expandedGnssSvUsedList_valid)
+ {
+ gnssSvUsedList_len = location_report_ptr->expandedGnssSvUsedList_len;
+ svUsedList = location_report_ptr->expandedGnssSvUsedList;
+ } else if (location_report_ptr->gnssSvUsedList_valid)
+ {
+ gnssSvUsedList_len = location_report_ptr->gnssSvUsedList_len;
+ svUsedList = location_report_ptr->gnssSvUsedList;
+ }
+
+ // If multifreq data is not available then default to L1 for all constellations.
+ if ((location_report_ptr->gnssSvUsedSignalTypeList_valid) &&
+ (location_report_ptr->gnssSvUsedSignalTypeList_len != 0)) {
+ multiBandTypesAvailable = true;
+ }
+
+ LOC_LOGv("sv length %d ", gnssSvUsedList_len);
+
+ locationExtended.numOfMeasReceived = gnssSvUsedList_len;
+ memset(locationExtended.measUsageInfo, 0, sizeof(locationExtended.measUsageInfo));
+ // Set of used_in_fix SV ID
+ bool reported = LocApiBase::needReport(location,
+ (eQMI_LOC_SESS_STATUS_IN_PROGRESS_V02 ==
+ location_report_ptr->sessionStatus ?
+ LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS),
+ tech_Mask);
+ if (reported) {
+ for (idx = 0; idx < gnssSvUsedList_len; idx++)
+ {
+ gnssSvIdUsed = svUsedList[idx];
+ locationExtended.measUsageInfo[idx].gnssSvId = gnssSvIdUsed;
+ locationExtended.measUsageInfo[idx].carrierPhaseAmbiguityType =
+ CARRIER_PHASE_AMBIGUITY_RESOLUTION_NONE;
+
+ qmiLocGnssSignalTypeMaskT_v02 qmiGnssSignalType =
+ location_report_ptr->gnssSvUsedSignalTypeList[idx];
+ GnssSignalTypeMask gnssSignalTypeMask =
+ convertQmiGnssSignalType(qmiGnssSignalType);
+ LOC_LOGd("sv id %d, qmi signal type: 0x%" PRIx64 ", hal signal type: 0x%x",
+ gnssSvIdUsed, qmiGnssSignalType, gnssSignalTypeMask);
+
+ if (gnssSvIdUsed <= GPS_SV_PRN_MAX)
+ {
+ uint64_t bit = (1ULL << (gnssSvIdUsed - GPS_SV_PRN_MIN));
+ locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask |= bit;
+ locationExtended.measUsageInfo[idx].gnssConstellation =
+ GNSS_LOC_SV_SYSTEM_GPS;
+ if (multiBandTypesAvailable) {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ gnssSignalTypeMask;
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GPS_L1CA) {
+ locationExtended.gnss_mb_sv_used_ids.gps_l1ca_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GPS_L1C) {
+ locationExtended.gnss_mb_sv_used_ids.gps_l1c_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GPS_L2) {
+ locationExtended.gnss_mb_sv_used_ids.gps_l2_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GPS_L5) {
+ locationExtended.gnss_mb_sv_used_ids.gps_l5_sv_used_ids_mask
+ |= bit;
+ }
+ } else {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ GNSS_SIGNAL_GPS_L1CA;
+ }
+ }
+ else if ((gnssSvIdUsed >= GLO_SV_PRN_MIN) &&
+ (gnssSvIdUsed <= GLO_SV_PRN_MAX))
+ {
+ uint64_t bit = (1ULL << (gnssSvIdUsed - GLO_SV_PRN_MIN));
+ locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask |= bit;
+ locationExtended.measUsageInfo[idx].gnssConstellation =
+ GNSS_LOC_SV_SYSTEM_GLONASS;
+ if (multiBandTypesAvailable) {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ gnssSignalTypeMask;
+
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GLONASS_G1) {
+ locationExtended.gnss_mb_sv_used_ids.glo_g1_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GLONASS_G2) {
+ locationExtended.gnss_mb_sv_used_ids.glo_g2_sv_used_ids_mask
+ |= bit;
+ }
+ } else {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ GNSS_SIGNAL_GLONASS_G1;
+ }
+
+ }
+ else if ((gnssSvIdUsed >= BDS_SV_PRN_MIN) &&
+ (gnssSvIdUsed <= BDS_SV_PRN_MAX))
+ {
+ uint64_t bit = (1ULL << (gnssSvIdUsed - BDS_SV_PRN_MIN));
+ locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask |= bit;
+ locationExtended.measUsageInfo[idx].gnssConstellation =
+ GNSS_LOC_SV_SYSTEM_BDS;
+ if (multiBandTypesAvailable) {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ gnssSignalTypeMask;
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_BEIDOU_B1I) {
+ locationExtended.gnss_mb_sv_used_ids.bds_b1i_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_BEIDOU_B1C) {
+ locationExtended.gnss_mb_sv_used_ids.bds_b1c_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_BEIDOU_B2I) {
+ locationExtended.gnss_mb_sv_used_ids.bds_b2i_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_BEIDOU_B2AI) {
+ locationExtended.gnss_mb_sv_used_ids.bds_b2ai_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_BEIDOU_B2AQ) {
+ locationExtended.gnss_mb_sv_used_ids.bds_b2aq_sv_used_ids_mask
+ |= bit;
+ }
+ } else {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ GNSS_SIGNAL_BEIDOU_B1I;
+ }
+ }
+ else if ((gnssSvIdUsed >= GAL_SV_PRN_MIN) &&
+ (gnssSvIdUsed <= GAL_SV_PRN_MAX))
+ {
+ uint64_t bit = (1ULL << (gnssSvIdUsed - GAL_SV_PRN_MIN));
+ locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask |= bit;
+ locationExtended.measUsageInfo[idx].gnssConstellation =
+ GNSS_LOC_SV_SYSTEM_GALILEO;
+ if (multiBandTypesAvailable) {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ gnssSignalTypeMask;
+
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GALILEO_E1) {
+ locationExtended.gnss_mb_sv_used_ids.gal_e1_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GALILEO_E5A) {
+ locationExtended.gnss_mb_sv_used_ids.gal_e5a_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_GALILEO_E5B) {
+ locationExtended.gnss_mb_sv_used_ids.gal_e5b_sv_used_ids_mask
+ |= bit;
+ }
+ } else {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ GNSS_SIGNAL_GALILEO_E1;
+ }
+ }
+ else if ((gnssSvIdUsed >= QZSS_SV_PRN_MIN) &&
+ (gnssSvIdUsed <= QZSS_SV_PRN_MAX))
+ {
+ uint64_t bit = (1ULL << (gnssSvIdUsed - QZSS_SV_PRN_MIN));
+ locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask |= bit;
+ locationExtended.measUsageInfo[idx].gnssConstellation =
+ GNSS_LOC_SV_SYSTEM_QZSS;
+ if (multiBandTypesAvailable) {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ gnssSignalTypeMask;
+
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_QZSS_L1CA) {
+ locationExtended.gnss_mb_sv_used_ids.qzss_l1ca_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_QZSS_L1S) {
+ locationExtended.gnss_mb_sv_used_ids.qzss_l1s_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_QZSS_L2) {
+ locationExtended.gnss_mb_sv_used_ids.qzss_l2_sv_used_ids_mask
+ |= bit;
+ }
+ if (locationExtended.measUsageInfo[idx].gnssSignalType &
+ GNSS_SIGNAL_QZSS_L5) {
+ locationExtended.gnss_mb_sv_used_ids.qzss_l5_sv_used_ids_mask
+ |= bit;
+ }
+ } else {
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ GNSS_SIGNAL_QZSS_L1CA;
+ }
+ }
+ else if ((gnssSvIdUsed >= NAVIC_SV_PRN_MIN) &&
+ (gnssSvIdUsed <= NAVIC_SV_PRN_MAX))
+ {
+ locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask |=
+ (1ULL << (gnssSvIdUsed - NAVIC_SV_PRN_MIN));
+ locationExtended.measUsageInfo[idx].gnssConstellation =
+ GNSS_LOC_SV_SYSTEM_NAVIC;
+ locationExtended.measUsageInfo[idx].gnssSignalType =
+ (multiBandTypesAvailable ?
+ location_report_ptr->gnssSvUsedSignalTypeList[idx] :
+ GNSS_SIGNAL_NAVIC_L5);
+ }
+ }
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA;
+ if (multiBandTypesAvailable) {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MULTIBAND;
+ }
+ }
+ }
+
+ if (location_report_ptr->navSolutionMask_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK;
+ locationExtended.navSolutionMask =
+ convertNavSolutionMask(location_report_ptr->navSolutionMask);
+ }
+
+ if (location_report_ptr->gpsTime_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_GPS_TIME;
+ locationExtended.gpsTime.gpsWeek = location_report_ptr->gpsTime.gpsWeek;
+ locationExtended.gpsTime.gpsTimeOfWeekMs = location_report_ptr->gpsTime.gpsTimeOfWeekMs;
+ }
+
+ if (location_report_ptr->extDOP_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_EXT_DOP;
+ locationExtended.extDOP.PDOP = location_report_ptr->extDOP.PDOP;
+ locationExtended.extDOP.HDOP = location_report_ptr->extDOP.HDOP;
+ locationExtended.extDOP.VDOP = location_report_ptr->extDOP.VDOP;
+ locationExtended.extDOP.GDOP = location_report_ptr->extDOP.GDOP;
+ locationExtended.extDOP.TDOP = location_report_ptr->extDOP.TDOP;
+ }
+
+ if (location_report_ptr->velEnu_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_EAST_VEL;
+ locationExtended.eastVelocity = location_report_ptr->velEnu[0];
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_NORTH_VEL;
+ locationExtended.northVelocity = location_report_ptr->velEnu[1];
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_UP_VEL;
+ locationExtended.upVelocity = location_report_ptr->velEnu[2];
+ }
+
+ if (location_report_ptr->velUncEnu_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC;
+ locationExtended.eastVelocityStdDeviation = location_report_ptr->velUncEnu[0];
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC;
+ locationExtended.northVelocityStdDeviation = location_report_ptr->velUncEnu[1];
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC;
+ locationExtended.upVelocityStdDeviation = location_report_ptr->velUncEnu[2];
+ }
+ // fill in GnssSystemTime based on gps timestamp and time uncertainty
+ locationExtended.gnssSystemTime.gnssSystemTimeSrc = (Gnss_LocSvSystemEnumType)0;
+ if (location_report_ptr->gpsTime_valid)
+ {
+ locationExtended.gnssSystemTime.gnssSystemTimeSrc = GNSS_LOC_SV_SYSTEM_GPS;
+ locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask = 0x0;
+
+ locationExtended.gnssSystemTime.u.gpsSystemTime.systemWeek =
+ locationExtended.gpsTime.gpsWeek;
+ locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask |=
+ GNSS_SYSTEM_TIME_WEEK_VALID;
+
+ locationExtended.gnssSystemTime.u.gpsSystemTime.systemMsec =
+ locationExtended.gpsTime.gpsTimeOfWeekMs;
+ locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask |=
+ GNSS_SYSTEM_TIME_WEEK_MS_VALID;
+
+ locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeBias = 0.0f;
+ locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask |=
+ GNSS_SYSTEM_CLK_TIME_BIAS_VALID;
+
+ if (location_report_ptr->timeUnc_valid)
+ {
+ locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs =
+ locationExtended.timeUncMs;
+ locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask |=
+ GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID;
+ }
+ }
+
+ if (location_report_ptr->timeUnc_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_TIME_UNC;
+ locationExtended.timeUncMs = location_report_ptr->timeUnc;
+ }
+
+ if (location_report_ptr->leapSeconds_valid)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS;
+ locationExtended.leapSeconds = location_report_ptr->leapSeconds;
+ }
+
+ if (location_report_ptr->dgnssCorrectionSource_valid) {
+ locationExtended.flags |=
+ GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_TYPE;
+ locationExtended.dgnssCorrectionSourceType = (LocDgnssCorrectionSourceType)
+ location_report_ptr->dgnssCorrectionSource;
+ }
+
+ if (location_report_ptr->dgnssCorrectionSourceID_valid) {
+ locationExtended.flags |=
+ GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_ID;
+ locationExtended.dgnssCorrectionSourceID =
+ location_report_ptr->dgnssCorrectionSourceID;
+ }
+
+ if (location_report_ptr->dgnssConstellationUsage_valid) {
+ locationExtended.flags |=
+ GPS_LOCATION_EXTENDED_HAS_DGNSS_CONSTELLATION_USAGE;
+ convertGnssConestellationMask(location_report_ptr->dgnssConstellationUsage,
+ locationExtended.dgnssConstellationUsage);
+ }
+
+ if (location_report_ptr->dgnssRefStationId_valid) {
+ locationExtended.flags |=
+ GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID;
+ locationExtended.dgnssRefStationId =
+ location_report_ptr->dgnssRefStationId;
+ }
+
+ if (location_report_ptr->dgnssDataAgeMsec_valid) {
+ locationExtended.flags |=
+ GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE;
+ locationExtended.dgnssDataAgeMsec =
+ location_report_ptr->dgnssDataAgeMsec;
+ }
+
+ if (location_report_ptr->systemTick_valid &&
+ location_report_ptr->systemTickUnc_valid) {
+ /* deal with Qtimer for ElapsedRealTimeNanos */
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_ELAPSED_REAL_TIME;
+ location.gpsLocation.elapsedRealTime = location_report_ptr->systemTick;
+
+ /* Uncertainty on HLOS time is 0, so the uncertainty of the difference
+ is the uncertainty of the Qtimer in the modem */
+ location.gpsLocation.elapsedRealTimeUnc =
+ qTimerTicksToNanos((double)location_report_ptr->systemTickUnc);
+ }
+
+ LOC_LOGv("report position mask: 0x%" PRIx64 ", dgnss info: 0x%x %d %d %d %d,",
+ locationExtended.flags,
+ locationExtended.dgnssConstellationUsage,
+ locationExtended.dgnssCorrectionSourceType,
+ locationExtended.dgnssCorrectionSourceID,
+ locationExtended.dgnssDataAgeMsec,
+ locationExtended.dgnssRefStationId);
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ (location_report_ptr->sessionStatus ==
+ eQMI_LOC_SESS_STATUS_IN_PROGRESS_V02 ?
+ LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS),
+ tech_Mask, &dataNotify, msInWeek);
+ }
+ else
+ {
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ LOC_SESS_FAILURE,
+ LOC_POS_TECH_MASK_DEFAULT,
+ &dataNotify, msInWeek);
+
+ LOC_LOGD("%s:%d]: Ignoring position report with sess status = %d, "
+ "fix id = %u\n", __func__, __LINE__,
+ location_report_ptr->sessionStatus,
+ location_report_ptr->fixId );
+ }
+}
+
+/*convert signal type to carrier frequency*/
+float LocApiV02::convertSignalTypeToCarrierFrequency(
+ qmiLocGnssSignalTypeMaskT_v02 signalType,
+ uint8_t gloFrequency)
+{
+ float carrierFrequency = 0.0;
+
+ LOC_LOGv("signalType = 0x%" PRIx64 , signalType);
+ switch (signalType) {
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA_V02:
+ carrierFrequency = GPS_L1CA_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C_V02:
+ carrierFrequency = GPS_L1C_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L_V02:
+ carrierFrequency = GPS_L2C_L_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q_V02:
+ carrierFrequency = GPS_L5_Q_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1_V02:
+ carrierFrequency = GLONASS_G1_CARRIER_FREQUENCY;
+ if ((gloFrequency >= 1 && gloFrequency <= 14)) {
+ carrierFrequency += ((gloFrequency - 8) * 562500);
+ }
+ LOC_LOGv("GLO carFreq after conversion = %f", carrierFrequency);
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2_V02:
+ carrierFrequency = GLONASS_G2_CARRIER_FREQUENCY;
+ if ((gloFrequency >= 1 && gloFrequency <= 14)) {
+ carrierFrequency += ((gloFrequency - 8) * 437500);
+ }
+ LOC_LOGv("GLO carFreq after conversion = %f", carrierFrequency);
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C_V02:
+ carrierFrequency = GALILEO_E1_C_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q_V02:
+ carrierFrequency = GALILEO_E5A_Q_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q_V02:
+ carrierFrequency = GALILEO_E5B_Q_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I_V02:
+ carrierFrequency = BEIDOU_B1_I_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C_V02:
+ carrierFrequency = BEIDOU_B1C_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I_V02:
+ carrierFrequency = BEIDOU_B2_I_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I_V02:
+ carrierFrequency = BEIDOU_B2A_I_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA_V02:
+ carrierFrequency = QZSS_L1CA_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S_V02:
+ carrierFrequency = QZSS_L1S_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L_V02:
+ carrierFrequency = QZSS_L2C_L_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q_V02:
+ carrierFrequency = QZSS_L5_Q_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA_V02:
+ carrierFrequency = SBAS_L1_CA_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q_V02:
+ carrierFrequency = BEIDOU_B2A_Q_CARRIER_FREQUENCY;
+ break;
+
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5_V02:
+ carrierFrequency = NAVIC_L5_CARRIER_FREQUENCY;
+ break;
+
+ default:
+ break;
+ }
+ return carrierFrequency;
+}
+
+/* convert satellite report to location api format and send the converted
+ report to base */
+void LocApiV02 :: reportSv (
+ const qmiLocEventGnssSvInfoIndMsgT_v02 *gnss_report_ptr)
+{
+ GnssSvNotification SvNotify = {};
+ int num_svs_max, i;
+ const qmiLocSvInfoStructT_v02 *sv_info_ptr;
+ uint8_t gloFrequency = 0;
+
+ num_svs_max = 0;
+ if (1 == gnss_report_ptr->expandedSvList_valid) {
+ num_svs_max = std::min((uint32_t)QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ gnss_report_ptr->expandedSvList_len);
+ }
+ else if (1 == gnss_report_ptr->svList_valid) {
+ num_svs_max = std::min((uint32_t)QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02,
+ gnss_report_ptr->svList_len);
+ }
+ num_svs_max = std::min(num_svs_max, GNSS_SV_MAX);
+
+ SvNotify.size = sizeof(GnssSvNotification);
+ if (gnss_report_ptr->gnssSignalTypeList_valid) {
+ SvNotify.gnssSignalTypeMaskValid = true;
+ }
+
+ if (1 == gnss_report_ptr->svList_valid ||
+ 1 == gnss_report_ptr->expandedSvList_valid) {
+ SvNotify.count = 0;
+ for(i = 0; i < num_svs_max; i++) {
+ if (1 == gnss_report_ptr->expandedSvList_valid) {
+ sv_info_ptr = &(gnss_report_ptr->expandedSvList[i].svInfo);
+ }
+ else {
+ sv_info_ptr = &(gnss_report_ptr->svList[i]);
+ }
+ if((sv_info_ptr->validMask & QMI_LOC_SV_INFO_MASK_VALID_SYSTEM_V02) &&
+ (sv_info_ptr->validMask & QMI_LOC_SV_INFO_MASK_VALID_GNSS_SVID_V02)
+ && (sv_info_ptr->gnssSvId != 0 ))
+ {
+ GnssSvOptionsMask mask = 0;
+
+ LOC_LOGv("i:%d sv-id:%d count:%d sys:%d en:0x%" PRIx64,
+ i, sv_info_ptr->gnssSvId, SvNotify.count, sv_info_ptr->system,
+ gnss_report_ptr->gnssSignalTypeList[SvNotify.count]);
+
+ GnssSv &gnssSv_ref = SvNotify.gnssSvs[SvNotify.count];
+
+ gnssSv_ref.size = sizeof(GnssSv);
+ gnssSv_ref.svId = sv_info_ptr->gnssSvId;
+ switch (sv_info_ptr->system) {
+ case eQMI_LOC_SV_SYSTEM_GPS_V02:
+ gnssSv_ref.type = GNSS_SV_TYPE_GPS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_GALILEO_V02:
+ gnssSv_ref.type = GNSS_SV_TYPE_GALILEO;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_SBAS_V02:
+ gnssSv_ref.type = GNSS_SV_TYPE_SBAS;
+ break;
+
+ // Glonass in SV report comes in range of [1, 32],
+ // convert to [65, 96]
+ case eQMI_LOC_SV_SYSTEM_GLONASS_V02:
+ gnssSv_ref.type = GNSS_SV_TYPE_GLONASS;
+ gnssSv_ref.svId = sv_info_ptr->gnssSvId + GLO_SV_PRN_MIN - 1;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_BDS_V02:
+ case eQMI_LOC_SV_SYSTEM_COMPASS_V02:
+ gnssSv_ref.type = GNSS_SV_TYPE_BEIDOU;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_QZSS_V02:
+ gnssSv_ref.type = GNSS_SV_TYPE_QZSS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_NAVIC_V02:
+ gnssSv_ref.type = GNSS_SV_TYPE_NAVIC;
+ break;
+
+ default:
+ gnssSv_ref.type = GNSS_SV_TYPE_UNKNOWN;
+ break;
+ }
+
+ if (sv_info_ptr->validMask & QMI_LOC_SV_INFO_MASK_VALID_SNR_V02) {
+ gnssSv_ref.cN0Dbhz = sv_info_ptr->snr;
+ }
+
+ if (sv_info_ptr->validMask & QMI_LOC_SV_INFO_MASK_VALID_ELEVATION_V02) {
+ gnssSv_ref.elevation = sv_info_ptr->elevation;
+ }
+
+ if (sv_info_ptr->validMask & QMI_LOC_SV_INFO_MASK_VALID_AZIMUTH_V02) {
+ gnssSv_ref.azimuth = sv_info_ptr->azimuth;
+ }
+
+ if (sv_info_ptr->validMask &
+ QMI_LOC_SV_INFO_MASK_VALID_SVINFO_MASK_V02) {
+ if (sv_info_ptr->svInfoMask &
+ QMI_LOC_SVINFO_MASK_HAS_EPHEMERIS_V02) {
+ mask |= GNSS_SV_OPTIONS_HAS_EPHEMER_BIT;
+ }
+ if (sv_info_ptr->svInfoMask &
+ QMI_LOC_SVINFO_MASK_HAS_ALMANAC_V02) {
+ mask |= GNSS_SV_OPTIONS_HAS_ALMANAC_BIT;
+ }
+ }
+
+ if (gnss_report_ptr->gnssSignalTypeList_valid) {
+ mask |= GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT;
+ if (SvNotify.count > gnss_report_ptr->gnssSignalTypeList_len - 1) {
+ LOC_LOGv("Frequency not available for this SV");
+ }
+ else {
+ if (1 == gnss_report_ptr->expandedSvList_valid) {
+ gloFrequency = gnss_report_ptr->expandedSvList[i].gloFrequency;
+ LOC_LOGv("gloFrequency = 0x%X", gloFrequency);
+ }
+
+ if (gnss_report_ptr->gnssSignalTypeList[SvNotify.count] != 0) {
+ gnssSv_ref.carrierFrequencyHz =
+ convertSignalTypeToCarrierFrequency(
+ gnss_report_ptr->gnssSignalTypeList[SvNotify.count],
+ gloFrequency);
+ mask |= GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT;
+ gnssSv_ref.gnssSignalTypeMask = convertQmiGnssSignalType(
+ gnss_report_ptr->gnssSignalTypeList[SvNotify.count]);
+ LOC_LOGd("sv id %d, qmi signal type: 0x%" PRIx64 ", "
+ "hal signal type: 0x%x", gnssSv_ref.svId,
+ gnss_report_ptr->gnssSignalTypeList[SvNotify.count],
+ gnssSv_ref.gnssSignalTypeMask);
+ }
+ }
+ } else {
+ mask |= GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT;
+ gnssSv_ref.carrierFrequencyHz = CarrierFrequencies[gnssSv_ref.type];
+ }
+
+ gnssSv_ref.gnssSvOptionsMask = mask;
+ SvNotify.count++;
+ }
+ }
+ }
+
+ LocApiBase::reportSv(SvNotify);
+}
+
+static Gnss_LocSvSystemEnumType getLocApiSvSystemType (qmiLocSvSystemEnumT_v02 qmiSvSystemType) {
+ Gnss_LocSvSystemEnumType locSvSystemType = GNSS_LOC_SV_SYSTEM_UNKNOWN;
+
+ switch (qmiSvSystemType) {
+ case eQMI_LOC_SV_SYSTEM_GPS_V02:
+ locSvSystemType = GNSS_LOC_SV_SYSTEM_GPS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_GALILEO_V02:
+ locSvSystemType = GNSS_LOC_SV_SYSTEM_GALILEO;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_SBAS_V02:
+ locSvSystemType = GNSS_LOC_SV_SYSTEM_SBAS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_GLONASS_V02:
+ locSvSystemType = GNSS_LOC_SV_SYSTEM_GLONASS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_BDS_V02:
+ case eQMI_LOC_SV_SYSTEM_COMPASS_V02:
+ locSvSystemType = GNSS_LOC_SV_SYSTEM_BDS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_QZSS_V02:
+ locSvSystemType = GNSS_LOC_SV_SYSTEM_QZSS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_NAVIC_V02:
+ locSvSystemType = GNSS_LOC_SV_SYSTEM_NAVIC;
+ break;
+
+ default:
+ break;
+ }
+
+ return locSvSystemType;
+}
+
+/* convert satellite polynomial to loc eng format and send the converted
+ report to loc eng */
+void LocApiV02 :: reportSvPolynomial (
+ const qmiLocEventGnssSvPolyIndMsgT_v02 *gnss_sv_poly_ptr)
+{
+ GnssSvPolynomial svPolynomial;
+
+ memset(&svPolynomial, 0, sizeof(GnssSvPolynomial));
+ svPolynomial.size = sizeof(GnssSvPolynomial);
+ svPolynomial.is_valid = 0;
+
+ if(0 != gnss_sv_poly_ptr->gnssSvId)
+ {
+ svPolynomial.gnssSvId = gnss_sv_poly_ptr->gnssSvId;
+ svPolynomial.T0 = gnss_sv_poly_ptr->T0;
+
+ if(1 == gnss_sv_poly_ptr->gloFrequency_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GLO_FREQ;
+ svPolynomial.freqNum = gnss_sv_poly_ptr->gloFrequency;
+ }
+ if(1 == gnss_sv_poly_ptr->IODE_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_IODE;
+ svPolynomial.iode = gnss_sv_poly_ptr->IODE;
+ }
+
+ if(1 == gnss_sv_poly_ptr->svPosUnc_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_SV_POSUNC;
+ svPolynomial.svPosUnc = gnss_sv_poly_ptr->svPosUnc;
+ }
+
+ if(0 != gnss_sv_poly_ptr->svPolyFlagValid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_FLAG;
+ svPolynomial.svPolyStatusMaskValidity = gnss_sv_poly_ptr->svPolyFlagValid;
+ svPolynomial.svPolyStatusMask = gnss_sv_poly_ptr->svPolyFlags;
+ }
+
+ if(1 == gnss_sv_poly_ptr->polyCoeffXYZ0_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZ0;
+ for(int i=0;i<GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE;i++)
+ {
+ svPolynomial.polyCoeffXYZ0[i] = gnss_sv_poly_ptr->polyCoeffXYZ0[i];
+ }
+ }
+
+ if(1 == gnss_sv_poly_ptr->polyCoefXYZN_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZN;
+ for(int i=0;i<GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE;i++)
+ {
+ svPolynomial.polyCoefXYZN[i] = gnss_sv_poly_ptr->polyCoefXYZN[i];
+ }
+ }
+
+ if(1 == gnss_sv_poly_ptr->polyCoefClockBias_valid)
+ {
+
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_POLYCOEFF_OTHER;
+ for(int i=0;i<GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE;i++)
+ {
+ svPolynomial.polyCoefOther[i] = gnss_sv_poly_ptr->polyCoefClockBias[i];
+ }
+ }
+
+ if(1 == gnss_sv_poly_ptr->ionoDot_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_IONODOT;
+ svPolynomial.ionoDot = gnss_sv_poly_ptr->ionoDot;
+ }
+ if(1 == gnss_sv_poly_ptr->ionoDelay_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_IONODELAY;
+ svPolynomial.ionoDelay = gnss_sv_poly_ptr->ionoDelay;
+ }
+
+ if(1 == gnss_sv_poly_ptr->sbasIonoDot_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_SBAS_IONODOT;
+ svPolynomial.sbasIonoDot = gnss_sv_poly_ptr->sbasIonoDot;
+ }
+ if(1 == gnss_sv_poly_ptr->sbasIonoDelay_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_SBAS_IONODELAY;
+ svPolynomial.sbasIonoDelay = gnss_sv_poly_ptr->sbasIonoDelay;
+ }
+ if(1 == gnss_sv_poly_ptr->tropoDelay_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_TROPODELAY;
+ svPolynomial.tropoDelay = gnss_sv_poly_ptr->tropoDelay;
+ }
+ if(1 == gnss_sv_poly_ptr->elevation_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_ELEVATION;
+ svPolynomial.elevation = gnss_sv_poly_ptr->elevation;
+ }
+ if(1 == gnss_sv_poly_ptr->elevationDot_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_ELEVATIONDOT;
+ svPolynomial.elevationDot = gnss_sv_poly_ptr->elevationDot;
+ }
+ if(1 == gnss_sv_poly_ptr->elenationUnc_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_ELEVATIONUNC;
+ svPolynomial.elevationUnc = gnss_sv_poly_ptr->elenationUnc;
+ }
+ if(1 == gnss_sv_poly_ptr->velCoef_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_VELO_COEFF;
+ for(int i=0;i<GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE;i++)
+ {
+ svPolynomial.velCoef[i] = gnss_sv_poly_ptr->velCoef[i];
+ }
+ }
+ if(1 == gnss_sv_poly_ptr->enhancedIOD_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD;
+ svPolynomial.enhancedIOD = gnss_sv_poly_ptr->enhancedIOD;
+ }
+
+ if(1 == gnss_sv_poly_ptr->gpsIscL1ca_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GPS_ISC_L1CA;
+ svPolynomial.gpsIscL1ca = gnss_sv_poly_ptr->gpsIscL1ca;
+ }
+
+ if(1 == gnss_sv_poly_ptr->gpsIscL2c_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GPS_ISC_L2C;
+ svPolynomial.gpsIscL2c = gnss_sv_poly_ptr->gpsIscL2c;
+ }
+
+ if(1 == gnss_sv_poly_ptr->gpsIscL5I5_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5I5;
+ svPolynomial.gpsIscL5I5 = gnss_sv_poly_ptr->gpsIscL5I5;
+ }
+
+ if(1 == gnss_sv_poly_ptr->gpsIscL5Q5_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5Q5;
+ svPolynomial.gpsIscL5Q5 = gnss_sv_poly_ptr->gpsIscL5Q5;
+ }
+
+ if(1 == gnss_sv_poly_ptr->gpsTgd_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GPS_TGD;
+ svPolynomial.gpsTgd = gnss_sv_poly_ptr->gpsTgd;
+ }
+
+ if(1 == gnss_sv_poly_ptr->gloTgdG1G2_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GLO_TGD_G1G2;
+ svPolynomial.gloTgdG1G2 = gnss_sv_poly_ptr->gloTgdG1G2;
+ }
+
+ if(1 == gnss_sv_poly_ptr->bdsTgdB1_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_BDS_TGD_B1;
+ svPolynomial.bdsTgdB1 = gnss_sv_poly_ptr->bdsTgdB1;
+ }
+
+ if(1 == gnss_sv_poly_ptr->bdsTgdB2_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2;
+ svPolynomial.bdsTgdB2= gnss_sv_poly_ptr->bdsTgdB2;
+ }
+
+ if(1 == gnss_sv_poly_ptr->bdsTgdB2a_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2A;
+ svPolynomial.bdsTgdB2a = gnss_sv_poly_ptr->bdsTgdB2a;
+ }
+
+ if(1 == gnss_sv_poly_ptr->bdsIscB2a_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_BDS_ISC_B2A;
+ svPolynomial.bdsIscB2a = gnss_sv_poly_ptr->bdsIscB2a;
+ }
+
+ if(1 == gnss_sv_poly_ptr->galBgdE1E5a_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5A;
+ svPolynomial.galBgdE1E5a = gnss_sv_poly_ptr->galBgdE1E5a;
+ }
+
+ if(1 == gnss_sv_poly_ptr->galBgdE1E5b_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5B;
+ svPolynomial.galBgdE1E5b = gnss_sv_poly_ptr->galBgdE1E5b;
+ }
+
+ if(1 == gnss_sv_poly_ptr->navicTgdL5_valid)
+ {
+ svPolynomial.is_valid |= ULP_GNSS_SV_POLY_BIT_NAVIC_TGD_L5;
+ svPolynomial.navicTgdL5 = gnss_sv_poly_ptr->navicTgdL5;
+ }
+
+
+ LocApiBase::reportSvPolynomial(svPolynomial);
+
+ LOC_LOGV("[SV_POLY_QMI] SV-Id:%d\n", svPolynomial.gnssSvId);
+ }
+ else
+ {
+ LOC_LOGV("[SV_POLY] INVALID SV-Id:%d", svPolynomial.gnssSvId);
+ }
+} //reportSvPolynomial
+
+void LocApiV02::reportLocEvent(const qmiLocEventReportIndMsgT_v02 *event_report_ptr)
+{
+ GnssAidingData aidingData;
+ memset(&aidingData, 0, sizeof(aidingData));
+ LOC_LOGd("Loc event report: %" PRIu64 " KlobucharIonoMode_valid:%d: leapSec_valid:%d: tauC_valid:%d",
+ event_report_ptr->eventReport, event_report_ptr->klobucharIonoModel_valid,
+ event_report_ptr->leapSec_valid, event_report_ptr->tauC_valid);
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GPS_EPHEMERIS_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GPS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GLO_EPHEMERIS_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_BDS_EPHEMERIS_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GAL_EPHEMERIS_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_QZSS_EPHEMERIS_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_EPHEMERIS_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GPS_SV_POLY_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_POLY_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GPS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GLO_SV_POLY_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_POLY_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_BDS_SV_POLY_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_POLY_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GAL_SV_POLY_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_POLY_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_QZSS_SV_POLY_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_POLY_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GPS_IONO_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GPS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GLO_IONO_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_BDS_IONO_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_GAL_IONO_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT;
+ }
+
+ if (event_report_ptr->eventReport & QMI_LOC_DELETE_QZSS_IONO_ALL_V02) {
+ aidingData.sv.svMask |= GNSS_AIDING_DATA_SV_IONOSPHERE_BIT;
+ aidingData.sv.svTypeMask |= GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT;
+ }
+
+ if ((aidingData.sv.svMask != 0) && (aidingData.sv.svTypeMask != 0)) {
+ LocApiBase::reportDeleteAidingDataEvent(aidingData);
+ }
+
+ // report Klobuchar IonoModel
+ if (event_report_ptr->klobucharIonoModel_valid) {
+ GnssKlobucharIonoModel klobucharIonoModel;
+ memset(&klobucharIonoModel, 0, sizeof(klobucharIonoModel));
+
+ if (event_report_ptr->gpsSystemTime_valid) {
+ klobucharIonoModel.isSystemTimeValid = true;
+ populateGpsTimeOfReport(event_report_ptr->gpsSystemTime, klobucharIonoModel.systemTime);
+ }
+
+ switch(event_report_ptr->klobucharIonoModel.dataSource) {
+ case eQMI_LOC_SV_SYSTEM_GPS_V02:
+ klobucharIonoModel.gnssConstellation = GNSS_LOC_SV_SYSTEM_GPS;
+ break;
+ case eQMI_LOC_SV_SYSTEM_GALILEO_V02:
+ klobucharIonoModel.gnssConstellation = GNSS_LOC_SV_SYSTEM_GALILEO;
+ break;
+ case eQMI_LOC_SV_SYSTEM_SBAS_V02:
+ klobucharIonoModel.gnssConstellation = GNSS_LOC_SV_SYSTEM_SBAS;
+ break;
+ case eQMI_LOC_SV_SYSTEM_GLONASS_V02:
+ klobucharIonoModel.gnssConstellation = GNSS_LOC_SV_SYSTEM_GLONASS;
+ break;
+ case eQMI_LOC_SV_SYSTEM_BDS_V02:
+ case eQMI_LOC_SV_SYSTEM_COMPASS_V02:
+ klobucharIonoModel.gnssConstellation = GNSS_LOC_SV_SYSTEM_BDS;
+ break;
+ case eQMI_LOC_SV_SYSTEM_QZSS_V02:
+ klobucharIonoModel.gnssConstellation = GNSS_LOC_SV_SYSTEM_QZSS;
+ break;
+ }
+
+ klobucharIonoModel.alpha0 = event_report_ptr->klobucharIonoModel.alpha0;
+ klobucharIonoModel.alpha1 = event_report_ptr->klobucharIonoModel.alpha1;
+ klobucharIonoModel.alpha2 = event_report_ptr->klobucharIonoModel.alpha2;
+ klobucharIonoModel.alpha3 = event_report_ptr->klobucharIonoModel.alpha3;
+ klobucharIonoModel.beta0 = event_report_ptr->klobucharIonoModel.beta0;
+ klobucharIonoModel.beta1 = event_report_ptr->klobucharIonoModel.beta1;
+ klobucharIonoModel.beta2 = event_report_ptr->klobucharIonoModel.beta2;
+ klobucharIonoModel.beta3 = event_report_ptr->klobucharIonoModel.beta3;
+ LOC_LOGd("iono model: %d:%f:%f:%f:%f:%f:%f:%f:%f:%d",
+ klobucharIonoModel.gnssConstellation, klobucharIonoModel.alpha0,
+ klobucharIonoModel.alpha1, klobucharIonoModel.alpha2, klobucharIonoModel.alpha3,
+ klobucharIonoModel.beta0, klobucharIonoModel.beta1, klobucharIonoModel.beta2,
+ klobucharIonoModel.beta3, klobucharIonoModel.isSystemTimeValid);
+
+ LocApiBase::reportKlobucharIonoModel(klobucharIonoModel);
+ }
+
+ // report gnss additional system info
+ GnssAdditionalSystemInfo additionalSystemInfo;
+ memset(&additionalSystemInfo, 0, sizeof(additionalSystemInfo));
+ if (event_report_ptr->leapSec_valid) {
+ additionalSystemInfo.validityMask |= GNSS_ADDITIONAL_SYSTEMINFO_HAS_LEAP_SEC;
+ additionalSystemInfo.leapSec = event_report_ptr->leapSec;
+ LOC_LOGd("LeapSec: %d", event_report_ptr->leapSec);
+ }
+ if (event_report_ptr->tauC_valid) {
+ additionalSystemInfo.validityMask |= GNSS_ADDITIONAL_SYSTEMINFO_HAS_TAUC;
+ additionalSystemInfo.tauC = event_report_ptr->tauC;
+ LOC_LOGd("tauC: %lf", event_report_ptr->tauC);
+ }
+
+ if (additionalSystemInfo.validityMask && event_report_ptr->gpsSystemTime_valid) {
+ additionalSystemInfo.isSystemTimeValid = true;
+ populateGpsTimeOfReport(event_report_ptr->gpsSystemTime, additionalSystemInfo.systemTime);
+ LocApiBase::reportGnssAdditionalSystemInfo(additionalSystemInfo);
+ }
+}
+
+void LocApiV02::reportSvEphemeris (
+ uint32_t eventId, const locClientEventIndUnionType &eventPayload) {
+
+ GnssSvEphemerisReport svEphemeris;
+ memset(&svEphemeris, 0, sizeof(svEphemeris));
+
+ switch (eventId)
+ {
+ case QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02:
+ svEphemeris.gnssConstellation = GNSS_LOC_SV_SYSTEM_GPS;
+ populateGpsEphemeris(eventPayload.pGpsEphemerisReportEvent, svEphemeris);
+ break;
+ case QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02:
+ svEphemeris.gnssConstellation = GNSS_LOC_SV_SYSTEM_GLONASS;
+ populateGlonassEphemeris(eventPayload.pGloEphemerisReportEvent, svEphemeris);
+ break;
+ case QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02:
+ svEphemeris.gnssConstellation = GNSS_LOC_SV_SYSTEM_BDS;
+ populateBdsEphemeris(eventPayload.pBdsEphemerisReportEvent, svEphemeris);
+ break;
+ case QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02:
+ svEphemeris.gnssConstellation = GNSS_LOC_SV_SYSTEM_GALILEO;
+ populateGalEphemeris(eventPayload.pGalEphemerisReportEvent, svEphemeris);
+ break;
+ case QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02:
+ svEphemeris.gnssConstellation = GNSS_LOC_SV_SYSTEM_QZSS;
+ populateQzssEphemeris(eventPayload.pQzssEphemerisReportEvent, svEphemeris);
+ }
+
+ LocApiBase::reportSvEphemeris(svEphemeris);
+}
+
+void LocApiV02::populateGpsTimeOfReport(const qmiLocGnssTimeStructT_v02 &inGpsSystemTime,
+ GnssSystemTimeStructType& outGpsSystemTime) {
+
+ outGpsSystemTime.validityMask = GNSS_SYSTEM_TIME_WEEK_VALID | GNSS_SYSTEM_TIME_WEEK_MS_VALID |
+ GNSS_SYSTEM_CLK_TIME_BIAS_VALID | GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID;
+
+ outGpsSystemTime.systemWeek = inGpsSystemTime.systemWeek;
+ outGpsSystemTime.systemMsec = inGpsSystemTime.systemMsec;
+ outGpsSystemTime.systemClkTimeBias = inGpsSystemTime.systemClkTimeBias;
+ outGpsSystemTime.systemClkTimeUncMs = inGpsSystemTime.systemClkTimeUncMs;
+}
+
+
+void LocApiV02::populateCommonEphemeris(const qmiLocEphGnssDataStructT_v02 &receivedEph,
+ GnssEphCommon &ephToFill)
+{
+ LOC_LOGv("Eph received for sv-id: %d action:%d", receivedEph.gnssSvId,
+ receivedEph.updateAction);
+
+ ephToFill.gnssSvId = receivedEph.gnssSvId;
+ switch(receivedEph.updateAction) {
+ case eQMI_LOC_UPDATE_EPH_SRC_UNKNOWN_V02:
+ ephToFill.updateAction = GNSS_EPH_ACTION_UPDATE_SRC_UNKNOWN_V02;
+ break;
+ case eQMI_LOC_UPDATE_EPH_SRC_OTA_V02:
+ ephToFill.updateAction = GNSS_EPH_ACTION_UPDATE_SRC_OTA_V02;
+ break;
+ case eQMI_LOC_UPDATE_EPH_SRC_NETWORK_V02:
+ ephToFill.updateAction = GNSS_EPH_ACTION_UPDATE_SRC_NETWORK_V02;
+ break;
+ case eQMI_LOC_DELETE_EPH_SRC_UNKNOWN_V02:
+ ephToFill.updateAction = GNSS_EPH_ACTION_DELETE_SRC_UNKNOWN_V02;
+ break;
+ case eQMI_LOC_DELETE_EPH_SRC_NETWORK_V02:
+ ephToFill.updateAction = GNSS_EPH_ACTION_DELETE_SRC_NETWORK_V02;
+ break;
+ case eQMI_LOC_DELETE_EPH_SRC_OTA_V02:
+ ephToFill.updateAction = GNSS_EPH_ACTION_DELETE_SRC_OTA_V02;
+ break;
+ }
+
+ ephToFill.IODE = receivedEph.IODE;
+ ephToFill.aSqrt = receivedEph.aSqrt;
+ ephToFill.deltaN = receivedEph.deltaN;
+ ephToFill.m0 = receivedEph.m0;
+ ephToFill.eccentricity = receivedEph.eccentricity;
+ ephToFill.omega0 = receivedEph.omega0;
+ ephToFill.i0 = receivedEph.i0;
+ ephToFill.omega = receivedEph.omega;
+ ephToFill.omegaDot = receivedEph.omegaDot;
+ ephToFill.iDot = receivedEph.iDot;
+ ephToFill.cUc = receivedEph.cUc;
+ ephToFill.cUs = receivedEph.cUs;
+ ephToFill.cRc = receivedEph.cRc;
+ ephToFill.cRs = receivedEph.cRs;
+ ephToFill.cIc = receivedEph.cIc;
+ ephToFill.cIs = receivedEph.cIs;
+ ephToFill.toe = receivedEph.toe;
+ ephToFill.toc = receivedEph.toc;
+ ephToFill.af0 = receivedEph.af0;
+ ephToFill.af1 = receivedEph.af1;
+ ephToFill.af2 = receivedEph.af2;
+}
+
+
+void LocApiV02::populateGpsEphemeris(
+ const qmiLocGpsEphemerisReportIndMsgT_v02 *gpsEphemeris,
+ GnssSvEphemerisReport &svEphemeris)
+{
+ LOC_LOGd("GPS Ephemeris Received: Len= %d: systemTime_valid%d",
+ gpsEphemeris->gpsEphemerisList_len, gpsEphemeris->gpsSystemTime_valid);
+ svEphemeris.ephInfo.gpsEphemeris.numOfEphemeris = gpsEphemeris->gpsEphemerisList_len;
+
+ if (gpsEphemeris->gpsSystemTime_valid) {
+ svEphemeris.isSystemTimeValid = true;
+ populateGpsTimeOfReport(gpsEphemeris->gpsSystemTime, svEphemeris.systemTime);
+ }
+
+ for (uint32_t i =0; i < gpsEphemeris->gpsEphemerisList_len; i++) {
+ const qmiLocGpsEphemerisT_v02 &receivedGpsEphemeris = gpsEphemeris->gpsEphemerisList[i];
+ GpsEphemeris &gpsEphemerisToFill = svEphemeris.ephInfo.gpsEphemeris.gpsEphemerisData[i];
+
+ populateCommonEphemeris(receivedGpsEphemeris.commonEphemerisData,
+ gpsEphemerisToFill.commonEphemerisData);
+
+ gpsEphemerisToFill.signalHealth = receivedGpsEphemeris.signalHealth;
+ gpsEphemerisToFill.URAI = receivedGpsEphemeris.URAI;
+ gpsEphemerisToFill.codeL2 = receivedGpsEphemeris.codeL2;
+ gpsEphemerisToFill.dataFlagL2P = receivedGpsEphemeris.dataFlagL2P;
+ gpsEphemerisToFill.tgd = receivedGpsEphemeris.tgd;
+ gpsEphemerisToFill.fitInterval = receivedGpsEphemeris.fitInterval;
+ gpsEphemerisToFill.IODC = receivedGpsEphemeris.IODC;
+ }
+}
+
+void LocApiV02::populateGlonassEphemeris(const qmiLocGloEphemerisReportIndMsgT_v02 *gloEphemeris,
+ GnssSvEphemerisReport &svEphemeris)
+{
+ LOC_LOGd("GLO Ephemeris Received: Len= %d: systemTime_valid%d",
+ gloEphemeris->gloEphemerisList_len, gloEphemeris->gpsSystemTime_valid);
+ svEphemeris.ephInfo.glonassEphemeris.numOfEphemeris = gloEphemeris->gloEphemerisList_len;
+
+ if (gloEphemeris->gpsSystemTime_valid) {
+ svEphemeris.isSystemTimeValid = true;
+ populateGpsTimeOfReport(gloEphemeris->gpsSystemTime, svEphemeris.systemTime);
+ }
+
+ for (uint32_t i =0; i < gloEphemeris->gloEphemerisList_len; i++) {
+ const qmiLocGloEphemerisT_v02 &receivedGloEphemeris = gloEphemeris->gloEphemerisList[i];
+ GlonassEphemeris &gloEphemerisToFill = svEphemeris.ephInfo.glonassEphemeris.gloEphemerisData[i];
+
+ LOC_LOGv("Eph received for sv-id: %d action:%d", receivedGloEphemeris.gnssSvId,
+ receivedGloEphemeris.updateAction);
+
+ gloEphemerisToFill.gnssSvId = receivedGloEphemeris.gnssSvId;
+ switch(receivedGloEphemeris.updateAction) {
+ case eQMI_LOC_UPDATE_EPH_SRC_UNKNOWN_V02:
+ gloEphemerisToFill.updateAction = GNSS_EPH_ACTION_UPDATE_SRC_UNKNOWN_V02;
+ break;
+ case eQMI_LOC_UPDATE_EPH_SRC_OTA_V02:
+ gloEphemerisToFill.updateAction = GNSS_EPH_ACTION_UPDATE_SRC_OTA_V02;
+ break;
+ case eQMI_LOC_UPDATE_EPH_SRC_NETWORK_V02:
+ gloEphemerisToFill.updateAction = GNSS_EPH_ACTION_UPDATE_SRC_NETWORK_V02;
+ break;
+ case eQMI_LOC_DELETE_EPH_SRC_UNKNOWN_V02:
+ gloEphemerisToFill.updateAction = GNSS_EPH_ACTION_DELETE_SRC_UNKNOWN_V02;
+ break;
+ case eQMI_LOC_DELETE_EPH_SRC_NETWORK_V02:
+ gloEphemerisToFill.updateAction = GNSS_EPH_ACTION_DELETE_SRC_NETWORK_V02;
+ break;
+ case eQMI_LOC_DELETE_EPH_SRC_OTA_V02:
+ gloEphemerisToFill.updateAction = GNSS_EPH_ACTION_DELETE_SRC_OTA_V02;
+ break;
+ }
+
+ gloEphemerisToFill.bnHealth = receivedGloEphemeris.bnHealth;
+ gloEphemerisToFill.lnHealth = receivedGloEphemeris.lnHealth;
+ gloEphemerisToFill.tb = receivedGloEphemeris.tb;
+ gloEphemerisToFill.ft = receivedGloEphemeris.ft;
+ gloEphemerisToFill.gloM = receivedGloEphemeris.gloM;
+ gloEphemerisToFill.enAge = receivedGloEphemeris.enAge;
+ gloEphemerisToFill.gloFrequency = receivedGloEphemeris.gloFrequency;
+ gloEphemerisToFill.p1 = receivedGloEphemeris.p1;
+ gloEphemerisToFill.p2 = receivedGloEphemeris.p2;
+ gloEphemerisToFill.deltaTau = receivedGloEphemeris.deltaTau;
+ memcpy(gloEphemerisToFill.position, receivedGloEphemeris.position,
+ sizeof(*receivedGloEphemeris.position) * 3);
+ memcpy(gloEphemerisToFill.velocity, receivedGloEphemeris.velocity,
+ sizeof(*receivedGloEphemeris.velocity) * 3);
+ memcpy(gloEphemerisToFill.acceleration, receivedGloEphemeris.acceleration,
+ sizeof(*receivedGloEphemeris.acceleration) * 3);
+ gloEphemerisToFill.tauN = receivedGloEphemeris.tauN;
+ gloEphemerisToFill.gamma = receivedGloEphemeris.gamma;
+ gloEphemerisToFill.toe = receivedGloEphemeris.toe;
+ gloEphemerisToFill.nt = receivedGloEphemeris.nt;
+ }
+}
+
+void LocApiV02::populateBdsEphemeris(const qmiLocBdsEphemerisReportIndMsgT_v02 *bdsEphemeris,
+ GnssSvEphemerisReport &svEphemeris)
+{
+ LOC_LOGd("BDS Ephemeris Received: Len= %d: systemTime_valid%d",
+ bdsEphemeris->bdsEphemerisList_len, bdsEphemeris->gpsSystemTime_valid);
+ svEphemeris.ephInfo.bdsEphemeris.numOfEphemeris = bdsEphemeris->bdsEphemerisList_len;
+
+ if (bdsEphemeris->gpsSystemTime_valid) {
+ svEphemeris.isSystemTimeValid = true;
+ populateGpsTimeOfReport(bdsEphemeris->gpsSystemTime, svEphemeris.systemTime);
+ }
+
+
+ for (uint32_t i =0; i < bdsEphemeris->bdsEphemerisList_len; i++) {
+ const qmiLocBdsEphemerisT_v02 &receivedBdsEphemeris = bdsEphemeris->bdsEphemerisList[i];
+ BdsEphemeris &bdsEphemerisToFill = svEphemeris.ephInfo.bdsEphemeris.bdsEphemerisData[i];
+
+ populateCommonEphemeris(receivedBdsEphemeris.commonEphemerisData,
+ bdsEphemerisToFill.commonEphemerisData);
+
+ bdsEphemerisToFill.svHealth = receivedBdsEphemeris.svHealth;
+ bdsEphemerisToFill.AODC = receivedBdsEphemeris.AODC;
+ bdsEphemerisToFill.tgd1 = receivedBdsEphemeris.tgd1;
+ bdsEphemerisToFill.tgd2 = receivedBdsEphemeris.tgd2;
+ bdsEphemerisToFill.URAI = receivedBdsEphemeris.URAI;
+ }
+}
+
+void LocApiV02::populateGalEphemeris(const qmiLocGalEphemerisReportIndMsgT_v02 *galEphemeris,
+ GnssSvEphemerisReport &svEphemeris)
+{
+ LOC_LOGd("GAL Ephemeris Received: Len= %d: systemTime_valid%d",
+ galEphemeris->galEphemerisList_len, galEphemeris->gpsSystemTime_valid);
+ svEphemeris.ephInfo.galileoEphemeris.numOfEphemeris = galEphemeris->galEphemerisList_len;
+
+ if (galEphemeris->gpsSystemTime_valid) {
+ svEphemeris.isSystemTimeValid = true;
+ populateGpsTimeOfReport(galEphemeris->gpsSystemTime, svEphemeris.systemTime);
+ }
+
+
+ for (uint32_t i =0; i < galEphemeris->galEphemerisList_len; i++) {
+ const qmiLocGalEphemerisT_v02 &receivedGalEphemeris = galEphemeris->galEphemerisList[i];
+ GalileoEphemeris &galEphemerisToFill = svEphemeris.ephInfo.galileoEphemeris.galEphemerisData[i];
+
+ populateCommonEphemeris(receivedGalEphemeris.commonEphemerisData,
+ galEphemerisToFill.commonEphemerisData);
+
+ switch (receivedGalEphemeris.dataSourceSignal) {
+ case eQMI_LOC_GAL_EPH_SIGNAL_SRC_UNKNOWN_V02:
+ galEphemerisToFill.dataSourceSignal = GAL_EPH_SIGNAL_SRC_UNKNOWN_V02;
+ break;
+ case eQMI_LOC_GAL_EPH_SIGNAL_SRC_E1B_V02:
+ galEphemerisToFill.dataSourceSignal = GAL_EPH_SIGNAL_SRC_E1B_V02;
+ break;
+ case eQMI_LOC_GAL_EPH_SIGNAL_SRC_E5A_V02:
+ galEphemerisToFill.dataSourceSignal = GAL_EPH_SIGNAL_SRC_E5A_V02;
+ break;
+ case eQMI_LOC_GAL_EPH_SIGNAL_SRC_E5B_V02:
+ galEphemerisToFill.dataSourceSignal = GAL_EPH_SIGNAL_SRC_E5B_V02;
+ }
+
+ galEphemerisToFill.sisIndex = receivedGalEphemeris.sisIndex;
+ galEphemerisToFill.bgdE1E5a = receivedGalEphemeris.bgdE1E5a;
+ galEphemerisToFill.bgdE1E5b = receivedGalEphemeris.bgdE1E5b;
+ galEphemerisToFill.svHealth = receivedGalEphemeris.svHealth;
+ }
+}
+
+void LocApiV02::populateQzssEphemeris(const qmiLocQzssEphemerisReportIndMsgT_v02 *qzssEphemeris,
+ GnssSvEphemerisReport &svEphemeris)
+{
+ LOC_LOGd("QZSS Ephemeris Received: Len= %d: systemTime_valid%d",
+ qzssEphemeris->qzssEphemerisList_len, qzssEphemeris->gpsSystemTime_valid);
+ svEphemeris.ephInfo.qzssEphemeris.numOfEphemeris = qzssEphemeris->qzssEphemerisList_len;
+
+ if (qzssEphemeris->gpsSystemTime_valid) {
+ svEphemeris.isSystemTimeValid = true;
+ populateGpsTimeOfReport(qzssEphemeris->gpsSystemTime, svEphemeris.systemTime);
+ }
+
+
+ for (uint32_t i =0; i < qzssEphemeris->qzssEphemerisList_len; i++) {
+ const qmiLocGpsEphemerisT_v02 &receivedQzssEphemeris = qzssEphemeris->qzssEphemerisList[i];
+ GpsEphemeris &qzssEphemerisToFill = svEphemeris.ephInfo.qzssEphemeris.qzssEphemerisData[i];
+
+ populateCommonEphemeris(receivedQzssEphemeris.commonEphemerisData,
+ qzssEphemerisToFill.commonEphemerisData);
+
+ qzssEphemerisToFill.signalHealth = receivedQzssEphemeris.signalHealth;
+ qzssEphemerisToFill.URAI = receivedQzssEphemeris.URAI;
+ qzssEphemerisToFill.codeL2 = receivedQzssEphemeris.codeL2;
+ qzssEphemerisToFill.dataFlagL2P = receivedQzssEphemeris.dataFlagL2P;
+ qzssEphemerisToFill.tgd = receivedQzssEphemeris.tgd;
+ qzssEphemerisToFill.fitInterval = receivedQzssEphemeris.fitInterval;
+ qzssEphemerisToFill.IODC = receivedQzssEphemeris.IODC;
+ }
+}
+
+/* convert system info to GnssDataNotification format and dispatch
+ to the registered adapter */
+void LocApiV02 :: reportSystemInfo(
+ const qmiLocSystemInfoIndMsgT_v02* system_info_ptr){
+
+ if (system_info_ptr == nullptr) {
+ return;
+ }
+
+ LOC_LOGe("system info type: %d, leap second valid: %d "
+ "current gps time:valid:%d, week: %d, msec: %d,"
+ "current leap second:valid %d, seconds %d, "
+ "next gps time: valid %d, week: %d, msec: %d,"
+ "next leap second: valid %d, seconds %d",
+ system_info_ptr->systemInfo,
+ system_info_ptr->nextLeapSecondInfo_valid,
+ system_info_ptr->nextLeapSecondInfo.gpsTimeCurrent_valid,
+ system_info_ptr->nextLeapSecondInfo.gpsTimeCurrent.gpsWeek,
+ system_info_ptr->nextLeapSecondInfo.gpsTimeCurrent.gpsTimeOfWeekMs,
+ system_info_ptr->nextLeapSecondInfo.leapSecondsCurrent_valid,
+ system_info_ptr->nextLeapSecondInfo.leapSecondsCurrent,
+ system_info_ptr->nextLeapSecondInfo.gpsTimeNextLsEvent_valid,
+ system_info_ptr->nextLeapSecondInfo.gpsTimeNextLsEvent.gpsWeek,
+ system_info_ptr->nextLeapSecondInfo.gpsTimeNextLsEvent.gpsTimeOfWeekMs,
+ system_info_ptr->nextLeapSecondInfo.leapSecondsNext_valid,
+ system_info_ptr->nextLeapSecondInfo.leapSecondsNext);
+
+ LocationSystemInfo systemInfo = {};
+ if ((system_info_ptr->systemInfo == eQMI_LOC_NEXT_LEAP_SECOND_INFO_V02) &&
+ (system_info_ptr->nextLeapSecondInfo_valid == 1)) {
+
+ const qmiLocNextLeapSecondInfoStructT_v02 &nextLeapSecondInfo =
+ system_info_ptr->nextLeapSecondInfo;
+
+ if (nextLeapSecondInfo.gpsTimeNextLsEvent_valid &&
+ nextLeapSecondInfo.leapSecondsCurrent_valid &&
+ nextLeapSecondInfo.leapSecondsNext_valid) {
+
+ systemInfo.systemInfoMask |= LOCATION_SYS_INFO_LEAP_SECOND;
+ systemInfo.leapSecondSysInfo.leapSecondInfoMask |=
+ LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT;
+
+ LeapSecondChangeInfo &leapSecondChangeInfo =
+ systemInfo.leapSecondSysInfo.leapSecondChangeInfo;
+ leapSecondChangeInfo.gpsTimestampLsChange.systemWeek =
+ nextLeapSecondInfo.gpsTimeNextLsEvent.gpsWeek;
+ leapSecondChangeInfo.gpsTimestampLsChange.systemMsec =
+ nextLeapSecondInfo.gpsTimeNextLsEvent.gpsTimeOfWeekMs;
+ leapSecondChangeInfo.gpsTimestampLsChange.validityMask =
+ (GNSS_SYSTEM_TIME_WEEK_VALID | GNSS_SYSTEM_TIME_WEEK_MS_VALID);
+
+ leapSecondChangeInfo.leapSecondsBeforeChange =
+ nextLeapSecondInfo.leapSecondsCurrent;
+ leapSecondChangeInfo.leapSecondsAfterChange =
+ nextLeapSecondInfo.leapSecondsNext;
+ }
+
+ if (nextLeapSecondInfo.leapSecondsCurrent_valid) {
+ systemInfo.systemInfoMask |= LOCATION_SYS_INFO_LEAP_SECOND;
+ systemInfo.leapSecondSysInfo.leapSecondInfoMask |=
+ LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT;
+ systemInfo.leapSecondSysInfo.leapSecondCurrent =
+ nextLeapSecondInfo.leapSecondsCurrent;
+ }
+ }
+
+ if (systemInfo.systemInfoMask) {
+ LocApiBase::reportLocationSystemInfo(systemInfo);
+ }
+}
+
+void LocApiV02::reportLocationRequestNotification(
+ const qmiLocLocationRequestNotificationIndMsgT_v02* loc_req_notif)
+{
+ GnssNfwNotification notification = {};
+
+ LOC_LOGv("IN: protocolStack=%d"
+ " ,clientStrId_valid=%d"
+ " ,clientStrId=%s"
+ " ,requestor=%d"
+ " ,requestorId=%s"
+ " ,responseType=%d"
+ " ,inEmergencyMode=%d"
+ " ,isCachedLocation=%u",
+ loc_req_notif->protocolStack,
+ loc_req_notif->clientStrId_valid,
+ loc_req_notif->clientStrId,
+ loc_req_notif->requestor,
+ loc_req_notif->requestorId,
+ loc_req_notif->responseType,
+ loc_req_notif->inEmergencyMode,
+ loc_req_notif->isCachedLocation);
+
+ switch (loc_req_notif->protocolStack) {
+ case eQMI_LOC_CTRL_PLANE_V02:
+ notification.protocolStack = GNSS_NFW_CTRL_PLANE;
+ break;
+ case eQMI_LOC_SUPL_V02:
+ notification.protocolStack = GNSS_NFW_SUPL;
+ break;
+ case eQMI_LOC_IMS_V02:
+ notification.protocolStack = GNSS_NFW_IMS;
+ break;
+ case eQMI_LOC_SIM_V02:
+ notification.protocolStack = GNSS_NFW_SIM;
+ break;
+ case eQMI_LOC_MDT_V02:
+ case eQMI_LOC_TLOC_V02:
+ case eQMI_LOC_OTHER_V02:
+ default:
+ notification.protocolStack = GNSS_NFW_OTHER_PROTOCOL_STACK;
+ if (loc_req_notif->clientStrId_valid) {
+ strlcpy(notification.otherProtocolStackName,
+ loc_req_notif->clientStrId,
+ sizeof(notification.otherProtocolStackName));
+ } else {
+ strlcpy(notification.otherProtocolStackName,
+ "NFW Client",
+ sizeof(notification.otherProtocolStackName));
+ }
+ break;
+ }
+ switch (loc_req_notif->requestor) {
+ case eQMI_LOC_REQUESTOR_CARRIER_V02:
+ notification.requestor = GNSS_NFW_CARRIER;
+ break;
+ case eQMI_LOC_REQUESTOR_OEM_V02:
+ notification.requestor = GNSS_NFW_OEM;
+ break;
+ case eQMI_LOC_REQUESTOR_MODEM_CHIPSET_VENDOR_V02:
+ notification.requestor = GNSS_NFW_MODEM_CHIPSET_VENDOR;
+ break;
+ case eQMI_LOC_REQUESTOR_GNSS_CHIPSET_VENDOR_V02:
+ notification.requestor = GNSS_NFW_GNSS_CHIPSET_VENDOR;
+ break;
+ case eQMI_LOC_REQUESTOR_OTHER_CHIPSET_VENDOR_V02:
+ notification.requestor = GNSS_NFW_OTHER_CHIPSET_VENDOR;
+ break;
+ case eQMI_LOC_REQUESTOR_AUTOMOBILE_CLIENT_V02:
+ notification.requestor = GNSS_NFW_AUTOMOBILE_CLIENT;
+ break;
+ case eQMI_LOC_REQUESTOR_OTHER_V02:
+ default:
+ notification.requestor = GNSS_NFW_OTHER_REQUESTOR;
+ break;
+ }
+ switch (loc_req_notif->responseType) {
+ case eQMI_LOC_REJECTED_V02:
+ notification.responseType = GNSS_NFW_REJECTED;
+ break;
+ case eQMI_LOC_ACCEPTED_NO_LOCATION_PROVIDED_V02:
+ notification.responseType = GNSS_NFW_ACCEPTED_NO_LOCATION_PROVIDED;
+ break;
+ case eQMI_LOC_ACCEPTED_LOCATION_PROVIDED_V02:
+ notification.responseType = GNSS_NFW_ACCEPTED_LOCATION_PROVIDED;
+ break;
+ }
+ notification.inEmergencyMode = (bool)loc_req_notif->inEmergencyMode;
+ notification.isCachedLocation = (bool)loc_req_notif->isCachedLocation;
+
+ bool isImpossibleScenario = false;
+ // we need to reject various impossible scenarios
+ if (notification.inEmergencyMode) {
+ if (notification.protocolStack != GNSS_NFW_CTRL_PLANE &&
+ notification.protocolStack != GNSS_NFW_SUPL) {
+ isImpossibleScenario = true;
+ LOC_LOGe("inEmergencyMode is true, but protocolStack=%d",
+ notification.protocolStack);
+ }
+ if (GNSS_NFW_REJECTED == notification.responseType) {
+ isImpossibleScenario = true;
+ LOC_LOGe("inEmergencyMode is true, but responseType is REJECTED");
+ }
+ } else {
+ // requestorId is "" for emergency
+ strlcpy(notification.requestorId,
+ loc_req_notif->requestorId,
+ sizeof(notification.requestorId));
+ // proxyAppPackageName is "" for emergency
+ strlcpy(notification.proxyAppPackageName,
+ ContextBase::mGps_conf.PROXY_APP_PACKAGE_NAME,
+ sizeof(notification.proxyAppPackageName));
+ }
+
+ if (!isImpossibleScenario) {
+ LOC_LOGv("OUT: proxyAppPackageName=%s"
+ " ,protocolStack=%d"
+ " ,otherProtocolStackName=%s"
+ " ,requestor=%d"
+ " ,requestorId=%s"
+ " ,responseType=%d"
+ " ,inEmergencyMode=%d"
+ " ,isCachedLocation=%u",
+ notification.proxyAppPackageName,
+ notification.protocolStack,
+ notification.otherProtocolStackName,
+ notification.requestor,
+ notification.requestorId,
+ notification.responseType,
+ notification.inEmergencyMode,
+ notification.isCachedLocation);
+
+ LocApiBase::sendNfwNotification(notification);
+ }
+}
+
+/* convert engine state report to loc eng format and send the converted
+ report to loc eng */
+void LocApiV02 :: reportEngineState (
+ const qmiLocEventEngineStateIndMsgT_v02 *engine_state_ptr)
+{
+
+ LOC_LOGV("%s:%d]: state = %d\n", __func__, __LINE__,
+ engine_state_ptr->engineState);
+
+ struct MsgUpdateEngineState : public LocMsg {
+ LocApiV02* mpLocApiV02;
+ bool mEngineOn;
+ inline MsgUpdateEngineState(LocApiV02* pLocApiV02, bool engineOn) :
+ LocMsg(), mpLocApiV02(pLocApiV02), mEngineOn(engineOn) {}
+ inline virtual void proc() const {
+
+ // Call registerEventMask so that if qmi mask has changed,
+ // it will register the new qmi mask to the modem
+ mpLocApiV02->mEngineOn = mEngineOn;
+ mpLocApiV02->registerEventMask(mpLocApiV02->mMask);
+
+ if (!mEngineOn) {
+ for (auto resender : mpLocApiV02->mResenders) {
+ LOC_LOGV("%s:%d]: resend failed command.", __func__, __LINE__);
+ resender();
+ }
+ mpLocApiV02->mResenders.clear();
+ }
+ }
+ };
+
+ if (eQMI_LOC_ENGINE_STATE_ON_V02 == engine_state_ptr->engineState) {
+ sendMsg(new MsgUpdateEngineState(this, true));
+ }
+ else if (eQMI_LOC_ENGINE_STATE_OFF_V02 == engine_state_ptr->engineState) {
+ sendMsg(new MsgUpdateEngineState(this, false));
+ }
+
+}
+
+/* convert fix session state report to loc eng format and send the converted
+ report to loc eng */
+void LocApiV02 :: reportFixSessionState (
+ const qmiLocEventFixSessionStateIndMsgT_v02 *fix_session_state_ptr)
+{
+ LocGpsStatusValue status;
+ LOC_LOGD("%s:%d]: state = %d\n", __func__, __LINE__,
+ fix_session_state_ptr->sessionState);
+
+ status = LOC_GPS_STATUS_NONE;
+ if (fix_session_state_ptr->sessionState == eQMI_LOC_FIX_SESSION_STARTED_V02)
+ {
+ status = LOC_GPS_STATUS_SESSION_BEGIN;
+ }
+ else if (fix_session_state_ptr->sessionState
+ == eQMI_LOC_FIX_SESSION_FINISHED_V02)
+ {
+ status = LOC_GPS_STATUS_SESSION_END;
+ }
+ reportStatus(status);
+}
+
+/* convert NMEA report to loc eng format and send the converted
+ report to loc eng */
+void LocApiV02 :: reportNmea (
+ const qmiLocEventNmeaIndMsgT_v02 *nmea_report_ptr)
+{
+ if (NULL == nmea_report_ptr) {
+ return;
+ }
+
+ const char* p_nmea = NULL;
+ uint32_t q_nmea_len = 0;
+
+ if (nmea_report_ptr->expandedNmea_valid) {
+ p_nmea = nmea_report_ptr->expandedNmea;
+ q_nmea_len = strlen(nmea_report_ptr->expandedNmea);
+ if (q_nmea_len > QMI_LOC_EXPANDED_NMEA_STRING_MAX_LENGTH_V02) {
+ q_nmea_len = QMI_LOC_EXPANDED_NMEA_STRING_MAX_LENGTH_V02;
+ }
+ }
+ else
+ {
+ p_nmea = nmea_report_ptr->nmea;
+ q_nmea_len = strlen(nmea_report_ptr->nmea);
+ if (q_nmea_len > QMI_LOC_NMEA_STRING_MAX_LENGTH_V02) {
+ q_nmea_len = QMI_LOC_NMEA_STRING_MAX_LENGTH_V02;
+ }
+ }
+
+ if ((NULL != p_nmea) && (q_nmea_len > 0)) {
+ LocApiBase::reportNmea(p_nmea, q_nmea_len);
+ }
+}
+
+/* convert and report an ATL request to loc engine */
+void LocApiV02 :: reportAtlRequest(
+ const qmiLocEventLocationServerConnectionReqIndMsgT_v02 * server_request_ptr)
+{
+ uint32_t connHandle = server_request_ptr->connHandle;
+
+ if (server_request_ptr->requestType == eQMI_LOC_SERVER_REQUEST_OPEN_V02)
+ {
+ LocAGpsType agpsType = LOC_AGPS_TYPE_ANY;
+ LocApnTypeMask apnTypeMask = 0;
+
+ switch (server_request_ptr->wwanType)
+ {
+ case eQMI_LOC_WWAN_TYPE_INTERNET_V02:
+ agpsType = LOC_AGPS_TYPE_WWAN_ANY;
+ break;
+ case eQMI_LOC_WWAN_TYPE_AGNSS_V02:
+ agpsType = LOC_AGPS_TYPE_SUPL;
+ break;
+ case eQMI_LOC_WWAN_TYPE_AGNSS_EMERGENCY_V02:
+ agpsType = LOC_AGPS_TYPE_SUPL_ES;
+ break;
+ default:
+ agpsType = LOC_AGPS_TYPE_WWAN_ANY;
+ break;
+ }
+
+ if (server_request_ptr->apnTypeMask_valid) {
+ apnTypeMask = convertQmiLocApnTypeMask(server_request_ptr->apnTypeMask);
+ }
+ LOC_LOGd("handle=%d agpsType=0x%X apnTypeMask=0x%X",
+ connHandle, agpsType, apnTypeMask);
+ requestATL(connHandle, agpsType, apnTypeMask);
+ }
+ // service the ATL close request
+ else if (server_request_ptr->requestType == eQMI_LOC_SERVER_REQUEST_CLOSE_V02)
+ {
+ releaseATL(connHandle);
+ }
+}
+
+/* conver the NI report to loc eng format and send t loc engine */
+void LocApiV02 :: reportNiRequest(
+ const qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *ni_req_ptr)
+{
+ GnssNiNotification notif = {};
+ notif.messageEncoding = GNSS_NI_ENCODING_TYPE_NONE ;
+ notif.requestorEncoding = GNSS_NI_ENCODING_TYPE_NONE;
+ notif.timeoutResponse = GNSS_NI_RESPONSE_NO_RESPONSE;
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME;
+
+ /* Handle Vx request */
+ if (1 == ni_req_ptr->NiVxInd_valid) {
+ const qmiLocNiVxNotifyVerifyStructT_v02 *vx_req = &(ni_req_ptr->NiVxInd);
+
+ notif.type = GNSS_NI_TYPE_VOICE;
+
+ // Requestor ID, the requestor id recieved is NULL terminated
+ hexcode(notif.requestor, sizeof notif.requestor,
+ (char *)vx_req->requestorId, vx_req->requestorId_len );
+ }
+
+ /* Handle UMTS CP request*/
+ else if (1 == ni_req_ptr->NiUmtsCpInd_valid) {
+ const qmiLocNiUmtsCpNotifyVerifyStructT_v02 *umts_cp_req =
+ &ni_req_ptr->NiUmtsCpInd;
+
+ notif.type = GNSS_NI_TYPE_CONTROL_PLANE;
+
+ /* notificationText should always be a NULL terminated string */
+ hexcode(notif.message, sizeof notif.message,
+ (char *)umts_cp_req->notificationText,
+ umts_cp_req->notificationText_len);
+
+ /* Store requestor ID */
+ hexcode(notif.requestor, sizeof(notif.requestor),
+ (char *)umts_cp_req->requestorId.codedString,
+ umts_cp_req->requestorId.codedString_len);
+
+ /* convert encodings */
+ notif.messageEncoding = convertNiEncoding(umts_cp_req->dataCodingScheme);
+
+ notif.requestorEncoding =
+ convertNiEncoding(umts_cp_req->requestorId.dataCodingScheme);
+
+ /* LCS address (using extras field) */
+ if (0 != umts_cp_req->clientAddress_len) {
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+
+ // Copy LCS Address into notif.extras in the format: Address = 012345
+ strlcat(notif.extras, LOC_NI_NOTIF_KEY_ADDRESS, sizeof (notif.extras));
+ strlcat(notif.extras, " = ", sizeof notif.extras);
+ int addr_len = 0;
+ const char *address_source = NULL;
+ address_source = (char *)umts_cp_req->clientAddress;
+ // client Address is always NULL terminated
+ addr_len = decodeAddress(lcs_addr, sizeof(lcs_addr), address_source,
+ umts_cp_req->clientAddress_len);
+
+ // The address is ASCII string
+ if (addr_len) {
+ strlcat(notif.extras, lcs_addr, sizeof notif.extras);
+ }
+ }
+ } else if (1 == ni_req_ptr->NiSuplInd_valid) {
+ const qmiLocNiSuplNotifyVerifyStructT_v02 *supl_req =
+ &ni_req_ptr->NiSuplInd;
+
+ notif.type = GNSS_NI_TYPE_SUPL;
+
+ // Client name
+ if (supl_req->valid_flags & QMI_LOC_SUPL_CLIENT_NAME_MASK_V02) {
+ hexcode(notif.message, sizeof(notif.message),
+ (char *)supl_req->clientName.formattedString,
+ supl_req->clientName.formattedString_len);
+ LOC_LOGv("SUPL NI: client_name: %s \n", notif.message);
+ } else {
+ LOC_LOGv("SUPL NI: client_name not present.");
+ }
+
+ // Requestor ID
+ if (supl_req->valid_flags & QMI_LOC_SUPL_REQUESTOR_ID_MASK_V02) {
+ hexcode(notif.requestor, sizeof notif.requestor,
+ (char*)supl_req->requestorId.formattedString,
+ supl_req->requestorId.formattedString_len);
+
+ LOC_LOGv("SUPL NI: requestor: %s", notif.requestor);
+ } else {
+ LOC_LOGv("SUPL NI: requestor not present.");
+ }
+
+ // Encoding type
+ if (supl_req->valid_flags & QMI_LOC_SUPL_DATA_CODING_SCHEME_MASK_V02) {
+ notif.messageEncoding = convertNiEncoding(supl_req->dataCodingScheme);
+ notif.requestorEncoding = convertNiEncoding(supl_req->dataCodingScheme);
+ } else {
+ notif.messageEncoding = notif.requestorEncoding = GNSS_NI_ENCODING_TYPE_NONE;
+ }
+
+ // ES SUPL
+ if (1 == ni_req_ptr->suplEmergencyNotification_valid) {
+ const qmiLocEmergencyNotificationStructT_v02 *supl_emergency_request =
+ &ni_req_ptr->suplEmergencyNotification;
+
+ notif.type = GNSS_NI_TYPE_EMERGENCY_SUPL;
+ }
+ } //ni_req_ptr->NiSuplInd_valid == 1
+ else {
+ LOC_LOGe("unknown request event");
+ return;
+ }
+
+ // Set default_response & notify_flags
+ convertNiNotifyVerifyType(¬if, ni_req_ptr->notificationType);
+
+ qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *ni_req_copy_ptr =
+ (qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *)malloc(sizeof(*ni_req_copy_ptr));
+
+ LocInEmergency emergencyState = ni_req_ptr->isInEmergencySession_valid ?
+ (ni_req_ptr->isInEmergencySession ? LOC_IN_EMERGENCY_SET : LOC_IN_EMERGENCY_NOT_SET) :
+ LOC_IN_EMERGENCY_UNKNOWN;
+ if (NULL != ni_req_copy_ptr) {
+ memcpy(ni_req_copy_ptr, ni_req_ptr, sizeof(*ni_req_copy_ptr));
+ requestNiNotify(notif, (const void*)ni_req_copy_ptr, emergencyState);
+ } else {
+ LOC_LOGe("Error copying NI request");
+ }
+}
+
+/* If Confidence value is less than 68%, then scale the accuracy value to
+ 68%.confidence.*/
+void LocApiV02 :: scaleAccuracyTo68PercentConfidence(
+ const uint8_t confidenceValue,
+ LocGpsLocation &gpsLocation,
+ const bool isCircularUnc)
+{
+ if (confidenceValue < 68)
+ {
+ // Circular uncertainty is at 63%.confidence. Scale factor should be
+ // 1.072(from 63% -> 68%)
+ uint8_t realConfidence = (isCircularUnc) ? 63:confidenceValue;
+ // get scaling value based on 2D% confidence scaling table
+ for (uint8_t iter = 0; iter < CONF_SCALER_ARRAY_MAX; iter++)
+ {
+ if (realConfidence <= confScalers[iter].confidence)
+ {
+ LOC_LOGD("Confidence: %d, Scaler value:%f",
+ realConfidence,confScalers[iter].scaler_to_68);
+ gpsLocation.accuracy *= confScalers[iter].scaler_to_68;
+ break;
+ }
+ }
+ }
+}
+
+/* Report the Xtra Server Url from the modem to HAL*/
+void LocApiV02 :: reportXtraServerUrl(
+ const qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02*
+ server_request_ptr)
+{
+
+ if (server_request_ptr->serverList.serverList_len == 1)
+ {
+ reportXtraServer(server_request_ptr->serverList.serverList[0].serverUrl,
+ "",
+ "",
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02);
+ }
+ else if (server_request_ptr->serverList.serverList_len == 2)
+ {
+ reportXtraServer(server_request_ptr->serverList.serverList[0].serverUrl,
+ server_request_ptr->serverList.serverList[1].serverUrl,
+ "",
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02);
+ }
+ else
+ {
+ reportXtraServer(server_request_ptr->serverList.serverList[0].serverUrl,
+ server_request_ptr->serverList.serverList[1].serverUrl,
+ server_request_ptr->serverList.serverList[2].serverUrl,
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02);
+ }
+
+}
+
+/* convert Ni Encoding type from QMI_LOC to loc eng format */
+GnssNiEncodingType LocApiV02 ::convertNiEncoding(
+ qmiLocNiDataCodingSchemeEnumT_v02 loc_encoding)
+{
+ GnssNiEncodingType enc = GNSS_NI_ENCODING_TYPE_NONE;
+
+ switch (loc_encoding)
+ {
+ case eQMI_LOC_NI_SUPL_UTF8_V02:
+ enc = GNSS_NI_ENCODING_TYPE_UTF8;
+ break;
+ case eQMI_LOC_NI_SUPL_UCS2_V02:
+ enc = GNSS_NI_ENCODING_TYPE_UCS2;
+ break;
+ case eQMI_LOC_NI_SUPL_GSM_DEFAULT_V02:
+ enc = GNSS_NI_ENCODING_TYPE_GSM_DEFAULT;
+ break;
+ case eQMI_LOC_NI_SS_LANGUAGE_UNSPEC_V02:
+ enc = GNSS_NI_ENCODING_TYPE_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
+ break;
+ default:
+ break;
+ }
+
+ return enc;
+}
+
+/*convert NI notify verify type from QMI LOC to loc eng format*/
+bool LocApiV02 :: convertNiNotifyVerifyType (
+ GnssNiNotification *notif,
+ qmiLocNiNotifyVerifyEnumT_v02 notif_priv)
+{
+ switch (notif_priv)
+ {
+ case eQMI_LOC_NI_USER_NO_NOTIFY_NO_VERIFY_V02:
+ notif->options = 0;
+ break;
+
+ case eQMI_LOC_NI_USER_NOTIFY_ONLY_V02:
+ notif->options = GNSS_NI_OPTIONS_NOTIFICATION_BIT;
+ break;
+
+ case eQMI_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP_V02:
+ notif->options = GNSS_NI_OPTIONS_NOTIFICATION_BIT | GNSS_NI_OPTIONS_VERIFICATION_BIT;
+ notif->timeoutResponse = GNSS_NI_RESPONSE_ACCEPT;
+ break;
+
+ case eQMI_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP_V02:
+ notif->options = GNSS_NI_OPTIONS_NOTIFICATION_BIT | GNSS_NI_OPTIONS_VERIFICATION_BIT;
+ notif->timeoutResponse = GNSS_NI_RESPONSE_DENY;
+ break;
+
+ case eQMI_LOC_NI_USER_NOTIFY_VERIFY_PRIVACY_OVERRIDE_V02:
+ notif->options = GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT;
+ break;
+
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+/* convert and report GNSS measurement data to loc eng */
+void LocApiV02::reportGnssMeasurementData(
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr)
+{
+ LOC_LOGv("entering");
+
+ static uint32_t prevRefFCount = 0;
+ static bool newMeasProcessed = false;
+
+ LOC_LOGd("[SvMeas] nHz (%d, %d), SeqNum: %d, MaxMsgNum: %d, "
+ "SvSystem: %d SignalType: %" PRIu64 " MeasValid: %d, #of SV: %d",
+ gnss_measurement_report_ptr.nHzMeasurement_valid,
+ gnss_measurement_report_ptr.nHzMeasurement,
+ gnss_measurement_report_ptr.seqNum,
+ gnss_measurement_report_ptr.maxMessageNum,
+ gnss_measurement_report_ptr.system,
+ gnss_measurement_report_ptr.gnssSignalType,
+ gnss_measurement_report_ptr.svMeasurement_valid,
+ gnss_measurement_report_ptr.svMeasurement_len);
+
+ if (!mGnssMeasurements) {
+ mGnssMeasurements = (GnssMeasurements*)malloc(sizeof(GnssMeasurements));
+ if (!mGnssMeasurements) {
+ LOC_LOGe("Malloc failed to allocate heap memory for mGnssMeasurements");
+ return;
+ }
+ resetSvMeasurementReport();
+ newMeasProcessed = false;
+ }
+
+ if (gnss_measurement_report_ptr.seqNum > gnss_measurement_report_ptr.maxMessageNum) {
+ LOC_LOGe("Invalid seqNum, do not proceed");
+ return;
+ }
+
+ // in case the measurement with seqNum of 1 is dropped, we will use ref count
+ // to reset the measurement
+ if ((gnss_measurement_report_ptr.seqNum == 1) ||
+ (gnss_measurement_report_ptr.systemTimeExt_valid &&
+ gnss_measurement_report_ptr.systemTimeExt.refFCount != prevRefFCount)) {
+ // we have received some valid info since we last reported when
+ // seq num matches with max seq num
+ if (true == newMeasProcessed) {
+ LOC_LOGe ("report due to seq number jump");
+ reportSvMeasurementInternal();
+ resetSvMeasurementReport();
+ newMeasProcessed = false;
+ }
+
+ prevRefFCount = gnss_measurement_report_ptr.systemTimeExt.refFCount;
+ if (gnss_measurement_report_ptr.nHzMeasurement_valid &&
+ gnss_measurement_report_ptr.nHzMeasurement) {
+ mGnssMeasurements->gnssSvMeasurementSet.isNhz = true;
+ }
+ mCounter++;
+ }
+
+ Gnss_LocSvSystemEnumType locSvSystemType =
+ getLocApiSvSystemType(gnss_measurement_report_ptr.system);
+ if (GNSS_LOC_SV_SYSTEM_UNKNOWN == locSvSystemType) {
+ LOC_LOGi("Unknown sv system");
+ return;
+ }
+
+ // set up indication that we have processed some new measurement
+ newMeasProcessed = true;
+
+ convertGnssMeasurementsHeader(locSvSystemType, gnss_measurement_report_ptr);
+
+ // check whether we have valid dgnss measurement
+ bool validDgnssMeas = false;
+ if ((gnss_measurement_report_ptr.dgnssSvMeasurement_valid) &&
+ (gnss_measurement_report_ptr.dgnssSvMeasurement_len != 0)){
+ uint32_t totalSvMeasLen = 0;
+ if (gnss_measurement_report_ptr.svMeasurement_valid) {
+ totalSvMeasLen = gnss_measurement_report_ptr.svMeasurement_len;
+ if (gnss_measurement_report_ptr.extSvMeasurement_valid) {
+ totalSvMeasLen += gnss_measurement_report_ptr.extSvMeasurement_len;
+ }
+ }
+ if (totalSvMeasLen == gnss_measurement_report_ptr.dgnssSvMeasurement_len) {
+ validDgnssMeas = true;
+ }
+ }
+
+ // number of measurements
+ if (gnss_measurement_report_ptr.svMeasurement_valid) {
+ if (gnss_measurement_report_ptr.svMeasurement_len != 0 &&
+ gnss_measurement_report_ptr.svMeasurement_len <= QMI_LOC_SV_MEAS_LIST_MAX_SIZE_V02) {
+ // the array of measurements
+ LOC_LOGv("Measurements received for GNSS system %d",
+ gnss_measurement_report_ptr.system);
+
+ if (0 == mGnssMeasurements->gnssMeasNotification.count) {
+ mAgcIsPresent = true;
+ }
+ for (uint32_t index = 0; index < gnss_measurement_report_ptr.svMeasurement_len &&
+ mGnssMeasurements->gnssMeasNotification.count < GNSS_MEASUREMENTS_MAX;
+ index++) {
+ LOC_LOGv("index=%u count=%" PRIu32,
+ index, mGnssMeasurements->gnssMeasNotification.count);
+ if ((gnss_measurement_report_ptr.svMeasurement[index].validMeasStatusMask &
+ QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_STAT_BIT_VALID_V02) &&
+ (gnss_measurement_report_ptr.svMeasurement[index].measurementStatus &
+ QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_VALID_V02)) {
+ mAgcIsPresent &= convertGnssMeasurements(
+ gnss_measurement_report_ptr,
+ index, false, validDgnssMeas);
+ mGnssMeasurements->gnssMeasNotification.count++;
+ } else {
+ LOC_LOGv("Measurements are stale, do not report");
+ }
+ }
+ LOC_LOGv("there are %d SV measurements now, total=%" PRIu32,
+ gnss_measurement_report_ptr.svMeasurement_len,
+ mGnssMeasurements->gnssMeasNotification.count);
+
+ /* now check if more measurements are available (some constellations such
+ as BDS have more measurements available in extSvMeasurement)
+ */
+ if (gnss_measurement_report_ptr.extSvMeasurement_valid &&
+ gnss_measurement_report_ptr.extSvMeasurement_len != 0 &&
+ gnss_measurement_report_ptr.extSvMeasurement_len <=
+ QMI_LOC_EXT_SV_MEAS_LIST_MAX_SIZE_V02) {
+ // the array of measurements
+ LOC_LOGv("More measurements received for GNSS system %d",
+ gnss_measurement_report_ptr.system);
+ for (uint32_t index = 0; index < gnss_measurement_report_ptr.extSvMeasurement_len &&
+ mGnssMeasurements->gnssMeasNotification.count < GNSS_MEASUREMENTS_MAX;
+ index++) {
+ LOC_LOGv("index=%u count=%" PRIu32, index, mGnssMeasurements->gnssMeasNotification.count);
+ if ((gnss_measurement_report_ptr.extSvMeasurement[index].validMeasStatusMask &
+ QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_STAT_BIT_VALID_V02) &&
+ (gnss_measurement_report_ptr.extSvMeasurement[index].measurementStatus &
+ QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_VALID_V02)) {
+ mAgcIsPresent &= convertGnssMeasurements(
+ gnss_measurement_report_ptr,
+ index, true, validDgnssMeas);
+ mGnssMeasurements->gnssMeasNotification.count++;
+ }
+ else {
+ LOC_LOGv("Measurements are stale, do not report");
+ }
+ }
+ LOC_LOGv("there are %d SV measurements now, total=%" PRIu32,
+ gnss_measurement_report_ptr.extSvMeasurement_len,
+ mGnssMeasurements->gnssMeasNotification.count);
+ }
+ }
+ } else {
+ LOC_LOGv("there is no valid GNSS measurement for system %d, total=%" PRIu32,
+ gnss_measurement_report_ptr.system,
+ mGnssMeasurements->gnssMeasNotification.count);
+ }
+ // the GPS clock time reading
+ if (eQMI_LOC_SV_SYSTEM_GPS_V02 == gnss_measurement_report_ptr.system &&
+ false == mGPSreceived) {
+ mGPSreceived = true;
+ mMsInWeek = convertGnssClock(mGnssMeasurements->gnssMeasNotification.clock,
+ gnss_measurement_report_ptr);
+ }
+
+ if (gnss_measurement_report_ptr.maxMessageNum == gnss_measurement_report_ptr.seqNum) {
+ LOC_LOGv("Report the measurements to the upper layer");
+ if (gnss_measurement_report_ptr.refCountTicks_valid &&
+ gnss_measurement_report_ptr.refCountTicksUnc_valid) {
+ /* deal with Qtimer for ElapsedRealTimeNanos */
+
+ mGnssMeasurements->gnssMeasNotification.clock.flags |=
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT;
+
+ mGnssMeasurements->gnssMeasNotification.clock.elapsedRealTime =
+ gnss_measurement_report_ptr.refCountTicks;
+
+ /* Uncertainty on HLOS time is 0, so the uncertainty of the difference
+ is the uncertainty of the Qtimer in the modem */
+ mGnssMeasurements->gnssMeasNotification.clock.elapsedRealTimeUnc =
+ qTimerTicksToNanos((double)gnss_measurement_report_ptr.refCountTicksUnc);
+ }
+ reportSvMeasurementInternal();
+ resetSvMeasurementReport();
+ // set up flag to indicate that no new info in mGnssMeasurements
+ newMeasProcessed = false;
+ }
+}
+
+
+void LocApiV02 ::reportSvMeasurementInternal() {
+
+ if (mGnssMeasurements) {
+ // calling the base
+ if (mAgcIsPresent) {
+ /* If we can get AGC from QMI LOC there is no need to get it from NMEA */
+ mMsInWeek = -1;
+ }
+ // now remove all the elements in the vector which are not for current epoch
+ if (mADRdata.size() > 0) {
+ auto front = mADRdata.begin();
+ for (auto back = mADRdata.end(); front != back;) {
+ if (mCounter != front->counter) {
+ --back;
+ swap(*front, *back);
+ } else {
+ front++;
+ }
+ }
+ if (front != mADRdata.end()) {
+ mADRdata.erase(front, mADRdata.end());
+ }
+ }
+
+ mGnssMeasurements->gnssSvMeasurementSet.svMeasCount = mGnssMeasurements->gnssMeasNotification.count;
+ GnssSvMeasurementHeader &svMeasSetHead =
+ mGnssMeasurements->gnssSvMeasurementSet.svMeasSetHeader;
+
+ // when we received the last sequence, timestamp the packet with AP time
+ struct timespec apTimestamp;
+ if (clock_gettime(CLOCK_BOOTTIME, &apTimestamp)== 0) {
+ svMeasSetHead.apBootTimeStamp.apTimeStamp.tv_sec = apTimestamp.tv_sec;
+ svMeasSetHead.apBootTimeStamp.apTimeStamp.tv_nsec = apTimestamp.tv_nsec;
+
+ // use the time uncertainty configured in gps.conf
+ svMeasSetHead.apBootTimeStamp.apTimeStampUncertaintyMs =
+ (float)ap_timestamp_uncertainty;
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_AP_TIMESTAMP;
+
+ LOC_LOGD("%s:%d QMI_MeasPacketTime %u (sec) %u (nsec)",__func__,__LINE__,
+ svMeasSetHead.apBootTimeStamp.apTimeStamp.tv_sec,
+ svMeasSetHead.apBootTimeStamp.apTimeStamp.tv_nsec);
+ }
+ else {
+ svMeasSetHead.apBootTimeStamp.apTimeStampUncertaintyMs = FLT_MAX;
+ LOC_LOGE("%s:%d Error in clock_gettime() ",__func__, __LINE__);
+ }
+
+ LOC_LOGd("report %d sv in sv meas",
+ mGnssMeasurements->gnssMeasNotification.count);
+
+ LocApiBase::reportGnssMeasurements(*mGnssMeasurements, mMsInWeek);
+ }
+}
+
+void LocApiV02::convertGnssMeasurementsHeader(const Gnss_LocSvSystemEnumType locSvSystemType,
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info)
+{
+ GnssSvMeasurementHeader &svMeasSetHead =
+ mGnssMeasurements->gnssSvMeasurementSet.svMeasSetHeader;
+
+ // The refCountTicks for each constellation sent for one meas report is the same
+ // always. It does not matter if it gets overwritten.
+ if (gnss_measurement_info.refCountTicks_valid) {
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS;
+ svMeasSetHead.refCountTicks = gnss_measurement_info.refCountTicks;
+ }
+
+ // clock frequency
+ if (1 == gnss_measurement_info.rcvrClockFrequencyInfo_valid) {
+ const qmiLocRcvrClockFrequencyInfoStructT_v02* rcvClockFreqInfo =
+ &gnss_measurement_info.rcvrClockFrequencyInfo;
+
+ svMeasSetHead.clockFreq.size = sizeof(Gnss_LocRcvrClockFrequencyInfoStructType);
+ svMeasSetHead.clockFreq.clockDrift =
+ gnss_measurement_info.rcvrClockFrequencyInfo.clockDrift;
+ svMeasSetHead.clockFreq.clockDriftUnc =
+ gnss_measurement_info.rcvrClockFrequencyInfo.clockDriftUnc;
+ svMeasSetHead.clockFreq.sourceOfFreq = (Gnss_LocSourceofFreqEnumType)
+ gnss_measurement_info.rcvrClockFrequencyInfo.sourceOfFreq;
+
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_CLOCK_FREQ;
+ LOC_LOGv("FreqInfo:: Drift: %f, DriftUnc: %f, sourceoffreq: %d",
+ svMeasSetHead.clockFreq.clockDrift, svMeasSetHead.clockFreq.clockDriftUnc,
+ svMeasSetHead.clockFreq.sourceOfFreq);
+ }
+
+ if ((1 == gnss_measurement_info.leapSecondInfo_valid) &&
+ (0 == gnss_measurement_info.leapSecondInfo.leapSecUnc)) {
+
+ qmiLocLeapSecondInfoStructT_v02* leapSecond =
+ (qmiLocLeapSecondInfoStructT_v02*)&gnss_measurement_info.leapSecondInfo;
+
+ svMeasSetHead.leapSec.size = sizeof(Gnss_LeapSecondInfoStructType);
+ svMeasSetHead.leapSec.leapSec = gnss_measurement_info.leapSecondInfo.leapSec;
+ svMeasSetHead.leapSec.leapSecUnc = gnss_measurement_info.leapSecondInfo.leapSecUnc;
+
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND;
+ LOC_LOGV("leapSecondInfo:: leapSec: %d, leapSecUnc: %d",
+ svMeasSetHead.leapSec.leapSec, svMeasSetHead.leapSec.leapSecUnc);
+ }
+
+ if (1 == gnss_measurement_info.gpsGloInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.gpsGloInterSystemBias;
+
+ getInterSystemTimeBias("gpsGloInterSystemBias",
+ svMeasSetHead.gpsGloInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GPS_GLO_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.gpsBdsInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.gpsBdsInterSystemBias;
+
+ getInterSystemTimeBias("gpsBdsInterSystemBias",
+ svMeasSetHead.gpsBdsInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GPS_BDS_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.gpsGalInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.gpsGalInterSystemBias;
+
+ getInterSystemTimeBias("gpsGalInterSystemBias",
+ svMeasSetHead.gpsGalInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GPS_GAL_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.bdsGloInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.bdsGloInterSystemBias;
+
+ getInterSystemTimeBias("bdsGloInterSystemBias",
+ svMeasSetHead.bdsGloInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_BDS_GLO_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.galGloInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.galGloInterSystemBias;
+
+ getInterSystemTimeBias("galGloInterSystemBias",
+ svMeasSetHead.galGloInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GAL_GLO_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.galBdsInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.galBdsInterSystemBias;
+
+ getInterSystemTimeBias("galBdsInterSystemBias",
+ svMeasSetHead.galBdsInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GAL_BDS_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.gpsNavicInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.gpsNavicInterSystemBias;
+
+ getInterSystemTimeBias("gpsNavicInterSystemBias",
+ svMeasSetHead.gpsNavicInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GPS_NAVIC_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.galNavicInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.galNavicInterSystemBias;
+
+ getInterSystemTimeBias("galNavicInterSystemBias",
+ svMeasSetHead.galNavicInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GAL_NAVIC_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.gloNavicInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.gloNavicInterSystemBias;
+
+ getInterSystemTimeBias("gloNavicInterSystemBias",
+ svMeasSetHead.gloNavicInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GLO_NAVIC_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.bdsNavicInterSystemBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.bdsNavicInterSystemBias;
+
+ getInterSystemTimeBias("bdsNavicInterSystemBias",
+ svMeasSetHead.bdsNavicInterSystemBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_BDS_NAVIC_INTER_SYSTEM_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.GpsL1L5TimeBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.GpsL1L5TimeBias;
+
+ getInterSystemTimeBias("gpsL1L5TimeBias",
+ svMeasSetHead.gpsL1L5TimeBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GPSL1L5_TIME_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.GalE1E5aTimeBias_valid) {
+ qmiLocInterSystemBiasStructT_v02* interSystemBias =
+ (qmiLocInterSystemBiasStructT_v02*)&gnss_measurement_info.GalE1E5aTimeBias;
+
+ getInterSystemTimeBias("galE1E5aTimeBias",
+ svMeasSetHead.galE1E5aTimeBias, interSystemBias);
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GALE1E5A_TIME_BIAS;
+ }
+
+ if (1 == gnss_measurement_info.gloTime_valid) {
+ GnssGloTimeStructType & gloSystemTime = svMeasSetHead.gloSystemTime;
+
+ gloSystemTime.gloFourYear = gnss_measurement_info.gloTime.gloFourYear;
+ gloSystemTime.gloDays = gnss_measurement_info.gloTime.gloDays;
+ gloSystemTime.gloMsec = gnss_measurement_info.gloTime.gloMsec;
+ gloSystemTime.gloClkTimeBias = gnss_measurement_info.gloTime.gloClkTimeBias;
+ gloSystemTime.gloClkTimeUncMs = gnss_measurement_info.gloTime.gloClkTimeUncMs;
+ gloSystemTime.validityMask |= (GNSS_GLO_FOUR_YEAR_VALID |
+ GNSS_CLO_DAYS_VALID |
+ GNSS_GLO_MSEC_VALID |
+ GNSS_GLO_CLK_TIME_BIAS_VALID |
+ GNSS_GLO_CLK_TIME_BIAS_UNC_VALID);
+
+ if (gnss_measurement_info.systemTimeExt_valid) {
+ gloSystemTime.refFCount = gnss_measurement_info.systemTimeExt.refFCount;
+ gloSystemTime.validityMask |= GNSS_GLO_REF_FCOUNT_VALID;
+ }
+
+ if (gnss_measurement_info.numClockResets_valid) {
+ gloSystemTime.numClockResets = gnss_measurement_info.numClockResets;
+ gloSystemTime.validityMask |= GNSS_GLO_NUM_CLOCK_RESETS_VALID;
+ }
+
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME;
+ }
+
+ if ((1 == gnss_measurement_info.systemTime_valid) ||
+ (1 == gnss_measurement_info.systemTimeExt_valid)) {
+
+ GnssSystemTimeStructType* systemTimePtr = nullptr;
+ Gnss_LocGnssTimeExtStructType* systemTimeExtPtr = nullptr;
+ GpsSvMeasHeaderFlags systemTimeFlags = 0x0;
+ GpsSvMeasHeaderFlags systemTimeExtFlags = 0x0;
+
+ switch (locSvSystemType) {
+ case GNSS_LOC_SV_SYSTEM_GPS:
+ systemTimePtr = &svMeasSetHead.gpsSystemTime;
+ systemTimeExtPtr = &svMeasSetHead.gpsSystemTimeExt;
+ systemTimeFlags = GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME;
+ systemTimeExtFlags = GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME_EXT;
+ break;
+ case GNSS_LOC_SV_SYSTEM_GALILEO:
+ systemTimePtr = &svMeasSetHead.galSystemTime;
+ systemTimeExtPtr = &svMeasSetHead.galSystemTimeExt;
+ systemTimeFlags = GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME;
+ systemTimeExtFlags = GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME_EXT;
+ break;
+ case GNSS_LOC_SV_SYSTEM_BDS:
+ systemTimePtr = &svMeasSetHead.bdsSystemTime;
+ systemTimeExtPtr = &svMeasSetHead.bdsSystemTimeExt;
+ systemTimeFlags = GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME;
+ systemTimeExtFlags = GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME_EXT;
+ break;
+ case GNSS_LOC_SV_SYSTEM_QZSS:
+ systemTimePtr = &svMeasSetHead.qzssSystemTime;
+ systemTimeExtPtr = &svMeasSetHead.qzssSystemTimeExt;
+ systemTimeFlags = GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME;
+ systemTimeExtFlags = GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME_EXT;
+ break;
+ case GNSS_LOC_SV_SYSTEM_GLONASS:
+ systemTimeExtPtr = &svMeasSetHead.gloSystemTimeExt;
+ systemTimeExtFlags = GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME_EXT;
+ break;
+ case GNSS_LOC_SV_SYSTEM_NAVIC:
+ systemTimePtr = &svMeasSetHead.navicSystemTime;
+ systemTimeExtPtr = &svMeasSetHead.navicSystemTimeExt;
+ systemTimeFlags = GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME;
+ systemTimeExtFlags = GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME_EXT;
+ break;
+ default:
+ break;
+ }
+
+ if (systemTimePtr) {
+ if (gnss_measurement_info.systemTime_valid) {
+ systemTimePtr->systemWeek =
+ gnss_measurement_info.systemTime.systemWeek;
+ systemTimePtr->systemMsec =
+ gnss_measurement_info.systemTime.systemMsec;
+ systemTimePtr->systemClkTimeBias =
+ gnss_measurement_info.systemTime.systemClkTimeBias;
+ systemTimePtr->systemClkTimeUncMs =
+ gnss_measurement_info.systemTime.systemClkTimeUncMs;
+ systemTimePtr->validityMask |= (GNSS_SYSTEM_TIME_WEEK_VALID |
+ GNSS_SYSTEM_TIME_WEEK_MS_VALID |
+ GNSS_SYSTEM_CLK_TIME_BIAS_VALID |
+ GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID);
+ svMeasSetHead.flags |= systemTimeFlags;
+ }
+
+ if (gnss_measurement_info.systemTimeExt_valid) {
+ systemTimePtr->refFCount = gnss_measurement_info.systemTimeExt.refFCount;
+ systemTimePtr->validityMask |= GNSS_SYSTEM_REF_FCOUNT_VALID;
+ svMeasSetHead.flags |= systemTimeFlags;
+ }
+
+ if (gnss_measurement_info.numClockResets_valid) {
+ systemTimePtr->numClockResets = gnss_measurement_info.numClockResets;
+ systemTimePtr->validityMask |= GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID;
+ svMeasSetHead.flags |= systemTimeFlags;
+ }
+ }
+
+ if (systemTimeExtPtr) {
+ if (gnss_measurement_info.systemTimeExt_valid) {
+ systemTimeExtPtr->size = sizeof(Gnss_LocGnssTimeExtStructType);
+
+ systemTimeExtPtr->systemRtc_valid =
+ gnss_measurement_info.systemTimeExt.systemRtc_valid;
+ systemTimeExtPtr->systemRtcMs =
+ gnss_measurement_info.systemTimeExt.systemRtcMs;
+
+ svMeasSetHead.flags |= systemTimeExtFlags;
+ }
+ }
+ }
+
+ if (gnss_measurement_info.dgnssCorrectionSourceT_valid) {
+ svMeasSetHead.dgnssCorrectionSourceType =
+ (LocDgnssCorrectionSourceType)gnss_measurement_info.dgnssCorrectionSourceT;
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_TYPE;
+ }
+ if (gnss_measurement_info.dgnssCorrectionSourceID_valid) {
+ svMeasSetHead.dgnssCorrectionSourceID =
+ gnss_measurement_info.dgnssCorrectionSourceID;
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_ID;
+
+ }
+ if (gnss_measurement_info.dgnssRefStationId_valid) {
+ svMeasSetHead.dgnssRefStationId =
+ gnss_measurement_info.dgnssRefStationId;
+ svMeasSetHead.flags |= GNSS_SV_MEAS_HEADER_HAS_DGNSS_REF_STATION_ID;
+ }
+}
+
+/* convert and report ODCPI request */
+void LocApiV02::requestOdcpi(const qmiLocEventWifiReqIndMsgT_v02& qmiReq)
+{
+ LOC_LOGv("ODCPI Request: requestType %d", qmiReq.requestType);
+
+ OdcpiRequestInfo req = {};
+ req.size = sizeof(OdcpiRequestInfo);
+
+ if (eQMI_LOC_WIFI_START_PERIODIC_HI_FREQ_FIXES_V02 == qmiReq.requestType ||
+ eQMI_LOC_WIFI_START_PERIODIC_KEEP_WARM_V02 == qmiReq.requestType) {
+ req.type = ODCPI_REQUEST_TYPE_START;
+ } else if (eQMI_LOC_WIFI_STOP_PERIODIC_FIXES_V02 == qmiReq.requestType){
+ req.type = ODCPI_REQUEST_TYPE_STOP;
+ } else {
+ LOC_LOGe("Invalid request type");
+ return;
+ }
+
+ if (qmiReq.e911Mode_valid) {
+ req.isEmergencyMode = qmiReq.e911Mode == 1 ? true : false;
+ }
+
+ if (qmiReq.tbfInMs_valid) {
+ req.tbfMillis = qmiReq.tbfInMs;
+ }
+
+ LocApiBase::requestOdcpi(req);
+}
+
+void LocApiV02::wifiStatusInformSync()
+{
+ qmiLocNotifyWifiStatusReqMsgT_v02 wifiStatusReq;
+ memset(&wifiStatusReq, 0, sizeof(wifiStatusReq));
+ wifiStatusReq.wifiStatus = eQMI_LOC_WIFI_STATUS_AVAILABLE_V02;
+
+ LOC_LOGv("Informing wifi status available.");
+ LOC_SEND_SYNC_REQ(NotifyWifiStatus, NOTIFY_WIFI_STATUS, wifiStatusReq);
+}
+
+#define FIRST_BDS_D2_SV_PRN 1
+#define LAST_BDS_D2_SV_PRN 5
+#define IS_BDS_GEO_SV(svId, gnssType) ( ((gnssType == GNSS_SV_TYPE_BEIDOU) && \
+ (svId <= LAST_BDS_D2_SV_PRN) && \
+ (svId >= FIRST_BDS_D2_SV_PRN)) ? true : false )
+
+/*convert GnssMeasurement type from QMI LOC to loc eng format*/
+bool LocApiV02 :: convertGnssMeasurements(
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr,
+ int index, bool isExt, bool validDgnssSvMeas)
+{
+ bool bAgcIsPresent = false;
+ qmiLocSVMeasurementStructT_v02 gnss_measurement_info;
+ uint32_t count = mGnssMeasurements->gnssMeasNotification.count;
+
+ LOC_LOGv("entering extMeas %d, qmi sv index %d, current sv count %d", isExt, index, count);
+ if (isExt) {
+ gnss_measurement_info = gnss_measurement_report_ptr.extSvMeasurement[index];
+ } else {
+ gnss_measurement_info = gnss_measurement_report_ptr.svMeasurement[index];
+ }
+
+ GnssMeasurementsData& measurementData =
+ mGnssMeasurements->gnssMeasNotification.measurements[count];
+
+ Gnss_SVMeasurementStructType& svMeas =
+ mGnssMeasurements->gnssSvMeasurementSet.svMeas[count];
+
+ svMeas.size = sizeof(Gnss_SVMeasurementStructType);
+ svMeas.gnssSystem = getLocApiSvSystemType(gnss_measurement_report_ptr.system);
+ svMeas.gnssSvId = gnss_measurement_info.gnssSvId;
+ svMeas.gloFrequency = gnss_measurement_info.gloFrequency;
+ if (gnss_measurement_report_ptr.gnssSignalType_valid) {
+ svMeas.gnssSignalTypeMask = gnss_measurement_report_ptr.gnssSignalType;
+ }
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_LOSSOFLOCK_VALID_V02) {
+ svMeas.lossOfLock = (bool)gnss_measurement_info.lossOfLock;
+ }
+
+ svMeas.svStatus = (Gnss_LocSvSearchStatusEnumT)gnss_measurement_info.svStatus;
+
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_HEALTH_VALID_V02) {
+ svMeas.healthStatus_valid = 1;
+ svMeas.healthStatus = (uint8_t)gnss_measurement_info.healthStatus;
+ }
+
+ svMeas.svInfoMask = (Gnss_LocSvInfoMaskT)gnss_measurement_info.svInfoMask;
+ svMeas.CNo = gnss_measurement_info.CNo;
+ svMeas.gloRfLoss = gnss_measurement_info.gloRfLoss;
+ svMeas.measLatency = gnss_measurement_info.measLatency;
+
+ // SVTimeSpeed
+ svMeas.svTimeSpeed.size = sizeof(Gnss_LocSVTimeSpeedStructType);
+ svMeas.svTimeSpeed.svMs = gnss_measurement_info.svTimeSpeed.svTimeMs;
+ svMeas.svTimeSpeed.svSubMs = gnss_measurement_info.svTimeSpeed.svTimeSubMs;
+ svMeas.svTimeSpeed.svTimeUncMs = gnss_measurement_info.svTimeSpeed.svTimeUncMs;
+ svMeas.svTimeSpeed.dopplerShift = gnss_measurement_info.svTimeSpeed.dopplerShift;
+ svMeas.svTimeSpeed.dopplerShiftUnc = gnss_measurement_info.svTimeSpeed.dopplerShiftUnc;
+
+ svMeas.validMeasStatusMask = gnss_measurement_info.validMeasStatusMask;
+ qmiLocSvMeasStatusMaskT_v02 measStatus = gnss_measurement_info.measurementStatus;
+ svMeas.measurementStatus = GNSS_LOC_MEAS_STATUS_NULL;
+ // Convert qmiSvMeas.measurementStatus to svMeas.measurementStatus
+ if (QMI_LOC_MASK_MEAS_STATUS_SM_VALID_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_SM_VALID;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_SB_VALID_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_SB_VALID;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_MS_VALID_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_MS_VALID;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_BE_CONFIRM_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_BE_CONFIRM;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_VELOCITY_VALID_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_VELOCITY_VALID;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_VELOCITY_FINE_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_VELOCITY_FINE;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_LP_VALID_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_LP_VALID;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_LP_POS_VALID_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_LP_POS_VALID;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_FROM_RNG_DIFF_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_FROM_VE_DIFF_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF;
+ }
+ if (QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_VALID_V02 & measStatus) {
+ svMeas.measurementStatus |= GNSS_LOC_MEAS_STATUS_GNSS_FRESH_MEAS;
+ }
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_MULTIPATH_EST_VALID_V02) {
+ svMeas.multipathEstValid = 1;
+ svMeas.multipathEstimate = gnss_measurement_info.multipathEstimate;
+ }
+
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_FINE_SPEED_VALID_V02) {
+ svMeas.fineSpeedValid = 1;
+ svMeas.fineSpeed = gnss_measurement_info.fineSpeed;
+ }
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_FINE_SPEED_UNC_VALID_V02) {
+ svMeas.fineSpeedUncValid = 1;
+ svMeas.fineSpeedUnc = gnss_measurement_info.fineSpeedUnc;
+ }
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_CARRIER_PHASE_VALID_V02) {
+ svMeas.carrierPhaseValid = 1;
+ svMeas.carrierPhase = gnss_measurement_info.carrierPhase;
+ }
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_SV_DIRECTION_VALID_V02) {
+ svMeas.svDirectionValid = 1;
+ svMeas.svElevation = gnss_measurement_info.svElevation;
+ svMeas.svAzimuth = gnss_measurement_info.svAzimuth;
+ }
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_CYCLESLIP_COUNT_VALID_V02) {
+ svMeas.cycleSlipCountValid = 1;
+ svMeas.cycleSlipCount = gnss_measurement_info.cycleSlipCount;
+ }
+
+ if (validDgnssSvMeas) {
+ int dgnssSvMeasIndex = index;
+ // adjust the dgnss meas index if we are processing external SV measurement
+ if (isExt) {
+ dgnssSvMeasIndex += gnss_measurement_report_ptr.svMeasurement_len;
+ }
+ const qmiLocDgnssSVMeasurementStructT_v02* dgnss_sv_meas_ptr =
+ &gnss_measurement_report_ptr.dgnssSvMeasurement[dgnssSvMeasIndex];
+ svMeas.dgnssSvMeas.dgnssMeasStatus = (LocSvDgnssMeasStatusMask)
+ dgnss_sv_meas_ptr->dgnssMeasStatus,
+ svMeas.dgnssSvMeas.diffDataEpochTimeMsec =
+ dgnss_sv_meas_ptr->diffDataEpochTimeMsec;
+ svMeas.dgnssSvMeas.prCorrMeters =
+ dgnss_sv_meas_ptr->prCorrMeters;
+ svMeas.dgnssSvMeas.prrCorrMetersPerSec =
+ dgnss_sv_meas_ptr->prrCorrMetersPerSec;
+ }
+
+ if (!isExt) {
+ uint32_t svMeas_len = gnss_measurement_report_ptr.svMeasurement_len;
+ uint32_t svCarPhUnc_len = gnss_measurement_report_ptr.svCarrierPhaseUncertainty_len;
+ if ((1 == gnss_measurement_report_ptr.svCarrierPhaseUncertainty_valid) &&
+ (svMeas_len == svCarPhUnc_len)) {
+ svMeas.carrierPhaseUncValid = 1;
+ svMeas.carrierPhaseUnc =
+ gnss_measurement_report_ptr.svCarrierPhaseUncertainty[index];
+ }
+ } else {
+ uint32_t extSvMeas_len = gnss_measurement_report_ptr.extSvMeasurement_len;
+ uint32_t extSvCarPhUnc_len = gnss_measurement_report_ptr.extSvCarrierPhaseUncertainty_len;
+ if ((1 == gnss_measurement_report_ptr.extSvCarrierPhaseUncertainty_valid) &&
+ (extSvMeas_len == extSvCarPhUnc_len)) {
+ svMeas.carrierPhaseUncValid = 1;
+ svMeas.carrierPhaseUnc =
+ gnss_measurement_report_ptr.extSvCarrierPhaseUncertainty[index];
+ }
+ }
+
+ // size
+ measurementData.size = sizeof(GnssMeasurementsData);
+
+ // flag initiation
+ measurementData.flags = 0;
+
+ // svid
+ measurementData.svId = gnss_measurement_info.gnssSvId;
+
+ // constellation
+ switch (gnss_measurement_report_ptr.system)
+ {
+ case eQMI_LOC_SV_SYSTEM_GPS_V02:
+ measurementData.svType = GNSS_SV_TYPE_GPS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_GALILEO_V02:
+ measurementData.svType = GNSS_SV_TYPE_GALILEO;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_SBAS_V02:
+ measurementData.svType = GNSS_SV_TYPE_SBAS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_GLONASS_V02:
+ measurementData.svType = GNSS_SV_TYPE_GLONASS;
+ measurementData.gloFrequency = gnss_measurement_info.gloFrequency;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_BDS_V02:
+ measurementData.svType = GNSS_SV_TYPE_BEIDOU;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_QZSS_V02:
+ measurementData.svType = GNSS_SV_TYPE_QZSS;
+ break;
+
+ case eQMI_LOC_SV_SYSTEM_NAVIC_V02:
+ measurementData.svType = GNSS_SV_TYPE_NAVIC;
+ break;
+
+ default:
+ measurementData.svType = GNSS_SV_TYPE_UNKNOWN;
+ break;
+ }
+
+ // time_offset_ns
+ if (0 != gnss_measurement_info.measLatency)
+ {
+ LOC_LOGV("%s:%d]: measLatency is not 0\n", __func__, __LINE__);
+ }
+ measurementData.timeOffsetNs = 0.0;
+
+ // stateMask & receivedSvTimeNs & received_gps_tow_uncertainty_ns
+ uint64_t validMeasStatus = gnss_measurement_info.measurementStatus &
+ gnss_measurement_info.validMeasStatusMask;
+ uint64_t bitSynMask = QMI_LOC_MASK_MEAS_STATUS_BE_CONFIRM_V02 |
+ QMI_LOC_MASK_MEAS_STATUS_SB_VALID_V02;
+ double gpsTowUncNs = (double)gnss_measurement_info.svTimeSpeed.svTimeUncMs * 1e6;
+
+ bool bBandNotAvailable = !gnss_measurement_report_ptr.gnssSignalType_valid;
+ qmiLocGnssSignalTypeMaskT_v02 gnssBand;
+
+ if (gnss_measurement_report_ptr.gnssSignalType_valid) {
+ gnssBand = gnss_measurement_report_ptr.gnssSignalType;
+ }
+
+ measurementData.stateMask = GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT;
+ measurementData.receivedSvTimeNs = 0;
+ measurementData.receivedSvTimeUncertaintyNs = 0;
+
+ // Deal with Galileo first since it is special
+ uint64_t galSVstateMask = 0;
+ if (GNSS_SV_TYPE_GALILEO == measurementData.svType &&
+ (bBandNotAvailable ||
+ (QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C_V02 == gnssBand))) {
+
+ galSVstateMask = GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT;
+
+ if (gnss_measurement_info.measurementStatus &
+ QMI_LOC_MASK_MEAS_STATUS_100MS_STAT_BIT_VALID_V02) {
+ galSVstateMask |= GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT;
+ }
+
+ if (gnss_measurement_info.measurementStatus &
+ QMI_LOC_MASK_MEAS_STATUS_2S_STAT_BIT_VALID_V02) {
+ galSVstateMask |= GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT;
+ }
+ }
+ // now deal with all constellations
+ bool bIsL5orE5 = false;
+ // L5
+ if (GNSS_SV_TYPE_GPS == measurementData.svType &&
+ (bBandNotAvailable ||
+ (QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q_V02 == gnssBand))) {
+ bIsL5orE5 = true;
+ }
+ // E5
+ if (GNSS_SV_TYPE_GALILEO == measurementData.svType &&
+ (bBandNotAvailable ||
+ (QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q_V02 == gnssBand))) {
+ bIsL5orE5 = true;
+ }
+
+ if (validMeasStatus & QMI_LOC_MASK_MEAS_STATUS_MS_VALID_V02) {
+ /* sub-frame decode & TOW decode */
+ measurementData.stateMask |= (GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT |
+ GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT |
+ GNSS_MEASUREMENTS_STATE_TOW_KNOWN_BIT |
+ GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT |
+ GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT);
+ // GLO
+ if (GNSS_SV_TYPE_GLONASS == measurementData.svType &&
+ (bBandNotAvailable ||
+ (QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1_V02 == gnssBand))) {
+
+ measurementData.stateMask |= (GNSS_MEASUREMENTS_STATE_GLO_TOD_KNOWN_BIT |
+ GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT |
+ GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT);
+ }
+
+ // GAL
+ measurementData.stateMask |= galSVstateMask;
+
+ // BDS
+ if (IS_BDS_GEO_SV(measurementData.svId, measurementData.svType)) {
+ /* BDS_GEO SV transmitting D2 signal */
+ measurementData.stateMask |= (GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT |
+ GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT);
+ }
+
+ // L5 or E5
+ if (bIsL5orE5) {
+ measurementData.stateMask |= GNSS_MEASUREMENTS_STATE_2ND_CODE_LOCK_BIT;
+ }
+
+ measurementData.receivedSvTimeNs =
+ ((int64_t)gnss_measurement_info.svTimeSpeed.svTimeMs * 1000000) +
+ (int64_t)(gnss_measurement_info.svTimeSpeed.svTimeSubMs * 1e6);
+
+ measurementData.receivedSvTimeUncertaintyNs = (int64_t)gpsTowUncNs;
+
+ } else if ((validMeasStatus & bitSynMask) == bitSynMask) {
+ /* bit sync */
+ measurementData.stateMask |= (GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT |
+ GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT |
+ GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT);
+ measurementData.stateMask |= galSVstateMask;
+
+ // L5 or E5
+ if (bIsL5orE5) {
+ measurementData.stateMask |= GNSS_MEASUREMENTS_STATE_2ND_CODE_LOCK_BIT;
+ }
+
+ measurementData.receivedSvTimeNs =
+ (((int64_t)gnss_measurement_info.svTimeSpeed.svTimeMs * 1000000) +
+ (int64_t)(gnss_measurement_info.svTimeSpeed.svTimeSubMs * 1e6)) % (int64_t)20;
+
+ measurementData.receivedSvTimeUncertaintyNs = (int64_t)gpsTowUncNs;
+
+ } else if (validMeasStatus & QMI_LOC_MASK_MEAS_STATUS_SM_VALID_V02) {
+ /* code lock */
+ measurementData.stateMask |= GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT;
+ measurementData.stateMask |= galSVstateMask;
+
+ measurementData.receivedSvTimeNs =
+ (int64_t)(gnss_measurement_info.svTimeSpeed.svTimeSubMs * 1e6);
+
+ measurementData.receivedSvTimeUncertaintyNs = (int64_t)gpsTowUncNs;
+ }
+
+ // carrierToNoiseDbHz
+ measurementData.carrierToNoiseDbHz = gnss_measurement_info.CNo/10.0;
+
+ if (QMI_LOC_MASK_MEAS_STATUS_VELOCITY_FINE_V02 == (gnss_measurement_info.measurementStatus & QMI_LOC_MASK_MEAS_STATUS_VELOCITY_FINE_V02))
+ {
+ LOC_LOGV ("%s:%d]: FINE mS=0x%4" PRIX64 " fS=%f fSU=%f dS=%f dSU=%f\n", __func__, __LINE__,
+ gnss_measurement_info.measurementStatus,
+ gnss_measurement_info.fineSpeed, gnss_measurement_info.fineSpeedUnc,
+ gnss_measurement_info.svTimeSpeed.dopplerShift, gnss_measurement_info.svTimeSpeed.dopplerShiftUnc);
+ // pseudorangeRateMps
+ measurementData.pseudorangeRateMps = gnss_measurement_info.fineSpeed;
+
+ // pseudorangeRateUncertaintyMps
+ measurementData.pseudorangeRateUncertaintyMps = gnss_measurement_info.fineSpeedUnc;
+ }
+ else
+ {
+ LOC_LOGV ("%s:%d]: COARSE mS=0x%4" PRIX64 " fS=%f fSU=%f dS=%f dSU=%f\n", __func__, __LINE__,
+ gnss_measurement_info.measurementStatus,
+ gnss_measurement_info.fineSpeed, gnss_measurement_info.fineSpeedUnc,
+ gnss_measurement_info.svTimeSpeed.dopplerShift, gnss_measurement_info.svTimeSpeed.dopplerShiftUnc);
+ // pseudorangeRateMps
+ measurementData.pseudorangeRateMps = gnss_measurement_info.svTimeSpeed.dopplerShift;
+
+ // pseudorangeRateUncertaintyMps
+ measurementData.pseudorangeRateUncertaintyMps = gnss_measurement_info.svTimeSpeed.dopplerShiftUnc;
+ }
+
+ // carrier frequency
+ if (gnss_measurement_report_ptr.gnssSignalType_valid) {
+ LOC_LOGv("gloFrequency = 0x%X, sigType=%" PRIu64,
+ gnss_measurement_info.gloFrequency, gnss_measurement_report_ptr.gnssSignalType);
+ measurementData.carrierFrequencyHz = convertSignalTypeToCarrierFrequency(
+ gnss_measurement_report_ptr.gnssSignalType, gnss_measurement_info.gloFrequency);
+ measurementData.flags |= GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT;
+ }
+ else {
+ measurementData.carrierFrequencyHz = 0;
+ // GLONASS is FDMA system, so each channel has its own carrier frequency
+ // The formula is f(k) = fc + k * 0.5625;
+ // This is applicable for GLONASS G1 only, where fc = 1602MHz
+ if ((gnss_measurement_info.gloFrequency >= 1 && gnss_measurement_info.gloFrequency <= 14)) {
+ measurementData.carrierFrequencyHz += (gnss_measurement_info.gloFrequency - 8) * 562500;
+ }
+ measurementData.carrierFrequencyHz += CarrierFrequencies[measurementData.svType];
+ measurementData.flags |= GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT;
+
+ LOC_LOGv("gnss_measurement_report_ptr.gnssSignalType_valid = 0");
+ }
+
+ // accumulatedDeltaRangeM
+ if (gnss_measurement_info.validMask & QMI_LOC_SV_CARRIER_PHASE_VALID_V02) {
+ double carrierPhase = gnss_measurement_info.carrierPhase;
+ if ((validMeasStatus & QMI_LOC_MASK_MEAS_STATUS_LP_VALID_V02) &&
+ (validMeasStatus & QMI_LOC_MASK_MEAS_STATUS_LP_POS_VALID_V02)) {
+ carrierPhase += 0.5;
+ }
+ measurementData.adrMeters =
+ (SPEED_OF_LIGHT / measurementData.carrierFrequencyHz) * carrierPhase;
+ LOC_LOGv("carrierPhase = %.2f adrMeters = %.2f",
+ carrierPhase,
+ measurementData.adrMeters);
+ } else {
+ measurementData.adrMeters = 0.0;
+ }
+
+ // accumulatedDeltaRangeUncertaintyM
+ if (!isExt) {
+ if (gnss_measurement_report_ptr.svCarrierPhaseUncertainty_valid) {
+ measurementData.adrUncertaintyMeters =
+ (SPEED_OF_LIGHT / measurementData.carrierFrequencyHz) *
+ gnss_measurement_report_ptr.svCarrierPhaseUncertainty[index];
+ LOC_LOGv("carrierPhaseUnc = %.6f adrMetersUnc = %.6f",
+ gnss_measurement_report_ptr.svCarrierPhaseUncertainty[index],
+ measurementData.adrUncertaintyMeters);
+ } else {
+ measurementData.adrUncertaintyMeters = 0.0;
+ }
+ } else {
+ if (gnss_measurement_report_ptr.extSvCarrierPhaseUncertainty_valid) {
+ measurementData.adrUncertaintyMeters =
+ (SPEED_OF_LIGHT / measurementData.carrierFrequencyHz) *
+ gnss_measurement_report_ptr.extSvCarrierPhaseUncertainty[index];
+ LOC_LOGv("extCarrierPhaseUnc = %.6f adrMetersUnc = %.6f",
+ gnss_measurement_report_ptr.extSvCarrierPhaseUncertainty[index],
+ measurementData.adrUncertaintyMeters);
+ } else {
+ measurementData.adrUncertaintyMeters = 0.0;
+ }
+ }
+
+ // accumulatedDeltaRangeState
+ measurementData.adrStateMask = GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN;
+ if ((gnss_measurement_info.validMask & QMI_LOC_SV_CARRIER_PHASE_VALID_V02) &&
+ (gnss_measurement_info.carrierPhase != 0.0)) {
+ measurementData.adrStateMask = GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT;
+
+ bool bFound = false;
+ adrData tempAdrData;
+ vector<adrData>::iterator it;
+ // check the prior epoch
+ // first see if info for this satellite exists in the vector (from prior epoch)
+ for (it = mADRdata.begin(); it != mADRdata.end(); ++it) {
+ tempAdrData = *it;
+ if (gnss_measurement_report_ptr.system == tempAdrData.system &&
+ ((gnss_measurement_report_ptr.gnssSignalType_valid &&
+ (gnss_measurement_report_ptr.gnssSignalType == tempAdrData.gnssSignalType)) ||
+ (!gnss_measurement_report_ptr.gnssSignalType_valid &&
+ (0 == tempAdrData.gnssSignalType))) &&
+ gnss_measurement_info.gnssSvId == tempAdrData.gnssSvId) {
+ bFound = true;
+ break;
+ }
+ }
+ measurementData.adrStateMask |= GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT;
+ if (bFound) {
+ LOC_LOGv("Found the carrier phase for this satellite from last epoch");
+ if (tempAdrData.validMask & QMI_LOC_SV_CARRIER_PHASE_VALID_V02) {
+ LOC_LOGv("and it has valid carrier phase");
+ // let's make sure this is prior measurement
+ if (mMinInterval <= 1000 &&
+ (tempAdrData.counter == (mCounter - 1))) {
+ // at this point prior epoch does have carrier phase valid
+ measurementData.adrStateMask &=
+ ~GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT;
+ if (tempAdrData.validMask & QMI_LOC_SV_CYCLESLIP_COUNT_VALID_V02 &&
+ gnss_measurement_info.validMask & QMI_LOC_SV_CYCLESLIP_COUNT_VALID_V02) {
+ LOC_LOGv("cycle slip count is valid for both current and prior epochs");
+ if (tempAdrData.cycleSlipCount != gnss_measurement_info.cycleSlipCount) {
+ LOC_LOGv("cycle slip count for current epoch (%d)"
+ " is different than the last epoch(%d)",
+ gnss_measurement_info.cycleSlipCount,
+ tempAdrData.cycleSlipCount);
+ measurementData.adrStateMask |=
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT;
+ }
+ }
+ }
+ }
+ // now update the current satellite info to the vector
+ tempAdrData.counter = mCounter;
+ tempAdrData.validMask = gnss_measurement_info.validMask;
+ tempAdrData.cycleSlipCount = gnss_measurement_info.cycleSlipCount;
+ *it = tempAdrData;
+ } else {
+ // now add the current satellite info to the vector
+ tempAdrData.counter = mCounter;
+ tempAdrData.system = gnss_measurement_report_ptr.system;
+ if (gnss_measurement_report_ptr.gnssSignalType_valid) {
+ tempAdrData.gnssSignalType = gnss_measurement_report_ptr.gnssSignalType;
+ } else {
+ tempAdrData.gnssSignalType = 0;
+ }
+ tempAdrData.gnssSvId = gnss_measurement_info.gnssSvId;
+ tempAdrData.validMask = gnss_measurement_info.validMask;
+ tempAdrData.cycleSlipCount = gnss_measurement_info.cycleSlipCount;
+ mADRdata.push_back(tempAdrData);
+ }
+
+ if (validMeasStatus & QMI_LOC_MASK_MEAS_STATUS_LP_VALID_V02) {
+ LOC_LOGv("measurement status has QMI_LOC_MASK_MEAS_STATUS_LP_VALID_V02 set");
+ measurementData.adrStateMask |=
+ GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT;
+ }
+ LOC_LOGv("adrStateMask = 0x%02x", measurementData.adrStateMask);
+ }
+
+ // multipath_indicator
+ measurementData.multipathIndicator = GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN;
+
+ // AGC
+ if (gnss_measurement_report_ptr.jammerIndicator_valid) {
+ if (GNSS_INVALID_JAMMER_IND !=
+ gnss_measurement_report_ptr.jammerIndicator.agcMetricDb) {
+ LOC_LOGv("AGC is valid: agcMetricDb = 0x%X bpMetricDb = 0x%X",
+ gnss_measurement_report_ptr.jammerIndicator.agcMetricDb,
+ gnss_measurement_report_ptr.jammerIndicator.bpMetricDb);
+
+ measurementData.agcLevelDb =
+ (double)gnss_measurement_report_ptr.jammerIndicator.agcMetricDb / 100.0;
+ measurementData.flags |= GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT;
+ } else {
+ LOC_LOGv("AGC is invalid: agcMetricDb = 0x%X bpMetricDb = 0x%X",
+ gnss_measurement_report_ptr.jammerIndicator.agcMetricDb,
+ gnss_measurement_report_ptr.jammerIndicator.bpMetricDb);
+ }
+ bAgcIsPresent = true;
+ } else {
+ LOC_LOGv("AGC is not present");
+ bAgcIsPresent = false;
+ }
+
+ // code type
+ if (gnss_measurement_report_ptr.measurementCodeType_valid) {
+ switch (gnss_measurement_report_ptr.measurementCodeType)
+ {
+ case eQMI_LOC_GNSS_CODE_TYPE_A_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_A; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_B_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_B; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_C_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_C; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_I_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_I; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_L_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_L; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_M_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_M; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_P_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_P; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_Q_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_Q; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_S_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_S; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_W_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_W; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_X_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_X; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_Y_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_Y; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_Z_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_Z; break;
+ case eQMI_LOC_GNSS_CODE_TYPE_N_V02:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_N; break;
+ default:
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_OTHER; break;
+ }
+ } else {
+ measurementData.codeType = GNSS_MEASUREMENTS_CODE_TYPE_OTHER;
+ }
+
+ memset(measurementData.otherCodeTypeName, 0, GNSS_MAX_NAME_LENGTH);
+ if (GNSS_MEASUREMENTS_CODE_TYPE_OTHER == measurementData.codeType) {
+ if (gnss_measurement_report_ptr.otherCodeTypeName_valid) {
+ strlcpy(measurementData.otherCodeTypeName,
+ gnss_measurement_report_ptr.otherCodeTypeName,
+ std::min((uint32_t)sizeof(measurementData.otherCodeTypeName),
+ (uint32_t)gnss_measurement_report_ptr.otherCodeTypeName_len+1));
+ LOC_LOGv("measurementData.otherCodeTypeName = %s", measurementData.otherCodeTypeName);
+ }
+ }
+
+ LOC_LOGv(" GNSS measurement raw data received from modem:\n"
+ " Input => gnssSvId=%d validMask=0x%04x validMeasStatus=0x%" PRIx64
+ " CNo=%d dopplerShift=%.2f dopplerShiftUnc=%.2f fineSpeed=%.2f fineSpeedUnc=%.2f"
+ " svTimeMs=%u svTimeSubMs=%.2f svTimeUncMs=%.2f codeType=%d"
+ " carrierPhase=%.2f carrierPhaseUnc=%.6f cycleSlipCount=%u\n"
+ " GNSS measurement data after conversion:"
+ " Output => size=%" PRIu32 "svid=%d time_offset_ns=%.2f stateMask=0x%08x"
+ " received_sv_time_in_ns=%" PRIu64 " received_sv_time_uncertainty_in_ns=%" PRIu64
+ " c_n0_dbhz=%.2f"
+ " pseudorange_rate_mps=%.2f pseudorange_rate_uncertainty_mps=%.2f"
+ " adrStateMask=0x%02x adrMeters=%.2f adrUncertaintyMeters=%.6f"
+ " carrierFrequencyHz=%.2f codeType=%d",
+ gnss_measurement_info.gnssSvId, // %d
+ gnss_measurement_info.validMask, // 0x%4x
+ validMeasStatus, // %PRIx64
+ gnss_measurement_info.CNo, // %d
+ gnss_measurement_info.svTimeSpeed.dopplerShift, // %f
+ gnss_measurement_info.svTimeSpeed.dopplerShiftUnc, // %f
+ gnss_measurement_info.fineSpeed, // %f
+ gnss_measurement_info.fineSpeedUnc, // %f
+ gnss_measurement_info.svTimeSpeed.svTimeMs, // %u
+ gnss_measurement_info.svTimeSpeed.svTimeSubMs, // %f
+ gnss_measurement_info.svTimeSpeed.svTimeUncMs, // %f
+ gnss_measurement_report_ptr.measurementCodeType, // %d
+ gnss_measurement_info.carrierPhase, // %f
+ gnss_measurement_report_ptr.svCarrierPhaseUncertainty[index], // %f
+ gnss_measurement_info.cycleSlipCount, // %u
+ measurementData.size, // %zu
+ measurementData.svId, // %d
+ measurementData.timeOffsetNs, // %f
+ measurementData.stateMask, // 0x%8x
+ measurementData.receivedSvTimeNs, // %PRIu64
+ measurementData.receivedSvTimeUncertaintyNs, // %PRIu64
+ measurementData.carrierToNoiseDbHz, // %g
+ measurementData.pseudorangeRateMps, // %g
+ measurementData.pseudorangeRateUncertaintyMps, // %g
+ measurementData.adrStateMask, // 0x%2x
+ measurementData.adrMeters, // %f
+ measurementData.adrUncertaintyMeters, // %f
+ measurementData.carrierFrequencyHz, // %f
+ measurementData.codeType); // %d
+ return bAgcIsPresent;
+}
+
+/*convert GnssMeasurementsClock type from QMI LOC to loc eng format*/
+int LocApiV02 :: convertGnssClock (GnssMeasurementsClock& clock,
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info)
+{
+ static uint32_t oldRefFCount = 0;
+ static uint32_t newRefFCount = 0;
+ static uint32_t oldDiscCount = 0;
+ static uint32_t newDiscCount = 0;
+ static uint32_t localDiscCount = 0;
+ int msInWeek = -1;
+
+ LOC_LOGV ("%s:%d]: entering\n", __func__, __LINE__);
+
+ // size
+ clock.size = sizeof(GnssMeasurementsClock);
+
+ // flag initiation
+ GnssMeasurementsClockFlagsMask flags = 0;
+
+ if (gnss_measurement_info.systemTimeExt_valid &&
+ gnss_measurement_info.numClockResets_valid) {
+ newRefFCount = gnss_measurement_info.systemTimeExt.refFCount;
+ newDiscCount = gnss_measurement_info.numClockResets;
+ if ((true == mMeasurementsStarted) ||
+ (oldDiscCount != newDiscCount) ||
+ (newRefFCount <= oldRefFCount))
+ {
+ if (true == mMeasurementsStarted)
+ {
+ mMeasurementsStarted = false;
+ }
+ // do not increment in full power mode
+ if (GNSS_POWER_MODE_M1 != mPowerMode) {
+ localDiscCount++;
+ }
+ }
+ oldDiscCount = newDiscCount;
+ oldRefFCount = newRefFCount;
+
+ // timeNs & timeUncertaintyNs
+ clock.timeNs = (int64_t)gnss_measurement_info.systemTimeExt.refFCount * 1e6;
+ clock.hwClockDiscontinuityCount = localDiscCount;
+ clock.timeUncertaintyNs = 0.0;
+
+ msInWeek = (int)gnss_measurement_info.systemTime.systemMsec;
+ if (gnss_measurement_info.systemTime_valid) {
+ uint16_t systemWeek = gnss_measurement_info.systemTime.systemWeek;
+ uint32_t systemMsec = gnss_measurement_info.systemTime.systemMsec;
+ float sysClkBias = gnss_measurement_info.systemTime.systemClkTimeBias;
+ float sysClkUncMs = gnss_measurement_info.systemTime.systemClkTimeUncMs;
+ bool isTimeValid = (sysClkUncMs <= 16.0f); // 16ms
+
+ if (systemWeek != C_GPS_WEEK_UNKNOWN && isTimeValid) {
+ // fullBiasNs, biasNs & biasUncertaintyNs
+ int64_t totalMs = ((int64_t)systemWeek) *
+ ((int64_t)WEEK_MSECS) + ((int64_t)systemMsec);
+ int64_t gpsTimeNs = totalMs * 1000000 - (int64_t)(sysClkBias * 1e6);
+ clock.fullBiasNs = clock.timeNs - gpsTimeNs;
+ clock.biasNs = sysClkBias * 1e6 - (double)((int64_t)(sysClkBias * 1e6));
+ clock.biasUncertaintyNs = (double)sysClkUncMs * 1e6;
+ flags |= (GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT |
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT |
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT);
+
+ if (mGnssMeasurements->gnssSvMeasurementSet.svMeasSetHeader.flags &
+ GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND) {
+ clock.leapSecond = mGnssMeasurements->
+ gnssSvMeasurementSet.svMeasSetHeader.leapSec.leapSec;
+ flags |= GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT;
+ LOC_LOGV("clock.leapSecond: %d", clock.leapSecond);
+ } else {
+ LOC_LOGV("GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND is not set");
+ }
+ }
+ }
+ }
+
+ // driftNsps & driftUncertaintyNsps
+ if (gnss_measurement_info.rcvrClockFrequencyInfo_valid)
+ {
+ double driftMPS = gnss_measurement_info.rcvrClockFrequencyInfo.clockDrift;
+ double driftUncMPS = gnss_measurement_info.rcvrClockFrequencyInfo.clockDriftUnc;
+
+ clock.driftNsps = driftMPS * MPS_TO_NSPS;
+ clock.driftUncertaintyNsps = driftUncMPS * MPS_TO_NSPS;
+
+ flags |= (GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT |
+ GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT);
+ }
+
+ clock.flags = flags;
+
+ LOC_LOGV(" %s:%d]: GNSS measurement clock data received from modem: \n", __func__, __LINE__);
+ LOC_LOGV(" Input => systemTime_valid=%d systemTimeExt_valid=%d numClockResets_valid=%d\n",
+ gnss_measurement_info.systemTime_valid, // %d
+ gnss_measurement_info.systemTimeExt_valid, // %d
+ gnss_measurement_info.numClockResets_valid); // %d
+
+ LOC_LOGV(" systemWeek=%d systemMsec=%d systemClkTimeBias=%f\n",
+ gnss_measurement_info.systemTime.systemWeek, // %d
+ gnss_measurement_info.systemTime.systemMsec, // %d
+ gnss_measurement_info.systemTime.systemClkTimeBias); // %f
+
+ LOC_LOGV(" systemClkTimeUncMs=%f refFCount=%d numClockResets=%d\n",
+ gnss_measurement_info.systemTime.systemClkTimeUncMs, // %f
+ gnss_measurement_info.systemTimeExt.refFCount, // %d
+ gnss_measurement_info.numClockResets); // %d
+
+ LOC_LOGV(" clockDrift=%f clockDriftUnc=%f\n",
+ gnss_measurement_info.rcvrClockFrequencyInfo.clockDrift, // %f
+ gnss_measurement_info.rcvrClockFrequencyInfo.clockDriftUnc); // %f
+
+
+ LOC_LOGV(" %s:%d]: GNSS measurement clock after conversion: \n", __func__, __LINE__);
+ LOC_LOGV(" Output => timeNs=%" PRId64 "\n",
+ clock.timeNs); // %PRId64
+
+ LOC_LOGV(" fullBiasNs=%" PRId64 " biasNs=%g bias_uncertainty_ns=%g\n",
+ clock.fullBiasNs, // %PRId64
+ clock.biasNs, // %g
+ clock.biasUncertaintyNs); // %g
+
+ LOC_LOGV(" driftNsps=%g drift_uncertainty_nsps=%g\n",
+ clock.driftNsps, // %g
+ clock.driftUncertaintyNsps); // %g
+
+ LOC_LOGV(" hw_clock_discontinuity_count=%d flags=0x%04x\n",
+ clock.hwClockDiscontinuityCount, // %lld
+ clock.flags); // %04x
+
+ return msInWeek;
+}
+
+/* event callback registered with the loc_api v02 interface */
+void LocApiV02 :: eventCb(locClientHandleType /*clientHandle*/,
+ uint32_t eventId, locClientEventIndUnionType eventPayload)
+{
+ LOC_LOGd("event id = 0x%X", eventId);
+
+ switch(eventId)
+ {
+ //Position Report
+ case QMI_LOC_EVENT_POSITION_REPORT_IND_V02:
+ reportPosition(eventPayload.pPositionReportEvent);
+ break;
+
+ // Satellite report
+ case QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02:
+ reportSv(eventPayload.pGnssSvInfoReportEvent);
+ break;
+
+ // Status report
+ case QMI_LOC_EVENT_ENGINE_STATE_IND_V02:
+ reportEngineState(eventPayload.pEngineState);
+ break;
+
+ case QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02:
+ reportFixSessionState(eventPayload.pFixSessionState);
+ break;
+
+ // NMEA
+ case QMI_LOC_EVENT_NMEA_IND_V02:
+ reportNmea(eventPayload.pNmeaReportEvent);
+ break;
+
+ // XTRA request
+ case QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02:
+ LOC_LOGD("%s:%d]: XTRA download request\n", __func__,
+ __LINE__);
+ reportXtraServerUrl(eventPayload.pInjectPredictedOrbitsReqEvent);
+ requestXtraData();
+ break;
+
+ // time request
+ case QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02:
+ LOC_LOGD("%s:%d]: Time request\n", __func__,
+ __LINE__);
+ requestTime();
+ break;
+
+ //position request
+ case QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02:
+ LOC_LOGD("%s:%d]: Position request\n", __func__,
+ __LINE__);
+ requestLocation();
+ break;
+
+ // NI request
+ case QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02:
+ reportNiRequest(eventPayload.pNiNotifyVerifyReqEvent);
+ break;
+
+ // AGPS connection request
+ case QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02:
+ reportAtlRequest(eventPayload.pLocationServerConnReqEvent);
+ break;
+
+ case QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02:
+ LOC_LOGd("GNSS Measurement Report");
+ if (mInSession) {
+ reportGnssMeasurementData(*eventPayload.pGnssSvRawInfoEvent);
+ }
+ break;
+
+ case QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02:
+ LOC_LOGD("%s:%d]: GNSS SV Polynomial Ind\n", __func__,
+ __LINE__);
+ reportSvPolynomial(eventPayload.pGnssSvPolyInfoEvent);
+ break;
+
+ case QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02:
+ case QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02:
+ reportSvEphemeris(eventId, eventPayload);
+ break;
+
+ //Unpropagated position report
+ case QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02:
+ reportPosition(eventPayload.pPositionReportEvent, true);
+ break;
+
+ case QMI_LOC_GET_BLACKLIST_SV_IND_V02:
+ LOC_LOGd("GET blacklist SV Ind");
+ reportGnssSvIdConfig(*eventPayload.pGetBlacklistSvEvent);
+ break;
+
+ case QMI_LOC_GET_CONSTELLATION_CONTROL_IND_V02:
+ LOC_LOGd("GET constellation Ind");
+ reportGnssSvTypeConfig(*eventPayload.pGetConstellationConfigEvent);
+ break;
+
+ case QMI_LOC_EVENT_WIFI_REQ_IND_V02:
+ LOC_LOGd("WIFI Req Ind");
+ requestOdcpi(*eventPayload.pWifiReqEvent);
+ break;
+
+ case QMI_LOC_EVENT_REPORT_IND_V02:
+ reportLocEvent(eventPayload.pLocEvent);
+ break;
+
+ // System info event regarding next leap second
+ case QMI_LOC_SYSTEM_INFO_IND_V02:
+ reportSystemInfo(eventPayload.pLocSystemInfoEvent);
+ break;
+
+ case QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02:
+ reportLocationRequestNotification(eventPayload.pLocReqNotifEvent);
+ break;
+
+ case QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02:
+ LOC_LOGd("Got QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02");
+ geofenceBreachEvent(eventPayload.pGeofenceBreachEvent);
+ break;
+
+ case QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02:
+ LOC_LOGd("Got QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02");
+ geofenceBreachEvent(eventPayload.pGeofenceBatchedBreachEvent);
+ break;
+
+ case QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02:
+ geofenceStatusEvent(eventPayload.pGeofenceGenAlertEvent);
+ break;
+
+ case QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02:
+ LOC_LOGd("Got QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02");
+ geofenceDwellEvent(eventPayload.pGeofenceBatchedDwellEvent);
+ break;
+
+ case QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02:
+ LOC_LOGd("Got QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02");
+ batchFullEvent(eventPayload.pBatchCount);
+ break;
+
+ case QMI_LOC_EVENT_BATCHING_STATUS_IND_V02:
+ LOC_LOGd("Got QMI_LOC_EVENT_BATCHING_STATUS_IND_V02");
+ batchStatusEvent(eventPayload.pBatchingStatusEvent);
+ break;
+
+ case QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02:
+ LOC_LOGd("Got QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02");
+ onDbtPosReportEvent(eventPayload.pDbtPositionReportEvent);
+ break;
+
+ }
+}
+
+/* Call the service LocAdapterBase down event*/
+void LocApiV02 :: errorCb(locClientHandleType /*handle*/,
+ locClientErrorEnumType errorId)
+{
+ if(errorId == eLOC_CLIENT_ERROR_SERVICE_UNAVAILABLE)
+ {
+ LOC_LOGE("%s:%d]: Service unavailable error\n",
+ __func__, __LINE__);
+
+ handleEngineDownEvent();
+ }
+}
+
+void LocApiV02 ::getWwanZppFix()
+{
+ sendMsg(new LocApiMsg([this] () {
+
+ locClientReqUnionType req_union;
+ qmiLocGetAvailWwanPositionReqMsgT_v02 zpp_req;
+ memset(&zpp_req, 0, sizeof(zpp_req));
+
+ req_union.pGetAvailWwanPositionReq = &zpp_req;
+
+ LOC_LOGD("%s:%d]: Get ZPP Fix from available wwan position\n", __func__, __LINE__);
+ locClientStatusEnumType status =
+ locClientSendReq(QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02, req_union);
+
+ if (status != eLOC_CLIENT_SUCCESS) {
+ LOC_LOGe("error! status = %s\n", loc_get_v02_client_status_name(status));
+ }
+ }));
+}
+
+void LocApiV02 ::getBestAvailableZppFix()
+{
+ sendMsg(new LocApiMsg([this] () {
+
+ locClientReqUnionType req_union;
+ qmiLocGetBestAvailablePositionReqMsgT_v02 zpp_req;
+
+ memset(&zpp_req, 0, sizeof(zpp_req));
+ req_union.pGetBestAvailablePositionReq = &zpp_req;
+
+ LOC_LOGd("Get ZPP Fix from best available source\n");
+
+ locClientStatusEnumType status =
+ locClientSendReq(QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02, req_union);
+
+ if (status != eLOC_CLIENT_SUCCESS) {
+ LOC_LOGe("error! status = %s\n", loc_get_v02_client_status_name(status));
+ }
+ }));
+}
+
+LocationError LocApiV02 :: setGpsLockSync(GnssConfigGpsLock lock)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ qmiLocSetEngineLockReqMsgT_v02 setEngineLockReq;
+ qmiLocSetEngineLockIndMsgT_v02 setEngineLockInd;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ memset(&setEngineLockReq, 0, sizeof(setEngineLockReq));
+ setEngineLockReq.lockType = convertGpsLockFromAPItoQMI((GnssConfigGpsLock)lock);;
+ setEngineLockReq.subType_valid = true;
+ setEngineLockReq.subType = eQMI_LOC_LOCK_ALL_SUB_V02;
+ setEngineLockReq.lockClient_valid = false;
+ req_union.pSetEngineLockReq = &setEngineLockReq;
+ LOC_LOGd("API lock type = 0x%X QMI lockType = %d", lock, setEngineLockReq.lockType);
+ memset(&setEngineLockInd, 0, sizeof(setEngineLockInd));
+ status = locSyncSendReq(QMI_LOC_SET_ENGINE_LOCK_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_ENGINE_LOCK_IND_V02,
+ &setEngineLockInd);
+ if (eLOC_CLIENT_SUCCESS != status || eQMI_LOC_SUCCESS_V02 != setEngineLockInd.status) {
+ LOC_LOGe("Set engine lock failed. status: %s, ind status:%s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(setEngineLockInd.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ return err;
+}
+
+void LocApiV02::requestForAidingData(GnssAidingDataSvMask svDataMask)
+{
+ sendMsg(new LocApiMsg([this, svDataMask] () {
+ locClientEventMaskType qmiMask = 0;
+
+ if (svDataMask & GNSS_AIDING_DATA_SV_POLY_BIT)
+ qmiMask |= QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02;
+
+ if (svDataMask & GNSS_AIDING_DATA_SV_EPHEMERIS_BIT)
+ qmiMask |= QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02;
+
+ if (svDataMask & GNSS_AIDING_DATA_SV_IONOSPHERE_BIT)
+ qmiMask |= QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT_V02;
+
+ sendRequestForAidingData(qmiMask);
+ }));
+}
+
+/*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+*/
+int LocApiV02 :: getGpsLock(uint8_t subType)
+{
+ qmiLocGetEngineLockReqMsgT_v02 getEngineLockReq;
+ qmiLocGetEngineLockIndMsgT_v02 getEngineLockInd;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+ int ret=0;
+ memset(&getEngineLockInd, 0, sizeof(getEngineLockInd));
+
+ //Passing req_union as a parameter even though this request has no payload
+ //since NULL or 0 gives an error during compilation
+ getEngineLockReq.subType_valid = true;
+ getEngineLockReq.subType = (qmiLocLockSubInfoEnumT_v02)subType;
+ req_union.pGetEngineLockReq = &getEngineLockReq;
+ status = locSyncSendReq(QMI_LOC_GET_ENGINE_LOCK_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_GET_ENGINE_LOCK_IND_V02,
+ &getEngineLockInd);
+ if(status != eLOC_CLIENT_SUCCESS || getEngineLockInd.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGE("%s:%d]: Set engine lock failed. status: %s, ind status:%s\n",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(getEngineLockInd.status));
+ ret = -1;
+ }
+ else {
+ if(getEngineLockInd.lockType_valid) {
+ ret = (int)convertGpsLockFromQMItoAPI(getEngineLockInd.lockType);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Lock Type not valid\n", __func__, __LINE__);
+ ret = -1;
+ }
+ }
+ return ret;
+}
+
+LocationError
+LocApiV02:: setXtraVersionCheckSync(uint32_t check)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ qmiLocSetXtraVersionCheckReqMsgT_v02 req;
+ qmiLocSetXtraVersionCheckIndMsgT_v02 ind;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ LOC_LOGD("%s:%d]: Enter. check: %u", __func__, __LINE__, check);
+ memset(&req, 0, sizeof(req));
+ memset(&ind, 0, sizeof(ind));
+ switch (check) {
+ case 0:
+ req.xtraVersionCheckMode = eQMI_LOC_XTRA_VERSION_CHECK_DISABLE_V02;
+ break;
+ case 1:
+ req.xtraVersionCheckMode = eQMI_LOC_XTRA_VERSION_CHECK_AUTO_V02;
+ break;
+ case 2:
+ req.xtraVersionCheckMode = eQMI_LOC_XTRA_VERSION_CHECK_XTRA2_V02;
+ break;
+ case 3:
+ req.xtraVersionCheckMode = eQMI_LOC_XTRA_VERSION_CHECK_XTRA3_V02;
+ break;
+ default:
+ req.xtraVersionCheckMode = eQMI_LOC_XTRA_VERSION_CHECK_DISABLE_V02;
+ break;
+ }
+
+ req_union.pSetXtraVersionCheckReq = &req;
+ status = locSyncSendReq(QMI_LOC_SET_XTRA_VERSION_CHECK_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_XTRA_VERSION_CHECK_IND_V02,
+ &ind);
+ if(status != eLOC_CLIENT_SUCCESS || ind.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGE("%s:%d]: Set xtra version check failed. status: %s, ind status:%s\n",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ LOC_LOGD("%s:%d]: Exit. err: %u", __func__, __LINE__, err);
+ return err;
+}
+
+void LocApiV02 :: installAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t numberOfCerts,
+ uint32_t slotBitMask)
+{
+ LOC_LOGD("%s:%d]:, slot mask=%u number of certs=%zu",
+ __func__, __LINE__, slotBitMask, numberOfCerts);
+
+ uint8_t certIndex = 0;
+ for (uint8_t slot = 0; slot <= LOC_AGPS_CERTIFICATE_MAX_SLOTS-1; slot++, slotBitMask >>= 1)
+ {
+ if (slotBitMask & 1) //slot is writable
+ {
+ if (certIndex < numberOfCerts && pData[certIndex].data && pData[certIndex].length > 0)
+ {
+ LOC_LOGD("%s:%d]:, Inject cert#%u slot=%u length=%zu",
+ __func__, __LINE__, certIndex, slot, pData[certIndex].length);
+
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocInjectSuplCertificateReqMsgT_v02 injectCertReq;
+ qmiLocInjectSuplCertificateIndMsgT_v02 injectCertInd;
+
+ memset(&injectCertReq, 0, sizeof(injectCertReq));
+ memset(&injectCertInd, 0, sizeof(injectCertInd));
+ injectCertReq.suplCertId = slot;
+ injectCertReq.suplCertData_len = pData[certIndex].length;
+ memcpy(injectCertReq.suplCertData, pData[certIndex].data, pData[certIndex].length);
+
+ req_union.pInjectSuplCertificateReq = &injectCertReq;
+
+ status = locSyncSendReq(QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02,
+ &injectCertInd);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != injectCertInd.status)
+ {
+ LOC_LOGE ("%s:%d]: inject-error status = %s, set_server_ind.status = %s",
+ __func__,__LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(injectCertInd.status));
+ }
+
+ certIndex++; //move to next cert
+
+ } else {
+
+ LOC_LOGD("%s:%d]:, Delete slot=%u",
+ __func__, __LINE__, slot);
+
+ // A fake cert is injected first before delete is called to workaround
+ // an issue that is seen with trying to delete an empty slot.
+ {
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocInjectSuplCertificateReqMsgT_v02 injectFakeCertReq;
+ qmiLocInjectSuplCertificateIndMsgT_v02 injectFakeCertInd;
+
+ memset(&injectFakeCertReq, 0, sizeof(injectFakeCertReq));
+ memset(&injectFakeCertInd, 0, sizeof(injectFakeCertInd));
+ injectFakeCertReq.suplCertId = slot;
+ injectFakeCertReq.suplCertData_len = 1;
+ injectFakeCertReq.suplCertData[0] = 1;
+
+ req_union.pInjectSuplCertificateReq = &injectFakeCertReq;
+
+ status = locSyncSendReq(QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02,
+ &injectFakeCertInd);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != injectFakeCertInd.status)
+ {
+ LOC_LOGE ("%s:%d]: inject-fake-error status = %s, set_server_ind.status = %s",
+ __func__,__LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(injectFakeCertInd.status));
+ }
+ }
+
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+ qmiLocDeleteSuplCertificateReqMsgT_v02 deleteCertReq;
+ qmiLocDeleteSuplCertificateIndMsgT_v02 deleteCertInd;
+
+ memset(&deleteCertReq, 0, sizeof(deleteCertReq));
+ memset(&deleteCertInd, 0, sizeof(deleteCertInd));
+ deleteCertReq.suplCertId = slot;
+ deleteCertReq.suplCertId_valid = 1;
+
+ req_union.pDeleteSuplCertificateReq = &deleteCertReq;
+
+ status = locSyncSendReq(QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_DELETE_SUPL_CERTIFICATE_IND_V02,
+ &deleteCertInd);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != deleteCertInd.status)
+ {
+ LOC_LOGE("%s:%d]: delete-error status = %s, set_server_ind.status = %s",
+ __func__,__LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(deleteCertInd.status));
+ }
+ }
+ } else {
+ LOC_LOGD("%s:%d]:, Not writable slot=%u",
+ __func__, __LINE__, slot);
+ }
+ }
+}
+
+int LocApiV02::setSvMeasurementConstellation(const locClientEventMaskType mask)
+{
+ enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ qmiLocSetGNSSConstRepConfigReqMsgT_v02 setGNSSConstRepConfigReq;
+ qmiLocSetGNSSConstRepConfigIndMsgT_v02 setGNSSConstRepConfigInd;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ qmiLocGNSSConstellEnumT_v02 svConstellation = eQMI_SYSTEM_GPS_V02 |
+ eQMI_SYSTEM_GLO_V02 |
+ eQMI_SYSTEM_BDS_V02 |
+ eQMI_SYSTEM_GAL_V02 |
+ eQMI_SYSTEM_QZSS_V02;
+ LOC_LOGD("%s] set GNSS measurement to report constellation: %" PRIu64 " "
+ "report mask = 0x%" PRIx64 "\n",
+ __func__, svConstellation, mask);
+
+ memset(&setGNSSConstRepConfigReq, 0, sizeof(setGNSSConstRepConfigReq));
+
+ setGNSSConstRepConfigReq.measReportConfig_valid = true;
+ if ((mask & QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02) ||
+ mMasterRegisterNotSupported) {
+ setGNSSConstRepConfigReq.measReportConfig = svConstellation;
+ }
+
+ setGNSSConstRepConfigReq.svPolyReportConfig_valid = true;
+ if (mask & QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02) {
+ setGNSSConstRepConfigReq.svPolyReportConfig = svConstellation;
+ }
+ req_union.pSetGNSSConstRepConfigReq = &setGNSSConstRepConfigReq;
+ memset(&setGNSSConstRepConfigInd, 0, sizeof(setGNSSConstRepConfigInd));
+
+ status = locSyncSendReq(QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_IND_V02,
+ &setGNSSConstRepConfigInd);
+
+ if (status != eLOC_CLIENT_SUCCESS ||
+ (setGNSSConstRepConfigInd.status != eQMI_LOC_SUCCESS_V02 &&
+ setGNSSConstRepConfigInd.status != eQMI_LOC_ENGINE_BUSY_V02)) {
+ LOC_LOGE("%s:%d]: Set GNSS constellation failed. status: %s, ind status:%s\n",
+ __func__, __LINE__,
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(setGNSSConstRepConfigInd.status));
+ ret_val = LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else {
+ LOC_LOGD("%s:%d]: Set GNSS constellation succeeded.\n",
+ __func__, __LINE__);
+ }
+
+ return ret_val;
+}
+
+void LocApiV02::setConstrainedTuncMode(bool enabled,
+ float tuncConstraint,
+ uint32_t energyBudget,
+ LocApiResponse *adapterResponse) {
+ sendMsg(new LocApiMsg([this, enabled, tuncConstraint, energyBudget, adapterResponse] () {
+
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ qmiLocSetConstrainedTuncModeReqMsgT_v02 req;
+ qmiLocSetConstrainedTuncModeIndMsgT_v02 ind;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ memset(&req, 0, sizeof(req));
+ memset(&ind, 0, sizeof(ind));
+ req.tuncConstraintOn = enabled;
+ if (tuncConstraint > 0.0) {
+ req.tuncConstraint_valid = true;
+ req.tuncConstraint = tuncConstraint;
+ }
+ if (energyBudget != 0) {
+ req.energyBudget_valid = true;
+ req.energyBudget = energyBudget;
+ }
+
+ LOC_LOGd("Enter. enabled %d, tuncConstraint (%d, %f),"
+ "energyBudget (%d, %d)", req.tuncConstraintOn,
+ req.tuncConstraint_valid, req.tuncConstraint,
+ req.energyBudget_valid, req.energyBudget);
+
+ req_union.pSetConstrainedTuncModeReq = &req;
+ status = locSyncSendReq(QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_CONSTRAINED_TUNC_MODE_IND_V02,
+ &ind);
+ if(status != eLOC_CLIENT_SUCCESS || ind.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("failed, status: %s, ind status:%s\n",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ if (adapterResponse) {
+ adapterResponse->returnToSender(err);
+ }
+ LOC_LOGv("Exit. err: %u", err);
+ }));
+}
+
+void LocApiV02::setPositionAssistedClockEstimatorMode
+ (bool enabled, LocApiResponse *adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, enabled, adapterResponse] () {
+
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ qmiLocEnablePositionAssistedClockEstReqMsgT_v02 req;
+ qmiLocEnablePositionAssistedClockEstIndMsgT_v02 ind;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ LOC_LOGd("Enter. enabled %d", enabled);
+ memset(&req, 0, sizeof(req));
+ memset(&ind, 0, sizeof(ind));
+ req.enablePositionAssistedClockEst = enabled;
+
+ req_union.pSetEnablePositionAssistedClockEstReq = &req;
+ status = locSyncSendReq(QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_IND_V02,
+ &ind);
+ if(status != eLOC_CLIENT_SUCCESS || ind.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("failed. status: %s, ind status:%s\n",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ if (adapterResponse) {
+ adapterResponse->returnToSender(err);
+ }
+ LOC_LOGv("Exit. err: %u", err);
+ }));
+}
+
+LocationError LocApiV02::getGnssEnergyConsumed() {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ qmiLocQueryGNSSEnergyConsumedReqMsgT_v02 req;
+ qmiLocQueryGNSSEnergyConsumedIndMsgT_v02 ind;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ LOC_LOGd("Enter. ");
+ memset(&req, 0, sizeof(req));
+ memset(&ind, 0, sizeof(ind));
+
+ req_union.pQueryGNSSEnergyConsumedReq = &req;
+ status = locSyncSendReq(QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_IND_V02,
+ &ind);
+
+ if(status != eLOC_CLIENT_SUCCESS) {
+ LOC_LOGe("failed. status: %s\n", loc_get_v02_client_status_name(status));
+ // report invalid read to indicate error (based on QMI message)
+ LocApiBase::reportGnssEngEnergyConsumedEvent(0xffffffffffffffff);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ } else {
+ LocApiBase::reportGnssEngEnergyConsumedEvent(ind.energyConsumedSinceFirstBoot);
+ }
+
+ LOC_LOGd("Exit. err: %u", err);
+ return err;
+}
+
+void LocApiV02 :: updateSystemPowerState(PowerStateType powerState){
+ sendMsg(new LocApiMsg([this, powerState] () {
+
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ qmiLocInjectPlatformPowerStateReqMsgT_v02 req;
+ qmiLocInjectPlatformPowerStateIndMsgT_v02 ind;
+
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ LOC_LOGd("Enter. power state %d", powerState);
+ qmiLocPlatformPowerStateEnumT_v02 qmiPowerState = eQMI_LOC_POWER_STATE_UNKNOWN_V02;
+ switch (powerState) {
+ case POWER_STATE_SUSPEND:
+ qmiPowerState = eQMI_LOC_POWER_STATE_SUSPENDED_V02;
+ break;
+ case POWER_STATE_RESUME:
+ qmiPowerState = eQMI_LOC_POWER_STATE_RESUME_V02;
+ break;
+ case POWER_STATE_SHUTDOWN:
+ qmiPowerState = eQMI_LOC_POWER_STATE_SHUTDOWN_V02;
+ break;
+ default:
+ break;
+ }
+
+ // unknown power state will not be injected to modem
+ if (eQMI_LOC_POWER_STATE_UNKNOWN_V02 != qmiPowerState) {
+ memset(&req, 0, sizeof(req));
+ memset(&ind, 0, sizeof(ind));
+ req.powerState = qmiPowerState;
+ req_union.pInjectPowerStateReq = &req;
+
+ status = locSyncSendReq(QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_INJECT_PLATFORM_POWER_STATE_IND_V02,
+ &ind);
+ if (status != eLOC_CLIENT_SUCCESS || ind.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("failed. status: %s, ind status:%s\n",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ }
+
+ LOC_LOGd("Exit. err: %u", err);
+ }));
+}
+
+void LocApiV02::configRobustLocation
+ (bool enable, bool enableForE911, LocApiResponse *adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, enable, enableForE911, adapterResponse] () {
+
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ qmiLocSetRobustLocationReqMsgT_v02 req;
+ qmiLocGenReqStatusIndMsgT_v02 ind;
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ LOC_LOGd("Enter. enabled %d, enableForE911 %d", enable, enableForE911);
+ memset(&req, 0, sizeof(req));
+ memset(&ind, 0, sizeof(ind));
+ req.enable = enable;
+ req.enableForE911_valid = true;
+ req.enableForE911 = enableForE911;
+ if (enable == false && enableForE911 == true) {
+ LOC_LOGw("enableForE911 is not allowed when enable is set to false");
+ // change enableForE911 to false to simplify processing
+ req.enableForE911 = false;
+ }
+
+ req_union.pSetRobustLocationReq = &req;
+ status = locSyncSendReq(QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_SET_ROBUST_LOCATION_CONFIG_IND_V02,
+ &ind);
+ if (status != eLOC_CLIENT_SUCCESS || ind.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("failed. status: %s, ind status:%s\n",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ if (adapterResponse) {
+ adapterResponse->returnToSender(err);
+ }
+ LOC_LOGv("Exit. err: %u", err);
+ }));
+}
+
+void LocApiV02 :: getRobustLocationConfig(uint32_t sessionId, LocApiResponse *adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, sessionId, adapterResponse] () {
+
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_GENERAL;
+ locClientReqUnionType req_union = {};
+ qmiLocGetRobustLocationConfigIndMsgT_v02 getRobustLocationConfigInd = {};
+
+ status = locSyncSendReq(QMI_LOC_GET_ROBUST_LOCATION_CONFIG_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT,
+ QMI_LOC_GET_ROBUST_LOCATION_CONFIG_IND_V02,
+ &getRobustLocationConfigInd);
+
+ if ((status == eLOC_CLIENT_SUCCESS) &&
+ (getRobustLocationConfigInd.status == eQMI_LOC_SUCCESS_V02)) {
+ err = LOCATION_ERROR_SUCCESS;
+ }else {
+ LOC_LOGe("getRobustLocationConfig: failed. status: %s, ind status:%s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(getRobustLocationConfigInd.status));
+ if (status == eLOC_CLIENT_FAILURE_UNSUPPORTED) {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ } else {
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ }
+
+ if (LOCATION_ERROR_SUCCESS != err) {
+ adapterResponse->returnToSender(err);
+ } else {
+ GnssConfig config = {};
+ uint32_t robustLocationValidMask = 0;
+ config.flags |= GNSS_CONFIG_FLAGS_ROBUST_LOCATION_BIT;
+ if (getRobustLocationConfigInd.isEnabled_valid) {
+ robustLocationValidMask |= GNSS_CONFIG_ROBUST_LOCATION_ENABLED_VALID_BIT;
+ }
+ if (getRobustLocationConfigInd.isEnabledForE911_valid) {
+ robustLocationValidMask |= GNSS_CONFIG_ROBUST_LOCATION_ENABLED_FOR_E911_VALID_BIT;
+ }
+ config.robustLocationConfig.validMask =
+ (GnssConfigRobustLocationValidMask) robustLocationValidMask;
+ config.robustLocationConfig.enabled = getRobustLocationConfigInd.isEnabled;
+ config.robustLocationConfig.enabledForE911 = getRobustLocationConfigInd.isEnabledForE911;
+ LOC_LOGd("session id: %d, enabled (%d %d), enabledForE911 (%d, %d)",
+ sessionId, getRobustLocationConfigInd.isEnabled_valid,
+ getRobustLocationConfigInd.isEnabledForE911_valid,
+ config.robustLocationConfig.enabled,
+ config.robustLocationConfig.enabledForE911);
+ LocApiBase::reportGnssConfig(sessionId, config);
+ }
+
+ LOC_LOGv("Exit. err: %u", err);
+ }));
+}
+
+bool LocApiV02 :: cacheGnssMeasurementSupport()
+{
+ bool gnssMeasurementSupported = false;
+
+ /*for GNSS Measurement service, use
+ QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02
+ to check if modem support this feature or not*/
+ LOC_LOGD("%s:%d]: set GNSS measurement.\n", __func__, __LINE__);
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS ==
+ setSvMeasurementConstellation(QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02)) {
+ gnssMeasurementSupported = true;
+ }
+
+ LOC_LOGV("%s:%d]: gnssMeasurementSupported is %d\n", __func__, __LINE__,
+ gnssMeasurementSupported);
+
+ return gnssMeasurementSupported;
+}
+
+locClientStatusEnumType LocApiV02::locSyncSendReq(uint32_t req_id,
+ locClientReqUnionType req_payload, uint32_t timeout_msec,
+ uint32_t ind_id, void* ind_payload_ptr) {
+ locClientStatusEnumType status = loc_sync_send_req(clientHandle, req_id, req_payload,
+ timeout_msec, ind_id, ind_payload_ptr);
+ if (eLOC_CLIENT_FAILURE_ENGINE_BUSY == status ||
+ (eLOC_CLIENT_SUCCESS == status && nullptr != ind_payload_ptr &&
+ eQMI_LOC_ENGINE_BUSY_V02 == *((qmiLocStatusEnumT_v02*)ind_payload_ptr))) {
+ if (mResenders.empty() && ((mQmiMask & QMI_LOC_EVENT_MASK_ENGINE_STATE_V02) == 0)) {
+ locClientRegisterEventMask(clientHandle,
+ mQmiMask | QMI_LOC_EVENT_MASK_ENGINE_STATE_V02, isMaster());
+ }
+ LOC_LOGd("Engine busy, cache req: %d", req_id);
+ uint32_t reqLen = 0;
+ void* pReqData = nullptr;
+ locClientReqUnionType req_payload_copy = {nullptr};
+ validateRequest(req_id, req_payload, &pReqData, &reqLen);
+ if (nullptr != pReqData) {
+ req_payload_copy.pReqData = malloc(reqLen);
+ if (nullptr != req_payload_copy.pReqData) {
+ memcpy(req_payload_copy.pReqData, pReqData, reqLen);
+ }
+ }
+ // something would be wrong if (nullptr != pReqData && nullptr == req_payload_copy)
+ if (nullptr == pReqData || nullptr != req_payload_copy.pReqData) {
+ mResenders.push_back([=](){
+ // ignore indicator, we use nullptr as the last parameter
+ loc_sync_send_req(clientHandle, req_id, req_payload_copy,
+ timeout_msec, ind_id, nullptr);
+ if (nullptr != req_payload_copy.pReqData) {
+ free(req_payload_copy.pReqData);
+ }
+ });
+ }
+ }
+ return status;
+}
+
+void LocApiV02 ::
+handleWwanZppFixIndication(const qmiLocGetAvailWwanPositionIndMsgT_v02& zpp_ind)
+{
+ LocGpsLocation zppLoc;
+ memset(&zppLoc, 0, sizeof(zppLoc));
+
+ LOC_LOGD("Got Wwan Zpp fix location validity (lat:%d, lon:%d, timestamp:%d accuracy:%d)\n "
+ "(%.7f, %.7f), timestamp %" PRIu64 ", accuracy %f",
+ zpp_ind.latitude_valid,
+ zpp_ind.longitude_valid,
+ zpp_ind.timestampUtc_valid,
+ zpp_ind.horUncCircular_valid,
+ zpp_ind.latitude,
+ zpp_ind.longitude,
+ zpp_ind.timestampUtc,
+ zpp_ind.horUncCircular);
+
+ if ((zpp_ind.latitude_valid == false) ||
+ (zpp_ind.longitude_valid == false) ||
+ (zpp_ind.horUncCircular_valid == false)) {
+ LOC_LOGE(" Location not valid lat=%u lon=%u unc=%u",
+ zpp_ind.latitude_valid,
+ zpp_ind.longitude_valid,
+ zpp_ind.horUncCircular_valid);
+ } else {
+
+ zppLoc.size = sizeof(LocGpsLocation);
+ if (zpp_ind.timestampUtc_valid) {
+ zppLoc.timestamp = zpp_ind.timestampUtc;
+ } else {
+ /* The UTC time from modem is not valid.
+ In this case, we use current system time instead.*/
+
+ struct timespec time_info_current;
+ clock_gettime(CLOCK_REALTIME,&time_info_current);
+ zppLoc.timestamp = (time_info_current.tv_sec)*1e3 +
+ (time_info_current.tv_nsec)/1e6;
+ LOC_LOGD("zpp timestamp got from system: %" PRIu64, zppLoc.timestamp);
+ }
+
+ zppLoc.flags = LOC_GPS_LOCATION_HAS_LAT_LONG | LOC_GPS_LOCATION_HAS_ACCURACY;
+ zppLoc.latitude = zpp_ind.latitude;
+ zppLoc.longitude = zpp_ind.longitude;
+ zppLoc.accuracy = zpp_ind.horUncCircular;
+
+ // If horCircularConfidence_valid is true, and horCircularConfidence value
+ // is less than 68%, then scale the accuracy value to 68% confidence.
+ if (zpp_ind.horCircularConfidence_valid)
+ {
+ scaleAccuracyTo68PercentConfidence(zpp_ind.horCircularConfidence,
+ zppLoc, true);
+ }
+
+ if (zpp_ind.altitudeWrtEllipsoid_valid) {
+ zppLoc.flags |= LOC_GPS_LOCATION_HAS_ALTITUDE;
+ zppLoc.altitude = zpp_ind.altitudeWrtEllipsoid;
+ }
+
+ if (zpp_ind.vertUnc_valid) {
+ zppLoc.flags |= LOC_GPS_LOCATION_HAS_VERT_UNCERTAINITY;
+ zppLoc.vertUncertainity = zpp_ind.vertUnc;
+ }
+ }
+
+ LocApiBase::reportWwanZppFix(zppLoc);
+}
+
+void LocApiV02::
+ handleZppBestAvailableFixIndication(const qmiLocGetBestAvailablePositionIndMsgT_v02 &zpp_ind)
+{
+ LocGpsLocation zppLoc;
+ GpsLocationExtended location_extended;
+ LocPosTechMask tech_mask;
+
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ zppLoc.size = sizeof(zppLoc);
+
+ memset(&location_extended, 0, sizeof(location_extended));
+ location_extended.size = sizeof(location_extended);
+
+ tech_mask = LOC_POS_TECH_MASK_DEFAULT;
+
+ LOC_LOGD("Got Zpp fix location validity (lat:%d, lon:%d, timestamp:%d accuracy:%d)"
+ " (%.7f, %.7f), timestamp %" PRIu64 ", accuracy %f",
+ zpp_ind.latitude_valid,
+ zpp_ind.longitude_valid,
+ zpp_ind.timestampUtc_valid,
+ zpp_ind.horUncCircular_valid,
+ zpp_ind.latitude,
+ zpp_ind.longitude,
+ zpp_ind.timestampUtc,
+ zpp_ind.horUncCircular);
+
+ if (zpp_ind.timestampUtc_valid) {
+ zppLoc.timestamp = zpp_ind.timestampUtc;
+ } else {
+ /* The UTC time from modem is not valid.
+ In this case, we use current system time instead.*/
+
+ struct timespec time_info_current;
+ clock_gettime(CLOCK_REALTIME,&time_info_current);
+ zppLoc.timestamp = (time_info_current.tv_sec)*1e3 +
+ (time_info_current.tv_nsec)/1e6;
+ LOC_LOGD("zpp timestamp got from system: %" PRIu64, zppLoc.timestamp);
+ }
+
+ if (zpp_ind.latitude_valid && zpp_ind.longitude_valid &&
+ zpp_ind.horUncCircular_valid ) {
+ zppLoc.flags = LOC_GPS_LOCATION_HAS_LAT_LONG | LOC_GPS_LOCATION_HAS_ACCURACY;
+ zppLoc.latitude = zpp_ind.latitude;
+ zppLoc.longitude = zpp_ind.longitude;
+ zppLoc.accuracy = zpp_ind.horUncCircular;
+
+ // If horCircularConfidence_valid is true, and horCircularConfidence value
+ // is less than 68%, then scale the accuracy value to 68% confidence.
+ if (zpp_ind.horCircularConfidence_valid)
+ {
+ scaleAccuracyTo68PercentConfidence(zpp_ind.horCircularConfidence,
+ zppLoc, true);
+ }
+
+ if (zpp_ind.altitudeWrtEllipsoid_valid) {
+ zppLoc.flags |= LOC_GPS_LOCATION_HAS_ALTITUDE;
+ zppLoc.altitude = zpp_ind.altitudeWrtEllipsoid;
+ }
+
+ if (zpp_ind.horSpeed_valid) {
+ zppLoc.flags |= LOC_GPS_LOCATION_HAS_SPEED;
+ zppLoc.speed = zpp_ind.horSpeed;
+ }
+
+ if (zpp_ind.heading_valid) {
+ zppLoc.flags |= LOC_GPS_LOCATION_HAS_BEARING;
+ zppLoc.bearing = zpp_ind.heading;
+ }
+
+ if (zpp_ind.vertUnc_valid) {
+ location_extended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ location_extended.vert_unc = zpp_ind.vertUnc;
+ }
+
+ if (zpp_ind.horSpeedUnc_valid) {
+ location_extended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ location_extended.speed_unc = zpp_ind.horSpeedUnc;
+ }
+
+ if (zpp_ind.headingUnc_valid) {
+ location_extended.flags |= GPS_LOCATION_EXTENDED_HAS_BEARING_UNC;
+ location_extended.bearing_unc = zpp_ind.headingUnc;
+ }
+
+ if (zpp_ind.technologyMask_valid) {
+ tech_mask = zpp_ind.technologyMask;
+ }
+
+ if(zpp_ind.spoofReportMask_valid) {
+ zppLoc.flags |= LOC_GPS_LOCATION_HAS_SPOOF_MASK;
+ zppLoc.spoof_mask = (uint32_t)zpp_ind.spoofReportMask;
+ LOC_LOGD("%s:%d QMI_spoofReportMask:0x%x", __func__, __LINE__,
+ (uint8_t)zppLoc.spoof_mask);
+ }
+ }
+
+ LocApiBase::reportZppBestAvailableFix(zppLoc, location_extended, tech_mask);
+}
+
+
+LocPosTechMask LocApiV02 :: convertPosTechMask(
+ qmiLocPosTechMaskT_v02 mask)
+{
+ LocPosTechMask locTechMask = LOC_POS_TECH_MASK_DEFAULT;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_SATELLITE_V02)
+ locTechMask |= LOC_POS_TECH_MASK_SATELLITE;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_CELLID_V02)
+ locTechMask |= LOC_POS_TECH_MASK_CELLID;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_WIFI_V02)
+ locTechMask |= LOC_POS_TECH_MASK_WIFI;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_SENSORS_V02)
+ locTechMask |= LOC_POS_TECH_MASK_SENSORS;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_REFERENCE_LOCATION_V02)
+ locTechMask |= LOC_POS_TECH_MASK_REFERENCE_LOCATION;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION_V02)
+ locTechMask |= LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_AFLT_V02)
+ locTechMask |= LOC_POS_TECH_MASK_AFLT;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_HYBRID_V02)
+ locTechMask |= LOC_POS_TECH_MASK_HYBRID;
+
+ return locTechMask;
+}
+
+LocNavSolutionMask LocApiV02 :: convertNavSolutionMask(
+ qmiLocNavSolutionMaskT_v02 mask)
+{
+ LocNavSolutionMask locNavMask = 0;
+
+ if (mask & QMI_LOC_NAV_MASK_SBAS_CORRECTION_IONO_V02)
+ locNavMask |= LOC_NAV_MASK_SBAS_CORRECTION_IONO;
+
+ if (mask & QMI_LOC_NAV_MASK_SBAS_CORRECTION_FAST_V02)
+ locNavMask |= LOC_NAV_MASK_SBAS_CORRECTION_FAST;
+
+ if (mask & QMI_LOC_POS_TECH_MASK_WIFI_V02)
+ locNavMask |= LOC_POS_TECH_MASK_WIFI;
+
+ if (mask & QMI_LOC_NAV_MASK_SBAS_CORRECTION_LONG_V02)
+ locNavMask |= LOC_NAV_MASK_SBAS_CORRECTION_LONG;
+
+ if (mask & QMI_LOC_NAV_MASK_SBAS_INTEGRITY_V02)
+ locNavMask |= LOC_NAV_MASK_SBAS_INTEGRITY;
+
+ if (mask & QMI_LOC_NAV_MASK_CORRECTION_DGNSS_V02)
+ locNavMask |= LOC_NAV_MASK_DGNSS_CORRECTION;
+
+ return locNavMask;
+}
+
+qmiLocApnTypeMaskT_v02 LocApiV02::convertLocApnTypeMask(LocApnTypeMask mask)
+{
+ qmiLocApnTypeMaskT_v02 qmiMask = 0;
+
+ if (mask & LOC_APN_TYPE_MASK_DEFAULT) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_DEFAULT_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_IMS) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_IMS_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_MMS) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_MMS_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_DUN) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_DUN_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_SUPL) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_SUPL_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_HIPRI) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_HIPRI_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_FOTA) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_FOTA_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_CBS) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_CBS_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_IA) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_IA_V02;
+ }
+ if (mask & LOC_APN_TYPE_MASK_EMERGENCY) {
+ qmiMask |= QMI_LOC_APN_TYPE_MASK_EMERGENCY_V02;
+ }
+
+ return qmiMask;
+}
+
+LocApnTypeMask LocApiV02::convertQmiLocApnTypeMask(qmiLocApnTypeMaskT_v02 qmiMask)
+{
+ LocApnTypeMask mask = 0;
+
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_DEFAULT_V02) {
+ mask |= LOC_APN_TYPE_MASK_DEFAULT;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_IMS_V02) {
+ mask |= LOC_APN_TYPE_MASK_IMS;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_MMS_V02) {
+ mask |= LOC_APN_TYPE_MASK_MMS;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_DUN_V02) {
+ mask |= LOC_APN_TYPE_MASK_DUN;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_SUPL_V02) {
+ mask |= LOC_APN_TYPE_MASK_SUPL;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_HIPRI_V02) {
+ mask |= LOC_APN_TYPE_MASK_HIPRI;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_FOTA_V02) {
+ mask |= LOC_APN_TYPE_MASK_FOTA;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_CBS_V02) {
+ mask |= LOC_APN_TYPE_MASK_CBS;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_IA_V02) {
+ mask |= LOC_APN_TYPE_MASK_IA;
+ }
+ if (qmiMask & QMI_LOC_APN_TYPE_MASK_EMERGENCY_V02) {
+ mask |= LOC_APN_TYPE_MASK_EMERGENCY;
+ }
+
+ return mask;
+}
+
+GnssConfigSuplVersion
+LocApiV02::convertSuplVersion(const uint32_t suplVersion)
+{
+ switch (suplVersion) {
+ case 0x00020004:
+ return GNSS_CONFIG_SUPL_VERSION_2_0_4;
+ case 0x00020002:
+ return GNSS_CONFIG_SUPL_VERSION_2_0_2;
+ case 0x00020000:
+ return GNSS_CONFIG_SUPL_VERSION_2_0_0;
+ case 0x00010000:
+ default:
+ return GNSS_CONFIG_SUPL_VERSION_1_0_0;
+ }
+}
+
+GnssConfigLppProfile
+LocApiV02::convertLppProfile(const uint32_t lppProfile)
+{
+ switch (lppProfile) {
+ case 1:
+ return GNSS_CONFIG_LPP_PROFILE_USER_PLANE;
+ case 2:
+ return GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE;
+ case 3:
+ return GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE;
+ case 0:
+ default:
+ return GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
+ }
+}
+
+GnssConfigLppeControlPlaneMask
+LocApiV02::convertLppeCp(const uint32_t lppeControlPlaneMask)
+{
+ GnssConfigLppeControlPlaneMask mask = 0;
+ if ((1<<0) & lppeControlPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT;
+ }
+ if ((1<<1) & lppeControlPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT;
+ }
+ if ((1<<2) & lppeControlPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT;
+ }
+ if ((1<<3) & lppeControlPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT;
+ }
+ return mask;
+}
+
+GnssConfigLppeUserPlaneMask
+LocApiV02::convertLppeUp(const uint32_t lppeUserPlaneMask)
+{
+ GnssConfigLppeUserPlaneMask mask = 0;
+ if ((1 << 0) & lppeUserPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT;
+ }
+ if ((1 << 1) & lppeUserPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT;
+ }
+ if ((1 << 2) & lppeUserPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT;
+ }
+ if ((1 << 3) & lppeUserPlaneMask) {
+ mask |= GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT;
+ }
+ return mask;
+}
+
+LocationError
+LocApiV02::setEmergencyExtensionWindowSync(const uint32_t emergencyExtensionSeconds)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ qmiLocSetProtocolConfigParametersReqMsgT_v02 eCbW_req;
+ qmiLocSetProtocolConfigParametersIndMsgT_v02 eCbW_ind;
+
+ memset(&eCbW_req, 0, sizeof(eCbW_req));
+ memset(&eCbW_ind, 0, sizeof(eCbW_ind));
+
+ eCbW_req.emergencyCallbackWindow_valid = 1;
+ eCbW_req.emergencyCallbackWindow = emergencyExtensionSeconds;
+
+ req_union.pSetProtocolConfigParametersReq = &eCbW_req;
+
+ LOC_LOGd("emergencyCallbackWindow = %d", emergencyExtensionSeconds);
+
+ result = locSyncSendReq(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ &eCbW_ind);
+
+ if (result != eLOC_CLIENT_SUCCESS ||
+ eQMI_LOC_SUCCESS_V02 != eCbW_ind.status)
+ {
+ LOC_LOGe("Error status = %s, ind..status = %s ",
+ loc_get_v02_client_status_name(result),
+ loc_get_v02_qmi_status_name(eCbW_ind.status));
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+LocationError
+LocApiV02::setBlacklistSvSync(const GnssSvIdConfig& config)
+{
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_GENERAL;
+ locClientReqUnionType req_union = {};
+
+ qmiLocSetBlacklistSvReqMsgT_v02 setBlacklistSvMsg;
+ qmiLocGenReqStatusIndMsgT_v02 genReqStatusIndMsg;
+
+ // Clear all fields
+ memset(&setBlacklistSvMsg, 0, sizeof(setBlacklistSvMsg));
+ memset(&genReqStatusIndMsg, 0, sizeof(genReqStatusIndMsg));
+
+ // Fill in the request details
+ setBlacklistSvMsg.glo_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.glo_persist_blacklist_sv = config.gloBlacklistSvMask;
+ setBlacklistSvMsg.glo_clear_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.glo_clear_persist_blacklist_sv = ~config.gloBlacklistSvMask;
+
+ setBlacklistSvMsg.bds_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.bds_persist_blacklist_sv = config.bdsBlacklistSvMask;
+ setBlacklistSvMsg.bds_clear_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.bds_clear_persist_blacklist_sv = ~config.bdsBlacklistSvMask;
+
+ setBlacklistSvMsg.qzss_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.qzss_persist_blacklist_sv = config.qzssBlacklistSvMask;
+ setBlacklistSvMsg.qzss_clear_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.qzss_clear_persist_blacklist_sv = ~config.qzssBlacklistSvMask;
+
+ setBlacklistSvMsg.gal_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.gal_persist_blacklist_sv = config.galBlacklistSvMask;
+ setBlacklistSvMsg.gal_clear_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.gal_clear_persist_blacklist_sv = ~config.galBlacklistSvMask;
+
+ setBlacklistSvMsg.sbas_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.sbas_persist_blacklist_sv = config.sbasBlacklistSvMask,
+ setBlacklistSvMsg.sbas_clear_persist_blacklist_sv_valid = true;
+ setBlacklistSvMsg.sbas_clear_persist_blacklist_sv = ~config.sbasBlacklistSvMask;
+
+ LOC_LOGd(">>> configConstellations, "
+ "glo blacklist mask =0x%" PRIx64 ", "
+ "qzss blacklist mask =0x%" PRIx64 ",\n"
+ "bds blacklist mask =0x%" PRIx64 ", "
+ "gal blacklist mask =0x%" PRIx64 ",\n"
+ "sbas blacklist mask =0x%" PRIx64 ", ",
+ setBlacklistSvMsg.glo_persist_blacklist_sv,
+ setBlacklistSvMsg.qzss_persist_blacklist_sv,
+ setBlacklistSvMsg.bds_persist_blacklist_sv,
+ setBlacklistSvMsg.gal_persist_blacklist_sv,
+ setBlacklistSvMsg.sbas_persist_blacklist_sv);
+
+ // Update in request union
+ req_union.pSetBlacklistSvReq = &setBlacklistSvMsg;
+
+ // Send the request
+ status = loc_sync_send_req(clientHandle,
+ QMI_LOC_SET_BLACKLIST_SV_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_BLACKLIST_SV_IND_V02,
+ &genReqStatusIndMsg);
+ if(status != eLOC_CLIENT_SUCCESS ||
+ genReqStatusIndMsg.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("Set Blacklist SV failed. status: %s ind status %s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(genReqStatusIndMsg.status));
+ return LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return LOCATION_ERROR_SUCCESS;
+}
+
+void
+LocApiV02::setBlacklistSv(const GnssSvIdConfig& config)
+{
+ sendMsg(new LocApiMsg([this, config] () {
+ setBlacklistSvSync(config);
+ }));
+}
+
+void LocApiV02::getBlacklistSv()
+{
+ sendMsg(new LocApiMsg([this] () {
+
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_GENERAL;
+ locClientReqUnionType req_union = {};
+
+ // Nothing to update in request union
+
+ // Send the request
+ status = locClientSendReq(QMI_LOC_GET_BLACKLIST_SV_REQ_V02, req_union);
+ if(status != eLOC_CLIENT_SUCCESS) {
+ LOC_LOGe("Get Blacklist SV failed. status: %s",
+ loc_get_v02_client_status_name(status));
+ }
+
+ }));
+}
+
+void
+LocApiV02::setConstellationControl(const GnssSvTypeConfig& config,
+ LocApiResponse *adapterResponse)
+{
+ // QMI will return INVALID parameter if enabledSvTypesMask is 0,
+ // so we just return back to the caller as this is no-op
+ if (0 == config.enabledSvTypesMask) {
+ if (NULL != adapterResponse) {
+ adapterResponse->returnToSender(LOCATION_ERROR_SUCCESS);
+ }
+ return;
+ }
+
+ sendMsg(new LocApiMsg([this, config, adapterResponse] () {
+
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_GENERAL;
+ locClientReqUnionType req_union = {};
+
+ qmiLocSetConstellationConfigReqMsgT_v02 setConstellationConfigMsg;
+ qmiLocGenReqStatusIndMsgT_v02 genReqStatusIndMsg;
+
+ // Clear all fields
+ memset (&setConstellationConfigMsg, 0, sizeof(setConstellationConfigMsg));
+ memset(&genReqStatusIndMsg, 0, sizeof(genReqStatusIndMsg));
+
+ // Fill in the request details
+ setConstellationConfigMsg.resetConstellations = false;
+
+ setConstellationConfigMsg.enableMask_valid = true;
+ setConstellationConfigMsg.enableMask = config.enabledSvTypesMask;
+
+ // disableMask is not supported in modem
+ // if we set disableMask, QMI call will return error
+ LOC_LOGe("enable: %d 0x%" PRIx64 ", blacklisted: %d 0x%" PRIx64 "",
+ setConstellationConfigMsg.enableMask_valid,
+ setConstellationConfigMsg.enableMask,
+ setConstellationConfigMsg.disableMask_valid,
+ setConstellationConfigMsg.disableMask);
+
+ // Update in request union
+ req_union.pSetConstellationConfigReq = &setConstellationConfigMsg;
+
+ // Send the request
+ status = loc_sync_send_req(clientHandle,
+ QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_CONSTELLATION_CONTROL_IND_V02,
+ &genReqStatusIndMsg);
+ if(status != eLOC_CLIENT_SUCCESS ||
+ genReqStatusIndMsg.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("Set Constellation Config failed. status: %s ind status %s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(genReqStatusIndMsg.status));
+ }
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ if (eLOC_CLIENT_SUCCESS == status) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+
+ }));
+}
+
+void
+LocApiV02::getConstellationControl()
+{
+ sendMsg(new LocApiMsg([this] () {
+
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_GENERAL;
+ locClientReqUnionType req_union = {};
+
+ qmiLocGetConstellationConfigIndMsgT_v02 getConstIndMsg;
+ memset(&getConstIndMsg, 0, sizeof(getConstIndMsg));
+
+ // Nothing to update in request union
+
+ // Send the request
+ status = loc_sync_send_req(clientHandle,
+ QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_GET_CONSTELLATION_CONTROL_IND_V02,
+ &getConstIndMsg);
+ if(status == eLOC_CLIENT_SUCCESS &&
+ getConstIndMsg.status == eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGd("GET constellation Ind");
+ reportGnssSvTypeConfig(getConstIndMsg);
+ } else {
+ LOC_LOGe("Get Constellation failed. status: %s, ind status: %s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(getConstIndMsg.status));
+ }
+
+ }));
+}
+
+void
+LocApiV02::resetConstellationControl(LocApiResponse *adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, adapterResponse] () {
+
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_GENERAL;
+ locClientReqUnionType req_union = {};
+
+ qmiLocSetConstellationConfigReqMsgT_v02 setConstellationConfigMsg;
+ qmiLocGenReqStatusIndMsgT_v02 genReqStatusIndMsg;
+
+ // Clear all fields
+ memset (&setConstellationConfigMsg, 0, sizeof(setConstellationConfigMsg));
+ memset(&genReqStatusIndMsg, 0, sizeof(genReqStatusIndMsg));
+
+ // Fill in the request details
+ setConstellationConfigMsg.resetConstellations = true;
+
+ // Update in request union
+ req_union.pSetConstellationConfigReq = &setConstellationConfigMsg;
+
+ // Send the request
+ status = loc_sync_send_req(clientHandle,
+ QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_CONSTELLATION_CONTROL_IND_V02,
+ &genReqStatusIndMsg);
+ if(status != eLOC_CLIENT_SUCCESS ||
+ genReqStatusIndMsg.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("Reset Constellation Config failed. "
+ "status: %s ind status %s",
+ loc_get_v02_client_status_name(status),
+ loc_get_v02_qmi_status_name(genReqStatusIndMsg.status));
+ }
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ if (eLOC_CLIENT_SUCCESS == status) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ if (adapterResponse) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+LocApiV02::reportGnssSvIdConfig(
+ const qmiLocGetBlacklistSvIndMsgT_v02& ind)
+{
+ // Validate status
+ if (ind.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("Ind failure status %d", ind.status);
+ return;
+ }
+
+ // Parse all fields
+ GnssSvIdConfig config = {};
+ config.size = sizeof(GnssSvIdConfig);
+ if (ind.bds_persist_blacklist_sv_valid) {
+ config.bdsBlacklistSvMask = ind.bds_persist_blacklist_sv;
+ }
+ if (ind.gal_persist_blacklist_sv_valid) {
+ config.galBlacklistSvMask = ind.gal_persist_blacklist_sv;
+ }
+ if (ind.qzss_persist_blacklist_sv_valid) {
+ config.qzssBlacklistSvMask = ind.qzss_persist_blacklist_sv;
+ }
+ if (ind.glo_persist_blacklist_sv_valid) {
+ config.gloBlacklistSvMask = ind.glo_persist_blacklist_sv;
+ }
+
+ // Pass on GnssSvConfig
+ LocApiBase::reportGnssSvIdConfig(config);
+}
+
+void
+LocApiV02::reportGnssSvTypeConfig(
+ const qmiLocGetConstellationConfigIndMsgT_v02& ind)
+{
+ // Validate status
+ if (ind.status != eQMI_LOC_SUCCESS_V02) {
+ LOC_LOGe("Ind failure status %d", ind.status);
+ return;
+ }
+
+ // Parse all fields
+ GnssSvTypeConfig config = {};
+ config.size = sizeof(GnssSvTypeConfig);
+ convertToGnssSvTypeConfig(ind, config);
+
+ // Pass on GnssSvConfig
+ LocApiBase::reportGnssSvTypeConfig(config);
+}
+
+void
+LocApiV02::convertToGnssSvTypeConfig(
+ const qmiLocGetConstellationConfigIndMsgT_v02& ind,
+ GnssSvTypeConfig& config)
+{
+ // Enabled Mask
+ if (ind.bds_status_valid &&
+ (ind.bds_status == eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY_V02 ||
+ ind.bds_status == eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY_V02 ||
+ ind.bds_status == eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT_V02)) {
+ config.enabledSvTypesMask |= GNSS_SV_TYPES_MASK_BDS_BIT;
+ }
+ if (ind.glonass_status_valid &&
+ (ind.glonass_status == eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY_V02 ||
+ ind.glonass_status == eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY_V02 ||
+ ind.glonass_status == eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT_V02)) {
+ config.enabledSvTypesMask |= GNSS_SV_TYPES_MASK_GLO_BIT;
+ }
+ if (ind.galileo_status_valid &&
+ (ind.galileo_status == eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY_V02 ||
+ ind.galileo_status == eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY_V02 ||
+ ind.galileo_status == eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT_V02)) {
+ config.enabledSvTypesMask |= GNSS_SV_TYPES_MASK_GAL_BIT;
+ }
+ if (ind.qzss_status_valid &&
+ (ind.qzss_status == eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY_V02 ||
+ ind.qzss_status == eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY_V02 ||
+ ind.qzss_status == eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT_V02)) {
+ config.enabledSvTypesMask |= GNSS_SV_TYPES_MASK_QZSS_BIT;
+ }
+ if (ind.navic_status_valid &&
+ (ind.navic_status == eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY_V02 ||
+ ind.navic_status == eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY_V02 ||
+ ind.navic_status == eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT_V02)) {
+ config.enabledSvTypesMask |= GNSS_SV_TYPES_MASK_NAVIC_BIT;
+ }
+
+ // Disabled Mask
+ if (ind.bds_status_valid &&
+ (ind.bds_status == eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED_V02 ||
+ ind.bds_status == eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY_V02 ||
+ ind.bds_status == eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT_V02 ||
+ ind.bds_status == eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY_V02)) {
+ config.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_BDS_BIT;
+ }
+ if (ind.glonass_status_valid &&
+ (ind.glonass_status == eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED_V02 ||
+ ind.glonass_status == eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY_V02 ||
+ ind.glonass_status == eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT_V02 ||
+ ind.glonass_status == eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY_V02)) {
+ config.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_GLO_BIT;
+ }
+ if (ind.galileo_status_valid &&
+ (ind.galileo_status == eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED_V02 ||
+ ind.galileo_status == eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY_V02 ||
+ ind.galileo_status == eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT_V02 ||
+ ind.galileo_status == eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY_V02)) {
+ config.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_GAL_BIT;
+ }
+ if (ind.qzss_status_valid &&
+ (ind.qzss_status == eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED_V02 ||
+ ind.qzss_status == eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY_V02 ||
+ ind.qzss_status == eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT_V02 ||
+ ind.qzss_status == eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY_V02)) {
+ config.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_QZSS_BIT;
+ }
+ if (ind.navic_status_valid &&
+ (ind.navic_status == eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED_V02 ||
+ ind.navic_status == eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY_V02 ||
+ ind.navic_status == eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT_V02 ||
+ ind.navic_status == eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY_V02)) {
+ config.blacklistedSvTypesMask |= GNSS_SV_TYPES_MASK_NAVIC_BIT;
+ }
+}
+
+void LocApiV02::onDbtPosReportEvent(const qmiLocEventDbtPositionReportIndMsgT_v02* pDbtPosReport)
+{
+ UlpLocation location;
+ memset (&location, 0, sizeof (location));
+ location.size = sizeof(location);
+ const qmiLocDbtPositionStructT_v02 *pReport = &pDbtPosReport->dbtPosition;
+
+ // time stamp
+ location.gpsLocation.timestamp = pReport->timestampUtc;
+ // latitude & longitude
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_LAT_LONG;
+ location.gpsLocation.latitude = pReport->latitude;
+ location.gpsLocation.longitude = pReport->longitude;
+ // Altitude
+ if (pReport->altitudeWrtEllipsoid_valid == 1) {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_ALTITUDE;
+ location.gpsLocation.altitude = pReport->altitudeWrtEllipsoid;
+ }
+ // Speed
+ if (pReport->speedHorizontal_valid == 1) {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_SPEED;
+ location.gpsLocation.speed = pReport->speedHorizontal;
+ }
+ // Heading
+ if (pReport->heading_valid == 1) {
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_BEARING;
+ location.gpsLocation.bearing = pReport->heading;
+ }
+ // Accuracy
+ location.gpsLocation.flags |= LOC_GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy = sqrt(pReport->horUncEllipseSemiMinor*
+ pReport->horUncEllipseSemiMinor +
+ pReport->horUncEllipseSemiMajor*
+ pReport->horUncEllipseSemiMajor);
+ // Source used
+ LocPosTechMask loc_technology_mask = LOC_POS_TECH_MASK_DEFAULT;
+ if (pDbtPosReport->positionSrc_valid) {
+ switch (pDbtPosReport->positionSrc) {
+ case eQMI_LOC_POSITION_SRC_GNSS_V02:
+ loc_technology_mask = LOC_POS_TECH_MASK_SATELLITE;
+ break;
+ case eQMI_LOC_POSITION_SRC_CELLID_V02:
+ loc_technology_mask = LOC_POS_TECH_MASK_CELLID;
+ break;
+ case eQMI_LOC_POSITION_SRC_ENH_CELLID_V02:
+ loc_technology_mask = LOC_POS_TECH_MASK_CELLID;
+ break;
+ case eQMI_LOC_POSITION_SRC_WIFI_V02:
+ loc_technology_mask = LOC_POS_TECH_MASK_WIFI;
+ break;
+ case eQMI_LOC_POSITION_SRC_TERRESTRIAL_V02:
+ loc_technology_mask = LOC_POS_TECH_MASK_REFERENCE_LOCATION;
+ break;
+ case eQMI_LOC_POSITION_SRC_GNSS_TERRESTRIAL_HYBRID_V02:
+ loc_technology_mask = LOC_POS_TECH_MASK_HYBRID;
+ break;
+ default:
+ loc_technology_mask = LOC_POS_TECH_MASK_DEFAULT;
+ }
+ }
+
+ GpsLocationExtended locationExtended;
+ memset(&locationExtended, 0, sizeof (GpsLocationExtended));
+ locationExtended.size = sizeof(locationExtended);
+
+ if (pReport->vertUnc_valid) {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ locationExtended.vert_unc = pReport->vertUnc;
+ }
+ if (pDbtPosReport->speedUnc_valid) {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ locationExtended.speed_unc = pDbtPosReport->speedUnc;
+ }
+ if (pDbtPosReport->headingUnc_valid) {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_BEARING_UNC;
+ locationExtended.bearing_unc = pDbtPosReport->headingUnc;
+ }
+ // Calling the base
+ reportDBTPosition(location,
+ locationExtended,
+ LOC_SESS_SUCCESS,
+ loc_technology_mask);
+}
+
+void LocApiV02::batchFullEvent(const qmiLocEventBatchFullIndMsgT_v02* batchFullInfo)
+{
+ struct MsgGetBatchedLocations : public LocMsg {
+ LocApiBase& mApi;
+ size_t mCount;
+ uint32_t mAccumulatedDistance;
+ qmiLocBatchingTypeEnumT_v02 mBatchType;
+ inline MsgGetBatchedLocations(LocApiV02& api,
+ size_t count,
+ uint32_t accumulatedDistance,
+ qmiLocBatchingTypeEnumT_v02 batchType) :
+ LocMsg(),
+ mApi(api),
+ mCount(count),
+ mAccumulatedDistance(accumulatedDistance),
+ mBatchType(batchType) {}
+ inline virtual void proc() const {
+ // Explicit check for if OTB is supported or not to work around an
+ // issue with older modems where uninitialized batchInd is being sent
+ if ((mBatchType == eQMI_LOC_OUTDOOR_TRIP_BATCHING_V02) &&
+ (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING))) {
+ mApi.getBatchedTripLocationsSync(mCount, mAccumulatedDistance);
+ } else {
+ mApi.getBatchedLocationsSync(mCount);
+ }
+ }
+ };
+
+ sendMsg(new MsgGetBatchedLocations(*this,
+ batchFullInfo->batchCount,
+ (batchFullInfo->accumulatedDistance_valid ?
+ batchFullInfo->accumulatedDistance: 0),
+ (batchFullInfo->batchType_valid ? batchFullInfo->batchType :
+ eQMI_LOC_LOCATION_BATCHING_V02)));
+
+}
+
+void LocApiV02::batchStatusEvent(const qmiLocEventBatchingStatusIndMsgT_v02* batchStatusInfo)
+{
+ BatchingStatus batchStatus;
+
+ switch(batchStatusInfo->batchingStatus)
+ {
+ case eQMI_LOC_BATCH_POS_UNAVAILABLE_V02:
+ batchStatus = BATCHING_STATUS_POSITION_UNAVAILABLE;
+ break;
+ case eQMI_LOC_BATCH_POS_AVAILABLE_V02:
+ batchStatus = BATCHING_STATUS_POSITION_AVAILABE;
+ break;
+ default:
+ batchStatus = BATCHING_STATUS_POSITION_UNAVAILABLE;
+ }
+
+ handleBatchStatusEvent(batchStatus);
+}
+
+// For Geofence
+void LocApiV02::geofenceBreachEvent(const qmiLocEventGeofenceBreachIndMsgT_v02* breachInfo)
+{
+ uint32_t hwId = breachInfo->geofenceId;
+ int64_t timestamp = time(NULL); // get the current time
+ Location location;
+ memset(&location, 0, sizeof(Location));
+ location.size = sizeof(Location);
+
+ if (breachInfo->geofencePosition_valid) {
+ // Latitude & Longitude
+ location.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ if (breachInfo->geofencePosition.latitude >= -90 &&
+ breachInfo->geofencePosition.latitude <= 90 &&
+ breachInfo->geofencePosition.longitude >= -180 &&
+ breachInfo->geofencePosition.longitude <= 180) {
+ // latitude and longitude look to be in the expected format
+ location.latitude = breachInfo->geofencePosition.latitude;
+ location.longitude = breachInfo->geofencePosition.longitude;
+ }
+ else {
+ // latitude and longitude must be in wrong format, so convert
+ location.latitude = breachInfo->geofencePosition.latitude * LAT_LONG_TO_RADIANS;
+ location.longitude = breachInfo->geofencePosition.longitude * LAT_LONG_TO_RADIANS;
+ }
+
+ // Time stamp (UTC)
+ location.timestamp = breachInfo->geofencePosition.timestampUtc;
+
+ // Altitude
+ location.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ location.altitude = breachInfo->geofencePosition.altitudeWrtEllipsoid;
+
+ // Speed
+ if (breachInfo->geofencePosition.speedHorizontal_valid == 1) {
+ location.flags |= LOCATION_HAS_SPEED_BIT;
+ location.speed = breachInfo->geofencePosition.speedHorizontal;
+ }
+
+ // Heading
+ if (breachInfo->geofencePosition.heading_valid == 1) {
+ location.flags |= LOCATION_HAS_BEARING_BIT;
+ location.bearing = breachInfo->geofencePosition.heading;
+ }
+
+ // Uncertainty (circular)
+ location.flags |= LOCATION_HAS_ACCURACY_BIT;
+ location.accuracy = sqrt(
+ (breachInfo->geofencePosition.horUncEllipseSemiMinor *
+ breachInfo->geofencePosition.horUncEllipseSemiMinor) +
+ (breachInfo->geofencePosition.horUncEllipseSemiMajor *
+ breachInfo->geofencePosition.horUncEllipseSemiMajor));
+
+ location.techMask = LOCATION_TECHNOLOGY_GNSS_BIT;
+
+ LOC_LOGV("%s:%d]: Location lat=%8.2f long=%8.2f ",
+ __func__, __LINE__, location.latitude, location.longitude);
+
+ } else {
+ LOC_LOGE("%s:%d]: NO Location ", __func__, __LINE__);
+ }
+
+ GeofenceBreachType breachType;
+ switch (breachInfo->breachType) {
+ case eQMI_LOC_GEOFENCE_BREACH_TYPE_ENTERING_V02:
+ breachType = GEOFENCE_BREACH_ENTER;
+ break;
+ case eQMI_LOC_GEOFENCE_BREACH_TYPE_LEAVING_V02:
+ breachType = GEOFENCE_BREACH_EXIT;
+ break;
+ default:
+ breachType = GEOFENCE_BREACH_UNKNOWN;
+ break;
+ }
+
+ // calling the base
+ geofenceBreach(1, &hwId, location, breachType, timestamp);
+}
+
+void
+LocApiV02::geofenceBreachEvent(const qmiLocEventGeofenceBatchedBreachIndMsgT_v02* breachInfo)
+{
+ if (NULL == breachInfo)
+ return;
+
+ int64_t timestamp = time(NULL); // get the current time
+ Location location;
+ memset(&location, 0, sizeof(Location));
+ location.size = sizeof(Location);
+
+ if (breachInfo->geofencePosition_valid) {
+ // Latitude & Longitude
+ location.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ if (breachInfo->geofencePosition.latitude >= -90 &&
+ breachInfo->geofencePosition.latitude <= 90 &&
+ breachInfo->geofencePosition.longitude >= -180 &&
+ breachInfo->geofencePosition.longitude <= 180) {
+ // latitude and longitude look to be in the expected format
+ location.latitude = breachInfo->geofencePosition.latitude;
+ location.longitude = breachInfo->geofencePosition.longitude;
+ }
+ else {
+ // latitdue and longitude must be in wrong format, so convert
+ location.latitude = breachInfo->geofencePosition.latitude *
+ LAT_LONG_TO_RADIANS;
+ location.longitude = breachInfo->geofencePosition.longitude *
+ LAT_LONG_TO_RADIANS;
+ }
+
+ // Time stamp (UTC)
+ location.timestamp = breachInfo->geofencePosition.timestampUtc;
+
+ // Altitude
+ location.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ location.altitude = breachInfo->geofencePosition.altitudeWrtEllipsoid;
+
+ // Speed
+ if (breachInfo->geofencePosition.speedHorizontal_valid == 1) {
+ location.flags |= LOCATION_HAS_SPEED_BIT;
+ location.speed = breachInfo->geofencePosition.speedHorizontal;
+ }
+
+ // Heading
+ if (breachInfo->geofencePosition.heading_valid == 1) {
+ location.flags |= LOCATION_HAS_BEARING_BIT;
+ location.bearing = breachInfo->geofencePosition.heading;
+ }
+
+ // Uncertainty (circular)
+ location.flags |= LOCATION_HAS_ACCURACY_BIT;
+ location.accuracy = sqrt(
+ (breachInfo->geofencePosition.horUncEllipseSemiMinor *
+ breachInfo->geofencePosition.horUncEllipseSemiMinor) +
+ (breachInfo->geofencePosition.horUncEllipseSemiMajor *
+ breachInfo->geofencePosition.horUncEllipseSemiMajor));
+
+ location.techMask = LOCATION_TECHNOLOGY_GNSS_BIT;
+
+ LOC_LOGV("%s]: latitude=%8.2f longitude=%8.2f ",
+ __func__, location.latitude, location.longitude);
+
+ } else {
+ LOC_LOGE("%s:%d]: NO Location ", __func__, __LINE__);
+ }
+
+ GeofenceBreachType breachType;
+ switch (breachInfo->breachType) {
+ case eQMI_LOC_GEOFENCE_BREACH_TYPE_ENTERING_V02:
+ breachType = GEOFENCE_BREACH_ENTER;
+ break;
+ case eQMI_LOC_GEOFENCE_BREACH_TYPE_LEAVING_V02:
+ breachType = GEOFENCE_BREACH_EXIT;
+ break;
+ default:
+ breachType = GEOFENCE_BREACH_UNKNOWN;
+ break;
+ }
+
+ size_t count = 0;
+ if (1 == breachInfo->geofenceIdDiscreteList_valid) {
+ count += breachInfo->geofenceIdDiscreteList_len;
+ }
+
+ if (1 == breachInfo->geofenceIdContinuousList_valid) {
+ for (uint32_t i = 0; i < breachInfo->geofenceIdContinuousList_len; i++) {
+ count += breachInfo->geofenceIdContinuousList[i].idHigh -
+ breachInfo->geofenceIdContinuousList[i].idLow + 1;
+ }
+ }
+
+ if (0 == count) {
+ return;
+ }
+
+ uint32_t* hwIds = new uint32_t[count];
+ if (hwIds == nullptr) {
+ LOC_LOGE("new allocation failed, fatal error.");
+ return;
+ }
+ uint32_t index = 0;
+ if (1 == breachInfo->geofenceIdDiscreteList_valid) {
+ for (uint32_t i = 0; i<breachInfo->geofenceIdDiscreteList_len; i++) {
+ LOC_LOGV("%s]: discrete hwID %u breachType %u",
+ __func__, breachInfo->geofenceIdDiscreteList[i], breachType);
+ if (index < count) {
+ hwIds[index++] = breachInfo->geofenceIdDiscreteList[i];
+ }
+ }
+ }
+
+ if (1 == breachInfo->geofenceIdContinuousList_valid) {
+ for (uint32_t i = 0; i < breachInfo->geofenceIdContinuousList_len; i++) {
+ for (uint32_t j = breachInfo->geofenceIdContinuousList[i].idLow;
+ j <= breachInfo->geofenceIdContinuousList[i].idHigh;
+ j++) {
+ LOC_LOGV("%s]: continuous hwID %u breachType %u",__func__, j, breachType);
+ if (index < count) {
+ hwIds[index++] = j;
+ }
+ }
+ }
+ }
+
+ // calling the base
+ geofenceBreach(count, hwIds, location, breachType, timestamp);
+
+ delete[] hwIds;
+}
+
+void LocApiV02::geofenceStatusEvent(const qmiLocEventGeofenceGenAlertIndMsgT_v02* alertInfo)
+{
+ const char* names[] = {
+ "bad value",
+ "GEOFENCE_GEN_ALERT_GNSS_UNAVAILABLE",
+ "GEOFENCE_GEN_ALERT_GNSS_AVAILABLE",
+ "GEOFENCE_GEN_ALERT_OOS",
+ "GEOFENCE_GEN_ALERT_TIME_INVALID"
+ };
+ int index = alertInfo->geofenceAlert;
+ if (index < 0 || index > 4) {
+ index = 0;
+ }
+ LOC_LOGV("%s]: GEOFENCE_GEN_ALERT - %s", __func__, names[index]);
+
+ GeofenceStatusAvailable available = GEOFENCE_STATUS_AVAILABILE_NO;
+ switch (alertInfo->geofenceAlert) {
+ case eQMI_LOC_GEOFENCE_GEN_ALERT_GNSS_UNAVAILABLE_V02:
+ available = GEOFENCE_STATUS_AVAILABILE_NO;
+ break;
+ case eQMI_LOC_GEOFENCE_GEN_ALERT_GNSS_AVAILABLE_V02:
+ available = GEOFENCE_STATUS_AVAILABILE_YES;
+ break;
+ default:
+ return;
+ break;
+ }
+
+ // calling the base
+ geofenceStatus(available);
+}
+
+void
+LocApiV02::geofenceDwellEvent(const qmiLocEventGeofenceBatchedDwellIndMsgT_v02 *dwellInfo)
+{
+ if (NULL == dwellInfo)
+ return;
+
+ int64_t timestamp = time(NULL); // get the current time
+ GeofenceBreachType breachType;
+ if (eQMI_LOC_GEOFENCE_DWELL_TYPE_INSIDE_V02 == dwellInfo->dwellType) {
+ breachType = GEOFENCE_BREACH_DWELL_IN;
+ } else if (eQMI_LOC_GEOFENCE_DWELL_TYPE_OUTSIDE_V02 == dwellInfo->dwellType) {
+ breachType = GEOFENCE_BREACH_DWELL_OUT;
+ } else {
+ LOC_LOGW("%s]: unknown dwell type %d", __func__, dwellInfo->dwellType);
+ breachType = GEOFENCE_BREACH_UNKNOWN;
+ }
+
+ Location location;
+ memset(&location, 0, sizeof(Location));
+ location.size = sizeof(Location);
+
+ if (dwellInfo->geofencePosition_valid) {
+ // Latitude & Longitude
+ location.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ if (dwellInfo->geofencePosition.latitude >= -90 &&
+ dwellInfo->geofencePosition.latitude <= 90 &&
+ dwellInfo->geofencePosition.longitude >= -180 &&
+ dwellInfo->geofencePosition.longitude <= 180) {
+ // latitude and longitude look to be in the expected format
+ location.latitude = dwellInfo->geofencePosition.latitude;
+ location.longitude = dwellInfo->geofencePosition.longitude;
+ } else {
+ // latitude and longitude must be in wrong format, so convert
+ location.latitude = dwellInfo->geofencePosition.latitude *
+ LAT_LONG_TO_RADIANS;
+ location.longitude = dwellInfo->geofencePosition.longitude *
+ LAT_LONG_TO_RADIANS;
+ }
+
+ // Time stamp (UTC)
+ location.timestamp = dwellInfo->geofencePosition.timestampUtc;
+
+ // Altitude
+ location.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ location.altitude = dwellInfo->geofencePosition.altitudeWrtEllipsoid;
+
+ // Speed
+ if (dwellInfo->geofencePosition.speedHorizontal_valid == 1) {
+ location.flags |= LOCATION_HAS_SPEED_BIT;
+ location.speed = dwellInfo->geofencePosition.speedHorizontal;
+ }
+
+ // Heading
+ if (dwellInfo->geofencePosition.heading_valid == 1) {
+ location.flags |= LOCATION_HAS_BEARING_BIT;
+ location.bearing = dwellInfo->geofencePosition.heading;
+ }
+
+ // Uncertainty (circular)
+ location.flags |= LOCATION_HAS_ACCURACY_BIT;
+ location.accuracy = sqrt(
+ (dwellInfo->geofencePosition.horUncEllipseSemiMinor *
+ dwellInfo->geofencePosition.horUncEllipseSemiMinor) +
+ (dwellInfo->geofencePosition.horUncEllipseSemiMajor *
+ dwellInfo->geofencePosition.horUncEllipseSemiMajor));
+
+ LOC_LOGV("%s]: latitude=%8.2f longitude=%8.2f ",
+ __func__, location.latitude, location.longitude);
+ } else {
+ LOC_LOGE("%s:%d]: NO Location ", __func__, __LINE__);
+ }
+
+ size_t count = 0;
+ if (1 == dwellInfo->geofenceIdDiscreteList_valid) {
+ count += dwellInfo->geofenceIdDiscreteList_len;
+ }
+
+ if (1 == dwellInfo->geofenceIdContinuousList_valid) {
+ for (uint32_t i = 0; i < dwellInfo->geofenceIdContinuousList_len; i++) {
+ count += dwellInfo->geofenceIdContinuousList[i].idHigh -
+ dwellInfo->geofenceIdContinuousList[i].idLow + 1;
+ }
+ }
+
+ if (0 == count) {
+ return;
+ }
+
+ uint32_t* hwIds = new uint32_t[count];
+ if (hwIds == nullptr) {
+ LOC_LOGE("new allocation failed, fatal error.");
+ return;
+ }
+ uint32_t index = 0;
+ if (1 == dwellInfo->geofenceIdDiscreteList_valid) {
+ for (uint32_t i = 0; i<dwellInfo->geofenceIdDiscreteList_len; i++) {
+ LOC_LOGV("%s]: discrete hwID %u breachType %u",
+ __func__, dwellInfo->geofenceIdDiscreteList[i], breachType);
+ if (index < count) {
+ hwIds[index++] = dwellInfo->geofenceIdDiscreteList[i];
+ }
+ }
+ }
+
+ if (1 == dwellInfo->geofenceIdContinuousList_valid) {
+ for (uint32_t i = 0; i < dwellInfo->geofenceIdContinuousList_len; i++) {
+ for (uint32_t j = dwellInfo->geofenceIdContinuousList[i].idLow;
+ j <= dwellInfo->geofenceIdContinuousList[i].idHigh;
+ j++) {
+ LOC_LOGV("%s]: continuous hwID %u breachType %u", __func__, j , breachType);
+ if (index < count) {
+ hwIds[index++] = j;
+ }
+ }
+ }
+ }
+
+ // calling the base
+ geofenceBreach(count, hwIds, location, breachType, timestamp);
+
+ delete[] hwIds;
+}
+
+void
+LocApiV02::addGeofence(uint32_t clientId,
+ const GeofenceOption& options,
+ const GeofenceInfo& info,
+ LocApiResponseData<LocApiGeofenceData>* adapterResponseData)
+{
+ sendMsg(new LocApiMsg([this, clientId, options, info, adapterResponseData] () {
+
+ LOC_LOGD("%s]: lat=%8.2f long=%8.2f radius %8.2f breach=%u respon=%u dwell=%u",
+ __func__, info.latitude, info.longitude, info.radius,
+ options.breachTypeMask, options.responsiveness, options.dwellTime);
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ qmiLocAddCircularGeofenceReqMsgT_v02 addReq;
+ memset(&addReq, 0, sizeof(addReq));
+
+ if (options.breachTypeMask & GEOFENCE_BREACH_ENTER_BIT)
+ addReq.breachMask |= QMI_LOC_GEOFENCE_BREACH_ENTERING_MASK_V02;
+ if (options.breachTypeMask & GEOFENCE_BREACH_EXIT_BIT)
+ addReq.breachMask |= QMI_LOC_GEOFENCE_BREACH_LEAVING_MASK_V02;
+
+ // confidence
+ addReq.confidence_valid = true;
+ addReq.confidence = eQMI_LOC_GEOFENCE_CONFIDENCE_HIGH_V02; // always high
+
+ // custom responsiveness
+ addReq.customResponsivenessValue_valid = true;
+ // The (min,max) custom responsiveness we support in seconds is (1, 65535)
+ addReq.customResponsivenessValue =
+ ((options.responsiveness < 1000U) ? 1 :
+ std::min((options.responsiveness / 1000U), (uint32_t)UINT16_MAX));
+
+ // dwell time
+ if (options.dwellTime > 0) {
+ addReq.dwellTime_valid = 1;
+ addReq.dwellTime = options.dwellTime;
+ addReq.dwellTypeMask_valid = 1;
+ if (options.breachTypeMask & GEOFENCE_BREACH_DWELL_IN_BIT) {
+ addReq.dwellTypeMask |= QMI_LOC_GEOFENCE_DWELL_TYPE_INSIDE_MASK_V02;
+ }
+ if (options.breachTypeMask & GEOFENCE_BREACH_DWELL_OUT_BIT) {
+ addReq.dwellTypeMask |= QMI_LOC_GEOFENCE_DWELL_TYPE_OUTSIDE_MASK_V02;
+ }
+ }
+ addReq.circularGeofenceArgs.latitude = info.latitude;
+ addReq.circularGeofenceArgs.longitude = info.longitude;
+ addReq.circularGeofenceArgs.radius = info.radius;
+ addReq.includePosition = true;
+ addReq.transactionId = clientId;
+
+ LOC_SEND_SYNC_REQ(AddCircularGeofence, ADD_CIRCULAR_GEOFENCE, addReq);
+
+ LocApiGeofenceData data;
+ if (rv && ind.geofenceId_valid != 0) {
+ data.hwId = ind.geofenceId;
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ if (eQMI_LOC_MAX_GEOFENCE_PROGRAMMED_V02 == ind.status) {
+ err = LOCATION_ERROR_GEOFENCES_AT_MAX;
+ }
+ LOC_LOGE("%s]: failed! rv is %d, ind.geofenceId_valid is %d",
+ __func__, rv, ind.geofenceId_valid);
+ }
+
+ if (adapterResponseData != NULL) {
+ adapterResponseData->returnToSender(err, data);
+ }
+ }));
+}
+
+void
+LocApiV02::removeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, hwId, clientId, adapterResponse] () {
+
+ LOC_LOGD("%s]: hwId %u", __func__, hwId);
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ qmiLocDeleteGeofenceReqMsgT_v02 deleteReq;
+ memset(&deleteReq, 0, sizeof(deleteReq));
+
+ deleteReq.geofenceId = hwId;
+ deleteReq.transactionId = clientId;
+
+ LOC_SEND_SYNC_REQ(DeleteGeofence, DELETE_GEOFENCE, deleteReq);
+
+ if (rv) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGE("%s]: failed! rv is %d", __func__, rv);
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+LocApiV02::pauseGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, hwId, clientId, adapterResponse] () {
+
+ LOC_LOGD("%s]: hwId %u", __func__, hwId);
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ qmiLocEditGeofenceReqMsgT_v02 editReq;
+ memset(&editReq, 0, sizeof(editReq));
+
+ editReq.geofenceId = hwId;
+ editReq.transactionId = clientId;
+ editReq.geofenceState_valid = 1;
+ editReq.geofenceState = eQMI_LOC_GEOFENCE_STATE_SUSPEND_V02;
+
+ LOC_SEND_SYNC_REQ(EditGeofence, EDIT_GEOFENCE, editReq);
+
+ if (rv) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGE("%s]: failed! rv is %d", __func__, rv);
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+LocApiV02::resumeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, hwId, clientId, adapterResponse] () {
+
+ LOC_LOGD("%s]: hwId %u", __func__, hwId);
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ qmiLocEditGeofenceReqMsgT_v02 editReq;
+ memset(&editReq, 0, sizeof(editReq));
+
+ editReq.geofenceId = hwId;
+ editReq.transactionId = clientId;
+ editReq.geofenceState_valid = 1;
+ editReq.geofenceState = eQMI_LOC_GEOFENCE_STATE_ACTIVE_V02;
+
+ LOC_SEND_SYNC_REQ(EditGeofence, EDIT_GEOFENCE, editReq);
+
+ if (rv) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGE("%s]: failed! rv is %d", __func__, rv);
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+LocApiV02::modifyGeofence(uint32_t hwId,
+ uint32_t clientId,
+ const GeofenceOption& options, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, hwId, clientId, options, adapterResponse] () {
+
+ LOC_LOGD("%s]: breach=%u respon=%u dwell=%u",
+ __func__, options.breachTypeMask, options.responsiveness, options.dwellTime);
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ qmiLocEditGeofenceReqMsgT_v02 editReq;
+ memset(&editReq, 0, sizeof(editReq));
+
+ editReq.geofenceId = hwId;
+ editReq.transactionId = clientId;
+
+ editReq.breachMask_valid = 1;
+ if (options.breachTypeMask & GEOFENCE_BREACH_ENTER_BIT) {
+ editReq.breachMask |= QMI_LOC_GEOFENCE_BREACH_ENTERING_MASK_V02;
+ }
+ if (options.breachTypeMask & GEOFENCE_BREACH_EXIT_BIT) {
+ editReq.breachMask |= QMI_LOC_GEOFENCE_BREACH_LEAVING_MASK_V02;
+ }
+
+ editReq.responsiveness_valid = 1;
+ if (options.responsiveness <= GF_RESPONSIVENESS_THRESHOLD_MSEC_HIGH) {
+ editReq.responsiveness = eQMI_LOC_GEOFENCE_RESPONSIVENESS_HIGH_V02;
+ } else if (options.responsiveness <= GF_RESPONSIVENESS_THRESHOLD_MSEC_MEDIUM) {
+ editReq.responsiveness = eQMI_LOC_GEOFENCE_RESPONSIVENESS_MED_V02;
+ } else {
+ editReq.responsiveness = eQMI_LOC_GEOFENCE_RESPONSIVENESS_LOW_V02;
+ }
+
+ LOC_SEND_SYNC_REQ(EditGeofence, EDIT_GEOFENCE, editReq);
+
+ if (rv) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGE("%s]: failed! rv is %d", __func__, rv);
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+
+}
+
+void LocApiV02::setBatchSize(size_t size)
+{
+ LOC_LOGD("%s]: mDesiredBatchSize %zu", __func__, size);
+ mDesiredBatchSize = size;
+ // set to zero so the actual batch size will be queried from modem on first startBatching call
+ mBatchSize = 0;
+}
+
+void LocApiV02::setTripBatchSize(size_t size)
+{
+ mDesiredTripBatchSize = size;
+ // set to zero so the actual trip batch size will be queried from modem on
+ // first startOutdoorTripBatching call
+ mTripBatchSize = 0;
+}
+
+LocationError
+LocApiV02::queryBatchBuffer(size_t desiredSize,
+ size_t &allocatedSize, BatchingMode batchMode)
+{
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ qmiLocGetBatchSizeReqMsgT_v02 batchSizeReq;
+
+ memset(&batchSizeReq, 0, sizeof(batchSizeReq));
+ batchSizeReq.transactionId = 1;
+ batchSizeReq.batchSize = desiredSize;
+
+ batchSizeReq.batchType_valid = 1;
+ batchSizeReq.batchType = (batchMode == BATCHING_MODE_ROUTINE ? eQMI_LOC_LOCATION_BATCHING_V02 :
+ eQMI_LOC_OUTDOOR_TRIP_BATCHING_V02);
+ LOC_SEND_SYNC_REQ(GetBatchSize, GET_BATCH_SIZE, batchSizeReq);
+
+ if (rv) {
+ allocatedSize = ind.batchSize;
+ LOC_LOGV("%s:%d]: get batching size succeeded. The modem batch size for"
+ " batch mode %u is %zu. Desired batch size : %zu.",
+ __func__, __LINE__, batchMode, allocatedSize, desiredSize);
+ if (allocatedSize != 0) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ if ((batchMode == BATCHING_MODE_TRIP) &&
+ (ind.status == eQMI_LOC_INVALID_PARAMETER_V02) &&
+ (ind.batchSize > 0)) {
+
+ LOC_LOGW("%s:%d]: get batching size failed. The modem max threshold batch size "
+ "for batch mode %u is %u. Desired batch size : %zu. "
+ "Retrying with max threshold size ...",
+ __func__, __LINE__, batchMode, ind.batchSize, desiredSize);
+
+ desiredSize = ind.batchSize;
+ batchSizeReq.batchSize = ind.batchSize;
+ LOC_SEND_SYNC_REQ(GetBatchSize, GET_BATCH_SIZE, batchSizeReq);
+
+ if (rv) {
+ allocatedSize = ind.batchSize;
+ LOC_LOGV("%s:%d]: get batching size succeeded. The modem batch size for"
+ " batch mode %u is %zu. Desired batch size : %zu.",
+ __func__, __LINE__, batchMode, allocatedSize, desiredSize);
+ if (allocatedSize != 0) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ return err;
+ }
+ }
+
+ allocatedSize = 0;
+ LOC_LOGE("%s:%d]: get batching size failed for batch mode %u and desired batch size %zu"
+ "Or modem does not support batching",
+ __func__, __LINE__, batchMode, desiredSize);
+ }
+
+ return err;
+}
+
+LocationError
+LocApiV02::releaseBatchBuffer(BatchingMode batchMode) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ qmiLocReleaseBatchReqMsgT_v02 batchReleaseReq;
+ memset(&batchReleaseReq, 0, sizeof(batchReleaseReq));
+ batchReleaseReq.transactionId = 1;
+
+ batchReleaseReq.batchType_valid = 1;
+ switch (batchMode) {
+ case BATCHING_MODE_ROUTINE:
+ batchReleaseReq.batchType = eQMI_LOC_LOCATION_BATCHING_V02;
+ break;
+
+ case BATCHING_MODE_TRIP:
+ batchReleaseReq.batchType = eQMI_LOC_OUTDOOR_TRIP_BATCHING_V02;
+ break;
+
+ default:
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ LOC_LOGE("%s:%d]: release batch failed for batch mode %u",
+ __func__, __LINE__, batchMode);
+ return err;
+ }
+
+ LOC_SEND_SYNC_REQ(ReleaseBatch, RELEASE_BATCH, batchReleaseReq);
+
+ if (rv) {
+ LOC_LOGV("%s:%d]: release batch succeeded for batch mode %u",
+ __func__, __LINE__, batchMode);
+ mTripBatchSize = 0;
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGE("%s:%d]: release batch failed for batch mode %u",
+ __func__, __LINE__, batchMode);
+ }
+
+ return err;
+}
+
+
+void
+LocApiV02::setOperationMode(GnssSuplMode mode)
+{
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+
+ qmiLocSetOperationModeReqMsgT_v02 set_mode_msg;
+ qmiLocSetOperationModeIndMsgT_v02 set_mode_ind;
+
+ memset (&set_mode_msg, 0, sizeof(set_mode_msg));
+ memset (&set_mode_ind, 0, sizeof(set_mode_ind));
+
+ if (GNSS_SUPL_MODE_MSB == mode) {
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_MSB_V02;
+ LOC_LOGV("%s:%d]: operationMode MSB", __func__, __LINE__);
+ } else if (GNSS_SUPL_MODE_MSA == mode) {
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_MSA_V02;
+ LOC_LOGV("%s:%d]: operationMode MSA", __func__, __LINE__);
+ } else {
+ set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_STANDALONE_V02;
+ LOC_LOGV("%s:%d]: operationMode STANDALONE", __func__, __LINE__);
+ }
+
+ req_union.pSetOperationModeReq = &set_mode_msg;
+
+ status = locSyncSendReq(QMI_LOC_SET_OPERATION_MODE_REQ_V02,
+ req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_SET_OPERATION_MODE_IND_V02,
+ &set_mode_ind);
+
+ if (eLOC_CLIENT_SUCCESS != status || eQMI_LOC_SUCCESS_V02 != set_mode_ind.status) {
+ LOC_LOGE ("%s:%d]: Failed status = %d ind.status = %d",
+ __func__, __LINE__, status, set_mode_ind.status);
+ }
+}
+
+void
+LocApiV02::startTimeBasedTracking(const TrackingOptions& options, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, options, adapterResponse] () {
+
+ LOC_LOGD("%s] minInterval %u", __func__, options.minInterval);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ mInSession = true;
+ mMeasurementsStarted = true;
+ registerEventMask(mMask);
+ setOperationMode(options.mode);
+
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+ qmiLocStartReqMsgT_v02 start_msg;
+ memset(&start_msg, 0, sizeof(start_msg));
+
+ start_msg.sessionId = 1; // dummy session id
+
+ // interval
+ uint32_t minInterval = options.minInterval;
+
+ /*set interval for intermediate fixes*/
+ start_msg.minIntermediatePositionReportInterval_valid = 1;
+ start_msg.minIntermediatePositionReportInterval = minInterval;
+
+ /*set interval for final fixes*/
+ start_msg.minInterval_valid = 1;
+ start_msg.minInterval = minInterval;
+
+ // accuracy
+ start_msg.horizontalAccuracyLevel_valid = 1;
+ start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_HIGH_V02;
+
+ // recurrence
+ start_msg.fixRecurrence_valid = 1;
+ start_msg.fixRecurrence = eQMI_LOC_RECURRENCE_PERIODIC_V02;
+
+ // altitude assumed
+ start_msg.configAltitudeAssumed_valid = 1;
+ start_msg.configAltitudeAssumed =
+ eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_DISABLED_V02;
+
+ // power mode
+ if (GNSS_POWER_MODE_INVALID != options.powerMode) {
+ start_msg.powerMode_valid = 1;
+ start_msg.powerMode.powerMode =
+ convertPowerMode(options.powerMode);
+ start_msg.powerMode.timeBetweenMeasurement = options.tbm;
+ // Force low accuracy for background power modes
+ if (GNSS_POWER_MODE_M3 == options.powerMode ||
+ GNSS_POWER_MODE_M4 == options.powerMode ||
+ GNSS_POWER_MODE_M5 == options.powerMode) {
+ start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
+ }
+ // Force TBM = TBF for power mode M4
+ if (GNSS_POWER_MODE_M4 == options.powerMode) {
+ start_msg.powerMode.timeBetweenMeasurement = start_msg.minInterval;
+ }
+ }
+
+ req_union.pStartReq = &start_msg;
+ status = locClientSendReq(QMI_LOC_START_REQ_V02, req_union);
+ if (eLOC_CLIENT_SUCCESS != status) {
+ LOC_LOGE ("%s]: failed! status %d",
+ __func__, status);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+qmiLocPowerModeEnumT_v02
+LocApiV02::convertPowerMode(GnssPowerMode powerMode)
+{
+ switch(powerMode) {
+ case GNSS_POWER_MODE_M1:
+ return eQMI_LOC_POWER_MODE_IMPROVED_ACCURACY_V02;
+ case GNSS_POWER_MODE_M2:
+ return eQMI_LOC_POWER_MODE_NORMAL_V02;
+ case GNSS_POWER_MODE_M3:
+ return eQMI_LOC_POWER_MODE_BACKGROUND_DEFINED_POWER_V02;
+ case GNSS_POWER_MODE_M4:
+ return eQMI_LOC_POWER_MODE_BACKGROUND_DEFINED_TIME_V02;
+ case GNSS_POWER_MODE_M5:
+ return eQMI_LOC_POWER_MODE_BACKGROUND_KEEP_WARM_V02;
+ default:
+ LOC_LOGE("Invalid power mode %d", powerMode);
+ }
+
+ return QMILOCPOWERMODEENUMT_MIN_ENUM_VAL_V02;
+}
+
+void
+LocApiV02::stopTimeBasedTracking(LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, adapterResponse] () {
+
+ LOC_LOGD("%s] ", __func__);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+ qmiLocStopReqMsgT_v02 stop_msg;
+ memset(&stop_msg, 0, sizeof(stop_msg));
+ stop_msg.sessionId = 1; // dummy session id
+ req_union.pStopReq = &stop_msg;
+
+ status = locClientSendReq(QMI_LOC_STOP_REQ_V02, req_union);
+ if (status != eLOC_CLIENT_SUCCESS) {
+ LOC_LOGE ("%s]: failed! status %d",
+ __func__, status);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ } else {
+ mInSession = false;
+ mPowerMode = GNSS_POWER_MODE_INVALID;
+
+ // if engine on never happend, deregister events
+ // without waiting for Engine Off
+ if (!mEngineOn) {
+ registerEventMask(mMask);
+ }
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+LocApiV02::startDistanceBasedTracking(uint32_t sessionId,
+ const LocationOptions& options,
+ LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, sessionId, options, adapterResponse] () {
+
+ LOC_LOGD("%s] id %u minInterval %u minDistance %u",
+ __func__, sessionId, options.minInterval, options.minDistance);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ /** start distance based tracking session*/
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+ qmiLocStartDbtReqMsgT_v02 start_dbt_req;
+ qmiLocStartDbtIndMsgT_v02 start_dbt_ind;
+ memset(&start_dbt_req, 0, sizeof(start_dbt_req));
+ memset(&start_dbt_ind, 0, sizeof(start_dbt_ind));
+
+ // request id
+ start_dbt_req.reqId = sessionId;
+
+ // distance
+ start_dbt_req.minDistance = options.minDistance;
+
+ // time
+ uint32_t minInterval = options.minInterval;
+ start_dbt_req.maxLatency_valid = 1;
+ start_dbt_req.maxLatency = minInterval/1000; //in seconds
+ if (0 == start_dbt_req.maxLatency) {
+ start_dbt_req.maxLatency = 1; //in seconds
+ }
+
+ // type
+ start_dbt_req.distanceType = eQMI_LOC_DBT_DISTANCE_TYPE_STRAIGHT_LINE_V02;
+
+ /* original location disabled by default, as the original location is
+ the one cached in the modem buffer and its timestamps is not fresh.*/
+ start_dbt_req.needOriginLocation = 0;
+
+ start_dbt_req.usageType_valid = 1;
+ start_dbt_req.usageType = eQMI_LOC_DBT_USAGE_NAVIGATION_V02;
+ req_union.pStartDbtReq = &start_dbt_req;
+
+ status = locSyncSendReq(QMI_LOC_START_DBT_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_START_DBT_IND_V02,
+ &start_dbt_ind);
+
+ if (eLOC_CLIENT_SUCCESS != status ||
+ eQMI_LOC_SUCCESS_V02 != start_dbt_ind.status) {
+ LOC_LOGE("%s] failed! status %d ind.status %d",
+ __func__, status, start_dbt_ind.status);
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+LocApiV02::stopDistanceBasedTracking(uint32_t sessionId, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, sessionId, adapterResponse] () {
+
+ LOC_LOGD("%s] id %u", __func__, sessionId);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ locClientStatusEnumType status;
+ locClientReqUnionType req_union;
+ qmiLocStopDbtReqMsgT_v02 stop_dbt_req;
+ qmiLocStopDbtIndMsgT_v02 stop_dbt_Ind;
+ memset(&stop_dbt_req, 0, sizeof(stop_dbt_req));
+ memset(&stop_dbt_Ind, 0, sizeof(stop_dbt_Ind));
+
+ stop_dbt_req.reqId = sessionId;
+
+ req_union.pStopDbtReq = &stop_dbt_req;
+
+ status = locSyncSendReq(QMI_LOC_STOP_DBT_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_STOP_DBT_IND_V02,
+ &stop_dbt_Ind);
+
+ if (eLOC_CLIENT_SUCCESS != status ||
+ eQMI_LOC_SUCCESS_V02 != stop_dbt_Ind.status) {
+ LOC_LOGE("%s] failed! status %d ind.status %d",
+ __func__, status, stop_dbt_Ind.status);
+ }
+
+ adapterResponse->returnToSender(err);
+ }));
+}
+
+void
+LocApiV02::startBatching(uint32_t sessionId,
+ const LocationOptions& options,
+ uint32_t accuracy,
+ uint32_t timeout,
+ LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, sessionId, options, accuracy, timeout, adapterResponse] () {
+
+ LOC_LOGD("%s]: id %u minInterval %u minDistance %u accuracy %u timeout %u",
+ __func__, sessionId, options.minInterval, options.minDistance, accuracy, timeout);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ setOperationMode(options.mode);
+
+ //get batch size if needs
+ if (mBatchSize == 0) {
+ if (LOCATION_ERROR_SUCCESS != queryBatchBuffer(mDesiredBatchSize,
+ mBatchSize, BATCHING_MODE_ROUTINE)) {
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(LOCATION_ERROR_GENERAL_FAILURE);
+ }
+ return;
+ }
+ }
+
+ qmiLocStartBatchingReqMsgT_v02 startBatchReq;
+ memset(&startBatchReq, 0, sizeof(startBatchReq));
+
+ // interval
+ startBatchReq.minInterval_valid = 1;
+ if (options.minInterval >= FLP_BATCHING_MINIMUN_INTERVAL) {
+ startBatchReq.minInterval = options.minInterval;
+ } else {
+ startBatchReq.minInterval = FLP_BATCHING_MINIMUN_INTERVAL; // 1 second
+ }
+
+ // distance
+ startBatchReq.minDistance_valid = 1;
+ startBatchReq.minDistance = options.minDistance;
+
+ // accuracy
+ startBatchReq.horizontalAccuracyLevel_valid = 1;
+ switch(accuracy) {
+ case 0:
+ startBatchReq.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
+ break;
+ case 1:
+ startBatchReq.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_MED_V02;
+ break;
+ case 2:
+ startBatchReq.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_HIGH_V02;
+ break;
+ default:
+ startBatchReq.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
+ }
+
+ // time out
+ if (timeout > 0) {
+ startBatchReq.fixSessionTimeout_valid = 1;
+ startBatchReq.fixSessionTimeout = timeout;
+ } else {
+ // modem will use the default time out (20 seconds)
+ startBatchReq.fixSessionTimeout_valid = 0;
+ }
+
+ // batch request id
+ startBatchReq.requestId_valid = 1;
+ startBatchReq.requestId = sessionId;
+
+ // batch all fixes always
+ startBatchReq.batchAllPos_valid = 1;
+ startBatchReq.batchAllPos = true;
+
+ LOC_SEND_SYNC_REQ(StartBatching, START_BATCHING, startBatchReq);
+
+ if (!rv) {
+ LOC_LOGE("%s] failed!", __func__);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+
+ }));
+}
+
+void
+LocApiV02::stopBatching(uint32_t sessionId, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, sessionId, adapterResponse] () {
+
+ LOC_LOGD("%s] id %u", __func__, sessionId);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ locClientStatusEnumType status;
+
+ qmiLocStopBatchingReqMsgT_v02 stopBatchingReq;
+ memset(&stopBatchingReq, 0, sizeof(stopBatchingReq));
+
+ stopBatchingReq.requestId_valid = 1;
+ stopBatchingReq.requestId = sessionId;
+
+ stopBatchingReq.batchType_valid = 1;
+ stopBatchingReq.batchType = eQMI_LOC_LOCATION_BATCHING_V02;
+
+ LOC_SEND_SYNC_REQ(StopBatching, STOP_BATCHING, stopBatchingReq);
+
+ if (!rv) {
+ LOC_LOGE("%s] failed!", __func__);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+LocationError
+LocApiV02::startOutdoorTripBatchingSync(uint32_t tripDistance, uint32_t tripTbf, uint32_t timeout)
+{
+ LOC_LOGD("%s]: minInterval %u minDistance %u timeout %u",
+ __func__, tripTbf, tripDistance, timeout);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ //get batch size if needs
+ if (mTripBatchSize == 0) {
+ if (LOCATION_ERROR_SUCCESS != queryBatchBuffer(mDesiredTripBatchSize,
+ mTripBatchSize, BATCHING_MODE_TRIP)) {
+ return LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ }
+
+ qmiLocStartOutdoorTripBatchingReqMsgT_v02 startOutdoorTripBatchReq;
+ memset(&startOutdoorTripBatchReq, 0, sizeof(startOutdoorTripBatchReq));
+
+ if (tripDistance > 0) {
+ startOutdoorTripBatchReq.batchDistance = tripDistance;
+ } else {
+ startOutdoorTripBatchReq.batchDistance = FLP_BATCHING_MIN_TRIP_DISTANCE; // 1 meter
+ }
+
+ if (tripTbf >= FLP_BATCHING_MINIMUN_INTERVAL) {
+ startOutdoorTripBatchReq.minTimeInterval = tripTbf;
+ } else {
+ startOutdoorTripBatchReq.minTimeInterval = FLP_BATCHING_MINIMUN_INTERVAL; // 1 second
+ }
+
+ // batch all fixes always
+ startOutdoorTripBatchReq.batchAllPos_valid = 1;
+ startOutdoorTripBatchReq.batchAllPos = true;
+
+ // time out
+ if (timeout > 0) {
+ startOutdoorTripBatchReq.fixSessionTimeout_valid = 1;
+ startOutdoorTripBatchReq.fixSessionTimeout = timeout;
+ } else {
+ // modem will use the default time out (20 seconds)
+ startOutdoorTripBatchReq.fixSessionTimeout_valid = 0;
+ }
+
+ LOC_SEND_SYNC_REQ(StartOutdoorTripBatching, START_OUTDOOR_TRIP_BATCHING,
+ startOutdoorTripBatchReq);
+
+ if (!rv) {
+ LOC_LOGE("%s] failed!", __func__);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ return err;
+}
+
+void
+LocApiV02::startOutdoorTripBatching(uint32_t tripDistance, uint32_t tripTbf, uint32_t timeout,
+ LocApiResponse* adapterResponse) {
+ sendMsg(new LocApiMsg([this, tripDistance, tripTbf, timeout, adapterResponse] () {
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(startOutdoorTripBatchingSync(tripDistance,
+ tripTbf,
+ timeout));
+ }
+ }));
+}
+
+void
+LocApiV02::reStartOutdoorTripBatching(uint32_t ongoingTripDistance,
+ uint32_t ongoingTripInterval,
+ uint32_t batchingTimeout,
+ LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, ongoingTripDistance, ongoingTripInterval, batchingTimeout,
+ adapterResponse] () {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ uint32_t accumulatedDistance = 0;
+ uint32_t numOfBatchedPositions = 0;
+ queryAccumulatedTripDistanceSync(accumulatedDistance, numOfBatchedPositions);
+
+ if (numOfBatchedPositions) {
+ getBatchedTripLocationsSync(numOfBatchedPositions, 0);
+ }
+
+ stopOutdoorTripBatchingSync(false);
+
+ err = startOutdoorTripBatchingSync(ongoingTripDistance,
+ ongoingTripInterval,
+ batchingTimeout);
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+LocationError
+LocApiV02::stopOutdoorTripBatchingSync(bool deallocBatchBuffer)
+{
+ LOC_LOGD("%s] dellocBatchBuffer : %d", __func__, deallocBatchBuffer);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ locClientStatusEnumType status;
+
+ qmiLocStopBatchingReqMsgT_v02 stopBatchingReq;
+ memset(&stopBatchingReq, 0, sizeof(stopBatchingReq));
+
+ stopBatchingReq.batchType_valid = 1;
+ stopBatchingReq.batchType = eQMI_LOC_OUTDOOR_TRIP_BATCHING_V02;
+ LOC_SEND_SYNC_REQ(StopBatching, STOP_BATCHING, stopBatchingReq);
+
+ if (!rv) {
+ LOC_LOGE("%s] failed!", __func__);
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ return err;
+ }
+
+ if (deallocBatchBuffer) {
+ err = releaseBatchBuffer(BATCHING_MODE_TRIP);
+ }
+
+ return err;
+}
+
+void
+LocApiV02::stopOutdoorTripBatching(bool deallocBatchBuffer, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, deallocBatchBuffer, adapterResponse] () {
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(stopOutdoorTripBatchingSync(deallocBatchBuffer));
+ }
+ }));
+}
+
+LocationError
+LocApiV02::getBatchedLocationsSync(size_t count)
+{
+ LOC_LOGD("%s] count %zu.", __func__, count);
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ size_t entriesToReadInTotal = std::min(mBatchSize,count);
+ if (entriesToReadInTotal == 0) {
+ LOC_LOGD("%s] No batching memory allocated in modem or nothing to read", __func__);
+ // calling the base class
+ reportLocations(NULL, 0, BATCHING_MODE_ROUTINE);
+ } else {
+ size_t entriesToRead =
+ std::min(entriesToReadInTotal, (size_t)QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02);
+ size_t entriesGotInTotal = 0;
+ size_t entriesGotInEachTime = 0;
+ //allocate +1 just in case we get one more location added during read
+ Location* pLocationsFromModem = new Location[entriesToReadInTotal+1]();
+ if (pLocationsFromModem == nullptr) {
+ LOC_LOGE("new allocation failed, fatal error.");
+ return LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ memset(pLocationsFromModem, 0, sizeof(Location)*(entriesToReadInTotal+1));
+ Location* tempLocationP = new Location[QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02]();
+ if (tempLocationP == nullptr) {
+ LOC_LOGE("new allocation failed, fatal error.");
+ return LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ do {
+ memset(tempLocationP, 0, QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02*sizeof(Location));
+ readModemLocations(tempLocationP,
+ entriesToRead,
+ BATCHING_MODE_ROUTINE,
+ entriesGotInEachTime);
+ for (size_t i = 0; i<entriesGotInEachTime; i++) {
+ size_t index = entriesToReadInTotal-entriesGotInTotal-i;
+
+ // make sure index is not too large or small to fit in the array
+ if (index <= entriesToReadInTotal && (int)index >= 0) {
+ pLocationsFromModem[index] = tempLocationP[i];
+ } else {
+ LOC_LOGW("%s] dropped an unexpected location.", __func__);
+ }
+ }
+ entriesGotInTotal += entriesGotInEachTime;
+ entriesToRead = std::min(entriesToReadInTotal - entriesGotInTotal,
+ (size_t)QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02);
+ } while (entriesGotInEachTime > 0 && entriesToRead > 0);
+ delete[] tempLocationP;
+
+ LOC_LOGD("%s] Read out %zu batched locations from modem in total.",
+ __func__, entriesGotInTotal);
+
+ // offset is by default 1 because we allocated one extra location during read
+ uint32_t offset = 1;
+ if (entriesToReadInTotal > entriesGotInTotal) {
+ offset = 1 + entriesToReadInTotal - entriesGotInTotal;
+ LOC_LOGD("%s] offset %u", __func__, offset);
+ } else if (entriesGotInTotal > entriesToReadInTotal) {
+ // offset is zero because we need one extra slot for the extra location
+ offset = 0;
+ LOC_LOGD("%s] Read %zu extra location(s) than expected.",
+ __func__, entriesGotInTotal - entriesToReadInTotal);
+ // we got one extra location added during modem read, so one location will
+ // be out of order and needs to be found and put in order
+ int64_t currentTimeStamp = pLocationsFromModem[entriesToReadInTotal].timestamp;
+ for (int i=entriesToReadInTotal-1; i >= 0; i--) {
+ // find the out of order location
+ if (currentTimeStamp < pLocationsFromModem[i].timestamp) {
+ LOC_LOGD("%s] Out of order location is index %d timestamp %" PRIu64,
+ __func__, i, pLocationsFromModem[i].timestamp);
+ // save the out of order location to be put at end of array
+ Location tempLocation(pLocationsFromModem[i]);
+ // shift the remaining locations down one
+ for (size_t j=i; j<entriesToReadInTotal; j++) {
+ pLocationsFromModem[j] = pLocationsFromModem[j+1];
+ }
+ // put the out of order location at end of array now
+ pLocationsFromModem[entriesToReadInTotal] = tempLocation;
+ break;
+ } else {
+ currentTimeStamp = pLocationsFromModem[i].timestamp;
+ }
+ }
+ }
+
+ LOC_LOGD("%s] Calling reportLocations with count:%zu and entriesGotInTotal:%zu",
+ __func__, count, entriesGotInTotal);
+
+ // calling the base class
+ reportLocations(pLocationsFromModem+offset, entriesGotInTotal, BATCHING_MODE_ROUTINE);
+ delete[] pLocationsFromModem;
+ }
+ return err;
+
+}
+
+void
+LocApiV02::getBatchedLocations(size_t count, LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, count, adapterResponse] () {
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(getBatchedLocationsSync(count));
+ }
+ }));
+}
+
+LocationError LocApiV02::getBatchedTripLocationsSync(size_t count, uint32_t accumulatedDistance)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ size_t idxLocationFromModem = 0;
+
+ size_t entriesToReadInTotal = std::min(mTripBatchSize, count);
+ if (entriesToReadInTotal == 0) {
+ LOC_LOGD("%s] No trip batching memory allocated in modem or nothing to read", __func__);
+ // calling the base class
+ reportLocations(NULL, 0, BATCHING_MODE_TRIP);
+ } else {
+ size_t entriesToRead =
+ std::min(entriesToReadInTotal, (size_t)QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02);
+ size_t entriesGotInTotal = 0;
+ size_t entriesGotInEachTime = 0;
+
+ Location* pLocationsFromModem = new Location[entriesToReadInTotal]();
+ if (pLocationsFromModem == nullptr) {
+ LOC_LOGE("new allocation failed, fatal error.");
+ return LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ memset(pLocationsFromModem, 0, sizeof(Location)*(entriesToReadInTotal));
+ Location* tempLocationP = new Location[QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02]();
+ if (tempLocationP == nullptr) {
+ LOC_LOGE("new allocation failed, fatal error.");
+ return LOCATION_ERROR_GENERAL_FAILURE;
+ }
+
+ do {
+ memset(tempLocationP, 0, QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02*sizeof(Location));
+ readModemLocations(tempLocationP,
+ entriesToRead,
+ BATCHING_MODE_TRIP,
+ entriesGotInEachTime);
+ for (size_t iEntryIndex = 0; iEntryIndex<entriesGotInEachTime;
+ iEntryIndex++, idxLocationFromModem++) {
+ // make sure index is not too large fit in the array
+ if (idxLocationFromModem < entriesToReadInTotal) {
+ pLocationsFromModem[idxLocationFromModem] = tempLocationP[iEntryIndex];
+ } else {
+ LOC_LOGW("%s] dropped an unexpected location.", __func__);
+ }
+ }
+ entriesGotInTotal += entriesGotInEachTime;
+ entriesToRead = std::min(entriesToReadInTotal - entriesGotInTotal,
+ (size_t)QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02);
+ } while (entriesGotInEachTime > 0 && entriesToRead > 0);
+ delete[] tempLocationP;
+
+ LOC_LOGD("%s] Calling reportLocations with count:%zu and entriesGotInTotal:%zu",
+ __func__, count, entriesGotInTotal);
+
+ // calling the base class
+ reportLocations(pLocationsFromModem, entriesGotInTotal, BATCHING_MODE_TRIP);
+
+ if (accumulatedDistance != 0) {
+ LOC_LOGD("%s] Calling reportCompletedTrips with distance %u:",
+ __func__, accumulatedDistance);
+ reportCompletedTrips(accumulatedDistance);
+ }
+
+ delete[] pLocationsFromModem;
+ }
+
+ return err;
+}
+
+void LocApiV02::getBatchedTripLocations(size_t count, uint32_t accumulatedDistance,
+ LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([this, count, accumulatedDistance, adapterResponse] () {
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(getBatchedTripLocationsSync(count, accumulatedDistance));
+ }
+ }));
+}
+
+void
+LocApiV02::readModemLocations(Location* pLocationPiece,
+ size_t count,
+ BatchingMode batchingMode,
+ size_t& numbOfEntries)
+{
+ LOC_LOGD("%s] count %zu.", __func__, count);
+ numbOfEntries = 0;
+ qmiLocReadFromBatchReqMsgT_v02 getBatchLocatonReq;
+ memset(&getBatchLocatonReq, 0, sizeof(getBatchLocatonReq));
+
+ if (count != 0) {
+ getBatchLocatonReq.numberOfEntries = count;
+ getBatchLocatonReq.transactionId = 1;
+ }
+
+ getBatchLocatonReq.batchType_valid = 1;
+ getBatchLocatonReq.batchType = ((batchingMode == BATCHING_MODE_ROUTINE) ?
+ eQMI_LOC_LOCATION_BATCHING_V02: eQMI_LOC_OUTDOOR_TRIP_BATCHING_V02);
+
+ LOC_SEND_SYNC_REQ(ReadFromBatch, READ_FROM_BATCH, getBatchLocatonReq);
+
+ if (!rv) {
+ LOC_LOGE("%s] Reading batched locations from modem failed.", __func__);
+ return;
+ }
+ if (ind.numberOfEntries_valid != 0 &&
+ ind.batchedReportList_valid != 0) {
+ for (uint32_t i=0; i<ind.numberOfEntries; i++) {
+ Location temp;
+ memset (&temp, 0, sizeof(temp));
+ temp.size = sizeof(Location);
+ if ((ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_LATITUDE_V02) &&
+ (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_LONGITUDE_V02)) {
+ temp.latitude = ind.batchedReportList[i].latitude;
+ temp.longitude = ind.batchedReportList[i].longitude;
+ temp.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_ALT_WRT_ELP_V02) {
+ temp.altitude = ind.batchedReportList[i].altitudeWrtEllipsoid;
+ temp.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_TIMESTAMP_UTC_V02) {
+ temp.timestamp = ind.batchedReportList[i].timestampUtc;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_HOR_CIR_UNC_V02) {
+ temp.accuracy = ind.batchedReportList[i].horUncCircular;
+ temp.flags |= LOCATION_HAS_ACCURACY_BIT;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_HEADING_V02) {
+ temp.bearing = ind.batchedReportList[i].heading;
+ temp.flags |= LOCATION_HAS_BEARING_BIT;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_HOR_V02) {
+ temp.speed = ind.batchedReportList[i].speedHorizontal;
+ temp.flags |= LOCATION_HAS_SPEED_BIT;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_TECH_MASK_V02) {
+ if (QMI_LOC_POS_TECH_MASK_SATELLITE_V02 & ind.batchedReportList[i].technologyMask) {
+ temp.techMask |= LOCATION_TECHNOLOGY_GNSS_BIT;
+ }
+ if (QMI_LOC_POS_TECH_MASK_CELLID_V02 & ind.batchedReportList[i].technologyMask) {
+ temp.techMask |= LOCATION_TECHNOLOGY_CELL_BIT;
+ }
+ if (QMI_LOC_POS_TECH_MASK_WIFI_V02 & ind.batchedReportList[i].technologyMask) {
+ temp.techMask |= LOCATION_TECHNOLOGY_WIFI_BIT;
+ }
+ if (QMI_LOC_POS_TECH_MASK_SENSORS_V02 & ind.batchedReportList[i].technologyMask) {
+ temp.techMask |= LOCATION_TECHNOLOGY_SENSORS_BIT;
+ }
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_VERT_UNC_V02) {
+ temp.verticalAccuracy = ind.batchedReportList[i].vertUnc;
+ temp.flags |= LOCATION_HAS_VERTICAL_ACCURACY_BIT;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_UNC_V02) {
+ temp.speedAccuracy = ind.batchedReportList[i].speedUnc;
+ temp.flags |= LOCATION_HAS_SPEED_ACCURACY_BIT;
+ }
+ if (ind.batchedReportList[i].validFields &
+ QMI_LOC_BATCHED_REPORT_MASK_VALID_HEADING_UNC_V02) {
+ temp.bearingAccuracy = ind.batchedReportList[i].headingUnc;
+ temp.flags |= LOCATION_HAS_BEARING_ACCURACY_BIT;
+ }
+ pLocationPiece[i] = temp;
+ }
+ numbOfEntries = ind.numberOfEntries;
+ LOC_LOGD("%s] Read out %zu batched locations from modem.",
+ __func__, numbOfEntries);
+ } else {
+ LOC_LOGD("%s] Modem does not return batched location.", __func__);
+ }
+}
+
+LocationError LocApiV02::queryAccumulatedTripDistanceSync(uint32_t &accumulatedTripDistance,
+ uint32_t &numOfBatchedPositions)
+{
+ locClientStatusEnumType st = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType req_union;
+ locClientStatusEnumType status;
+
+ qmiLocQueryOTBAccumulatedDistanceReqMsgT_v02 accumulated_distance_req;
+ qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02 accumulated_distance_ind;
+
+ memset(&accumulated_distance_req,0,sizeof(accumulated_distance_req));
+ memset(&accumulated_distance_ind, 0, sizeof(accumulated_distance_ind));
+
+ req_union.pQueryOTBAccumulatedDistanceReq = &accumulated_distance_req;
+
+ status = locSyncSendReq(QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02,
+ req_union,
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
+ QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_IND_V02,
+ &accumulated_distance_ind);
+ if ((eLOC_CLIENT_SUCCESS != status) ||
+ (eQMI_LOC_SUCCESS_V02 != accumulated_distance_ind.status))
+ {
+ LOC_LOGE ("%s:%d]: error! status = %d, accumulated_distance_ind.status = %d\n",
+ __func__, __LINE__,
+ (status),
+ (accumulated_distance_ind.status));
+ return LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ else
+ {
+ LOC_LOGD("Got accumulated distance: %u number of accumulated positions %u",
+ accumulated_distance_ind.accumulatedDistance, accumulated_distance_ind.batchedPosition);
+
+ accumulatedTripDistance = accumulated_distance_ind.accumulatedDistance;
+ numOfBatchedPositions = accumulated_distance_ind.batchedPosition;
+
+ return LOCATION_ERROR_SUCCESS;
+ }
+}
+
+void LocApiV02::queryAccumulatedTripDistance(
+ LocApiResponseData<LocApiBatchData>* adapterResponseData)
+{
+ sendMsg(new LocApiMsg([this, adapterResponseData] () {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ LocApiBatchData data;
+ err = queryAccumulatedTripDistanceSync(data.accumulatedDistance,
+ data.numOfBatchedPositions);
+ if (adapterResponseData != NULL) {
+ adapterResponseData->returnToSender(err, data);
+ }
+ }));
+}
+
+void LocApiV02::addToCallQueue(LocApiResponse* adapterResponse)
+{
+ sendMsg(new LocApiMsg([adapterResponse] () {
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(LOCATION_ERROR_SUCCESS);
+ }
+ }));
+}
+
+/* convert dgnss constellation mask from QMI loc to loc eng format */
+void LocApiV02::convertGnssConestellationMask(
+ qmiLocGNSSConstellEnumT_v02 qmiConstellationEnum,
+ GnssConstellationTypeMask& constellationMask) {
+
+ constellationMask = 0x0;
+ if (qmiConstellationEnum & eQMI_SYSTEM_GPS_V02) {
+ constellationMask |= GNSS_CONSTELLATION_TYPE_GPS_BIT;
+ }
+
+ if (qmiConstellationEnum & eQMI_SYSTEM_GLO_V02) {
+ constellationMask |= GNSS_CONSTELLATION_TYPE_GLONASS_BIT;
+ }
+
+ if (qmiConstellationEnum & eQMI_SYSTEM_BDS_V02) {
+ constellationMask |= GNSS_CONSTELLATION_TYPE_BEIDOU_BIT;
+ }
+
+ if (qmiConstellationEnum & eQMI_SYSTEM_GAL_V02) {
+ constellationMask |= GNSS_CONSTELLATION_TYPE_GALILEO_BIT;
+ }
+
+ if (qmiConstellationEnum & eQMI_SYSTEM_QZSS_V02) {
+ constellationMask |= GNSS_CONSTELLATION_TYPE_QZSS_BIT;
+ }
+
+ if (qmiConstellationEnum & eQMI_SYSTEM_NAVIC_V02) {
+ constellationMask |= GNSS_CONSTELLATION_TYPE_NAVIC_BIT;
+ }
+}
+
+GnssSignalTypeMask LocApiV02::convertQmiGnssSignalType(
+ qmiLocGnssSignalTypeMaskT_v02 qmiGnssSignalType) {
+ GnssSignalTypeMask gnssSignalType = (GnssSignalTypeMask)0;
+
+ switch (qmiGnssSignalType) {
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA_V02:
+ gnssSignalType = GNSS_SIGNAL_GPS_L1CA;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C_V02:
+ gnssSignalType = GNSS_SIGNAL_GPS_L1C;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L_V02:
+ gnssSignalType = GNSS_SIGNAL_GPS_L2;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q_V02:
+ gnssSignalType = GNSS_SIGNAL_GPS_L5;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1_V02:
+ gnssSignalType = GNSS_SIGNAL_GLONASS_G1;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2_V02:
+ gnssSignalType = GNSS_SIGNAL_GLONASS_G2;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C_V02:
+ gnssSignalType = GNSS_SIGNAL_GALILEO_E1;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q_V02:
+ gnssSignalType = GNSS_SIGNAL_GALILEO_E5A;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q_V02:
+ gnssSignalType = GNSS_SIGNAL_GALILEO_E5B;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I_V02:
+ gnssSignalType = GNSS_SIGNAL_BEIDOU_B1I;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C_V02:
+ gnssSignalType = GNSS_SIGNAL_BEIDOU_B1C;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I_V02:
+ gnssSignalType = GNSS_SIGNAL_BEIDOU_B2I;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I_V02:
+ gnssSignalType = GNSS_SIGNAL_BEIDOU_B2AI;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA_V02:
+ gnssSignalType = GNSS_SIGNAL_QZSS_L1CA;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S_V02:
+ gnssSignalType = GNSS_SIGNAL_QZSS_L1S;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L_V02:
+ gnssSignalType = GNSS_SIGNAL_QZSS_L2;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q_V02:
+ gnssSignalType = GNSS_SIGNAL_QZSS_L5;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA_V02:
+ gnssSignalType = GNSS_SIGNAL_SBAS_L1;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5_V02:
+ gnssSignalType = GNSS_SIGNAL_NAVIC_L5;
+ break;
+ case QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q_V02:
+ gnssSignalType = GNSS_SIGNAL_BEIDOU_B2AQ;
+ break;
+ default:
+ break;
+ }
+
+ return gnssSignalType;
+}
+
diff --git a/location/loc_api/loc_api_v02/LocApiV02.h b/location/loc_api/loc_api_v02/LocApiV02.h
new file mode 100644
index 0000000..55a69aa
--- /dev/null
+++ b/location/loc_api/loc_api_v02/LocApiV02.h
@@ -0,0 +1,463 @@
+/* Copyright (c) 2011-2020, 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_API_V_0_2_H
+#define LOC_API_V_0_2_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <LocApiBase.h>
+#include <loc_api_v02_client.h>
+#include <vector>
+#include <functional>
+
+#define LOC_SEND_SYNC_REQ(NAME, ID, REQ) \
+ int rv = true; \
+ locClientStatusEnumType st; \
+ locClientReqUnionType reqUnion; \
+ qmiLoc##NAME##IndMsgT_v02 ind; \
+\
+ memset(&ind, 0, sizeof(ind)); \
+ reqUnion.p##NAME##Req = &REQ; \
+\
+ st = locSyncSendReq(QMI_LOC_##ID##_REQ_V02, \
+ reqUnion, \
+ LOC_ENGINE_SYNC_REQUEST_TIMEOUT, \
+ QMI_LOC_##ID##_IND_V02, \
+ &ind); \
+\
+ if (st != eLOC_CLIENT_SUCCESS || \
+ eQMI_LOC_SUCCESS_V02 != ind.status) { \
+ LOC_LOGE ("%s:%d]: Error : st = %d, ind.status = %d", \
+ __func__, __LINE__, st, ind.status); \
+ rv = false; \
+ }
+
+using Resender = std::function<void()>;
+using namespace loc_core;
+
+typedef struct
+{
+ uint32_t counter;
+ qmiLocSvSystemEnumT_v02 system;
+ qmiLocGnssSignalTypeMaskT_v02 gnssSignalType;
+ uint16_t gnssSvId;
+ qmiLocMeasFieldsValidMaskT_v02 validMask;
+ uint8_t cycleSlipCount;
+} adrData;
+
+/* This class derives from the LocApiBase class.
+ The members of this class are responsible for converting
+ the Loc API V02 data structures into Loc Adapter data structures.
+ This class also implements some of the virtual functions that
+ handle the requests from loc engine. */
+class LocApiV02 : public LocApiBase {
+protected:
+ /* loc api v02 handle*/
+ locClientHandleType clientHandle;
+
+private:
+ locClientEventMaskType mQmiMask;
+ bool mInSession;
+ GnssPowerMode mPowerMode;
+ bool mEngineOn;
+ bool mMeasurementsStarted;
+ std::vector<Resender> mResenders;
+ bool mMasterRegisterNotSupported;
+ uint32_t mCounter;
+ uint32_t mMinInterval;
+ std::vector<adrData> mADRdata;
+ GnssMeasurements* mGnssMeasurements;
+ bool mGPSreceived;
+ int mMsInWeek;
+ bool mAgcIsPresent;
+
+ size_t mBatchSize, mDesiredBatchSize;
+ size_t mTripBatchSize, mDesiredTripBatchSize;
+
+ /* Convert event mask from loc eng to loc_api_v02 format */
+ static locClientEventMaskType convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
+
+ /* Convert GPS LOCK from LocationAPI format to QMI format */
+ static qmiLocLockEnumT_v02 convertGpsLockFromAPItoQMI(GnssConfigGpsLock lock);
+
+ /* Convert GPS LOCK from QMI format to LocationAPI format */
+ static GnssConfigGpsLock convertGpsLockFromQMItoAPI(qmiLocLockEnumT_v02 lock);
+
+ /* Convert error from loc_api_v02 to loc eng format*/
+ static enum loc_api_adapter_err convertErr(locClientStatusEnumType status);
+
+ /* convert Ni Encoding type from QMI_LOC to loc eng format */
+ static GnssNiEncodingType convertNiEncoding(
+ qmiLocNiDataCodingSchemeEnumT_v02 loc_encoding);
+
+ /*convert NI notify verify type from QMI LOC to loc eng format*/
+ static bool convertNiNotifyVerifyType (GnssNiNotification *notif,
+ qmiLocNiNotifyVerifyEnumT_v02 notif_priv);
+
+ /*convert signal type to carrier frequency*/
+ static float convertSignalTypeToCarrierFrequency(
+ qmiLocGnssSignalTypeMaskT_v02 signalType,
+ uint8_t gloFrequency);
+
+ /*convert GnssMeasurement type from QMI LOC to loc eng format*/
+ bool convertGnssMeasurements (
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr,
+ int index, bool isExt, bool validDgnssSvMeas);
+
+ /* Convert APN Type mask */
+ static qmiLocApnTypeMaskT_v02 convertLocApnTypeMask(LocApnTypeMask mask);
+ static LocApnTypeMask convertQmiLocApnTypeMask(qmiLocApnTypeMaskT_v02 mask);
+
+ /* Convert Get Constellation QMI Ind info to GnssSvTypeConfig */
+ static void convertToGnssSvTypeConfig(
+ const qmiLocGetConstellationConfigIndMsgT_v02& ind,
+ GnssSvTypeConfig& config);
+
+ /* Convert GnssPowerMode to QMI Loc Power Mode Enum */
+ static qmiLocPowerModeEnumT_v02 convertPowerMode(GnssPowerMode powerMode);
+
+ void convertGnssMeasurementsHeader(const Gnss_LocSvSystemEnumType locSvSystemType,
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info);
+
+ /*convert LocGnssClock type from QMI LOC to loc eng format*/
+ int convertGnssClock (GnssMeasurementsClock& clock,
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info);
+
+ /* convert dgnss constellation mask from QMI loc to loc eng format */
+ static void convertGnssConestellationMask (
+ qmiLocGNSSConstellEnumT_v02 qmiConstellationEnum,
+ GnssConstellationTypeMask& constellationMask);
+
+ /* If Confidence value is less than 68%, then scale the accuracy value to 68%
+ confidence.*/
+ void scaleAccuracyTo68PercentConfidence(const uint8_t confidenceValue,
+ LocGpsLocation &gpsLocation,
+ const bool isCircularUnc);
+
+ /* convert position report to loc eng format and send the converted
+ position to loc eng */
+ void reportPosition
+ (const qmiLocEventPositionReportIndMsgT_v02 *location_report_ptr,
+ bool unpropagatedPosition = false);
+
+ /* convert satellite report to loc eng format and send the converted
+ report to loc eng */
+ void reportSv (const qmiLocEventGnssSvInfoIndMsgT_v02 *gnss_report_ptr);
+
+ void reportSvPolynomial (
+ const qmiLocEventGnssSvPolyIndMsgT_v02 *gnss_sv_poly_ptr);
+
+ void reportSvEphemeris (
+ uint32_t eventId, const locClientEventIndUnionType &eventPayload);
+
+ void populateGpsEphemeris(const qmiLocGpsEphemerisReportIndMsgT_v02 *,
+ GnssSvEphemerisReport &);
+ void populateGlonassEphemeris(const qmiLocGloEphemerisReportIndMsgT_v02 *,
+ GnssSvEphemerisReport &);
+ void populateBdsEphemeris(const qmiLocBdsEphemerisReportIndMsgT_v02 *,
+ GnssSvEphemerisReport &);
+ void populateGalEphemeris(const qmiLocGalEphemerisReportIndMsgT_v02 *,
+ GnssSvEphemerisReport &);
+ void populateQzssEphemeris(const qmiLocQzssEphemerisReportIndMsgT_v02 *,
+ GnssSvEphemerisReport &);
+ void populateCommonEphemeris(const qmiLocEphGnssDataStructT_v02 &, GnssEphCommon &);
+ void populateGpsTimeOfReport(const qmiLocGnssTimeStructT_v02 &, GnssSystemTimeStructType &);
+
+ void reportLocEvent(const qmiLocEventReportIndMsgT_v02 *event_report_ptr);
+ /* convert system info to location api format and dispatch to
+ the registered adapter */
+ void reportSystemInfo(const qmiLocSystemInfoIndMsgT_v02* system_info_ptr);
+ void reportLocationRequestNotification(
+ const qmiLocLocationRequestNotificationIndMsgT_v02* loc_req_notif);
+
+ /* convert engine state report to loc eng format and send the converted
+ report to loc eng */
+ void reportEngineState (
+ const qmiLocEventEngineStateIndMsgT_v02 *engine_state_ptr);
+
+ /* convert fix session report to loc eng format and send the converted
+ report to loc eng */
+ void reportFixSessionState (
+ const qmiLocEventFixSessionStateIndMsgT_v02 *fix_session_state_ptr);
+
+ /* convert NMEA report to loc eng format and send the converted
+ report to loc eng */
+ void reportNmea (const qmiLocEventNmeaIndMsgT_v02 *nmea_report_ptr);
+
+ /* convert and report an ATL request to loc engine */
+ void reportAtlRequest(
+ const qmiLocEventLocationServerConnectionReqIndMsgT_v02
+ *server_request_ptr);
+
+ /* convert and report NI request to loc eng */
+ void reportNiRequest(
+ const qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *ni_req_ptr);
+
+ /* report the xtra server info */
+ void reportXtraServerUrl(
+ const qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02* server_request_ptr);
+
+ /* convert and report GNSS measurement data to loc eng */
+ void reportGnssMeasurementData(
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr);
+
+ void reportSvMeasurementInternal();
+
+ inline void resetSvMeasurementReport(){
+ memset(mGnssMeasurements, 0, sizeof(GnssMeasurements));
+ mGnssMeasurements->size = sizeof(GnssMeasurements);
+ mGnssMeasurements->gnssSvMeasurementSet.size = sizeof(GnssSvMeasurementSet);
+ mGnssMeasurements->gnssSvMeasurementSet.isNhz = false;
+ mGnssMeasurements->gnssSvMeasurementSet.svMeasSetHeader.size =
+ sizeof(GnssSvMeasurementHeader);
+ mGPSreceived = false;
+ mMsInWeek = -1;
+ mAgcIsPresent = false;
+ }
+
+ /* convert and report ODCPI request */
+ void requestOdcpi(
+ const qmiLocEventWifiReqIndMsgT_v02& odcpiReq);
+
+ void registerEventMask(LOC_API_ADAPTER_EVENT_MASK_T adapterMask);
+ bool sendRequestForAidingData(locClientEventMaskType qmiMask);
+ locClientEventMaskType adjustMaskIfNoSessionOrEngineOff(locClientEventMaskType qmiMask);
+ bool cacheGnssMeasurementSupport();
+ void registerMasterClient();
+ int getGpsLock(uint8_t subType);
+ void getRobustLocationConfig(uint32_t sessionId, LocApiResponse* adapterResponse);
+
+ /* Convert get blacklist sv info to GnssSvIdConfig */
+ void reportGnssSvIdConfig
+ (const qmiLocGetBlacklistSvIndMsgT_v02& getBlacklistSvIndMsg);
+
+ /* Convert get constellation info to GnssSvTypeConfig */
+ void reportGnssSvTypeConfig
+ (const qmiLocGetConstellationConfigIndMsgT_v02& getConstellationConfigIndMsg);
+
+ /* Inform ODCPI availability to Modem */
+ void wifiStatusInformSync();
+
+ void sendNfwNotification(GnssNfwNotification& notification);
+ LocationError queryBatchBuffer(size_t desiredSize,
+ size_t &allocatedSize, BatchingMode batchMode);
+ LocationError releaseBatchBuffer(BatchingMode batchMode);
+ void readModemLocations(Location* pLocationPiece, size_t count,
+ BatchingMode batchingMode, size_t& numbOfEntries);
+ void setOperationMode(GnssSuplMode mode);
+ bool needsNewTripBatchRestart(uint32_t newTripDistance, uint32_t newTripTBFInterval,
+ uint32_t &accumulatedDistance, uint32_t &numOfBatchedPositions);
+ void batchFullEvent(const qmiLocEventBatchFullIndMsgT_v02* batchFullInfo);
+ void batchStatusEvent(const qmiLocEventBatchingStatusIndMsgT_v02* batchStatusInfo);
+ void onDbtPosReportEvent(const qmiLocEventDbtPositionReportIndMsgT_v02* pDbtPosReport);
+ void geofenceBreachEvent(const qmiLocEventGeofenceBreachIndMsgT_v02* breachInfo);
+ void geofenceBreachEvent(const qmiLocEventGeofenceBatchedBreachIndMsgT_v02* batchedBreachInfo);
+ void geofenceStatusEvent(const qmiLocEventGeofenceGenAlertIndMsgT_v02* alertInfo);
+ void geofenceDwellEvent(const qmiLocEventGeofenceBatchedDwellIndMsgT_v02 *dwellEvent);
+
+protected:
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+
+ LocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context = NULL);
+ virtual ~LocApiV02();
+
+public:
+ static LocApiBase* createLocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context);
+ /* event callback registered with the loc_api v02 interface */
+ virtual void eventCb(locClientHandleType client_handle,
+ uint32_t loc_event_id,
+ locClientEventIndUnionType loc_event_payload);
+
+ /* error callback, this function handles the service unavailable
+ error */
+ void errorCb(locClientHandleType handle,
+ locClientErrorEnumType errorId);
+
+ // Tracking
+ virtual void startFix(const LocPosMode& posMode, LocApiResponse *adapterResponse);
+ virtual void stopFix(LocApiResponse *adapterResponse);
+
+ void startTimeBasedTracking(const TrackingOptions& options, LocApiResponse* adapterResponse);
+ void stopTimeBasedTracking(LocApiResponse* adapterResponse);
+ void startDistanceBasedTracking(uint32_t sessionId, const LocationOptions& options,
+ LocApiResponse* adapterResponse);
+ void stopDistanceBasedTracking(uint32_t sessionId, LocApiResponse* adapterResponse);
+
+ // Batching
+ void startBatching(uint32_t sessionId, const LocationOptions& options, uint32_t accuracy,
+ uint32_t timeout, LocApiResponse* adapterResponse);
+ void stopBatching(uint32_t sessionId, LocApiResponse* adapterResponse);
+ LocationError startOutdoorTripBatchingSync(uint32_t tripDistance, uint32_t tripTbf,
+ uint32_t timeout);
+ void startOutdoorTripBatching(uint32_t tripDistance, uint32_t tripTbf, uint32_t timeout,
+ LocApiResponse* adapterResponse);
+ void reStartOutdoorTripBatching(uint32_t ongoingTripDistance, uint32_t ongoingTripInterval,
+ uint32_t batchingTimeout, LocApiResponse* adapterResponse);
+ LocationError stopOutdoorTripBatchingSync(bool deallocBatchBuffer = true);
+ void stopOutdoorTripBatching(bool deallocBatchBuffer = true,
+ LocApiResponse* adapterResponse = nullptr);
+ LocationError getBatchedLocationsSync(size_t count);
+ void getBatchedLocations(size_t count, LocApiResponse* adapterResponse);
+ LocationError getBatchedTripLocationsSync(size_t count, uint32_t accumulatedDistance);
+ void getBatchedTripLocations(size_t count, uint32_t accumulatedDistance,
+ LocApiResponse* adapterResponse);
+ virtual void setBatchSize(size_t size);
+ virtual void setTripBatchSize(size_t size);
+ LocationError queryAccumulatedTripDistanceSync(uint32_t &accumulatedTripDistance,
+ uint32_t &numOfBatchedPositions);
+ void queryAccumulatedTripDistance(
+ LocApiResponseData<LocApiBatchData>* adapterResponseData);
+
+ // Geofence
+ virtual void addGeofence(uint32_t clientId, const GeofenceOption& options,
+ const GeofenceInfo& info, LocApiResponseData<LocApiGeofenceData>* adapterResponseData);
+ virtual void removeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
+ virtual void pauseGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
+ virtual void resumeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
+ virtual void modifyGeofence(uint32_t hwId, uint32_t clientId,
+ const GeofenceOption& options, LocApiResponse* adapterResponse);
+ virtual void addToCallQueue(LocApiResponse* adapterResponse);
+
+
+ virtual void
+ setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
+
+ virtual void
+ injectPosition(double latitude, double longitude, float accuracy);
+
+ virtual void
+ injectPosition(const Location& location, bool onDemandCpi);
+
+ virtual void
+ injectPosition(const GnssLocationInfoNotification &locationInfo, bool onDemandCpi);
+
+ virtual void
+ deleteAidingData(const GnssAidingData& data, LocApiResponse *adapterResponse);
+
+ virtual void
+ informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
+
+ virtual LocationError
+ setServerSync(const char* url, int len, LocServerType type);
+ virtual LocationError
+ setServerSync(unsigned int ip, int port, LocServerType type);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual void
+ atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen, AGpsBearerType bear,
+ LocAGpsType agpsType, LocApnTypeMask mask);
+ virtual void atlCloseStatus(int handle, int is_succ);
+ virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
+
+ virtual enum loc_api_adapter_err setNMEATypesSync(uint32_t typesMask);
+
+ virtual LocationError setLPPConfigSync(GnssConfigLppProfile profile);
+
+
+ virtual enum loc_api_adapter_err
+ setSensorPropertiesSync(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
+ bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
+ bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
+ bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
+ bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk);
+
+ virtual enum loc_api_adapter_err
+ setSensorPerfControlConfigSync(int controlMode, int accelSamplesPerBatch,
+ int accelBatchesPerSec, int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
+ virtual LocationError
+ setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
+ virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
+ virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
+ virtual void getWwanZppFix();
+ virtual void
+ handleWwanZppFixIndication(const qmiLocGetAvailWwanPositionIndMsgT_v02 &zpp_ind);
+ virtual void
+ handleZppBestAvailableFixIndication(const qmiLocGetBestAvailablePositionIndMsgT_v02 &zpp_ind);
+ virtual void getBestAvailableZppFix();
+ virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
+ virtual void setConstrainedTuncMode(bool enabled, float tuncConstraint, uint32_t powerBudget,
+ LocApiResponse *adapterResponse=nullptr);
+ virtual void setPositionAssistedClockEstimatorMode(bool enabled,
+ LocApiResponse *adapterResponse=nullptr);
+ virtual LocationError getGnssEnergyConsumed();
+ virtual void updateSystemPowerState(PowerStateType powerState);
+ virtual void requestForAidingData(GnssAidingDataSvMask svDataMask);
+ virtual void configRobustLocation(bool enable, bool enableForE911,
+ LocApiResponse *adapterResponse=nullptr);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int setSvMeasurementConstellation(const locClientEventMaskType mask);
+ virtual LocationError setXtraVersionCheckSync(uint32_t check);
+ virtual void installAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+
+ virtual LocPosTechMask convertPosTechMask(qmiLocPosTechMaskT_v02 mask);
+ virtual LocNavSolutionMask convertNavSolutionMask(qmiLocNavSolutionMaskT_v02 mask);
+ virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
+ virtual GnssConfigLppProfile convertLppProfile(const uint32_t lppProfile);
+ virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
+ virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
+ virtual LocationError setEmergencyExtensionWindowSync(const uint32_t emergencyExtensionSeconds);
+ virtual GnssSignalTypeMask convertQmiGnssSignalType(
+ qmiLocGnssSignalTypeMaskT_v02 qmiGnssSignalType);
+
+ /* Requests for SV/Constellation Control */
+ virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
+ virtual void setBlacklistSv(const GnssSvIdConfig& config);
+ virtual void getBlacklistSv();
+ virtual void setConstellationControl(const GnssSvTypeConfig& config,
+ LocApiResponse *adapterResponse=nullptr);
+ virtual void getConstellationControl();
+ virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
+
+ locClientStatusEnumType locSyncSendReq(uint32_t req_id, locClientReqUnionType req_payload,
+ uint32_t timeout_msec, uint32_t ind_id, void* ind_payload_ptr);
+
+ inline locClientStatusEnumType locClientSendReq(uint32_t req_id,
+ locClientReqUnionType req_payload) {
+ return ::locClientSendReq(clientHandle, req_id, req_payload);
+ }
+};
+
+extern "C" LocApiBase* getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+#endif //LOC_API_V_0_2_H
diff --git a/location/loc_api/loc_api_v02/Makefile.am b/location/loc_api/loc_api_v02/Makefile.am
new file mode 100644
index 0000000..8aefe09
--- /dev/null
+++ b/location/loc_api/loc_api_v02/Makefile.am
@@ -0,0 +1,47 @@
+AM_CFLAGS = \
+ -I. \
+ $(LOCPLA_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ $(LOC_CORE_CFLAGS) \
+ $(QMIFW_CFLAGS) \
+ -fno-short-enums \
+ -D__func__=__PRETTY_FUNCTION__ \
+ -DTARGET_USES_QCOM_BSP
+
+libloc_api_v02_la_SOURCES = \
+ LocApiV02.cpp \
+ loc_api_v02_log.cpp \
+ loc_api_v02_client.cpp \
+ loc_api_sync_req.cpp \
+ location_service_v02.c
+
+if USE_GLIB
+libloc_api_v02_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_v02_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -lcutils @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_v02_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_v02_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_v02_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -lcutils -shared -version-info 1:0:0
+libloc_api_v02_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_v02_la_CXXFLAGS = -std=c++0x
+libloc_api_v02_la_LIBADD = -lstdc++ -ldl -lutils $(QMIFW_LIBS) $(GPSUTILS_LIBS) $(LOC_CORE_LIBS)
+
+library_include_HEADERS = \
+ location_service_v02.h \
+ loc_api_v02_log.h \
+ loc_api_v02_client.h \
+ loc_api_sync_req.h \
+ LocApiV02.h \
+ loc_util_log.h
+
+library_includedir = $(pkgincludedir)/loc_api_v02
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_api_v02.la
+
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-api-v02.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/location/loc_api/loc_api_v02/configure.ac b/location/loc_api/loc_api_v02/configure.ac
new file mode 100644
index 0000000..20f7bff
--- /dev/null
+++ b/location/loc_api/loc_api_v02/configure.ac
@@ -0,0 +1,90 @@
+# configure.ac -- Autoconf script for gps loc-api-v02
+#
+# 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-api-v02 package version 1.0.0
+AC_INIT([loc-api-v02],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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])
+
+PKG_CHECK_MODULES([LOC_CORE], [loc-core])
+AC_SUBST([LOC_CORE_CFLAGS])
+AC_SUBST([LOC_CORE_LIBS])
+
+PKG_CHECK_MODULES([QMIFW], [qmi-framework])
+AC_SUBST([QMIFW_CFLAGS])
+AC_SUBST([QMIFW_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 \
+ loc-api-v02.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/loc_api/loc_api_v02/loc-api-v02.pc.in b/location/loc_api/loc_api_v02/loc-api-v02.pc.in
new file mode 100644
index 0000000..bb1e783
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc-api-v02.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-api-v02
+Description: Loc Api V02
+Version: @VERSION
+Libs: -L${libdir} -lloc_api_v02
+Cflags: -I${includedir} -I${includedir}/loc-api-v02
diff --git a/location/loc_api/loc_api_v02/loc_api_sync_req.cpp b/location/loc_api/loc_api_v02/loc_api_sync_req.cpp
new file mode 100644
index 0000000..595967a
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc_api_sync_req.cpp
@@ -0,0 +1,546 @@
+/* Copyright (c) 2011-2012, 2015-2016, 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 <stdio.h>
+#include <assert.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <string.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <loc_cfg.h>
+#include "loc_api_v02_client.h"
+#include "loc_api_sync_req.h"
+#include "loc_api_v02_log.h"
+#include <loc_pla.h>
+
+/* Logging */
+// Uncomment to log verbose logs
+#define LOG_NDEBUG 1
+
+// log debug logs
+#define LOG_NDDEBUG 1
+#define LOG_TAG "LocSvc_api_v02"
+#include "loc_util_log.h"
+
+#define LOC_SYNC_REQ_BUFFER_SIZE 8
+pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static bool loc_sync_call_initialized = false;
+
+typedef struct {
+ pthread_mutex_t sync_req_lock;
+
+ /* Client ID */
+ locClientHandleType client_handle;
+
+ /* waiting conditional variable */
+ pthread_cond_t ind_arrived_cond;
+
+ /* Callback waiting data block, protected by loc_cb_data_mutex */
+ bool ind_is_selected; /* is cb selected? */
+ bool ind_is_waiting; /* is waiting? */
+ bool ind_has_arrived; /* callback has arrived */
+ uint32_t req_id; /* sync request */
+ void *recv_ind_payload_ptr; /* received payload */
+ uint32_t recv_ind_id; /* received ind */
+
+} loc_sync_req_data_s_type;
+
+typedef struct {
+ bool in_use; /* at least one sync call is active */
+ bool slot_in_use[LOC_SYNC_REQ_BUFFER_SIZE];
+ loc_sync_req_data_s_type slots[LOC_SYNC_REQ_BUFFER_SIZE];
+} loc_sync_req_array_s_type;
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_req_array_s_type loc_sync_array;
+
+/*===========================================================================
+
+FUNCTION loc_sync_req_init
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_sync_req_init()
+{
+ LOC_LOGV(" %s:%d]:\n", __func__, __LINE__);
+ UTIL_READ_CONF_DEFAULT(LOC_PATH_GPS_CONF);
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if(true == loc_sync_call_initialized)
+ {
+ LOC_LOGD("%s:%d]:already initialized\n", __func__, __LINE__);
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+
+ loc_sync_array.in_use = false;
+
+ memset(loc_sync_array.slot_in_use, 0, sizeof(loc_sync_array.slot_in_use));
+
+ int i;
+ for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
+ {
+ loc_sync_req_data_s_type *slot = &loc_sync_array.slots[i];
+
+ pthread_mutex_init(&slot->sync_req_lock, NULL);
+ pthread_condattr_t condAttr;
+ pthread_condattr_init(&condAttr);
+ pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC);
+ pthread_cond_init(&slot->ind_arrived_cond, &condAttr);
+ pthread_condattr_destroy(&condAttr);
+
+ slot->client_handle = LOC_CLIENT_INVALID_HANDLE_VALUE;
+ slot->ind_is_selected = false; /* is ind selected? */
+ slot->ind_is_waiting = false; /* is waiting? */
+ slot->ind_has_arrived = false; /* callback has arrived */
+ slot->recv_ind_id = 0; /* ind to wait for */
+ slot->recv_ind_payload_ptr = NULL;
+ slot->req_id = 0; /* req id */
+ }
+
+ loc_sync_call_initialized = true;
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+
+/*===========================================================================
+
+FUNCTION loc_sync_process_ind
+
+DESCRIPTION
+ Wakes up blocked API calls to check if the needed callback has arrived
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_sync_process_ind(
+ locClientHandleType client_handle, /* handle of the client */
+ uint32_t ind_id , /* ind id */
+ void *ind_payload_ptr, /* payload */
+ uint32_t ind_payload_size /* payload size */
+)
+{
+
+ LOC_LOGV("%s:%d]: received indication, handle = %p ind_id = %u \n",
+ __func__,__LINE__, client_handle, ind_id);
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+
+ if (!loc_sync_array.in_use)
+ {
+ LOC_LOGD("%s:%d]: loc_sync_array not in use \n",
+ __func__, __LINE__);
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+
+ bool in_use = false, consumed = false;
+ int i;
+
+ for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE && !consumed; i++)
+ {
+ loc_sync_req_data_s_type *slot = &loc_sync_array.slots[i];
+
+ in_use |= loc_sync_array.slot_in_use[i];
+
+ pthread_mutex_lock(&slot->sync_req_lock);
+
+ if ( (loc_sync_array.slot_in_use[i]) && (slot->client_handle == client_handle)
+ && (ind_id == slot->recv_ind_id) && (!slot->ind_has_arrived))
+ {
+ LOC_LOGV("%s:%d]: found slot %d selected for ind %u \n",
+ __func__, __LINE__, i, ind_id);
+
+ if( NULL != slot->recv_ind_payload_ptr &&
+ NULL != ind_payload_ptr && ind_payload_size > 0 )
+ {
+ LOC_LOGV("%s:%d]: copying ind payload size = %u \n",
+ __func__, __LINE__, ind_payload_size);
+
+ memcpy(slot->recv_ind_payload_ptr, ind_payload_ptr, ind_payload_size);
+
+ consumed = true;
+ }
+ /* Received a callback while waiting, wake up thread to check it */
+ if (slot->ind_is_waiting)
+ {
+ slot->recv_ind_id = ind_id;
+
+ pthread_cond_signal(&slot->ind_arrived_cond);
+ }
+ else
+ {
+ /* If callback arrives before wait, remember it */
+ LOC_LOGV("%s:%d]: ind %u arrived before wait was called \n",
+ __func__, __LINE__, ind_id);
+
+ slot->ind_has_arrived = true;
+ }
+ }
+ pthread_mutex_unlock(&slot->sync_req_lock);
+ }
+
+ if (!in_use) {
+ loc_sync_array.in_use = false;
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_alloc_slot
+
+DESCRIPTION
+ Allocates a buffer slot for the synchronous API call
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : buffer full
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_alloc_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+
+ for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
+ {
+ if (!loc_sync_array.slot_in_use[i])
+ {
+ select_id = i;
+ loc_sync_array.slot_in_use[i] = 1;
+ loc_sync_array.in_use = true;
+ break;
+ }
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ LOC_LOGV("%s:%d]: returning slot %d\n",
+ __func__, __LINE__, select_id);
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_free_slot
+
+DESCRIPTION
+ Frees a buffer slot after the synchronous API call
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_free_slot(int select_id)
+{
+ int i;
+ loc_sync_req_data_s_type *slot;
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+
+ LOC_LOGD("%s:%d]: freeing slot %d\n", __func__, __LINE__, select_id);
+
+ loc_sync_array.slot_in_use[select_id] = 0;
+
+ slot = &loc_sync_array.slots[select_id];
+
+ slot->client_handle = LOC_CLIENT_INVALID_HANDLE_VALUE;
+ slot->ind_is_selected = false; /* is ind selected? */
+ slot->ind_is_waiting = false; /* is waiting? */
+ slot->ind_has_arrived = false; /* callback has arrived */
+ slot->recv_ind_id = 0; /* ind to wait for */
+ slot->recv_ind_payload_ptr = NULL;
+ slot->req_id = 0;
+
+ // check if all slots are now free
+ for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
+ {
+ if (loc_sync_array.slot_in_use[i]) break;
+ }
+
+ if (i >= LOC_SYNC_REQ_BUFFER_SIZE)
+ {
+ loc_sync_array.in_use = false;
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_sync_select_ind
+
+DESCRIPTION
+ Selects which indication to wait for.
+
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -ENOMEM : out of buffer
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_sync_select_ind(
+ locClientHandleType client_handle, /* Client handle */
+ uint32_t ind_id, /* ind Id wait for */
+ uint32_t req_id, /* req id */
+ void * ind_payload_ptr /* ptr where payload should be copied to*/
+)
+{
+ int select_id = loc_alloc_slot();
+
+ LOC_LOGV("%s:%d]: client handle %p, ind_id %u, req_id %u \n",
+ __func__, __LINE__, client_handle, ind_id, req_id);
+
+ if (select_id < 0)
+ {
+ LOC_LOGE("%s:%d]: buffer full for this synchronous req %s \n",
+ __func__, __LINE__, loc_get_v02_event_name(req_id));
+ return -ENOMEM;
+ }
+
+ loc_sync_req_data_s_type *slot = &loc_sync_array.slots[select_id];
+
+ pthread_mutex_lock(&slot->sync_req_lock);
+
+ slot->client_handle = client_handle;
+ slot->ind_is_selected = true;
+ slot->ind_is_waiting = false;
+ slot->ind_has_arrived = false;
+
+ slot->recv_ind_id = ind_id;
+ slot->req_id = req_id;
+ slot->recv_ind_payload_ptr = ind_payload_ptr; //store the payload ptr
+
+ pthread_mutex_unlock(&slot->sync_req_lock);
+
+ return select_id;
+}
+
+
+/*===========================================================================
+
+FUNCTION loc_sync_wait_for_ind
+
+DESCRIPTION
+ Waits for a selected indication. The wait expires in timeout_seconds seconds.
+ If the function is called before an existing wait has finished, it will
+ immediately return error.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0 on SUCCESS, -ve value on failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_sync_wait_for_ind(
+ int select_id, /* ID from loc_sync_select_ind() */
+ int timeout_seconds, /* Timeout in this number of seconds */
+ uint32_t ind_id
+)
+{
+ if (select_id < 0 || select_id >= LOC_SYNC_REQ_BUFFER_SIZE || !loc_sync_array.slot_in_use[select_id])
+ {
+ LOC_LOGE("%s:%d]: invalid select_id: %d \n",
+ __func__, __LINE__, select_id);
+
+ return (-EINVAL);
+ }
+
+ loc_sync_req_data_s_type *slot = &loc_sync_array.slots[select_id];
+
+ int ret_val = 0; /* the return value of this function: 0 = no error */
+ int rc; /* return code from pthread calls */
+
+ struct timespec expire_time;
+
+ pthread_mutex_lock(&slot->sync_req_lock);
+
+ do
+ {
+ if (slot->ind_has_arrived)
+ {
+ ret_val = 0; /* success */
+ break;
+ }
+
+ if (slot->ind_is_waiting)
+ {
+ LOC_LOGW("%s:%d]: already waiting in this slot %d\n", __func__,
+ __LINE__, select_id);
+ ret_val = -EBUSY; // busy
+ break;
+ }
+
+ /* Calculate absolute expire time */
+ clock_gettime(CLOCK_MONOTONIC, &expire_time);
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Take new wait request */
+ slot->ind_is_waiting = true;
+
+ /* Waiting */
+ rc = pthread_cond_timedwait(&slot->ind_arrived_cond,
+ &slot->sync_req_lock, &expire_time);
+
+ slot->ind_is_waiting = false;
+
+ if(rc == ETIMEDOUT)
+ {
+ LOC_LOGE("%s:%d]: slot %d, timed out for ind_id %s\n",
+ __func__, __LINE__, select_id, loc_get_v02_event_name(ind_id));
+ ret_val = -ETIMEDOUT; //time out
+ }
+
+ } while (0);
+
+ pthread_mutex_unlock(&slot->sync_req_lock);
+ loc_free_slot(select_id);
+
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_sync_send_req
+
+DESCRIPTION
+ Synchronous req call (thread safe)
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Loc API 2.0 status
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+locClientStatusEnumType loc_sync_send_req
+(
+ locClientHandleType client_handle,
+ uint32_t req_id, /* req id */
+ locClientReqUnionType req_payload,
+ uint32_t timeout_msec,
+ uint32_t ind_id, //ind ID to block for, usually the same as req_id */
+ void *ind_payload_ptr /* can be NULL*/
+)
+{
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS ;
+ int select_id;
+ int rc = 0;
+
+ // Select the callback we are waiting for
+ select_id = loc_sync_select_ind(client_handle, ind_id, req_id,
+ ind_payload_ptr);
+
+ if (select_id >= 0)
+ {
+ status = locClientSendReq (client_handle, req_id, req_payload);
+ LOC_LOGV("%s:%d]: select_id = %d,locClientSendReq returned %d\n",
+ __func__, __LINE__, select_id, status);
+
+ if (status != eLOC_CLIENT_SUCCESS )
+ {
+ loc_free_slot(select_id);
+ }
+ else
+ {
+ // Wait for the indication callback
+ if (( rc = loc_sync_wait_for_ind( select_id,
+ timeout_msec / 1000,
+ ind_id) ) < 0)
+ {
+ if ( rc == -ETIMEDOUT)
+ status = eLOC_CLIENT_FAILURE_TIMEOUT;
+ else
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+
+ // Callback waiting failed
+ LOC_LOGE("%s:%d]: loc_api_wait_for_ind failed, err %d, "
+ "select id %d, status %s", __func__, __LINE__, rc ,
+ select_id, loc_get_v02_client_status_name(status));
+ }
+ else
+ {
+ status = eLOC_CLIENT_SUCCESS;
+ LOC_LOGV("%s:%d]: success (select id %d)\n",
+ __func__, __LINE__, select_id);
+ }
+ }
+ } /* select id */
+
+ return status;
+}
+
+
diff --git a/location/loc_api/loc_api_v02/loc_api_sync_req.h b/location/loc_api/loc_api_v02/loc_api_sync_req.h
new file mode 100644
index 0000000..81ecb0c
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc_api_sync_req.h
@@ -0,0 +1,70 @@
+/* Copyright (c) 2011,2013,2016, 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_SYNC_REQ_H
+#define LOC_SYNC_REQ_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include <stdbool.h>
+#include <stdint.h>
+#include "loc_api_v02_client.h"
+
+#define LOC_ENGINE_SYNC_REQUEST_TIMEOUT (1000) // 1 second
+#define LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT (5000) // 5 seconds
+
+/* Init function */
+extern void loc_sync_req_init();
+
+
+/* Process Loc API indications to wake up blocked user threads */
+extern void loc_sync_process_ind(
+ locClientHandleType client_handle, /* handle of the client */
+ uint32_t ind_id , /* respInd id */
+ void *ind_payload_ptr, /* payload */
+ uint32_t ind_payload_size /* payload size */
+);
+
+/* Thread safe synchronous request, using Loc API status return code */
+extern locClientStatusEnumType loc_sync_send_req
+(
+ locClientHandleType client_handle,
+ uint32_t req_id, /* req id */
+ locClientReqUnionType req_payload,
+ uint32_t timeout_msec,
+ uint32_t ind_id, //ind ID to block for, usually the same as req_id */
+ void *ind_payload_ptr /* can be NULL*/
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_SYNC_REQ_H */
diff --git a/location/loc_api/loc_api_v02/loc_api_v02_client.cpp b/location/loc_api/loc_api_v02/loc_api_v02_client.cpp
new file mode 100644
index 0000000..896c74b
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc_api_v02_client.cpp
@@ -0,0 +1,2588 @@
+/* Copyright (c) 2011-2016, 2018-2020 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 <string.h>
+#include <stddef.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <inttypes.h>
+
+#include "qmi_client.h"
+#include "qmi_idl_lib.h"
+#include "qmi_cci_target_ext.h"
+
+#if defined( _ANDROID_)
+#include "qmi_cci_target.h"
+#include "qmi_cci_common.h"
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_api_v02"
+#endif //_ANDROID_
+
+#include <loc_pla.h>
+#include "loc_api_v02_client.h"
+#include "loc_util_log.h"
+#include "loc_api_v02_log.h"
+
+#include "loc_cfg.h"
+
+#ifdef LOC_UTIL_TARGET_OFF_TARGET
+
+// timeout in ms before send_msg_sync should return
+#define LOC_CLIENT_ACK_TIMEOUT (5000)
+
+#else
+
+// timeout in ms before send_msg_sync should return
+#define LOC_CLIENT_ACK_TIMEOUT (1000)
+
+#endif //LOC_UTIL_TARGET_OFF_TARGET
+
+#define LOC_CLIENT_MAX_OPEN_RETRIES (20)
+#define LOC_CLIENT_TIME_BETWEEN_OPEN_RETRIES (1)
+
+#define LOC_CLIENT_MAX_SYNC_RETRIES (50)
+#define LOC_CLIENT_TIME_BETWEEN_SYNC_RETRIES (20*1000)
+
+enum
+{
+ //! Special value for selecting any available service
+ /** This value enables selection of any available service */
+ eLOC_CLIENT_INSTANCE_ID_ANY = -1,
+ //! qca1530 service id value
+ /** qca1530 service daemon uses service id value 1 */
+ eLOC_CLIENT_INSTANCE_ID_QCA1530 = 1,
+ //! GSS service id value
+ /* GSS service id value is 0, but here it is set to -1 for compatibitily */
+ eLOC_CLIENT_INSTANCE_ID_GSS = eLOC_CLIENT_INSTANCE_ID_ANY,
+ //! MSM service id value
+ /** MSM service id value is 0, but here it is set to -1 for compatibitily */
+ eLOC_CLIENT_INSTANCE_ID_MSM = eLOC_CLIENT_INSTANCE_ID_ANY,
+ //! MDM service id value
+ /** MDM connects using QMUXD and assigned a value of
+ QMI_CLIENT_QMUX_RMNET_USB_INSTANCE_0 ("qmi_client_instance_defs.h", 37).
+ -1 for compatibility */
+ eLOC_CLIENT_INSTANCE_ID_MDM = eLOC_CLIENT_INSTANCE_ID_ANY,
+ /* GSS service id value is 0, for auto config */
+ eLOC_CLIENT_INSTANCE_ID_GSS_AUTO = 0,
+ /* Loc Modem Emulator Service Instance */
+ eLOC_CLIENT_INSTANCE_ID_MODEM_EMULATOR = 5,
+};
+
+/* Table to relate eventId, size and mask value used to enable the event*/
+typedef struct
+{
+ uint32_t eventId;
+ size_t eventSize;
+ locClientEventMaskType eventMask;
+}locClientEventIndTableStructT;
+
+pthread_mutex_t loc_shutdown_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static const locClientEventIndTableStructT locClientEventIndTable[]= {
+
+ // position report ind
+ { QMI_LOC_EVENT_POSITION_REPORT_IND_V02,
+ sizeof(qmiLocEventPositionReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_POSITION_REPORT_V02 },
+
+ // satellite report ind
+ { QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02,
+ sizeof(qmiLocEventGnssSvInfoIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GNSS_SV_INFO_V02 },
+
+ // NMEA report ind
+ { QMI_LOC_EVENT_NMEA_IND_V02,
+ sizeof(qmiLocEventNmeaIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_NMEA_V02 },
+
+ //NI event ind
+ { QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02,
+ sizeof(qmiLocEventNiNotifyVerifyReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_NI_NOTIFY_VERIFY_REQ_V02 },
+
+ //Time Injection Request Ind
+ { QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02,
+ sizeof(qmiLocEventInjectTimeReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_INJECT_TIME_REQ_V02 },
+
+ //Predicted Orbits Injection Request
+ { QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02,
+ sizeof(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_INJECT_PREDICTED_ORBITS_REQ_V02 },
+
+ //Position Injection Request Ind
+ { QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02,
+ sizeof(qmiLocEventInjectPositionReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_INJECT_POSITION_REQ_V02 } ,
+
+ //Engine State Report Ind
+ { QMI_LOC_EVENT_ENGINE_STATE_IND_V02,
+ sizeof(qmiLocEventEngineStateIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_ENGINE_STATE_V02 },
+
+ //Fix Session State Report Ind
+ { QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02,
+ sizeof(qmiLocEventFixSessionStateIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_FIX_SESSION_STATE_V02 },
+
+ //Wifi Request Indication
+ { QMI_LOC_EVENT_WIFI_REQ_IND_V02,
+ sizeof(qmiLocEventWifiReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_WIFI_REQ_V02 },
+
+ //Sensor Streaming Ready Status Ind
+ { QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_IND_V02,
+ sizeof(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_SENSOR_STREAMING_READY_STATUS_V02 },
+
+ // Time Sync Request Indication
+ { QMI_LOC_EVENT_TIME_SYNC_REQ_IND_V02,
+ sizeof(qmiLocEventTimeSyncReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_TIME_SYNC_REQ_V02 },
+
+ //Set Spi Streaming Report Event
+ { QMI_LOC_EVENT_SET_SPI_STREAMING_REPORT_IND_V02,
+ sizeof(qmiLocEventSetSpiStreamingReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_SET_SPI_STREAMING_REPORT_V02 },
+
+ //Location Server Connection Request event
+ { QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02,
+ sizeof(qmiLocEventLocationServerConnectionReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_LOCATION_SERVER_CONNECTION_REQ_V02 },
+
+ // NI Geofence Event
+ { QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02,
+ sizeof(qmiLocEventNiGeofenceNotificationIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_NI_GEOFENCE_NOTIFICATION_V02},
+
+ // Geofence General Alert Event
+ { QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02,
+ sizeof(qmiLocEventGeofenceGenAlertIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GEOFENCE_GEN_ALERT_V02},
+
+ //Geofence Breach event
+ { QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02,
+ sizeof(qmiLocEventGeofenceBreachIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION_V02},
+
+ //Geofence Batched Breach event
+ { QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02,
+ sizeof(qmiLocEventGeofenceBatchedBreachIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_BREACH_NOTIFICATION_V02},
+
+ //Pedometer Control event
+ { QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02,
+ sizeof(qmiLocEventPedometerControlIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_PEDOMETER_CONTROL_V02 },
+
+ //Motion Data Control event
+ { QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02,
+ sizeof(qmiLocEventMotionDataControlIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_MOTION_DATA_CONTROL_V02 },
+
+ //Wifi AP data request event
+ { QMI_LOC_EVENT_INJECT_WIFI_AP_DATA_REQ_IND_V02,
+ sizeof(qmiLocEventInjectWifiApDataReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_INJECT_WIFI_AP_DATA_REQ_V02 },
+
+ //Get Batching On Fix Event
+ { QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02,
+ sizeof(qmiLocEventLiveBatchedPositionReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_LIVE_BATCHED_POSITION_REPORT_V02 },
+
+ //Get Batching On Full Event
+ { QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02,
+ sizeof(qmiLocEventBatchFullIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_BATCH_FULL_NOTIFICATION_V02 },
+
+ //Vehicle Data Readiness event
+ { QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_IND_V02,
+ sizeof(qmiLocEventVehicleDataReadyIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_VEHICLE_DATA_READY_STATUS_V02 },
+
+ //Geofence Proximity event
+ { QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_IND_V02,
+ sizeof(qmiLocEventGeofenceProximityIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GEOFENCE_PROXIMITY_NOTIFICATION_V02},
+
+ //GNSS Measurement Indication
+ { QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02,
+ sizeof(qmiLocEventGnssSvMeasInfoIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02 },
+
+ //GNSS Measurement Indication
+ { QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02,
+ sizeof(qmiLocEventGnssSvPolyIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02 },
+
+ // for GDT
+ { QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_IND_V02,
+ sizeof(qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GDT_UPLOAD_BEGIN_REQ_V02,
+ },
+
+ { QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_IND_V02,
+ sizeof(qmiLocEventGdtUploadEndReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GDT_UPLOAD_END_REQ_V02,
+ },
+
+ { QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02,
+ sizeof(qmiLocEventDbtPositionReportIndMsgT_v02),
+ 0},
+
+ { QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02,
+ sizeof(qmiLocEventGeofenceBatchedDwellIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_DWELL_NOTIFICATION_V02},
+
+ { QMI_LOC_EVENT_GET_TIME_ZONE_INFO_IND_V02,
+ sizeof(qmiLocEventGetTimeZoneReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GET_TIME_ZONE_REQ_V02},
+
+ // Batching Status event
+ { QMI_LOC_EVENT_BATCHING_STATUS_IND_V02,
+ sizeof(qmiLocEventBatchingStatusIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_BATCHING_STATUS_V02},
+
+ // TDP download
+ { QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02,
+ sizeof(qmiLocEventGdtDownloadBeginReqIndMsgT_v02),
+ 0},
+
+ { QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02,
+ sizeof(qmiLocEventGdtReceiveDoneIndMsgT_v02),
+ 0},
+
+ { QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02,
+ sizeof(qmiLocEventGdtDownloadEndReqIndMsgT_v02),
+ 0},
+
+ // SRN Ap data inject request
+ { QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_IND_V02,
+ sizeof(qmiLocEventInjectSrnApDataReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_INJECT_SRN_AP_DATA_REQ_V02},
+
+ { QMI_LOC_EVENT_FDCL_SERVICE_REQ_IND_V02,
+ sizeof(qmiLocEventFdclServiceReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_FDCL_SERVICE_REQ_V02},
+
+ // unpropagated position report ind
+ { QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02,
+ sizeof(qmiLocEventPositionReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_UNPROPAGATED_POSITION_REPORT_V02},
+
+ { QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02,
+ sizeof(qmiLocEventBsObsDataServiceReqIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_BS_OBS_DATA_SERVICE_REQ_V02},
+
+ //GPS Ephemeris Indication
+ { QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02,
+ sizeof(qmiLocGpsEphemerisReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02},
+
+ //GLONASS Ephemeris Indication
+ { QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02,
+ sizeof(qmiLocGloEphemerisReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02},
+
+ //BDS Ephemeris Indication
+ { QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02,
+ sizeof(qmiLocBdsEphemerisReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02},
+
+ //GAL Ephemeris Indication
+ { QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02,
+ sizeof(qmiLocGalEphemerisReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02},
+
+ //QZSS Ephemeris Indication
+ { QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02,
+ sizeof(qmiLocQzssEphemerisReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02},
+
+ {QMI_LOC_EVENT_REPORT_IND_V02,
+ sizeof(qmiLocEventReportIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02},
+
+ // loc system info event ind
+ { QMI_LOC_SYSTEM_INFO_IND_V02,
+ sizeof(qmiLocSystemInfoIndMsgT_v02),
+ QMI_LOC_SYSTEM_INFO_IND_V02},
+
+ // Power Metrics with multiband support
+ { QMI_LOC_GET_BAND_MEASUREMENT_METRICS_IND_V02,
+ sizeof(qmiLocGetBandMeasurementMetricsIndMsgT_v02),
+ QMI_LOC_EVENT_MASK_GET_BAND_MEASUREMENT_METRICS_V02},
+
+ // loc system info event ind
+ { QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02,
+ sizeof(qmiLocLocationRequestNotificationIndMsgT_v02),
+ QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02},
+};
+
+/* table to relate the respInd Id with its size */
+typedef struct
+{
+ uint32_t respIndId;
+ size_t respIndSize;
+}locClientRespIndTableStructT;
+
+static const locClientRespIndTableStructT locClientRespIndTable[]= {
+
+ // get service revision ind
+ { QMI_LOC_GET_SERVICE_REVISION_IND_V02,
+ sizeof(qmiLocGetServiceRevisionIndMsgT_v02)},
+
+ // Get Fix Criteria Resp Ind
+ { QMI_LOC_GET_FIX_CRITERIA_IND_V02,
+ sizeof(qmiLocGetFixCriteriaIndMsgT_v02)},
+
+ // NI User Resp In
+ { QMI_LOC_NI_USER_RESPONSE_IND_V02,
+ sizeof(qmiLocNiUserRespIndMsgT_v02)},
+
+ //Inject Predicted Orbits Data Resp Ind
+ { QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02,
+ sizeof(qmiLocInjectPredictedOrbitsDataIndMsgT_v02)},
+
+ //Get Predicted Orbits Data Src Resp Ind
+ { QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_IND_V02,
+ sizeof(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02)},
+
+ // Get Predicted Orbits Data Validity Resp Ind
+ { QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_IND_V02,
+ sizeof(qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02)},
+
+ // Inject UTC Time Resp Ind
+ { QMI_LOC_INJECT_UTC_TIME_IND_V02,
+ sizeof(qmiLocInjectUtcTimeIndMsgT_v02)},
+
+ //Inject Position Resp Ind
+ { QMI_LOC_INJECT_POSITION_IND_V02,
+ sizeof(qmiLocInjectPositionIndMsgT_v02)},
+
+ //Set Engine Lock Resp Ind
+ { QMI_LOC_SET_ENGINE_LOCK_IND_V02,
+ sizeof(qmiLocSetEngineLockIndMsgT_v02)},
+
+ //Get Engine Lock Resp Ind
+ { QMI_LOC_GET_ENGINE_LOCK_IND_V02,
+ sizeof(qmiLocGetEngineLockIndMsgT_v02)},
+
+ //Set SBAS Config Resp Ind
+ { QMI_LOC_SET_SBAS_CONFIG_IND_V02,
+ sizeof(qmiLocSetSbasConfigIndMsgT_v02)},
+
+ //Get SBAS Config Resp Ind
+ { QMI_LOC_GET_SBAS_CONFIG_IND_V02,
+ sizeof(qmiLocGetSbasConfigIndMsgT_v02)},
+
+ //Set NMEA Types Resp Ind
+ { QMI_LOC_SET_NMEA_TYPES_IND_V02,
+ sizeof(qmiLocSetNmeaTypesIndMsgT_v02)},
+
+ //Get NMEA Types Resp Ind
+ { QMI_LOC_GET_NMEA_TYPES_IND_V02,
+ sizeof(qmiLocGetNmeaTypesIndMsgT_v02)},
+
+ //Set Low Power Mode Resp Ind
+ { QMI_LOC_SET_LOW_POWER_MODE_IND_V02,
+ sizeof(qmiLocSetLowPowerModeIndMsgT_v02)},
+
+ //Get Low Power Mode Resp Ind
+ { QMI_LOC_GET_LOW_POWER_MODE_IND_V02,
+ sizeof(qmiLocGetLowPowerModeIndMsgT_v02)},
+
+ //Set Server Resp Ind
+ { QMI_LOC_SET_SERVER_IND_V02,
+ sizeof(qmiLocSetServerIndMsgT_v02)},
+
+ //Get Server Resp Ind
+ { QMI_LOC_GET_SERVER_IND_V02,
+ sizeof(qmiLocGetServerIndMsgT_v02)},
+
+ //Delete Assist Data Resp Ind
+ { QMI_LOC_DELETE_ASSIST_DATA_IND_V02,
+ sizeof(qmiLocDeleteAssistDataIndMsgT_v02)},
+
+ //Set AP cache injection Resp Ind
+ { QMI_LOC_INJECT_APCACHE_DATA_IND_V02,
+ sizeof(qmiLocInjectApCacheDataIndMsgT_v02)},
+
+ //Set No AP cache injection Resp Ind
+ { QMI_LOC_INJECT_APDONOTCACHE_DATA_IND_V02,
+ sizeof(qmiLocInjectApDoNotCacheDataIndMsgT_v02)},
+
+ //Set XTRA-T Session Control Resp Ind
+ { QMI_LOC_SET_XTRA_T_SESSION_CONTROL_IND_V02,
+ sizeof(qmiLocSetXtraTSessionControlIndMsgT_v02)},
+
+ //Get XTRA-T Session Control Resp Ind
+ { QMI_LOC_GET_XTRA_T_SESSION_CONTROL_IND_V02,
+ sizeof(qmiLocGetXtraTSessionControlIndMsgT_v02)},
+
+ //Inject Wifi Position Resp Ind
+ { QMI_LOC_INJECT_WIFI_POSITION_IND_V02,
+ sizeof(qmiLocInjectWifiPositionIndMsgT_v02)},
+
+ //Notify Wifi Status Resp Ind
+ { QMI_LOC_NOTIFY_WIFI_STATUS_IND_V02,
+ sizeof(qmiLocNotifyWifiStatusIndMsgT_v02)},
+
+ //Get Registered Events Resp Ind
+ { QMI_LOC_GET_REGISTERED_EVENTS_IND_V02,
+ sizeof(qmiLocGetRegisteredEventsIndMsgT_v02)},
+
+ //Set Operation Mode Resp Ind
+ { QMI_LOC_SET_OPERATION_MODE_IND_V02,
+ sizeof(qmiLocSetOperationModeIndMsgT_v02)},
+
+ //Get Operation Mode Resp Ind
+ { QMI_LOC_GET_OPERATION_MODE_IND_V02,
+ sizeof(qmiLocGetOperationModeIndMsgT_v02)},
+
+ //Set SPI Status Resp Ind
+ { QMI_LOC_SET_SPI_STATUS_IND_V02,
+ sizeof(qmiLocSetSpiStatusIndMsgT_v02)},
+
+ //Inject Sensor Data Resp Ind
+ { QMI_LOC_INJECT_SENSOR_DATA_IND_V02,
+ sizeof(qmiLocInjectSensorDataIndMsgT_v02)},
+
+ //Inject Time Sync Data Resp Ind
+ { QMI_LOC_INJECT_TIME_SYNC_DATA_IND_V02,
+ sizeof(qmiLocInjectTimeSyncDataIndMsgT_v02)},
+
+ //Set Cradle Mount config Resp Ind
+ { QMI_LOC_SET_CRADLE_MOUNT_CONFIG_IND_V02,
+ sizeof(qmiLocSetCradleMountConfigIndMsgT_v02)},
+
+ //Get Cradle Mount config Resp Ind
+ { QMI_LOC_GET_CRADLE_MOUNT_CONFIG_IND_V02,
+ sizeof(qmiLocGetCradleMountConfigIndMsgT_v02)},
+
+ //Set External Power config Resp Ind
+ { QMI_LOC_SET_EXTERNAL_POWER_CONFIG_IND_V02,
+ sizeof(qmiLocSetExternalPowerConfigIndMsgT_v02)},
+
+ //Get External Power config Resp Ind
+ { QMI_LOC_GET_EXTERNAL_POWER_CONFIG_IND_V02,
+ sizeof(qmiLocGetExternalPowerConfigIndMsgT_v02)},
+
+ //Location server connection status
+ { QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02,
+ sizeof(qmiLocInformLocationServerConnStatusIndMsgT_v02)},
+
+ //Set Protocol Config Parameters
+ { QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ sizeof(qmiLocSetProtocolConfigParametersIndMsgT_v02)},
+
+ //Get Protocol Config Parameters
+ { QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
+ sizeof(qmiLocGetProtocolConfigParametersIndMsgT_v02)},
+
+ //Set Sensor Control Config
+ { QMI_LOC_SET_SENSOR_CONTROL_CONFIG_IND_V02,
+ sizeof(qmiLocSetSensorControlConfigIndMsgT_v02)},
+
+ //Get Sensor Control Config
+ { QMI_LOC_GET_SENSOR_CONTROL_CONFIG_IND_V02,
+ sizeof(qmiLocGetSensorControlConfigIndMsgT_v02)},
+
+ //Set Sensor Properties
+ { QMI_LOC_SET_SENSOR_PROPERTIES_IND_V02,
+ sizeof(qmiLocSetSensorPropertiesIndMsgT_v02)},
+
+ //Get Sensor Properties
+ { QMI_LOC_GET_SENSOR_PROPERTIES_IND_V02,
+ sizeof(qmiLocGetSensorPropertiesIndMsgT_v02)},
+
+ //Set Sensor Performance Control Config
+ { QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02,
+ sizeof(qmiLocSetSensorPerformanceControlConfigIndMsgT_v02)},
+
+ //Get Sensor Performance Control Config
+ { QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02,
+ sizeof(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02)},
+ //Inject SUPL certificate
+ { QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02,
+ sizeof(qmiLocInjectSuplCertificateIndMsgT_v02) },
+
+ //Delete SUPL certificate
+ { QMI_LOC_DELETE_SUPL_CERTIFICATE_IND_V02,
+ sizeof(qmiLocDeleteSuplCertificateIndMsgT_v02) },
+
+ // Set Position Engine Config
+ { QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02,
+ sizeof(qmiLocSetPositionEngineConfigParametersIndMsgT_v02)},
+
+ // Get Position Engine Config
+ { QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02,
+ sizeof(qmiLocGetPositionEngineConfigParametersIndMsgT_v02)},
+
+ //Add a Circular Geofence
+ { QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02,
+ sizeof(qmiLocAddCircularGeofenceIndMsgT_v02)},
+
+ //Delete a Geofence
+ { QMI_LOC_DELETE_GEOFENCE_IND_V02,
+ sizeof(qmiLocDeleteGeofenceIndMsgT_v02)} ,
+
+ //Query a Geofence
+ { QMI_LOC_QUERY_GEOFENCE_IND_V02,
+ sizeof(qmiLocQueryGeofenceIndMsgT_v02)},
+
+ //Edit a Geofence
+ { QMI_LOC_EDIT_GEOFENCE_IND_V02,
+ sizeof(qmiLocEditGeofenceIndMsgT_v02)},
+
+ //Get best available position
+ { QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02,
+ sizeof(qmiLocGetBestAvailablePositionIndMsgT_v02)},
+
+ //Secure Get available position
+ { QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_V02,
+ sizeof(qmiLocSecureGetAvailablePositionIndMsgT_v02)},
+
+ //Inject motion data
+ { QMI_LOC_INJECT_MOTION_DATA_IND_V02,
+ sizeof(qmiLocInjectMotionDataIndMsgT_v02)},
+
+ //Get NI Geofence list
+ { QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02,
+ sizeof(qmiLocGetNiGeofenceIdListIndMsgT_v02)},
+
+ //Inject GSM Cell Info
+ { QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02,
+ sizeof(qmiLocInjectGSMCellInfoIndMsgT_v02)},
+
+ //Inject Network Initiated Message
+ { QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02,
+ sizeof(qmiLocInjectNetworkInitiatedMessageIndMsgT_v02)},
+
+ //WWAN Out of Service Notification
+ { QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_IND_V02,
+ sizeof(qmiLocWWANOutOfServiceNotificationIndMsgT_v02)},
+
+ //Pedomete Report
+ { QMI_LOC_PEDOMETER_REPORT_IND_V02,
+ sizeof(qmiLocPedometerReportIndMsgT_v02)},
+
+ { QMI_LOC_INJECT_WCDMA_CELL_INFO_IND_V02,
+ sizeof(qmiLocInjectWCDMACellInfoIndMsgT_v02)},
+
+ { QMI_LOC_INJECT_TDSCDMA_CELL_INFO_IND_V02,
+ sizeof(qmiLocInjectTDSCDMACellInfoIndMsgT_v02)},
+
+ { QMI_LOC_INJECT_SUBSCRIBER_ID_IND_V02,
+ sizeof(qmiLocInjectSubscriberIDIndMsgT_v02)},
+
+ //Inject Wifi AP data Resp Ind
+ { QMI_LOC_INJECT_WIFI_AP_DATA_IND_V02,
+ sizeof(qmiLocInjectWifiApDataIndMsgT_v02)},
+
+ { QMI_LOC_START_BATCHING_IND_V02,
+ sizeof(qmiLocStartBatchingIndMsgT_v02)},
+
+ { QMI_LOC_STOP_BATCHING_IND_V02,
+ sizeof(qmiLocStopBatchingIndMsgT_v02)},
+
+ { QMI_LOC_GET_BATCH_SIZE_IND_V02,
+ sizeof(qmiLocGetBatchSizeIndMsgT_v02)},
+
+ { QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02,
+ sizeof(qmiLocEventLiveBatchedPositionReportIndMsgT_v02)},
+
+ { QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02,
+ sizeof(qmiLocEventBatchFullIndMsgT_v02)},
+
+ { QMI_LOC_READ_FROM_BATCH_IND_V02,
+ sizeof(qmiLocReadFromBatchIndMsgT_v02)},
+
+ { QMI_LOC_RELEASE_BATCH_IND_V02,
+ sizeof(qmiLocReleaseBatchIndMsgT_v02)},
+
+ { QMI_LOC_SET_XTRA_VERSION_CHECK_IND_V02,
+ sizeof(qmiLocSetXtraVersionCheckIndMsgT_v02)},
+
+ //Vehicle Sensor Data
+ { QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_IND_V02,
+ sizeof(qmiLocInjectVehicleSensorDataIndMsgT_v02)},
+
+ { QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_IND_V02,
+ sizeof(qmiLocNotifyWifiAttachmentStatusIndMsgT_v02)},
+
+ { QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_IND_V02,
+ sizeof(qmiLocNotifyWifiEnabledStatusIndMsgT_v02)},
+
+ { QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_IND_V02,
+ sizeof(qmiLocSetPremiumServicesCfgIndMsgT_v02)},
+
+ { QMI_LOC_GET_AVAILABLE_WWAN_POSITION_IND_V02,
+ sizeof(qmiLocGetAvailWwanPositionIndMsgT_v02)},
+
+ // for TDP
+ { QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_IND_V02,
+ sizeof(qmiLocInjectGtpClientDownloadedDataIndMsgT_v02) },
+
+ // for GDT
+ { QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_IND_V02,
+ sizeof(qmiLocGdtUploadBeginStatusIndMsgT_v02) },
+
+ { QMI_LOC_GDT_UPLOAD_END_IND_V02,
+ sizeof(qmiLocGdtUploadEndIndMsgT_v02) },
+
+ { QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_IND_V02,
+ sizeof(qmiLocSetGNSSConstRepConfigIndMsgT_v02)},
+
+ { QMI_LOC_START_DBT_IND_V02,
+ sizeof(qmiLocStartDbtIndMsgT_v02)},
+
+ { QMI_LOC_STOP_DBT_IND_V02,
+ sizeof(qmiLocStopDbtIndMsgT_v02)},
+
+ { QMI_LOC_INJECT_TIME_ZONE_INFO_IND_V02,
+ sizeof(qmiLocInjectTimeZoneInfoIndMsgT_v02)},
+
+ { QMI_LOC_QUERY_AON_CONFIG_IND_V02,
+ sizeof(qmiLocQueryAonConfigIndMsgT_v02)},
+
+ // for GTP
+ { QMI_LOC_GTP_AP_STATUS_IND_V02,
+ sizeof(qmiLocGtpApStatusIndMsgT_v02) },
+
+ // for GDT
+ { QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_IND_V02,
+ sizeof(qmiLocGdtDownloadBeginStatusIndMsgT_v02) },
+
+ { QMI_LOC_GDT_DOWNLOAD_READY_STATUS_IND_V02,
+ sizeof(qmiLocGdtDownloadReadyStatusIndMsgT_v02) },
+
+ { QMI_LOC_GDT_RECEIVE_DONE_STATUS_IND_V02,
+ sizeof(qmiLocGdtReceiveDoneStatusIndMsgT_v02) },
+
+ { QMI_LOC_GDT_DOWNLOAD_END_STATUS_IND_V02,
+ sizeof(qmiLocGdtDownloadEndStatusIndMsgT_v02) },
+
+ { QMI_LOC_GET_SUPPORTED_FEATURE_IND_V02,
+ sizeof(qmiLocGetSupportedFeatureIndMsgT_v02) },
+
+ //Delete Gnss Service Data Resp Ind
+ { QMI_LOC_DELETE_GNSS_SERVICE_DATA_IND_V02,
+ sizeof(qmiLocDeleteGNSSServiceDataIndMsgT_v02) },
+
+ // for XTRA Client 2.0
+ { QMI_LOC_INJECT_XTRA_DATA_IND_V02,
+ sizeof(qmiLocInjectXtraDataIndMsgT_v02) },
+
+ { QMI_LOC_INJECT_XTRA_PCID_IND_V02,
+ sizeof(qmiLocInjectXtraPcidIndMsgT_v02) },
+
+ // SRN Ap data inject
+ { QMI_LOC_INJECT_SRN_AP_DATA_IND_V02,
+ sizeof(qmiLocInjectSrnApDataIndMsgT_v02) },
+
+ // for Fusion CSM
+ { QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_IND_V02,
+ sizeof(qmiLocCrowdSourceManagerControlIndMsgT_v02) },
+
+ //xtra config data
+ { QMI_LOC_QUERY_XTRA_INFO_IND_V02,
+ sizeof(qmiLocQueryXtraInfoIndMsgT_v02) },
+
+ { QMI_LOC_START_OUTDOOR_TRIP_BATCHING_IND_V02,
+ sizeof(qmiLocStartOutdoorTripBatchingIndMsgT_v02) },
+
+ { QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_IND_V02,
+ sizeof(qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02) },
+
+ { QMI_LOC_GET_FDCL_BS_LIST_IND_V02,
+ sizeof(qmiLocGetFdclBsListIndMsgT_v02) },
+
+ { QMI_LOC_INJECT_FDCL_DATA_IND_V02,
+ sizeof(qmiLocInjectFdclDataIndMsgT_v02) },
+
+ { QMI_LOC_GET_BS_OBS_DATA_IND_V02,
+ sizeof(qmiLocGetBsObsDataIndMsgT_v02) },
+
+ { QMI_LOC_SET_BLACKLIST_SV_IND_V02,
+ sizeof(qmiLocGenReqStatusIndMsgT_v02) },
+
+ // register master
+ { QMI_LOC_REGISTER_MASTER_CLIENT_IND_V02,
+ sizeof(qmiLocRegisterMasterClientIndMsgT_v02) },
+
+ { QMI_LOC_GET_BLACKLIST_SV_IND_V02,
+ sizeof(qmiLocGetBlacklistSvIndMsgT_v02) },
+
+ { QMI_LOC_SET_CONSTELLATION_CONTROL_IND_V02,
+ sizeof(qmiLocGenReqStatusIndMsgT_v02) },
+
+ { QMI_LOC_GET_CONSTELLATION_CONTROL_IND_V02,
+ sizeof(qmiLocGetConstellationConfigIndMsgT_v02) },
+
+ { QMI_LOC_SET_CONSTRAINED_TUNC_MODE_IND_V02,
+ sizeof(qmiLocSetConstrainedTuncModeIndMsgT_v02) },
+
+ { QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_IND_V02,
+ sizeof(qmiLocEnablePositionAssistedClockEstIndMsgT_v02) },
+
+ { QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_IND_V02,
+ sizeof(qmiLocQueryGNSSEnergyConsumedIndMsgT_v02) },
+
+ { QMI_LOC_INJECT_PLATFORM_POWER_STATE_IND_V02,
+ sizeof(qmiLocInjectPlatformPowerStateIndMsgT_v02) },
+
+ { QMI_LOC_SET_ROBUST_LOCATION_CONFIG_IND_V02,
+ sizeof(qmiLocGenReqStatusIndMsgT_v02) },
+
+ { QMI_LOC_GET_ROBUST_LOCATION_CONFIG_IND_V02,
+ sizeof(qmiLocGetRobustLocationConfigIndMsgT_v02) },
+};
+
+
+/** whether indication is an event or a response */
+typedef enum { eventIndType =0, respIndType = 1 } locClientIndEnumT;
+
+
+/** @struct locClientInternalState
+ */
+
+typedef struct locClientCbDataStructT locClientCallbackDataType;
+
+struct locClientCbDataStructT
+{
+ // client cookie
+ void *pClientCookie;
+ //QCCI handle for this control point
+ qmi_client_type userHandle;
+
+ // callbacks registered by the clients
+ locClientEventIndCbType eventCallback;
+ locClientRespIndCbType respCallback;
+ locClientErrorCbType errorCallback;
+
+ // the event mask the client has registered for
+ locClientEventMaskType eventRegMask;
+
+ //pointer to itself for checking consistency data
+ locClientCallbackDataType *pMe;
+};
+
+static uint32_t LOC_MODEM_EMULATOR = 0;
+static const loc_param_s_type loc_cfgs[] =
+{
+ {"LOC_MODEM_EMULATOR", &LOC_MODEM_EMULATOR, NULL, 'n'},
+};
+
+static int getEmulatorCfg() {
+ static bool getEmulatorCfg_called = false;
+ if (!getEmulatorCfg_called) {
+ getEmulatorCfg_called = true;
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, loc_cfgs);
+ }
+ return LOC_MODEM_EMULATOR;
+}
+
+/*===========================================================================
+ *
+ * FUNCTION DECLARATION
+ *
+ *==========================================================================*/
+
+/** locClientGetSizeAndTypeByIndId
+ * @brief this function gets the size and the type (event,
+ * response)of the indication structure from its ID
+ * @param [in] indId ID of the indication
+ * @param [out] type event or response indication
+ * @param [out] size size of the indications
+ *
+ * @return true if the ID was found, false otherwise */
+
+static bool locClientGetSizeAndTypeByIndId (uint32_t indId, size_t *pIndSize,
+ locClientIndEnumT *pIndType)
+{
+ // look in the event table
+ if(true == locClientGetSizeByEventIndId(indId, pIndSize))
+ {
+ *pIndType = eventIndType;
+
+ LOC_LOGV("%s:%d]: indId %d is an event size = %d\n", __func__, __LINE__,
+ indId, (uint32_t)*pIndSize);
+ return true;
+ }
+
+ //else look in response table
+ if(true == locClientGetSizeByRespIndId(indId, pIndSize))
+ {
+ *pIndType = respIndType;
+
+ LOC_LOGV("%s:%d]: indId %d is a resp size = %d\n", __func__, __LINE__,
+ indId, (uint32_t)*pIndSize);
+ return true;
+ }
+
+ // Id not found
+ LOC_LOGW("%s:%d]: indId %d not found\n", __func__, __LINE__, indId);
+ return false;
+}
+
+/** checkQmiMsgsSupported
+ @brief check the qmi service is supported or not.
+ @param [in] pResponse pointer to the response received from
+ QMI_LOC service.
+*/
+static void checkQmiMsgsSupported(
+ const uint32_t* reqIdArray,
+ int reqIdArrayLength,
+ qmiLocGetSupportMsgT_v02 *pResponse,
+ uint64_t* supportedMsg)
+{
+ uint64_t result = 0;
+ if (pResponse->resp.supported_msgs_valid) {
+
+ /* For example, if a service supports exactly four messages with
+ IDs 0, 1, 30, and 31 (decimal), the array (in hexadecimal) is
+ 4 bytes [03 00 00 c0]. */
+
+ size_t idx = 0;
+ uint32_t reqId = 0;
+ uint32_t length = 0;
+ uint32_t supportedMsgsLen = pResponse->resp.supported_msgs_len;
+
+ // every bit saves a checked message result
+ uint32_t maxCheckedMsgsSavedNum = sizeof(result)<<3;
+
+ uint32_t loopSize = reqIdArrayLength;
+ loopSize =
+ loopSize < supportedMsgsLen ? loopSize : supportedMsgsLen;
+ loopSize =
+ loopSize < maxCheckedMsgsSavedNum ? loopSize : maxCheckedMsgsSavedNum;
+
+ for (idx = 0; idx < loopSize; idx++) {
+ reqId = reqIdArray[idx];
+ length = reqId >> 3;
+ if(supportedMsgsLen > length) {
+ uint32_t bit = reqId & ((uint32_t)7);
+ if (pResponse->resp.supported_msgs[length] & (1<<bit)) {
+ result |= ( 1 << idx ) ;
+ }
+ }
+ }
+ } else {
+ LOC_LOGE("%s:%d] Invalid supported message list.\n", __func__, __LINE__);
+ }
+ *supportedMsg = result;
+}
+
+/** convertQmiResponseToLocStatus
+ @brief converts a qmiLocGenRespMsgT to locClientStatusEnumType*
+ @param [in] pResponse; pointer to the response received from
+ QMI_LOC service.
+ @return locClientStatusEnumType corresponding to the
+ response.
+*/
+
+static locClientStatusEnumType convertQmiResponseToLocStatus(
+ qmiLocGenRespMsgT_v02 *pResponse)
+{
+ locClientStatusEnumType status = eLOC_CLIENT_FAILURE_INTERNAL;
+
+ // if result == SUCCESS don't look at error code
+ if(pResponse->resp.result == QMI_RESULT_SUCCESS_V01 )
+ {
+ status = eLOC_CLIENT_SUCCESS;
+ }
+ else
+ {
+ switch(pResponse->resp.error)
+ {
+ case QMI_ERR_MALFORMED_MSG_V01:
+ case QMI_ERR_INVALID_ARG_V01:
+ status = eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
+ break;
+
+ case QMI_ERR_DEVICE_IN_USE_V01:
+ status = eLOC_CLIENT_FAILURE_ENGINE_BUSY;
+ break;
+
+ case QMI_ERR_NOT_SUPPORTED_V01:
+ status = eLOC_CLIENT_FAILURE_UNSUPPORTED;
+ break;
+
+ case QMI_ERR_INVALID_MESSAGE_ID_V01:
+ status = eLOC_CLIENT_FAILURE_INVALID_MESSAGE_ID;
+ break;
+
+ default:
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+ break;
+ }
+ }
+ LOC_LOGV("%s:%d]: result = %d, error = %d, status = %d\n",
+ __func__, __LINE__, pResponse->resp.result,
+ pResponse->resp.error, status);
+ return status;
+}
+
+/** convertQmiErrorToLocError
+ @brief converts a qmi service error type to
+ locClientErrorEnumType
+ @param [in] error received QMI service.
+ @return locClientErrorEnumType corresponding to the error.
+*/
+
+static locClientErrorEnumType convertQmiErrorToLocError(
+ qmi_client_error_type error)
+{
+ locClientErrorEnumType locError ;
+ switch(error)
+ {
+ case QMI_SERVICE_ERR:
+ locError = eLOC_CLIENT_ERROR_SERVICE_UNAVAILABLE;
+ break;
+
+ default:
+ locError = eLOC_CLIENT_ERROR_SERVICE_UNAVAILABLE;
+ break;
+ }
+ LOC_LOGV("%s:%d]: qmi error = %d, loc error = %d\n",
+ __func__, __LINE__, error, locError);
+ return locError;
+}
+
+/** locClientErrorCb
+ * @brief handles the QCCI error events, this is called by the
+ * QCCI infrastructure when the service is no longer
+ * available.
+ * @param [in] user handle
+ * @param [in] error
+ * @param [in] *err_cb_data
+ */
+
+static void locClientErrorCb
+(
+ qmi_client_type user_handle,
+ qmi_client_error_type error,
+ void *err_cb_data
+)
+{
+ (void)user_handle;
+
+ locClientCallbackDataType* pCallbackData =
+ (locClientCallbackDataType *)err_cb_data;
+ locClientErrorCbType localErrorCallback = NULL;
+
+ /* copy the errorCallback function pointer from the callback
+ * data to local variable. This is to protect against the race
+ * condition between open/close and error callback.
+ */
+ if(NULL != pCallbackData)
+ {
+ localErrorCallback = pCallbackData->errorCallback;
+ }
+
+ LOC_LOGD("%s:%d]: Service Error %d received, pCallbackData = %p\n",
+ __func__, __LINE__, error, err_cb_data);
+
+ /* call the error callback
+ * To avoid calling the errorCallback after locClientClose
+ * is called, check pCallbackData->errorCallback again here
+ */
+
+ if( (NULL != pCallbackData) &&
+ (NULL != localErrorCallback) &&
+ (NULL != pCallbackData->errorCallback) &&
+ (pCallbackData == pCallbackData->pMe) )
+ {
+ pthread_mutex_lock(&loc_shutdown_mutex);
+ //invoke the error callback for the corresponding client
+ localErrorCallback(
+ (locClientHandleType)pCallbackData,
+ convertQmiErrorToLocError(error),
+ pCallbackData->pClientCookie);
+ pthread_mutex_unlock(&loc_shutdown_mutex);
+ }
+}
+
+
+/** locClientIndCb
+ * @brief handles the indications sent from the service, if a
+ * response indication was received then the it is sent
+ * to the response callback. If a event indication was
+ * received then it is sent to the event callback
+ * @param [in] user handle
+ * @param [in] msg_id
+ * @param [in] ind_buf
+ * @param [in] ind_buf_len
+ * @param [in] ind_cb_data */
+
+static void locClientIndCb
+(
+ qmi_client_type user_handle,
+ unsigned int msg_id,
+ void *ind_buf,
+ unsigned int ind_buf_len,
+ void *ind_cb_data
+)
+{
+ locClientIndEnumT indType;
+ size_t indSize = 0;
+ qmi_client_error_type rc ;
+
+ locClientCallbackDataType* pCallbackData =
+ (locClientCallbackDataType *)ind_cb_data;
+
+ LOC_LOGV("%s:%d]: Indication: msg_id=%d buf_len=%d pCallbackData = %p\n",
+ __func__, __LINE__, (uint32_t)msg_id, ind_buf_len,
+ pCallbackData);
+
+ // check callback data
+ if(NULL == pCallbackData ||(pCallbackData != pCallbackData->pMe))
+ {
+ LOC_LOGE("%s:%d]: invalid callback data", __func__, __LINE__);
+ return;
+ }
+
+ // check user handle
+ if(memcmp(&pCallbackData->userHandle, &user_handle, sizeof(user_handle)))
+ {
+ LOC_LOGE("%s:%d]: invalid user_handle got %p expected %p\n",
+ __func__, __LINE__,
+ user_handle, pCallbackData->userHandle);
+ return;
+ }
+ // Get the indication size and type ( eventInd or respInd)
+ if( true == locClientGetSizeAndTypeByIndId(msg_id, &indSize, &indType))
+ {
+ void *indBuffer = NULL;
+
+ // decode the indication
+ indBuffer = malloc(indSize);
+
+ if(NULL == indBuffer)
+ {
+ LOC_LOGE("%s:%d]: memory allocation failed\n", __func__, __LINE__);
+ return;
+ }
+ memset(indBuffer, 0, indSize);
+
+ rc = QMI_NO_ERR;
+
+ if (ind_buf_len > 0)
+ {
+ // decode the indication
+ rc = qmi_client_message_decode(
+ user_handle,
+ QMI_IDL_INDICATION,
+ msg_id,
+ ind_buf,
+ ind_buf_len,
+ indBuffer,
+ indSize);
+ }
+
+ if( rc == QMI_NO_ERR )
+ {
+ if(eventIndType == indType)
+ {
+ locClientEventIndUnionType eventIndUnion;
+
+ /* copy the eventCallback function pointer from the callback
+ * data to local variable. This is to protect against the race
+ * condition between open/close and indication callback.
+ */
+ locClientEventIndCbType localEventCallback =
+ pCallbackData->eventCallback;
+
+ // dummy event
+ eventIndUnion.pPositionReportEvent =
+ (qmiLocEventPositionReportIndMsgT_v02 *)indBuffer;
+
+ /* call the event callback
+ * To avoid calling the eventCallback after locClientClose
+ * is called, check pCallbackData->eventCallback again here
+ */
+ if((NULL != localEventCallback) &&
+ (NULL != pCallbackData->eventCallback))
+ {
+ pthread_mutex_lock(&loc_shutdown_mutex);
+ localEventCallback(
+ (locClientHandleType)pCallbackData,
+ msg_id,
+ eventIndUnion,
+ pCallbackData->pClientCookie);
+ pthread_mutex_unlock(&loc_shutdown_mutex);
+ }
+ }
+ else if(respIndType == indType)
+ {
+ locClientRespIndUnionType respIndUnion;
+
+ /* copy the respCallback function pointer from the callback
+ * data to local variable. This is to protect against the race
+ * condition between open/close and indication callback.
+ */
+ locClientRespIndCbType localRespCallback =
+ pCallbackData->respCallback;
+
+ // dummy to suppress compiler warnings
+ respIndUnion.pDeleteAssistDataInd =
+ (qmiLocDeleteAssistDataIndMsgT_v02 *)indBuffer;
+
+ /* call the response callback
+ * To avoid calling the respCallback after locClientClose
+ * is called, check pCallbackData->respCallback again here
+ */
+ if((NULL != localRespCallback) &&
+ (NULL != pCallbackData->respCallback))
+ {
+ pthread_mutex_lock(&loc_shutdown_mutex);
+ localRespCallback(
+ (locClientHandleType)pCallbackData,
+ msg_id,
+ respIndUnion,
+ indSize,
+ pCallbackData->pClientCookie);
+ pthread_mutex_unlock(&loc_shutdown_mutex);
+ }
+ }
+ }
+ else
+ {
+ LOC_LOGE("%s:%d]: Error decoding indication %d\n",
+ __func__, __LINE__, rc);
+ }
+ if(indBuffer)
+ {
+ free (indBuffer);
+ }
+ }
+ else // Id not found
+ {
+ LOC_LOGE("%s:%d]: Error indication not found %d\n",
+ __func__, __LINE__,(uint32_t)msg_id);
+ }
+ return;
+}
+
+
+/** locClientRegisterEventMask
+ * @brief registers the event mask with loc service
+ * @param [in] clientHandle
+ * @param [in] eventRegMask
+ * @return true if indication was validated; else false */
+
+bool locClientRegisterEventMask(
+ locClientHandleType clientHandle,
+ locClientEventMaskType eventRegMask,
+ bool bIsMaster)
+{
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ locClientReqUnionType reqUnion;
+ qmiLocRegEventsReqMsgT_v02 regEventsReq;
+
+ memset(®EventsReq, 0, sizeof(regEventsReq));
+
+ regEventsReq.eventRegMask = eventRegMask;
+ regEventsReq.clientStrId_valid = true;
+ if (bIsMaster) {
+ LOC_LOGV("%s:%d] %s", __func__, __LINE__, MASTER_HAL);
+ strlcpy(regEventsReq.clientStrId, MASTER_HAL,
+ sizeof(regEventsReq.clientStrId));
+ }
+ else {
+ LOC_LOGV("%s:%d] %s", __func__, __LINE__, HAL);
+ strlcpy(regEventsReq.clientStrId, HAL,
+ sizeof(regEventsReq.clientStrId));
+ }
+
+ regEventsReq.clientType_valid = true;
+ regEventsReq.clientType = eQMI_LOC_CLIENT_AFW_V02;
+ regEventsReq.enablePosRequestNotification_valid = true;
+ regEventsReq.enablePosRequestNotification = false;
+
+ reqUnion.pRegEventsReq = ®EventsReq;
+
+ status = locClientSendReq(clientHandle,
+ QMI_LOC_REG_EVENTS_REQ_V02,
+ reqUnion);
+
+ if(eLOC_CLIENT_SUCCESS != status )
+ {
+ LOC_LOGE("%s:%d] status %s\n", __func__, __LINE__,
+ loc_get_v02_client_status_name(status) );
+ return false;
+ }
+
+ return true;
+}
+
+/** validateRequest
+ @brief validates the input request
+ @param [in] reqId request ID
+ @param [in] reqPayload Union of pointers to message payload
+ @param [out] ppOutData Pointer to void *data if successful
+ @param [out] pOutLen Pointer to length of data if succesful.
+ @return false on failure, true on Success
+*/
+
+bool validateRequest(
+ uint32_t reqId,
+ const locClientReqUnionType reqPayload,
+ void **ppOutData,
+ uint32_t *pOutLen )
+
+{
+ bool noPayloadFlag = false;
+
+ switch(reqId)
+ {
+ case QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInformClientRevisionReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_REG_EVENTS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocRegEventsReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_START_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocStartReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_STOP_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocStopReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_NI_USER_RESPONSE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocNiUserRespReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectPredictedOrbitsDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_UTC_TIME_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectUtcTimeReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_POSITION_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectPositionReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_ENGINE_LOCK_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetEngineLockReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_SBAS_CONFIG_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetSbasConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_NMEA_TYPES_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetNmeaTypesReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_LOW_POWER_MODE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetLowPowerModeReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_SERVER_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetServerReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_DELETE_ASSIST_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocDeleteAssistDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_APCACHE_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectApCacheDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_APDONOTCACHE_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectApDoNotCacheDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetXtraTSessionControlReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_WIFI_POSITION_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectWifiPositionReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocNotifyWifiStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_OPERATION_MODE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetOperationModeReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_SPI_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetSpiStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_SENSOR_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectSensorDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectTimeSyncDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetCradleMountConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetExternalPowerConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInformLocationServerConnStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetProtocolConfigParametersReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetProtocolConfigParametersReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetSensorControlConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetSensorPropertiesReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetSensorPropertiesReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectSuplCertificateReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocDeleteSuplCertificateReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetPositionEngineConfigParametersReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetPositionEngineConfigParametersReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocAddCircularGeofenceReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_DELETE_GEOFENCE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocDeleteGeofenceReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_QUERY_GEOFENCE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocQueryGeofenceReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_EDIT_GEOFENCE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocEditGeofenceReqMsgT_v02);
+ break;
+ }
+ case QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetBestAvailablePositionReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSecureGetAvailablePositionReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_MOTION_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectMotionDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetNiGeofenceIdListReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectGSMCellInfoReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectNetworkInitiatedMessageReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_PEDOMETER_REPORT_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocPedometerReportReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_WCDMA_CELL_INFO_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectWCDMACellInfoReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_TDSCDMA_CELL_INFO_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectTDSCDMACellInfoReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_SUBSCRIBER_ID_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectSubscriberIDReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_WIFI_AP_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectWifiApDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_BATCH_SIZE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetBatchSizeReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_START_BATCHING_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocStartBatchingReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_READ_FROM_BATCH_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocReadFromBatchReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_STOP_BATCHING_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocStopBatchingReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_RELEASE_BATCH_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocReleaseBatchReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_XTRA_VERSION_CHECK_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetXtraVersionCheckReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectVehicleSensorDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocNotifyWifiEnabledStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetPremiumServicesCfgReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetAvailWwanPositionReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectGtpClientDownloadedDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGdtUploadBeginStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GDT_UPLOAD_END_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGdtUploadEndReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetGNSSConstRepConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_START_DBT_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocStartDbtReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_STOP_DBT_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocStopDbtReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_TIME_ZONE_INFO_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectTimeZoneInfoReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_QUERY_AON_CONFIG_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocQueryAonConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GTP_AP_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGtpApStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGdtDownloadBeginStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGdtDownloadReadyStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGdtReceiveDoneStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGdtDownloadEndStatusReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetSupportedFeatureReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocDeleteGNSSServiceDataReqMsgT_v02);
+ break;
+ }
+
+ // XTRA Client 2.0
+ case QMI_LOC_INJECT_XTRA_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectXtraDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_XTRA_PCID_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectXtraPcidReqMsgT_v02);
+ break;
+ }
+
+ // SRN AP data injection
+ case QMI_LOC_INJECT_SRN_AP_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectSrnApDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocCrowdSourceManagerControlReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocCrowdSourceManagerReadDataReqMsgT_v02);
+ break;
+ }
+
+ // Query Xtra config data
+ case QMI_LOC_QUERY_XTRA_INFO_REQ_V02 :
+ {
+ *pOutLen = sizeof(qmiLocQueryXtraInfoReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocStartOutdoorTripBatchingReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_FDCL_BS_LIST_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetFdclBsListReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_FDCL_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectFdclDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_BLACKLIST_SV_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetBlacklistSvReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetConstellationConfigReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02 :
+ {
+ *pOutLen = sizeof(qmiLocRegisterMasterClientReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_GET_BS_OBS_DATA_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocGetBsObsDataReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetConstrainedTuncModeReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocEnablePositionAssistedClockEstReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocQueryGNSSEnergyConsumedReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocInjectPlatformPowerStateReqMsgT_v02);
+ break;
+ }
+
+ case QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ_V02:
+ {
+ *pOutLen = sizeof(qmiLocSetRobustLocationReqMsgT_v02);
+ break;
+ }
+
+ // ALL requests with no payload
+ case QMI_LOC_GET_SERVICE_REVISION_REQ_V02:
+ case QMI_LOC_GET_FIX_CRITERIA_REQ_V02:
+ case QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02:
+ case QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_REQ_V02:
+ case QMI_LOC_GET_ENGINE_LOCK_REQ_V02:
+ case QMI_LOC_GET_SBAS_CONFIG_REQ_V02:
+ case QMI_LOC_GET_NMEA_TYPES_REQ_V02:
+ case QMI_LOC_GET_LOW_POWER_MODE_REQ_V02:
+ case QMI_LOC_GET_SERVER_REQ_V02:
+ case QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ_V02:
+ case QMI_LOC_GET_REGISTERED_EVENTS_REQ_V02:
+ case QMI_LOC_GET_OPERATION_MODE_REQ_V02:
+ case QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02:
+ case QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02:
+ case QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02:
+ case QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02:
+ case QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02:
+ case QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02:
+ case QMI_LOC_GET_SUPPORTED_FIELDS_REQ_V02:
+ case QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02:
+ case QMI_LOC_GET_BLACKLIST_SV_REQ_V02:
+ case QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02:
+ case QMI_LOC_GET_ROBUST_LOCATION_CONFIG_REQ_V02:
+ {
+ noPayloadFlag = true;
+ break;
+ }
+
+ default:
+ LOC_LOGw("Error unknown reqId=%d", reqId);
+ return false;
+ }
+ if(true == noPayloadFlag)
+ {
+ *ppOutData = NULL;
+ *pOutLen = 0;
+ }
+ else
+ {
+ //set dummy pointer for request union
+ *ppOutData = (void*) reqPayload.pInformClientRevisionReq;
+ }
+ LOC_LOGv("reqId=%d, len = %d", reqId, *pOutLen);
+ return true;
+}
+
+/** locClientQmiCtrlPointInit
+ @brief wait for the service to come up or timeout; when the
+ service comes up initialize the control point and set
+ internal handle and indication callback.
+ @param pQmiClient,
+*/
+
+static locClientStatusEnumType locClientQmiCtrlPointInit(
+ locClientCallbackDataType *pLocClientCbData,
+ int instanceId)
+{
+ qmi_client_type clnt, notifier;
+ bool notifierInitFlag = false;
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ // os_params must stay in the same scope as notifier
+ // because when notifier is initialized, the pointer
+ // of os_params is retained in QMI framework, and it
+ // used when notifier is released.
+ qmi_client_os_params os_params;
+ // instances of this service
+ qmi_service_info serviceInfo;
+
+ do
+ {
+ qmi_client_error_type rc = QMI_NO_ERR;
+
+ // Get the service object for the qmiLoc Service
+ qmi_idl_service_object_type locClientServiceObject =
+ loc_get_service_object_v02();
+
+ // Verify that qmiLoc_get_service_object did not return NULL
+ if (NULL == locClientServiceObject)
+ {
+ LOC_LOGE("%s:%d]: qmiLoc_get_service_object_v02 failed\n" ,
+ __func__, __LINE__ );
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+ break;
+ }
+
+ // register for service notification
+ rc = qmi_client_notifier_init(locClientServiceObject, &os_params, ¬ifier);
+ notifierInitFlag = (NULL != notifier);
+
+ if (rc != QMI_NO_ERR) {
+ LOC_LOGE("%s:%d]: qmi_client_notifier_init failed %d\n",
+ __func__, __LINE__, rc);
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+ break;
+ }
+
+ while (1) {
+ QMI_CCI_OS_SIGNAL_CLEAR(&os_params);
+
+ if (instanceId >= 0) {
+ // use instance-specific lookup
+ rc = qmi_client_get_service_instance(locClientServiceObject, instanceId, &serviceInfo);
+ } else {
+ // lookup service with any instance id
+ rc = qmi_client_get_any_service(locClientServiceObject, &serviceInfo);
+ }
+
+ // get the service addressing information
+ LOC_LOGV("%s:%d]: qmi_client_get_service() rc: %d ", __func__, __LINE__, rc);
+
+ if(rc == QMI_NO_ERR)
+ break;
+
+ QMI_CCI_OS_SIGNAL_WAIT(&os_params, 0);
+ }
+
+ LOC_LOGV("%s:%d]: passing the pointer %p to qmi_client_init \n",
+ __func__, __LINE__, pLocClientCbData);
+
+ // initialize the client
+ //sent the address of the first service found
+ // if IPC router is present, this will go to the service instance
+ // enumerated over IPC router, else it will go over the next transport where
+ // the service was enumerated.
+ rc = qmi_client_init(&serviceInfo, locClientServiceObject,
+ locClientIndCb, (void *) pLocClientCbData,
+ NULL, &clnt);
+
+ if(rc != QMI_NO_ERR)
+ {
+ LOC_LOGE("%s:%d]: qmi_client_init error %d\n",
+ __func__, __LINE__, rc);
+
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+ break;
+ }
+
+ LOC_LOGV("%s:%d]: passing the pointer %p to"
+ "qmi_client_register_error_cb \n",
+ __func__, __LINE__, pLocClientCbData);
+
+ // register error callback
+ rc = qmi_client_register_error_cb(clnt,
+ locClientErrorCb, (void *) pLocClientCbData);
+
+ if( QMI_NO_ERR != rc)
+ {
+ LOC_LOGE("%s:%d]: could not register QCCI error callback error:%d\n",
+ __func__, __LINE__, rc);
+
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+ break;
+ }
+
+ // copy the clnt handle returned in qmi_client_init
+ memcpy(&(pLocClientCbData->userHandle), &clnt, sizeof(qmi_client_type));
+
+ status = eLOC_CLIENT_SUCCESS;
+
+ } while(0);
+
+ /* release the notifier handle */
+ if(true == notifierInitFlag)
+ {
+ qmi_client_release(notifier);
+ }
+
+ return status;
+}
+//----------------------- END INTERNAL FUNCTIONS ----------------------------------------
+
+/** locClientOpenInstance
+ @brief Connects a location client to the location engine. If the connection
+ is successful, returns a handle that the location client uses for
+ future location operations.
+
+ @param [in] eventRegMask Mask of asynchronous events the client is
+ interested in receiving
+ @param [in] instanceId Value of QMI service instance id to use.
+ @param [in] eventIndCb Function to be invoked to handle an event.
+ @param [in] respIndCb Function to be invoked to handle a response
+ indication.
+ @param [out] locClientHandle Handle to be used by the client
+ for any subsequent requests.
+
+ @return
+ One of the following error codes:
+ - eLOC_CLIENT_SUCCESS -- If the connection is opened.
+ - non-zero error code(see locClientStatusEnumType)-- On failure.
+*/
+locClientStatusEnumType locClientOpenInstance (
+ locClientEventMaskType eventRegMask,
+ int instanceId,
+ const locClientCallbacksType* pLocClientCallbacks,
+ locClientHandleType* pLocClientHandle,
+ const void* pClientCookie)
+{
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ locClientCallbackDataType *pCallbackData = NULL;
+
+ // check input parameters
+ if( (NULL == pLocClientCallbacks) || (NULL == pLocClientHandle)
+ || (NULL == pLocClientCallbacks->respIndCb) ||
+ (pLocClientCallbacks->size != sizeof(locClientCallbacksType)))
+ {
+ LOC_LOGE("%s:%d]: Invalid parameters in locClientOpen\n",
+ __func__, __LINE__);
+ return eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
+ }
+
+ do
+ {
+ // Allocate memory for the callback data
+ pCallbackData =
+ ( locClientCallbackDataType*)calloc(
+ 1, sizeof(locClientCallbackDataType));
+
+ if(NULL == pCallbackData)
+ {
+ LOC_LOGE("%s:%d]: Could not allocate memory for callback data \n",
+ __func__, __LINE__);
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+ break;
+ }
+
+ /* Initialize the QMI control point; this function will block
+ * until a service is up or a timeout occurs. If the connection to
+ * the service succeeds the callback data will be filled in with
+ * a qmi_client value.
+ */
+
+
+ EXIT_LOG_CALLFLOW(%s, "loc client open");
+ status = locClientQmiCtrlPointInit(pCallbackData, instanceId);
+
+ LOC_LOGV ("%s:%d] locClientQmiCtrlPointInit returned %d\n",
+ __func__, __LINE__, status);
+
+ if(status != eLOC_CLIENT_SUCCESS)
+ {
+ free(pCallbackData);
+ pCallbackData = NULL;
+ LOC_LOGE ("%s:%d] locClientQmiCtrlPointInit returned %d\n",
+ __func__, __LINE__, status);
+ break;
+ }
+ // set the self pointer
+ pCallbackData->pMe = pCallbackData;
+ // set the handle to the callback data
+ *pLocClientHandle = (locClientHandleType)pCallbackData;
+
+ if (true != locClientRegisterEventMask(*pLocClientHandle, eventRegMask, false))
+ {
+ LOC_LOGE("%s:%d]: Error sending registration mask\n",
+ __func__, __LINE__);
+
+ // release the client
+ locClientClose(pLocClientHandle);
+
+ status = eLOC_CLIENT_FAILURE_INTERNAL;
+ break;
+ }
+
+ /* Initialize rest of the client structure now that the connection
+ * to the service has been created successfully.
+ */
+
+ //fill in the event callback
+ pCallbackData->eventCallback = pLocClientCallbacks->eventIndCb;
+
+ //fill in the response callback
+ pCallbackData->respCallback = pLocClientCallbacks->respIndCb;
+
+ //fill in the error callback
+ pCallbackData->errorCallback = pLocClientCallbacks->errorCb;
+
+ //set the client event registration mask
+ pCallbackData->eventRegMask = eventRegMask;
+
+ // set the client cookie
+ pCallbackData->pClientCookie = (void *)pClientCookie;
+
+ }while(0);
+
+ if(eLOC_CLIENT_SUCCESS != status)
+ {
+ *pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
+ LOC_LOGE("%s:%d]: Error! status = %d\n", __func__, __LINE__,status);
+ }
+
+ else
+ {
+ LOC_LOGD("%s:%d]: returning handle = %p, user_handle=%p, status = %d\n",
+ __func__, __LINE__, *pLocClientHandle,
+ pCallbackData->userHandle, status);
+ }
+
+ return(status);
+}
+
+/** locClientOpen
+ @brief Connects a location client to the location engine. If the connection
+ is successful, returns a handle that the location client uses for
+ future location operations.
+
+ @param [in] eventRegMask Mask of asynchronous events the client is
+ interested in receiving
+ @param [in] eventIndCb Function to be invoked to handle an event.
+ @param [in] respIndCb Function to be invoked to handle a response
+ indication.
+ @param [out] locClientHandle Handle to be used by the client
+ for any subsequent requests.
+
+ @return
+ One of the following error codes:
+ - eLOC_CLIENT_SUCCESS -- If the connection is opened.
+ - non-zero error code(see locClientStatusEnumType)-- On failure.
+*/
+
+locClientStatusEnumType locClientOpen (
+ locClientEventMaskType eventRegMask,
+ const locClientCallbacksType* pLocClientCallbacks,
+ locClientHandleType* pLocClientHandle,
+ const void* pClientCookie)
+{
+ int instanceId;
+ locClientStatusEnumType status;
+ int tries = 1;
+
+ if (getEmulatorCfg()) {
+ instanceId = eLOC_CLIENT_INSTANCE_ID_MODEM_EMULATOR;
+ } else {
+ #ifdef _ANDROID_
+ switch (getTargetGnssType(loc_get_target()))
+ {
+ case GNSS_GSS:
+ instanceId = eLOC_CLIENT_INSTANCE_ID_GSS;
+ break;
+ case GNSS_MSM:
+ instanceId = eLOC_CLIENT_INSTANCE_ID_MSM;
+ break;
+ case GNSS_MDM:
+ instanceId = eLOC_CLIENT_INSTANCE_ID_MDM;
+ break;
+ case GNSS_AUTO:
+ instanceId = eLOC_CLIENT_INSTANCE_ID_GSS_AUTO;
+ break;
+ default:
+ instanceId = eLOC_CLIENT_INSTANCE_ID_ANY;
+ break;
+ }
+ #else
+ instanceId = eLOC_CLIENT_INSTANCE_ID_ANY;
+ #endif
+ }
+
+ LOC_LOGI("%s:%d]: Service instance id is %d\n",
+ __func__, __LINE__, instanceId);
+
+ while ((status = locClientOpenInstance(eventRegMask, instanceId, pLocClientCallbacks,
+ pLocClientHandle, pClientCookie)) != eLOC_CLIENT_SUCCESS) {
+ if (tries <= LOC_CLIENT_MAX_OPEN_RETRIES) {
+ LOC_LOGE("%s:%d]: failed with status=%d on try %d",
+ __func__, __LINE__, status, tries);
+ tries++;
+ sleep(LOC_CLIENT_TIME_BETWEEN_OPEN_RETRIES);
+ } else {
+ LOC_LOGE("%s:%d]: failed with status=%d Aborting...",
+ __func__, __LINE__, status);
+ break;
+ }
+ }
+
+ return status;
+}
+
+/** locClientClose
+ @brief Disconnects a client from the location engine.
+ @param [in] pLocClientHandle Pointer to the handle returned by the
+ locClientOpen() function.
+ @return
+ One of the following error codes:
+ - 0 (eLOC_CLIENT_SUCCESS) - On success.
+ - non-zero error code(see locClientStatusEnumType) - On failure.
+*/
+
+locClientStatusEnumType locClientClose(
+ locClientHandleType* pLocClientHandle)
+{
+ // convert handle to callback data
+ locClientCallbackDataType *pCallbackData;
+ qmi_client_error_type rc = QMI_NO_ERR; //No error
+
+ if(NULL == pLocClientHandle)
+ {
+ // invalid handle
+ LOC_LOGE("%s:%d]: invalid pointer to handle \n",
+ __func__, __LINE__);
+
+ return(eLOC_CLIENT_FAILURE_INVALID_PARAMETER);
+ }
+
+ pCallbackData = (locClientCallbackDataType *)(*pLocClientHandle);
+
+ // check the input handle for sanity
+ if(NULL == pCallbackData ||
+ NULL == pCallbackData->userHandle ||
+ pCallbackData != pCallbackData->pMe )
+ {
+ // invalid handle
+ LOC_LOGE("%s:%d]: invalid handle \n",
+ __func__, __LINE__);
+
+ return(eLOC_CLIENT_FAILURE_INVALID_HANDLE);
+ }
+
+ LOC_LOGV("locClientClose releasing handle %p, user handle %p\n",
+ *pLocClientHandle, pCallbackData->userHandle );
+
+ // NEXT call goes out to modem. We log the callflow before it
+ // actually happens to ensure the this comes before resp callflow
+ // back from the modem, to avoid confusing log order. We trust
+ // that the QMI framework is robust.
+ EXIT_LOG_CALLFLOW(%s, "loc client close");
+
+ // release the handle
+ rc = qmi_client_release(pCallbackData->userHandle);
+ if(QMI_NO_ERR != rc )
+ {
+ LOC_LOGW("%s:%d]: qmi_client_release error %d for client %p\n",
+ __func__, __LINE__, rc, pCallbackData->userHandle);
+ return(eLOC_CLIENT_FAILURE_INTERNAL);
+ }
+
+ /* clear the memory allocated to callback data to minimize the chances
+ * of a race condition occurring between close and the indication
+ * callback
+ */
+ pthread_mutex_lock(&loc_shutdown_mutex);
+ memset(pCallbackData, 0, sizeof(*pCallbackData));
+ pthread_mutex_unlock(&loc_shutdown_mutex);
+
+ // free the memory assigned in locClientOpen
+ free(pCallbackData);
+ pCallbackData= NULL;
+
+ // set the handle to invalid value
+ *pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
+ return eLOC_CLIENT_SUCCESS;
+}
+
+/** locClientSendReq
+ @brief Sends a message to the location engine. If the locClientSendMsg()
+ function is successful, the client should expect an indication
+ (except start, stop, event reg and sensor injection messages),
+ through the registered callback in the locOpen() function. The
+ indication will contain the status of the request and if status is a
+ success, indication also contains the payload
+ associated with response.
+ @param [in] handle Handle returned by the locClientOpen()
+ function.
+ @param [in] reqId message ID of the request
+ @param [in] reqPayload Payload of the request, can be NULL
+ if request has no payload
+
+ @return
+ One of the following error codes:
+ - 0 (eLOC_CLIENT_SUCCESS ) - On success.
+ - non-zero error code (see locClientStatusEnumType) - On failure.
+*/
+
+locClientStatusEnumType locClientSendReq(
+ locClientHandleType handle,
+ uint32_t reqId,
+ locClientReqUnionType reqPayload )
+{
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ qmi_client_error_type rc = QMI_NO_ERR; //No error
+ qmiLocGenRespMsgT_v02 resp;
+ uint32_t reqLen = 0;
+ void *pReqData = NULL;
+ locClientCallbackDataType *pCallbackData =
+ (locClientCallbackDataType *)handle;
+ int tries;
+
+ // check the input handle for sanity
+ if(NULL == pCallbackData ||
+ NULL == pCallbackData->userHandle ||
+ pCallbackData != pCallbackData->pMe )
+ {
+ // did not find the handle in the client List
+ LOC_LOGE("%s:%d]: invalid handle \n",
+ __func__, __LINE__);
+
+ return(eLOC_CLIENT_FAILURE_INVALID_HANDLE);
+ }
+
+ // validate that the request is correct
+ if (validateRequest(reqId, reqPayload, &pReqData, &reqLen) == false)
+ {
+
+ LOC_LOGE("%s:%d] error invalid request\n", __func__,
+ __LINE__);
+
+ return(eLOC_CLIENT_FAILURE_INVALID_PARAMETER);
+ }
+
+ LOC_LOGv("sending reqId= %d, len = %d", reqId, reqLen);
+ for (tries = 1; tries <= LOC_CLIENT_MAX_SYNC_RETRIES; tries++) {
+ // NEXT call goes out to modem. We log the callflow before it
+ // actually happens to ensure the this comes before resp callflow
+ // back from the modem, to avoid confusing log order. We trust
+ // that the QMI framework is robust.
+ EXIT_LOG_CALLFLOW(%s, loc_get_v02_event_name(reqId));
+ memset(&resp, 0, sizeof(resp));
+ rc = qmi_client_send_msg_sync(
+ pCallbackData->userHandle,
+ reqId,
+ pReqData,
+ reqLen,
+ &resp,
+ sizeof(resp),
+ LOC_CLIENT_ACK_TIMEOUT);
+
+ LOC_LOGv("qmi_client_send_msg_sync returned %d", rc);
+
+ if (QMI_SERVICE_ERR == rc)
+ {
+ LOC_LOGe("send_msg_sync error: QMI_SERVICE_ERR");
+ return(eLOC_CLIENT_FAILURE_PHONE_OFFLINE);
+ }
+ else if (rc != QMI_NO_ERR)
+ {
+ LOC_LOGe("send_msg_sync error: %d\n", rc);
+ return(eLOC_CLIENT_FAILURE_INTERNAL);
+ }
+
+ if (QMI_ERR_SESSION_OWNERSHIP_V01 != resp.resp.error) {
+ break;
+ }
+ usleep(LOC_CLIENT_TIME_BETWEEN_SYNC_RETRIES);
+ }
+ if (tries > 1) {
+ LOC_LOGe("failed with QMI_ERR_SESSION_OWNERSHIP_V01 on try %d", tries);
+ }
+
+ // map the QCCI response to Loc API v02 status
+ status = convertQmiResponseToLocStatus(&resp);
+
+ // if the request is to change registered events, update the
+ // loc api copy of that
+ if(eLOC_CLIENT_SUCCESS == status &&
+ QMI_LOC_REG_EVENTS_REQ_V02 == reqId)
+ {
+ if(NULL != reqPayload.pRegEventsReq )
+ {
+ pCallbackData->eventRegMask =
+ (locClientEventMaskType)(reqPayload.pRegEventsReq->eventRegMask);
+ }
+ }
+ return(status);
+}
+
+/** locClientSupportMsgCheck
+ @brief Sends a QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02 message to the
+ location engine, and then receives a list of all services supported
+ by the engine. This function will check if the input service(s) form
+ the client is in the list or not. If the locClientSupportMsgCheck()
+ function is successful, the client should expect an result of
+ the service is supported or not recorded in supportedMsg.
+ @param [in] handle Handle returned by the locClientOpen()
+ function.
+ @param [in] supportedMsg an integer used to record which
+ message is supported
+
+ @return
+ One of the following error codes:
+ - 0 (eLOC_CLIENT_SUCCESS) -- On success.
+ - Non-zero error code (see \ref locClientStatusEnumType) -- On failure.
+*/
+
+locClientStatusEnumType locClientSupportMsgCheck(
+ locClientHandleType handle,
+ const uint32_t* msgArray,
+ uint32_t msgArrayLength,
+ uint64_t* supportedMsg)
+{
+
+ // set to true if one client has checked the modem capability.
+ static bool isCheckedAlready = false;
+ /*
+ The 1st bit in supportedMsgChecked indicates if
+ QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02
+ is supported or not;
+ The 2ed bit in supportedMsgChecked indicates if
+ QMI_LOC_GET_BATCH_SIZE_REQ_V02
+ is supported or not;
+ */
+ static uint64_t supportedMsgChecked = 0;
+
+ // Validate input arguments
+ if(msgArray == NULL || supportedMsg == NULL) {
+
+ LOC_LOGE("%s:%d]: Input argument/s NULL", __func__, __LINE__);
+ return eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
+ }
+
+ if (isCheckedAlready) {
+ // already checked modem
+ LOC_LOGV("%s:%d]: Already checked. The supportedMsgChecked is %" PRId64 "\n",
+ __func__, __LINE__, supportedMsgChecked);
+ *supportedMsg = supportedMsgChecked;
+ return eLOC_CLIENT_SUCCESS;
+ }
+
+ locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
+ qmi_client_error_type rc = QMI_NO_ERR; //No error
+ qmiLocGetSupportMsgT_v02 resp;
+
+ uint32_t reqLen = 0;
+ void *pReqData = NULL;
+ locClientCallbackDataType *pCallbackData =
+ (locClientCallbackDataType *)handle;
+
+ // check the input handle for sanity
+ if( NULL == pCallbackData ||
+ NULL == pCallbackData->userHandle ||
+ pCallbackData != pCallbackData->pMe ) {
+ // did not find the handle in the client List
+ LOC_LOGE("%s:%d]: invalid handle \n",
+ __func__, __LINE__);
+
+ return eLOC_CLIENT_FAILURE_GENERAL;
+ }
+
+ // NEXT call goes out to modem. We log the callflow before it
+ // actually happens to ensure the this comes before resp callflow
+ // back from the modem, to avoid confusing log order. We trust
+ // that the QMI framework is robust.
+
+ EXIT_LOG_CALLFLOW(%s, loc_get_v02_event_name(QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02));
+ rc = qmi_client_send_msg_sync(
+ pCallbackData->userHandle,
+ QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02,
+ pReqData,
+ reqLen,
+ &resp,
+ sizeof(resp),
+ LOC_CLIENT_ACK_TIMEOUT);
+
+ LOC_LOGV("%s:%d] qmi_client_send_msg_sync returned %d\n", __func__,
+ __LINE__, rc);
+
+ if (rc != QMI_NO_ERR)
+ {
+ LOC_LOGE("%s:%d]: send_msg_sync error: %d\n",__func__, __LINE__, rc);
+ return eLOC_CLIENT_FAILURE_GENERAL;
+ }
+
+ // map the QCCI response to Loc API v02 status
+ status = convertQmiResponseToLocStatus((qmiLocGenRespMsgT_v02*)&resp);
+
+ if(eLOC_CLIENT_SUCCESS == status)
+ {
+ LOC_LOGV("%s:%d]eLOC_CLIENT_SUCCESS == status\n", __func__, __LINE__);
+
+ // check every message listed in msgArray supported by modem or not
+ checkQmiMsgsSupported(msgArray, msgArrayLength, &resp, &supportedMsgChecked);
+
+ LOC_LOGV("%s:%d]: supportedMsgChecked is %" PRId64 "\n",
+ __func__, __LINE__, supportedMsgChecked);
+ *supportedMsg = supportedMsgChecked;
+ isCheckedAlready = true;
+ return status;
+ } else {
+
+ LOC_LOGE("%s:%d]: convertQmiResponseToLocStatus error: %d\n",
+ __func__, __LINE__, status);
+ return eLOC_CLIENT_FAILURE_GENERAL;
+ }
+}
+
+/** locClientGetSizeByRespIndId
+ * @brief Get the size of the response indication structure,
+ * from a specified id
+ * @param [in] respIndId
+ * @param [out] pRespIndSize
+ * @return true if resp ID was found; else false
+*/
+
+bool locClientGetSizeByRespIndId(uint32_t respIndId, size_t *pRespIndSize)
+{
+ size_t idx = 0, respIndTableSize = 0;
+
+ // Validate input arguments
+ if(pRespIndSize == NULL)
+ {
+ LOC_LOGE("%s:%d]: size argument NULL !", __func__, __LINE__);
+ return false;
+ }
+
+ respIndTableSize = (sizeof(locClientRespIndTable)/sizeof(locClientRespIndTableStructT));
+ for(idx=0; idx<respIndTableSize; idx++ )
+ {
+ if(respIndId == locClientRespIndTable[idx].respIndId)
+ {
+ // found
+ *pRespIndSize = locClientRespIndTable[idx].respIndSize;
+
+ LOC_LOGV("%s:%d]: resp ind Id %d size = %d\n", __func__, __LINE__,
+ respIndId, (uint32_t)*pRespIndSize);
+ return true;
+ }
+ }
+
+ //not found
+ return false;
+}
+
+
+/** locClientGetSizeByEventIndId
+ * @brief Gets the size of the event indication structure, from
+ * a specified id
+ * @param [in] eventIndId
+ * @param [out] pEventIndSize
+ * @return true if event ID was found; else false
+*/
+bool locClientGetSizeByEventIndId(uint32_t eventIndId, size_t *pEventIndSize)
+{
+ size_t idx = 0, eventIndTableSize = 0;
+
+ // Validate input arguments
+ if(pEventIndSize == NULL)
+ {
+ LOC_LOGE("%s:%d]: size argument NULL !", __func__, __LINE__);
+ return false;
+ }
+
+ // look in the event table
+ eventIndTableSize =
+ (sizeof(locClientEventIndTable)/sizeof(locClientEventIndTableStructT));
+
+ for(idx=0; idx<eventIndTableSize; idx++ )
+ {
+ if(eventIndId == locClientEventIndTable[idx].eventId)
+ {
+ // found
+ *pEventIndSize = locClientEventIndTable[idx].eventSize;
+
+ LOC_LOGV("%s:%d]: event ind Id %d size = %d\n", __func__, __LINE__,
+ eventIndId, (uint32_t)*pEventIndSize);
+ return true;
+ }
+ }
+ // not found
+ return false;
+}
diff --git a/location/loc_api/loc_api_v02/loc_api_v02_client.h b/location/loc_api/loc_api_v02/loc_api_v02_client.h
new file mode 100644
index 0000000..c4820a5
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc_api_v02_client.h
@@ -0,0 +1,1955 @@
+/* Copyright (c) 2011-2020 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.
+ */
+
+/** @file loc_api_v02_client.h
+*/
+
+#ifndef LOC_API_V02_CLIENT_H
+#define LOC_API_V02_CLIENT_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "location_service_v02.h" //QMI LOC Service data types definitions
+
+#include <stddef.h>
+
+/******************************************************************************
+ * Constants and configuration
+ *****************************************************************************/
+
+/** @ingroup constants_macros
+ Specific value of #locClientHandleType, indicating an invalid handle. */
+#define LOC_CLIENT_INVALID_HANDLE_VALUE (NULL)
+
+#define MASTER_HAL "MHAL"
+#define HAL "HAL"
+
+ /** @addtogroup data_types
+@{ */
+
+/** Location client handle used to represent a specific client. Negative values
+ are invalid handles.
+*/
+typedef void* locClientHandleType;
+
+/** Data type for events and event masks. */
+typedef uint64_t locClientEventMaskType;
+
+/** Location client status values.
+*/
+typedef enum
+{
+ eLOC_CLIENT_SUCCESS = 0,
+ /**< Request was successful. */
+
+ eLOC_CLIENT_FAILURE_GENERAL = 1,
+ /**< Failed because of a general failure. */
+
+ eLOC_CLIENT_FAILURE_UNSUPPORTED = 2,
+ /**< Failed because the service does not support the command. */
+
+ eLOC_CLIENT_FAILURE_INVALID_PARAMETER = 3,
+ /**< Failed because the request contained invalid parameters. */
+
+ eLOC_CLIENT_FAILURE_ENGINE_BUSY = 4,
+ /**< Failed because the engine is busy. */
+
+ eLOC_CLIENT_FAILURE_PHONE_OFFLINE = 5,
+ /**< Failed because the phone is offline. */
+
+ eLOC_CLIENT_FAILURE_TIMEOUT = 6,
+ /**< Failed because of a timeout. */
+
+ eLOC_CLIENT_FAILURE_SERVICE_NOT_PRESENT = 7,
+ /**< Failed because the service is not present. */
+
+ eLOC_CLIENT_FAILURE_SERVICE_VERSION_UNSUPPORTED = 8,
+ /**< Failed because the service version is unsupported. */
+
+ eLOC_CLIENT_FAILURE_CLIENT_VERSION_UNSUPPORTED = 9,
+ /**< Failed because the service does not support client version. */
+
+ eLOC_CLIENT_FAILURE_INVALID_HANDLE = 10,
+ /**< Failed because an invalid handle was specified. */
+
+ eLOC_CLIENT_FAILURE_INTERNAL = 11,
+ /**< Failed because of an internal error in the service. */
+
+ eLOC_CLIENT_FAILURE_NOT_INITIALIZED = 12,
+ /**< Failed because the service has not been initialized. */
+
+ eLOC_CLIENT_FAILURE_NOT_ENOUGH_MEMORY = 13,
+ /**< Failed because there is not enough memory to do the operation. */
+
+ eLOC_CLIENT_FAILURE_INVALID_MESSAGE_ID = 14
+ /**< Failed because there is not enough memory to do the operation. */
+
+}locClientStatusEnumType;
+
+/** Location client error values
+*/
+typedef enum
+{
+ eLOC_CLIENT_ERROR_SERVICE_UNAVAILABLE = 1
+ /**< Service is no longer available. Upon getting this error, the client
+ must close the existing connection and reopen the connection. */
+
+}locClientErrorEnumType;
+
+
+/** Request messages the client can send to the location engine.
+
+ The following requests do not have any data associated, so they do not have a
+ payload structure defined:
+
+ - GetServiceRevision
+ - GetFixCriteria
+ - GetPredictedOrbitsDataSource
+ - GetPredictedOrbitsDataValidity
+ - GetEngineLock
+ - GetSbasConfigReq
+ - GetRegisteredEvents
+ - GetNmeaTypes
+ - GetLowPowerMode
+ - GetXtraTSessionControl
+ - GetRegisteredEvents
+ - GetOperationMode
+ - GetCradleMountConfig
+ - GetExternalPowerConfig
+ - GetSensorControlConfig
+ - GetSensorPerformanceControlConfiguration
+ - WWANOutOfServiceNotification
+*/
+typedef union
+{
+ void* pReqData;
+ const qmiLocInformClientRevisionReqMsgT_v02* pInformClientRevisionReq;
+ /**< Notifies the service about the revision the client is using.
+
+ The client does not receive any indications corresponding to this
+ request.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02. */
+
+ const qmiLocRegEventsReqMsgT_v02* pRegEventsReq;
+ /**< Changes the events the client is interested in receiving.
+
+ The client does not receive any indications corresponding to this
+ request.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_REG_EVENTS_REQ_V02. */
+
+ const qmiLocStartReqMsgT_v02* pStartReq;
+ /**< Starts a positioning session.
+
+ The client receives the following indications: position report,
+ satellite report, fix session report, and NMEA report (if applicable).
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_START_REQ_V02. */
+
+ const qmiLocStopReqMsgT_v02* pStopReq;
+ /**< Stops a positioning session. The client receives a fix session report
+ denoting that the fix session ended after this message was sent.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_STOP_REQ_V02. */
+
+ const qmiLocNiUserRespReqMsgT_v02* pNiUserRespReq;
+ /**< Informs the service about the user response for a network-initiated call.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_NI_USER_RESPONSE_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_NI_USER_RESPONSE_REQ_V02. */
+
+ const qmiLocInjectPredictedOrbitsDataReqMsgT_v02* pInjectPredictedOrbitsDataReq;
+ /**< Injects the predicted orbits data into the service.
+
+ When all predicted orbits data parts have been injected, the client
+ receives the following indication containing a response:
+ QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02.
+
+ The client injects successive data parts without waiting for this
+ indication as long as locClientSendReq() returns successfully.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02. */
+
+ const qmiLocInjectUtcTimeReqMsgT_v02* pInjectUtcTimeReq;
+ /**< Injects UTC time into the service.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_UTC_TIME_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_UTC_TIME_REQ_V02. */
+
+ const qmiLocInjectPositionReqMsgT_v02* pInjectPositionReq;
+ /**< Injects a position into the service.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_POSITION_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_POSITION_REQ_V02. */
+
+ const qmiLocSetEngineLockReqMsgT_v02* pSetEngineLockReq;
+ /**< Sets the location engine lock.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_ENGINE_LOCK_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_ENGINE_LOCK_REQ_V02. */
+
+ const qmiLocGetEngineLockReqMsgT_v02* pGetEngineLockReq;
+ /**< Gets the location engine lock.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_ENGINE_LOCK_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_ENGINE_LOCK_REQ_V02. */
+
+ const qmiLocSetSbasConfigReqMsgT_v02* pSetSbasConfigReq;
+ /**< Sets the SBAS configuration.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_SBAS_CONFIG_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_SBAS_CONFIG_REQ_V02 . */
+
+ const qmiLocSetNmeaTypesReqMsgT_v02* pSetNmeaTypesReq;
+ /**< Sets the NMEA types configuration.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_NMEA_TYPES_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_NMEA_TYPES_REQ_V02. */
+
+ const qmiLocSetLowPowerModeReqMsgT_v02* pSetLowPowerModeReq;
+ /**< Sets the Low Power mode configuration.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_LOW_POWER_MODE_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_LOW_POWER_MODE_REQ_V02. */
+
+ const qmiLocRegisterMasterClientReqMsgT_v02* pRegisterMasterClientReq;
+ /**< Register Master Client.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_REGISTER_MASTER_CLIENT_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02. */
+
+ const qmiLocSetServerReqMsgT_v02* pSetServerReq;
+ /**< Sets the A-GPS server type and address.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_SERVER_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_SERVER_REQ_V02. */
+
+ const qmiLocGetServerReqMsgT_v02* pGetServerReq;
+ /**< Gets the A-GPS server type and address.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_SERVER_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_SERVER_REQ_V02. */
+
+ const qmiLocDeleteAssistDataReqMsgT_v02* pDeleteAssistDataReq;
+ /**< Deletes the aiding data from the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_DELETE_ASSIST_DATA_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_DELETE_ASSIST_DATA_REQ_V02. */
+
+ const qmiLocInjectApCacheDataReqMsgT_v02 *pInjectApCacheDataReq;
+ /**< Inject APcache data into the engine
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_APCACHE_DATA_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_APCACHE_DATA_REQ_V02. */
+
+ const qmiLocInjectApDoNotCacheDataReqMsgT_v02 *pInjectApDoNotCacheDataReq;
+ /**< Inject blacklist-Apcache data into the engine
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_DONOTAPCACHE_DATA_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_DONOTAPCACHE_DATA_REQ_V02. */
+
+
+ const qmiLocSetXtraTSessionControlReqMsgT_v02* pSetXtraTSessionControlReq;
+ /**< Sets XTRA-T session control in the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_XTRA_T_SESSION_CONTROL_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02. */
+
+ const qmiLocInjectWifiPositionReqMsgT_v02* pInjectWifiPositionReq;
+ /**< Injects a WiFi position into the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_WIFI_POSITION_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_WIFI_POSITION_REQ_V02. */
+
+ const qmiLocNotifyWifiStatusReqMsgT_v02* pNotifyWifiStatusReq;
+ /**< Notifies the engine about the WiFi status.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_NOTIFY_WIFI_STATUS_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02. */
+
+ const qmiLocSetOperationModeReqMsgT_v02* pSetOperationModeReq;
+ /**< Sets the engine Operation mode.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_OPERATION_MODE_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_OPERATION_MODE_REQ_V02. */
+
+ const qmiLocSetSpiStatusReqMsgT_v02* pSetSpiStatusReq;
+ /**< Sends the stationary position status to the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_SPI_STATUS_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_SPI_STATUS_REQ_V02. */
+
+ const qmiLocInjectSensorDataReqMsgT_v02* pInjectSensorDataReq;
+ /**< Injects sensor data into the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_SENSOR_DATA_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_SENSOR_DATA_REQ_V02. */
+
+ const qmiLocInjectTimeSyncDataReqMsgT_v02* pInjectTimeSyncReq;
+ /**< Injects time synchronization information into the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_TIME_SYNC_DATA_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02. */
+
+ const qmiLocSetCradleMountConfigReqMsgT_v02* pSetCradleMountConfigReq;
+ /**< Sets the cradle mount state information in the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ SET_CRADLE_MOUNT_CONFIG_REQ_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ SET_CRADLE_MOUNT_CONFIG_IND_V02. */
+
+ const qmiLocSetExternalPowerConfigReqMsgT_v02* pSetExternalPowerConfigReq;
+ /**< Sets external power configuration state in the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_EXTERNAL_POWER_CONFIG_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02. */
+
+ const qmiLocInformLocationServerConnStatusReqMsgT_v02*
+ pInformLocationServerConnStatusReq;
+ /**< Informs the engine about the connection status to the location server.
+
+ This can be sent in response to a
+ QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02 request. The
+ service sends back a QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02
+ response indication for this request.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02. */
+
+ const qmiLocSetProtocolConfigParametersReqMsgT_v02*
+ pSetProtocolConfigParametersReq;
+ /**< Sets the protocol configuration parameters in the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02. */
+
+ const qmiLocGetProtocolConfigParametersReqMsgT_v02*
+ pGetProtocolConfigParametersReq;
+ /**< Retrieves protocol configuration parameters from the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02. */
+
+ const qmiLocSetSensorControlConfigReqMsgT_v02*
+ pSetSensorControlConfigReq;
+ /**< Sets the sensor control configuration parameters in the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_SENSOR_CONTROL_CONFIG_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02. */
+
+ const qmiLocSetSensorPerformanceControlConfigReqMsgT_v02*
+ pSetSensorPerformanceControlConfigReq;
+ /**< Sets the sensor performance configuration parameters in the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02. */
+
+ const qmiLocGetSensorPropertiesReqMsgT_v02* pGetSensorPropertiesReq;
+ /**< Retrieves the sensor properties from the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_SENSOR_PROPERTIES_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02. */
+
+ const qmiLocSetSensorPropertiesReqMsgT_v02* pSetSensorPropertiesReq;
+ /**< Sets the sensor properties in the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_SENSOR_PROPERTIES_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02. */
+
+ const qmiLocInjectSuplCertificateReqMsgT_v02* pInjectSuplCertificateReq;
+ /**< Injects a SUPL certificate into the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02. */
+
+ const qmiLocDeleteSuplCertificateReqMsgT_v02* pDeleteSuplCertificateReq;
+ /**< Deletes a SUPL certificate from the engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_DELETE_SUPL_CERTIFICATE_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02. */
+
+ const qmiLocSetPositionEngineConfigParametersReqMsgT_v02*
+ pSetPositionEngineConfigParametersReq;
+ /**< Sets position engine configuration.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_IND _V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02. */
+
+ const qmiLocGetPositionEngineConfigParametersReqMsgT_v02*
+ pGetPositionEngineConfigParametersReq;
+ /**< Gets position engine configuration.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02. */
+
+ const qmiLocAddCircularGeofenceReqMsgT_v02* pAddCircularGeofenceReq;
+ /**< Adds a circular geofence.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02 */
+
+ const qmiLocDeleteGeofenceReqMsgT_v02* pDeleteGeofenceReq;
+ /**< Deletes a geofence.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_DELETE_GEOFENCE_IND_V02.
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_DELETE_GEOFENCE_REQ_V02 */
+
+ const qmiLocQueryGeofenceReqMsgT_v02* pQueryGeofenceReq;
+ /**< Queries a geofence.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_QUERY_GEOFENCE_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_QUERY_GEOFENCE_REQ_V02. */
+
+ const qmiLocEditGeofenceReqMsgT_v02* pEditGeofenceReq;
+ /**< Edits geofence parameters.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_EDIT_GEOFENCE_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_EDIT_GEOFENCE_REQ_V02. */
+
+ const qmiLocGetBestAvailablePositionReqMsgT_v02*
+ pGetBestAvailablePositionReq;
+ /**< Get the best available position from location engine
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02. @newpagetable */
+
+ const qmiLocSecureGetAvailablePositionReqMsgT_v02*
+ pSecureGetBestAvailablePositionReq;
+ /**< Get the best available position from location engine
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02. @newpagetable */
+
+ const qmiLocInjectMotionDataReqMsgT_v02* pInjectMotionDataReq;
+ /**< Inject motion data in the location engine
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_MOTION_DATA_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_MOTION_DATA_REQ_V02 */
+
+ const qmiLocGetNiGeofenceIdListReqMsgT_v02* pGetNiGeofenceIdListReq;
+ /**< Get the list of Network Initiated Geofences from the location engine.
+
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02 */
+
+ const qmiLocInjectGSMCellInfoReqMsgT_v02 *pInjectGSMCellInfoReq;
+ /**< Inject GSM Cell Information into the location engine.
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02 */
+
+ const qmiLocInjectNetworkInitiatedMessageReqMsgT_v02
+ *pInjectNetworkInitiatedMessageReq;
+ /**< Inject Network Initiated Message into the location engine.
+ If the request is accepted by the service, the client receives the
+ following indication containing a response:
+ QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02 */
+
+ const void *pWWANOutOfServiceNotificationReq;
+
+ const qmiLocPedometerReportReqMsgT_v02 *pPedometerReportReq;
+ /**< Send pedometer data to the location engine. If the request is
+ accepted by the service, the client receives the following
+ indication containing a response:
+ QMI_LOC_PEDOMETER_REPORT_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_PEDOMETER_REPORT_REQ_V02 */
+
+ const qmiLocInjectWCDMACellInfoReqMsgT_v02 *pInjectWCDMACellInfoReq;
+ const qmiLocInjectTDSCDMACellInfoReqMsgT_v02 *pInjectTDSCDMACellInfoReq;
+ const qmiLocInjectSubscriberIDReqMsgT_v02 *pInjectSubscriberIDReq;
+ const qmiLocInjectWifiApDataReqMsgT_v02 *pInjectWifiApDataReq;
+ const qmiLocNotifyWifiAttachmentStatusReqMsgT_v02 *pNotifyWifiAttachmentStatusReq;
+ const qmiLocNotifyWifiEnabledStatusReqMsgT_v02 *pNotifyWifiEnabledStatusReq;
+
+ const qmiLocReadFromBatchReqMsgT_v02 *pReadFromBatchReq;
+ const qmiLocGetBatchSizeReqMsgT_v02 *pGetBatchSizeReq;
+ const qmiLocStartBatchingReqMsgT_v02 *pStartBatchingReq;
+ const qmiLocStopBatchingReqMsgT_v02 *pStopBatchingReq;
+ const qmiLocReleaseBatchReqMsgT_v02 *pReleaseBatchReq;
+
+ const qmiLocInjectVehicleSensorDataReqMsgT_v02 *pInjectVehicleSensorDataReq;
+
+ /**< Send vehicle sensor data to the location engine. If the request is
+ accepted by the service, the client receives the following
+ indication containing a response:
+ QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_IND_V02
+
+ To send this request, set the reqId field in locClientSendReq() to
+ QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02 */
+
+ const qmiLocSetPremiumServicesCfgReqMsgT_v02 *pSetPremiumServicesCfgReq;
+ /*QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_REQ_V02*/
+
+ const qmiLocGetAvailWwanPositionReqMsgT_v02 *pGetAvailWwanPositionReq;
+ /*QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02*/
+
+ const qmiLocSetXtraVersionCheckReqMsgT_v02 *pSetXtraVersionCheckReq;
+
+ const qmiLocGdtUploadBeginStatusReqMsgT_v02* pGdtUploadBeginStatusReq;
+ /* QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_REQ_V02 */
+
+ const qmiLocGdtUploadEndReqMsgT_v02* pGdtUploadEndReq;
+ /* QMI_LOC_GDT_UPLOAD_END_REQ_V02*/
+
+ const qmiLocInjectGtpClientDownloadedDataReqMsgT_v02 *pInjectGtpClientDownloadedDataReq;
+ /* QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_REQ_V02 */
+
+ const qmiLocSetGNSSConstRepConfigReqMsgT_v02 *pSetGNSSConstRepConfigReq;
+ /*QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02*/
+
+ const qmiLocStartDbtReqMsgT_v02 *pStartDbtReq;
+ /*QMI_LOC_START_DBT_REQ_V02*/
+
+ const qmiLocStopDbtReqMsgT_v02 *pStopDbtReq;
+ /*QMI_LOC_STOP_DBT_REQ_V02*/
+
+ const qmiLocInjectTimeZoneInfoReqMsgT_v02 *pInjectTimeZoneInfoReq;
+ /*QMI_LOC_INJECT_TIME_ZONE_INFO*/
+
+ const qmiLocQueryAonConfigReqMsgT_v02 *pQueryAonConfigReq;
+ /*QMI_LOC_QUERY_AON_CONFIG_REQ_V02*/
+
+ const qmiLocGetSupportedFeatureReqMsgT_v02 *pGetSupportedFeatureReq;
+ /* QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02*/
+
+ const qmiLocGtpApStatusReqMsgT_v02* pGtpApStatusReq;
+ /* QMI_LOC_GTP_AP_STATUS_REQ_V02 */
+
+ const qmiLocGdtDownloadBeginStatusReqMsgT_v02* pGdtDownloadBeginStatusReq;
+ /* QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02 */
+
+ const qmiLocGdtDownloadReadyStatusReqMsgT_v02* pGdtDownloadReadyStatusReq;
+ /* QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02 */
+
+ const qmiLocGdtReceiveDoneStatusReqMsgT_v02* pGdtReceiveDoneStatusReq;
+ /* QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02 */
+
+ const qmiLocGdtDownloadEndStatusReqMsgT_v02* pGdtDownloadEndStatusReq;
+ /* QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02*/
+
+ const qmiLocDeleteGNSSServiceDataReqMsgT_v02* pDeleteGNSSServiceDataReq;
+ /* QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02*/
+
+ // XTRA Client 2.0
+ const qmiLocInjectXtraDataReqMsgT_v02 *pInjectXtraDataReq;
+ /*QMI_LOC_INJECT_XTRA_DATA_REQ_V02*/
+
+ const qmiLocInjectXtraPcidReqMsgT_v02 *pInjectXtraPcidReq;
+ /*QMI_LOC_INJECT_XTRA_PCID_REQ_V02*/
+
+ const qmiLocInjectSrnApDataReqMsgT_v02 *pInjectSrnApDataReq;
+ /*QMI_LOC_INJECT_SRN_AP_DATA_REQ_V02*/
+
+ const qmiLocCrowdSourceManagerControlReqMsgT_v02 *pCrowdSourceManagerControlReq;
+ /*QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ*/
+
+ const qmiLocCrowdSourceManagerReadDataReqMsgT_v02 *pCrowdSourceManagerReadDataReq;
+ /*QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ*/
+
+ const qmiLocQueryXtraInfoReqMsgT_v02 *pQueryXtraInfoReq;
+ /*QMI_LOC_QUERY_XTRA_INFO_REQ_V02*/
+ const qmiLocStartOutdoorTripBatchingReqMsgT_v02 *pStartOutdoorTripBatchingReq;
+ /*QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ_V02*/
+
+ const qmiLocQueryOTBAccumulatedDistanceReqMsgT_v02 *pQueryOTBAccumulatedDistanceReq;
+ /*QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02*/
+
+ const qmiLocGetFdclBsListReqMsgT_v02 *pGetFdclBsListReq;
+ /*QMI_LOC_GET_FDCL_BS_LIST_REQ_V02*/
+
+ const qmiLocInjectFdclDataReqMsgT_v02 *pInjectFdclDataReq;
+ /*QMI_LOC_INJECT_FDCL_DATA_REQ_V02*/
+
+ const qmiLocSetBlacklistSvReqMsgT_v02 *pSetBlacklistSvReq;
+ /*QMI_LOC_SET_BLACKLIST_SV_REQ_V02*/
+
+ const qmiLocSetConstellationConfigReqMsgT_v02 *pSetConstellationConfigReq;
+ /*QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02*/
+
+ const qmiLocGetBsObsDataReqMsgT_v02 *pGetBsObsDataReq;
+ /*QMI_LOC_GET_BS_OBS_DATA_REQ_V02*/
+
+ const qmiLocSetConstrainedTuncModeReqMsgT_v02
+ *pSetConstrainedTuncModeReq;
+ /*QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02*/
+
+ const qmiLocEnablePositionAssistedClockEstReqMsgT_v02
+ *pSetEnablePositionAssistedClockEstReq;
+ /*QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02*/
+
+ const qmiLocQueryGNSSEnergyConsumedReqMsgT_v02
+ *pQueryGNSSEnergyConsumedReq;
+ /*QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02*/
+
+ const qmiLocInjectPlatformPowerStateReqMsgT_v02
+ *pInjectPowerStateReq;
+ /*QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ*/
+
+ const qmiLocSetRobustLocationReqMsgT_v02
+ *pSetRobustLocationReq;
+ /*QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ*/
+}locClientReqUnionType;
+
+
+/** Event indications that are sent by the service.
+*/
+typedef union
+{
+ const qmiLocEventPositionReportIndMsgT_v02* pPositionReportEvent;
+ /**< Contains the position information.
+
+ This event is generated after QMI_LOC_START_REQ_V02 is sent. If
+ periodic fix criteria is specified, this event is generated multiple
+ times periodically at the specified rate until QMI_LOC_STOP_REQ_V02 is
+ sent.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_POSITION_REPORT_IND_V02 or
+ QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02. */
+
+ const qmiLocEventGnssSvInfoIndMsgT_v02* pGnssSvInfoReportEvent;
+ /**< Contains the GNSS satellite information.
+
+ This event is generated after QMI_LOC_START_REQ_V02 is sent. This event
+ is generated at 1 Hz if the location engine is tracking satellites to
+ make a location fix.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GNSS_INFO_IND_V02. */
+
+ const qmiLocEventNmeaIndMsgT_v02* pNmeaReportEvent;
+ /**< Contains an NMEA report sentence.
+
+ The entire NMEA report consisting of multiple sentences is sent at a
+ 1 Hz rate. This event is generated after QMI_LOC_START_REQ_V02 is sent.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_NMEA_IND_V02. */
+
+ const qmiLocEventNiNotifyVerifyReqIndMsgT_v02* pNiNotifyVerifyReqEvent;
+ /**< Notifies a location client when the network triggers a positioning
+ request to the mobile.
+
+ Upon getting this event, the location client displays the
+ network-initiated fix request in a dialog and prompts the user to
+ accept or deny the request. The client responds to this request with
+ the message QMI_LOC_NI_USER_RESPONSE_REQ_V02.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02. */
+
+ const qmiLocEventInjectTimeReqIndMsgT_v02* pInjectTimeReqEvent;
+ /**< Asks the client for time assistance.
+
+ The client responds to this request with the message
+ QMI_LOC_INJECT_UTC_TIME_REQ_V02.
+
+ The eventIndId field in the event indication callback is
+ set to QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02. */
+
+ const qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02*
+ pInjectPredictedOrbitsReqEvent;
+ /**< Asks the client for predicted orbits data assistance.
+
+ The client responds to this request with the message
+ QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02. */
+
+ const qmiLocEventInjectPositionReqIndMsgT_v02* pInjectPositionReqEvent;
+ /**< Asks the client for position assistance.
+
+ The client responds to this request with the message
+ QMI_LOC_INJECT_POSITION_REQ_V02.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02. */
+
+ const qmiLocEventEngineStateIndMsgT_v02* pEngineState;
+ /**< Sent by the engine whenever it turns on or off.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_ENGINE_STATE_IND_V02. */
+
+ const qmiLocEventFixSessionStateIndMsgT_v02* pFixSessionState;
+ /**< Sent by the engine when a location session begins or ends.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02. */
+
+ const qmiLocEventWifiReqIndMsgT_v02* pWifiReqEvent;
+ /**< Sent by the engine when it needs WiFi support.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_WIFI_REQ_IND_V02. */
+
+ const qmiLocEventSensorStreamingReadyStatusIndMsgT_v02*
+ pSensorStreamingReadyStatusEvent;
+ /**< Notifies the client that the engine is ready to accept sensor data.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_IND_V02. */
+
+ const qmiLocEventTimeSyncReqIndMsgT_v02* pTimeSyncReqEvent;
+ /**< Sent by the engine when it needs to synchronize its time with the sensor
+ processor time.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_TIME_SYNC_REQ_IND_V02. */
+
+ const qmiLocEventSetSpiStreamingReportIndMsgT_v02*
+ pSetSpiStreamingReportEvent;
+ /**< Asks the client to start/stop sending a Stationary Position Indicator
+ (SPI) stream.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_SET_SPI_STREAMING_REPORT_IND_V02. */
+
+ const qmiLocEventLocationServerConnectionReqIndMsgT_v02*
+ pLocationServerConnReqEvent;
+ /**< Sent by the engine to ask the client to open or close a connection to
+ a location server.
+
+ The client responds to this request by sending the
+ QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02 message.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02. */
+
+ const qmiLocEventNiGeofenceNotificationIndMsgT_v02*
+ pNiGeofenceNotificationEvent;
+ /**< Sent by the engine to notify the client about changes to a
+ network-initiated geofence.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02. */
+
+ const qmiLocEventGeofenceGenAlertIndMsgT_v02* pGeofenceGenAlertEvent;
+ /**< Sent by the engine to notify the client about updates that may
+ affect a geofence operation.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02. */
+
+ const qmiLocEventGeofenceBreachIndMsgT_v02* pGeofenceBreachEvent;
+ /**< Sent by the engine to notify the client about a geofence breach
+ event.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02. @newpagetable */
+
+ const qmiLocEventGeofenceBatchedBreachIndMsgT_v02* pGeofenceBatchedBreachEvent;
+ /**< Sent by the engine to notify the client about a geofence breach
+ event.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02. @newpagetable */
+
+ const qmiLocEventPedometerControlIndMsgT_v02* pPedometerControlEvent;
+ /**< Sent by the engine to recommend how pedometer data is sent to the
+ location engine.
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02. @newpagetable */
+
+ const qmiLocEventMotionDataControlIndMsgT_v02* pMotionDataControlEvent;
+ /**< Sent by the engine to recommend how motion data is sent to the
+ location engine.
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02. @newpagetable */
+
+ const qmiLocEventInjectWifiApDataReqIndMsgT_v02* pWifiApDataReqEvent;
+ const qmiLocEventLiveBatchedPositionReportIndMsgT_v02* pBatchPositionReportEvent;
+ /**< Sent by the engine to notify the client that live batch location
+ is ready, and the location info.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02. */
+
+ const qmiLocEventBatchFullIndMsgT_v02* pBatchCount;
+ /**< Sent by the engine to notify the client that batch location is
+ full, and how many location are available to read.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_BATCH_FULL_IND_V02. */
+
+ const qmiLocEventVehicleDataReadyIndMsgT_v02* pVehicleDataReadyEvent;
+ /**< Sent by the engine to recommend how vehicle sensor data is
+ sent to the location engine.
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_IND_V02. @newpagetable */
+
+ const qmiLocEventGeofenceProximityIndMsgT_v02* pGeofenceProximityEvent;
+ /**< Sent by the engine to notify the client about a geofence proximity
+ event.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_IND_V02. @newpagetable */
+
+ const qmiLocEventGnssSvMeasInfoIndMsgT_v02* pGnssSvRawInfoEvent;
+
+ /**< Sent by the engine when GNSS measurements are available
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02. @newpagetable */
+
+ const qmiLocEventGnssSvPolyIndMsgT_v02* pGnssSvPolyInfoEvent;
+
+ /**< Sent by the engine when GNSS measurements are available
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02. @newpagetable */
+
+ const qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02* pGdtUploadBeginEvent;
+ /**< Sent by the engine to notify the client about a GDT upload
+ begine event.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_IND_V02. @newpagetable */
+
+ const qmiLocEventGdtUploadEndReqIndMsgT_v02* pGdtUploadEndEvent;
+ /**< Sent by the engine to notify the client about a GDT upload
+ end event.
+
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_IND_V02. @newpagetable */
+
+ const qmiLocEventDbtPositionReportIndMsgT_v02 *pDbtPositionReportEvent;
+ /**< Sent by the engine to notify the client of a distance based
+ tracking position report.
+ QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02*/
+
+ const qmiLocEventDbtSessionStatusIndMsgT_v02 *pDbtSessionStatusEvent;
+ /**< Sent by the engine to notify the client of the status of the
+ DBT session.
+ QMI_LOC_EVENT_DBT_SESSION_STATUS_IND_V02*/
+
+ const qmiLocEventGeofenceBatchedDwellIndMsgT_v02 *pGeofenceBatchedDwellEvent;
+ /**< Sent by the engine to notify the client of the dwell time inside
+ or outside of a Geofence for a specified time.
+ QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02*/
+
+ const qmiLocEventGetTimeZoneReqIndMsgT_v02 *pGetTimeZoneReqEvent;
+ /**< Sent by the engine to request injection of time zone info
+ QMI_LOC_EVENT_GET_TIME_ZONE_INFO_IND_V02>*/
+
+ const qmiLocEventBatchingStatusIndMsgT_v02* pBatchingStatusEvent;
+ /**< Sent by the engine to notify the control point of the batching status.
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_BATCHING_STATUS_IND_V02. */
+
+ const qmiLocEventGdtDownloadBeginReqIndMsgT_v02 *pGdtDownloadBeginReqEvent;
+ /**< Sent by the engine to notify the client about a GDT download
+ begin event.
+ QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02. */
+
+ const qmiLocEventGdtReceiveDoneIndMsgT_v02 *pGdtReceiveDoneEvent;
+ /**< Sent by the engine to notify the client about a GDT download
+ receive done event.
+ QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02. */
+
+ const qmiLocEventGdtDownloadEndReqIndMsgT_v02 *pGdtDownloadEndReqEvent;
+ /**< Sent by the engine to notify the client about a GDT download
+ end event.
+ QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02. */
+
+ const qmiLocEventInjectSrnApDataReqIndMsgT_v02 *pInjectSrnApDataReqEvent;
+ /**< Sent by the engine to notify the client about a SRN Ap data
+ request.
+ QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_IND_V02. */
+
+ const qmiLocEventFdclServiceReqIndMsgT_v02 *pFdclServiceReqEvent;
+ /**< Sent by the engine to request the client for FDCL data
+ QMI_LOC_EVENT_FDCL_SERVICE_REQ_IND_V02. */
+
+ const qmiLocGetBlacklistSvIndMsgT_v02 *pGetBlacklistSvEvent;
+ /**< Sent by the engine to provide current blackisting SV info.
+ QMI_LOC_GET_BLACKLIST_SV_IND_V02. */
+
+ const qmiLocGetConstellationConfigIndMsgT_v02 *pGetConstellationConfigEvent;
+ /**< Sent by the engine to provide current constellation control info.
+ QMI_LOC_GET_CONSTELLATION_CONTROL_IND_V02. */
+
+ const qmiLocEventBsObsDataServiceReqIndMsgT_v02 *pBsObsDataServiceReqEvent;
+ /**< Sent by the engine to notify the client about BS CS data available
+ QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02. */
+
+ const qmiLocGpsEphemerisReportIndMsgT_v02 *pGpsEphemerisReportEvent;
+ /**< Sent by the engine when GPS ephemeris are available
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02 @newpagetable */
+
+ const qmiLocGloEphemerisReportIndMsgT_v02 *pGloEphemerisReportEvent;
+ /**< Sent by the engine when GLONASS ephemeris are available
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02 @newpagetable */
+
+ const qmiLocBdsEphemerisReportIndMsgT_v02 *pBdsEphemerisReportEvent;
+ /**< Sent by the engine when BDS ephemeris are available
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02 @newpagetable */
+
+ const qmiLocGalEphemerisReportIndMsgT_v02 *pGalEphemerisReportEvent;
+ /**< Sent by the engine when GALILEO ephemeris are available
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02 @newpagetable */
+
+ const qmiLocQzssEphemerisReportIndMsgT_v02 *pQzssEphemerisReportEvent;
+ /**< Sent by the engine when GALILEO ephemeris are available
+ The eventIndId field in the event indication callback is set to
+ QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02 @newpagetable */
+
+ const qmiLocEventReportIndMsgT_v02 *pLocEvent;
+ /** Sent by engine for modem events to the control point
+ QMI_LOC_EVENT_REPORT_IND_V02 */
+
+ const qmiLocSystemInfoIndMsgT_v02 *pLocSystemInfoEvent;
+ /** Sent by the engine to inform of location system info event
+ QMI_LOC_SYSTEM_INFO_IND_V02 */
+
+ const qmiLocGetBandMeasurementMetricsIndMsgT_v02 *pLocGetBandMeasurementMetricsEvent;
+ /** Sent asynchronously by MGP to registred clients for the Power metrics
+ QMI_LOC_GET_BAND_MEASUREMENT_METRICS_IND_V02 0x00CE*/
+
+ const qmiLocLocationRequestNotificationIndMsgT_v02 *pLocReqNotifEvent;
+ /** Sent by the engine to inform of location system info event
+ QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02 */
+
+}locClientEventIndUnionType;
+
+
+/** Response indications that are sent by the service.
+*/
+typedef union
+{
+ const qmiLocGetServiceRevisionIndMsgT_v02* pGetServiceRevisionInd;
+ /**< Response to the QMI_LOC_GET_SERVICE_REVISION_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_SERVICE_REVISION_IND_V02. */
+
+ const qmiLocGetFixCriteriaIndMsgT_v02* pGetFixCriteriaInd;
+ /**< Response to the QMI_LOC_GET_FIX_CRITERIA_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_FIX_CRITERIA_IND_V02. */
+
+ const qmiLocNiUserRespIndMsgT_v02* pNiUserRespInd;
+ /**< Response to the QMI_LOC_NI_USER_RESPONSE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_NI_USER_RESPONSE_IND_V02. */
+
+ const qmiLocInjectPredictedOrbitsDataIndMsgT_v02*
+ pInjectPredictedOrbitsDataInd;
+ /**< Sent after a predicted orbits data part has been successfully injected.
+
+ The client waits for this indication before injecting the next part.
+ This indication is sent in response to
+ QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02. */
+
+ const qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02*
+ pGetPredictedOrbitsDataSourceInd;
+ /**< Response to the QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02
+ request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_IND_V02. */
+
+ const qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02*
+ pGetPredictedOrbitsDataValidityInd;
+ /**< Response to the QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_REQ_V02
+ request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_IND_V02. */
+
+ const qmiLocInjectUtcTimeIndMsgT_v02* pInjectUtcTimeInd;
+ /**< Response to the QMI_LOC_INJECT_UTC_TIME_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_UTC_TIME_IND_V02. */
+
+ const qmiLocInjectPositionIndMsgT_v02* pInjectPositionInd;
+ /**< Response to the QMI_LOC_INJECT_POSITION_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_POSITION_IND_V02. */
+
+ const qmiLocSetEngineLockIndMsgT_v02* pSetEngineLockInd;
+ /**< Response to the QMI_LOC_SET_ENGINE_LOCK_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_ENGINE_LOCK_IND_V02. */
+
+ const qmiLocGetEngineLockIndMsgT_v02* pGetEngineLockInd;
+ /**< Response to the QMI_LOC_GET_ENGINE_LOCK_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_ENGINE_LOCK_IND_V02. */
+
+ const qmiLocSetSbasConfigIndMsgT_v02* pSetSbasConfigInd;
+ /**< Response to the QMI_LOC_SET_SBAS_CONFIG_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_SBAS_CONFIG_IND_V02. */
+
+ const qmiLocGetSbasConfigIndMsgT_v02* pGetSbasConfigInd;
+ /**< Response to the QMI_LOC_GET_SBAS_CONFIG_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_SBAS_CONFIG_IND_V02. */
+
+ const qmiLocSetNmeaTypesIndMsgT_v02* pSetNmeaTypesInd;
+ /**< Response to the QMI_LOC_SET_NMEA_TYPES_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_NMEA_TYPES_IND_V02. */
+
+ const qmiLocGetNmeaTypesIndMsgT_v02* pGetNmeaTypesInd;
+ /**< Response to the QMI_LOC_GET_NMEA_TYPES_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_NMEA_TYPES_IND_V02. */
+
+ const qmiLocSetLowPowerModeIndMsgT_v02* pSetLowPowerModeInd;
+ /**< Response to the QMI_LOC_SET_LOW_POWER_MODE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_LOW_POWER_MODE_IND_V02. */
+
+ const qmiLocGetLowPowerModeIndMsgT_v02* pGetLowPowerModeInd;
+ /**< Response to the QMI_LOC_GET_LOW_POWER_MODE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_LOW_POWER_MODE_IND_V02. */
+
+ const qmiLocRegisterMasterClientIndMsgT_v02* pRegisterMasterClientInd;
+ /**< Response to QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_REGISTER_MASTER_CLIENT_IND_V02. */
+
+ const qmiLocSetServerIndMsgT_v02* pSetServerInd;
+ /**< Response to the QMI_LOC_SET_SERVER_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_SERVER_IND_V02. */
+
+ const qmiLocGetServerIndMsgT_v02* pGetServerInd;
+ /**< Response to the QMI_LOC_GET_SERVER_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_SERVER_IND_V02. */
+
+ const qmiLocDeleteAssistDataIndMsgT_v02* pDeleteAssistDataInd;
+ /**< Response to the QMI_LOC_DELETE_ASSIST_DATA_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_DELETE_ASSIST_DATA_IND_V02. */
+
+ const qmiLocInjectApCacheDataIndMsgT_v02 *pInjectApCacheDataInd;
+ /**< Response to the QMI_LOC_INJECT_APCACHE_DATA_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_APCACHE_DATA_IND_V02. */
+
+ const qmiLocInjectApDoNotCacheDataIndMsgT_v02 *pInjectApDoNotCacheDataInd;
+ /**< Response to the QMI_LOC_INJECT_DONOTAPCACHE_DATA_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_DONOTAPCACHE_DATA_IND_V02. */
+
+ const qmiLocSetXtraTSessionControlIndMsgT_v02* pSetXtraTSessionControlInd;
+ /**< Response to the QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_XTRA_T_SESSION_CONTROL_IND_V02. */
+
+ const qmiLocGetXtraTSessionControlIndMsgT_v02* pGetXtraTSessionControlInd;
+ /**< Response to the QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_XTRA_T_SESSION_CONTROL_IND_V02. */
+
+ const qmiLocInjectWifiPositionIndMsgT_v02* pInjectWifiPositionInd;
+ /**< Response to the QMI_LOC_INJECT_WIFI_POSITION_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_WIFI_POSITION_IND_V02. */
+
+ const qmiLocNotifyWifiStatusIndMsgT_v02* pNotifyWifiStatusInd;
+ /**< Response to the QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_NOTIFY_WIFI_STATUS_IND_V02. */
+
+ const qmiLocGetRegisteredEventsIndMsgT_v02* pGetRegisteredEventsInd;
+ /**< Response to the QMI_LOC_GET_REGISTERED_EVENTS_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_REGISTERED_EVENTS_IND_V02. */
+
+ const qmiLocSetOperationModeIndMsgT_v02* pSetOperationModeInd;
+ /**< Response to the QMI_LOC_SET_OPERATION_MODE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_OPERATION_MODE_IND_V02. */
+
+ const qmiLocGetOperationModeIndMsgT_v02* pGetOperationModeInd;
+ /**< Response to the QMI_LOC_GET_OPERATION_MODE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_OPERATION_MODE_IND_V02. */
+
+ const qmiLocSetSpiStatusIndMsgT_v02* pSetSpiStatusInd;
+ /**< Response to the QMI_LOC_SET_SPI_STATUS_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_SPI_STATUS_IND_V02. */
+
+ const qmiLocInjectSensorDataIndMsgT_v02* pInjectSensorDataInd;
+ /**< Response to the QMI_LOC_INJECT_SENSOR_DATA_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_SENSOR_DATA_IND_V02. */
+
+ const qmiLocInjectTimeSyncDataIndMsgT_v02* pInjectTimeSyncDataInd;
+ /**< Response to the QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_TIME_SYNC_DATA_IND_V02. */
+
+ const qmiLocSetCradleMountConfigIndMsgT_v02* pSetCradleMountConfigInd;
+ /**< Response to the QMI_LOC_SET_CRADLE_MOUNT_CONFIG_IND_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ_V02. */
+
+ const qmiLocGetCradleMountConfigIndMsgT_v02* pGetCradleMountConfigInd;
+ /**< Response to the QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_CRADLE_MOUNT_CONFIG_IND_V02. */
+
+ const qmiLocSetExternalPowerConfigIndMsgT_v02* pSetExternalPowerConfigInd;
+ /**< Response to the QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_EXTERNAL_POWER_CONFIG_IND_V02. */
+
+ const qmiLocGetExternalPowerConfigIndMsgT_v02* pGetExternalPowerConfigInd;
+ /**< Response to the QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_EXTERNAL_POWER_CONFIG_IND_V02. */
+
+ const qmiLocInformLocationServerConnStatusIndMsgT_v02*
+ pInformLocationServerConnStatusInd;
+ /**< Response to the QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02
+ request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02.*/
+
+ const qmiLocSetProtocolConfigParametersIndMsgT_v02*
+ pSetProtocolConfigParametersInd;
+ /**< Response to the QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02. */
+
+ const qmiLocGetProtocolConfigParametersIndMsgT_v02*
+ pGetProtocolConfigParametersInd;
+ /**< Response to the QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_IND_V02. */
+
+ const qmiLocSetSensorControlConfigIndMsgT_v02* pSetSensorControlConfigInd;
+ /**< Response to the QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_SENSOR_CONTROL_CONFIG_IND_V02.
+ */
+
+ const qmiLocGetSensorControlConfigIndMsgT_v02* pGetSensorControlConfigInd;
+ /**< Response to the QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_SENSOR_CONTROL_CONFIG_IND_V02.
+ */
+
+ const qmiLocSetSensorPropertiesIndMsgT_v02* pSetSensorPropertiesInd;
+ /**< Response to the QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_SENSOR_PROPERTIES_IND_V02.
+ */
+
+ const qmiLocGetSensorPropertiesIndMsgT_v02* pGetSensorPropertiesInd;
+ /**< Response to the QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_SENSOR_PROPERTIES_IND_V02.
+ */
+
+ const qmiLocSetSensorPerformanceControlConfigIndMsgT_v02*
+ pSetSensorPerformanceControlConfigInd;
+ /**< Response to the
+ QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02. */
+
+ const qmiLocGetSensorPerformanceControlConfigIndMsgT_v02*
+ pGetSensorPerformanceControlConfigInd;
+ /**< Response to the
+ QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02. */
+
+ const qmiLocInjectSuplCertificateIndMsgT_v02* pInjectSuplCertificateInd;
+ /**< Response to the QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02. */
+
+ const qmiLocDeleteSuplCertificateIndMsgT_v02* pDeleteSuplCertificateInd;
+ /**< Response to the QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_DELETE_SUPL_CERTIFICATE_IND_V02. */
+
+ const qmiLocSetPositionEngineConfigParametersIndMsgT_v02*
+ pSetPositionEngineConfigParametersInd;
+ /**< Response to the QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02
+ request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02. */
+
+ const qmiLocGetPositionEngineConfigParametersIndMsgT_v02*
+ pGetPositionEngineConfigParametersInd;
+ /**< Response to the QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02
+ request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02. */
+
+ const qmiLocAddCircularGeofenceIndMsgT_v02* pAddCircularGeofenceInd;
+ /**< Response to the QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02. */
+
+ const qmiLocDeleteGeofenceIndMsgT_v02* pDeleteGeofenceInd;
+ /**< Response to the QMI_LOC_DELETE_GEOFENCE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_DELETE_GEOFENCE_IND_V02. */
+
+ const qmiLocQueryGeofenceIndMsgT_v02* pQueryGeofenceInd;
+ /**< Response to the QMI_LOC_QUERY_GEOFENCE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_QUERY_GEOFENCE_IND_V02. */
+
+ const qmiLocEditGeofenceIndMsgT_v02* pEditGeofenceInd;
+ /**< Response to the QMI_LOC_EDIT_GEOFENCE_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_EDIT_GEOFENCE_IND_V02. */
+
+ const qmiLocGetBestAvailablePositionIndMsgT_v02*
+ pGetBestAvailablePositionInd;
+ /**< Response to the QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02. */
+
+ const qmiLocSecureGetAvailablePositionIndMsgT_v02*
+ pSecureGetBestAvailablePositionInd;
+ /**< Response to the QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_V02. */
+
+ const qmiLocInjectMotionDataIndMsgT_v02* pInjectMotionDataInd;
+ /**< Response to the QMI_LOC_INJECT_MOTION_DATA_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_MOTION_DATA_IND_V02. */
+
+ const qmiLocGetNiGeofenceIdListIndMsgT_v02* pGetNiGeofenceIdListInd;
+ /**< Response to the QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02. */
+
+ const qmiLocInjectGSMCellInfoIndMsgT_v02* pInjectGSMCellInfoInd;
+ /**< Response to the QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02 request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02. */
+
+ const qmiLocInjectNetworkInitiatedMessageIndMsgT_v02*
+ pInjectNetworkInitiatedMessageInd;
+
+ /**< Response to the QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02
+ request.
+
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02. */
+
+ const qmiLocWWANOutOfServiceNotificationIndMsgT_v02*
+ pWWANOutOfServiceNotificationInd;
+
+ /**< Response to the QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02
+ request.
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_IND_V02. */
+
+ const qmiLocPedometerReportIndMsgT_v02* pPedometerReportInd;
+
+ /**< Response to the QMI_LOC_PEDOMETER_REPORT_REQ_V02 request.
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_PEDOMETER_REPORT_IND_V02. */
+
+ const qmiLocInjectWCDMACellInfoIndMsgT_v02 *pInjectWCDMACellInfoInd;
+ const qmiLocInjectTDSCDMACellInfoIndMsgT_v02 *pInjectTDSCDMACellInfoInd;
+ const qmiLocInjectSubscriberIDIndMsgT_v02 *pInjectSubscriberIDInd;
+ const qmiLocInjectWifiApDataIndMsgT_v02 *pInjectWifiApDataInd;
+ const qmiLocNotifyWifiAttachmentStatusIndMsgT_v02 *pNotifyWifiAttachmentStatusInd;
+ const qmiLocNotifyWifiEnabledStatusIndMsgT_v02 *pNotifyWifiEnabledStatusInd;
+
+ const qmiLocInjectVehicleSensorDataIndMsgT_v02 *pInjectVehicleSensorDataInd;
+
+ /**< Response to the QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02 request.
+ The respIndId field in the response indication callback is set to
+ QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_IND_V02. */
+
+ const qmiLocGetAvailWwanPositionIndMsgT_v02 *pGetAvailWwanPositionInd;
+ /*QMI_LOC_GET_AVAILABLE_WWAN_POSITION_IND_V02*/
+
+ const qmiLocSetXtraVersionCheckIndMsgT_v02 *pSetXtraVersionCheckInd;
+ /*QMI_LOC_SET_XTRA_VERSION_CHECK_IND_V02*/
+
+ const qmiLocSetGNSSConstRepConfigIndMsgT_v02 *pSetGNSSConstRepConfigInd;
+ /*QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_IND_V02*/
+
+ const qmiLocStartDbtIndMsgT_v02 *pStartDbtInd;
+ /*QMI_LOC_START_DBT_IND_V02*/
+
+ const qmiLocStopDbtIndMsgT_v02 *pStopDbtInd;
+ /*QMI_LOC_STOP_DBT_IND_V02*/
+
+ const qmiLocInjectTimeZoneInfoIndMsgT_v02 *pInjectTimeZoneInfoInd;
+ /*QMI_LOC_INJECT_TIME_ZONE_INFO_IND_V02*/
+
+ const qmiLocQueryAonConfigIndMsgT_v02 *pQueryAonConfigInd;
+ /*QMI_LOC_QUERY_AON_CONFIG_IND_V02*/
+
+ const qmiLocGetSupportedFeatureIndMsgT_v02 *pGetSupportedFeatureInd;
+ /*QMI_LOC_GET_SUPPORTED_FEATURE_IND_V02*/
+
+ const qmiLocGtpApStatusIndMsgT_v02 *pGtpApStatusInd;
+ /*QMI_LOC_GTP_AP_STATUS_IND_V02*/
+
+ const qmiLocGdtDownloadBeginStatusIndMsgT_v02 *pGdtDownloadBeginStatusInd;
+ /*QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_IND_V02*/
+
+ const qmiLocGdtDownloadReadyStatusIndMsgT_v02 *pGdtDownloadReadyStatusInd;
+ /*QMI_LOC_GDT_DOWNLOAD_READY_STATUS_IND_V02*/
+
+ const qmiLocGdtReceiveDoneStatusIndMsgT_v02 *pGdtReceiveDoneStatusInd;
+ /*QMI_LOC_GDT_RECEIVE_DONE_STATUS_IND_V02*/
+
+ const qmiLocGdtDownloadEndStatusIndMsgT_v02 *pGdtDownloadEndStatusInd;
+ /*QMI_LOC_GDT_DOWNLOAD_END_STATUS_IND_V02*/
+
+ const qmiLocDeleteGNSSServiceDataIndMsgT_v02 *pDeleteGNSSServiceDataInd;
+ /* QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02*/
+
+ const qmiLocInjectSrnApDataIndMsgT_v02 *pInjectSrnApDataInd;
+ /*QMI_LOC_INJECT_SRN_AP_DATA_IND_V02*/
+
+ const qmiLocCrowdSourceManagerControlIndMsgT_v02 *pCrowdSourceManagerControlInd;
+ /* QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_IND_V02*/
+
+ const qmiLocStartOutdoorTripBatchingIndMsgT_v02 *pStartOutdoorTripBatchingInd;
+ /*QMI_LOC_START_OUTDOOR_TRIP_BATCHING_IND_V02*/
+
+ const qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02 *pQueryOTBAccumulatedDistanceInd;
+ /*QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_IND_V02*/
+
+ const qmiLocInjectXtraDataIndMsgT_v02 *pInjectXtraDataInd;
+ /*QMI_LOC_INJECT_XTRA_DATA_IND_V02*/
+
+ const qmiLocGetFdclBsListIndMsgT_v02 *pGetFdclBsListInd;
+ /*QMI_LOC_GET_FDCL_BS_LIST_IND_V02 */
+
+ const qmiLocInjectFdclDataIndMsgT_v02 *pInjectFdclDataInd;
+ /* QMI_LOC_INJECT_FDCL_DATA_IND_V02 */
+
+ const qmiLocGetBsObsDataIndMsgT_v02 *pGetBsObsDataInd;
+ /* QMI_LOC_GET_BS_OBS_DATA_IND_V02 */
+
+ const qmiLocQueryGNSSEnergyConsumedIndMsgT_v02 *pQueryGNSSEnergyConsumedInd;
+ /* QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_IND_V02*/
+
+ const qmiLocInjectPlatformPowerStateIndMsgT_v02 *pInjectPlatformPowerStateInd;
+ /* QMI_LOC_INJECT_PLATFORM_POWER_STATE_IND_V02 */
+
+}locClientRespIndUnionType;
+
+/** @} */ /* end_addtogroup data_types */
+
+/** @addtogroup callback_functions
+@{ */
+/**
+ Location event indication callback function type. The Location service can
+ generate two types of indications:
+
+ - Asynchronous events indications, such as time injection request and satellite
+ reports. The client specifies the asynchronous events it is interested in
+ receiving through the event mask (see locClientOpen()).
+ - Response indications that are generated as a response to a request. For
+ example, the QMI_LOC_GET_FIX_CRITERIA_REQ_V02 request generates the
+ indication, QMI_LOC_GET_FIX_CRITERIA_IND_V02.
+
+ This callback handles the asynchronous event indications.
+
+ @datatypes
+ #locClientHandleType \n
+ #locClientEventIndUnionType
+
+ @param handle Location client for this event. Only the client who
+ registered for the corresponding event receives
+ this callback.
+ @param eventIndId ID of the event indication.
+ @param eventIndPayload Event indication payload.
+ @param pClientCookie Pointer to the cookie the client specified during
+ registration.
+
+ @return
+ None.
+
+ @dependencies
+ None. @newpage
+*/
+typedef void (*locClientEventIndCbType)(
+ locClientHandleType handle,
+ uint32_t eventIndId,
+ const locClientEventIndUnionType eventIndPayload,
+ void *pClientCookie
+);
+
+/**
+ Location response indication callback function type. The Location service can
+ generate two types of indications:
+
+ - Asynchronous events indications, such as time injection request and satellite
+ reports. The client specifies the asynchronous events it is interested in
+ receiving through the event mask (see locClientOpen()).
+ - Response indications that are generated as a response to a request. For
+ example, the QMI_LOC_GET_FIX_CRITERIA_REQ_V02 request generates the
+ indication, QMI_LOC_GET_FIX_CRITERIA_IND_V02.
+
+ This callback handles the response indications.
+
+ @datatypes
+ #locClientHandleType \n
+ #locClientRespIndUnionType
+
+ @param handle Location client who sent the request for which this
+ response indication is generated.
+ @param respIndId ID of the response. It is the same value as the ID
+ of request sent to the engine.
+ @param respIndPayload Payload of the response indication.
+ @param pClientCookie Pointer to the cookie the client specified during
+ registration.
+
+ @return
+ None.
+
+ @dependencies
+ None. @newpage
+*/
+typedef void (*locClientRespIndCbType)(
+ locClientHandleType handle,
+ uint32_t respIndId,
+ const locClientRespIndUnionType respIndPayload,
+ uint32_t respIndPayloadSize,
+ void *pClientCookie
+);
+
+/**
+ Location error callback function type. This function is called to inform
+ the client that the service is no longer available. When the client
+ receives this callback, it must close the existing connection and reopen
+ the client connection.
+
+ @datatypes
+ #locClientHandleType \n
+ #locClientErrorEnumType
+
+ @param handle Location client who sent the request for which this
+ error indication is generated.
+ @param errorId Error ID.
+ @param pClientCookie Payload associated with the error indication.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+typedef void (*locClientErrorCbType)(
+ locClientHandleType handle,
+ locClientErrorEnumType errorId,
+ void* pClientCookie
+ );
+/** @} */ /* end_addtogroup callback_functions */
+
+
+/** @ingroup data_types
+ Callback functions to be registered during locClientOpen().
+*/
+typedef struct
+{
+ uint32_t size; /**< Size of the structure. */
+ locClientEventIndCbType eventIndCb; /**< Event indication callback. */
+ locClientRespIndCbType respIndCb; /**< Response indication callback. */
+ locClientErrorCbType errorCb; /**< Error indication callback.
+ @newpagetable */
+}locClientCallbacksType;
+
+/**
+ Response for getting qmi service list
+*/
+typedef struct
+{
+ qmi_get_supported_msgs_resp_v01 resp; /**< Response */
+}qmiLocGetSupportMsgT_v02;
+
+/*===========================================================================
+ *
+ * FUNCTION DECLARATION
+ *
+ *==========================================================================*/
+/** @addtogroup operation_functions
+@{ */
+/*==========================================================================
+ locClientOpen */
+/** @xreflabel{hdr:locClientOpenFunction}
+ Connects a location client to the location engine. If the connection is
+ successful, this function returns a handle that the location client uses for
+ future location operations.
+
+ @datatypes
+ #locClientStatusEnumType \n
+ #locClientEventMaskType \n
+ #locClientCallbacksType \n
+ #locClientHandleType
+
+ @param[in] eventRegMask Mask of asynchronous events the client is
+ interested in receiving.
+ @param[in] pLocClientCallbacks Pointer to structure containing the
+ callbacks.
+ @param[out] pLocClientHandle Pointer to the handle to be used by the
+ client for any subsequent requests.
+ @param[in] pLocClientCookie Pointer to a cookie to be returned to the
+ client along with the callbacks.
+
+ @return
+ One of the following error codes:
+ - eLOC_CLIENT_SUCCESS -- If the connection is opened.
+ - Non-zero error code (see #locClientStatusEnumType) -- On failure.
+
+ @dependencies
+ None. @newpage
+*/
+extern locClientStatusEnumType locClientOpen (
+ locClientEventMaskType eventRegMask,
+ const locClientCallbacksType* pLocClientCallbacks,
+ locClientHandleType* pLocClientHandle,
+ const void* pLocClientCookie
+);
+
+
+/*==========================================================================
+ locClientClose */
+/** @xreflabel{hdr:locClientCloseFunction}
+ Disconnects a client from the location engine and sets the handle to
+ LOC_CLIENT_INVALID_HANDLE_VALUE.
+
+ @datatypes
+ #locClientStatusEnumType \n
+ #locClientHandleType
+
+ @param[in] pLocClientHandle Pointer to the handle returned by the
+ locClientOpen() function.
+
+ @return
+ One of the following error codes:
+ - 0 (eLOC_CLIENT_SUCCESS) -- On success.
+ - Non-zero error code (see \ref locClientStatusEnumType) -- On failure.
+
+ @dependencies
+ None. @newpage
+*/
+extern locClientStatusEnumType locClientClose (
+ locClientHandleType* pLocClientHandle
+);
+
+/*=============================================================================
+ locClientSendReq */
+/** @xreflabel{hdr:locClientSendReqFunction}
+ Sends a message to the location engine. If this function is successful, the
+ client expects an indication (except start, stop, event registration, and
+ sensor injection messages) through the registered callback in the
+ locClientOpen() function.
+
+ The indication contains the status of the request. If the status is a success,
+ the indication also contains the payload associated with response.
+
+ @datatypes
+ #locClientStatusEnumType \n
+ #locClientHandleType \n
+ #locClientReqUnionType
+
+ @param[in] handle Handle returned by the locClientOpen() function.
+ @param[in] reqId QMI_LOC service message ID of the request.
+ @param[in] reqPayload Payload of the request. This can be NULL if the
+ request has no payload.
+
+ @return
+ One of the following error codes:
+ - 0 (eLOC_CLIENT_SUCCESS) -- On success.
+ - Non-zero error code (see \ref locClientStatusEnumType) -- On failure.
+
+ @dependencies
+ None. @newpage
+*/
+extern locClientStatusEnumType locClientSendReq(
+ locClientHandleType handle,
+ uint32_t reqId,
+ locClientReqUnionType reqPayload
+);
+
+/*=============================================================================
+ locClientSupportMsgCheck */
+/**
+ @brief Sends a QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02 message to the
+ location engine, and then receives a list of all services supported
+ by the engine. This function will check if the input service(s) form
+ the client is in the list or not. If the locClientSupportMsgCheck()
+ function is successful, the client should expect an result of
+ the service is supported or not recorded in supportedMsg.
+ @param [in] handle Handle returned by the locClientOpen()
+ function.
+ @param [in] supportedMsg a integer used to record which
+ message is supported
+
+ @return
+ One of the following error codes:
+ - 0 (eLOC_CLIENT_SUCCESS) -- On success.
+ - Non-zero error code (see \ref locClientStatusEnumType) -- On failure.
+
+ @dependencies
+ None. @newpage
+*/
+extern locClientStatusEnumType locClientSupportMsgCheck(
+ locClientHandleType handle,
+ const uint32_t* msgArray,
+ uint32_t msgArrayLength,
+ uint64_t* supportedMsg
+);
+
+/*=============================================================================
+ locClientGetSizeByEventIndId */
+/** Gets the size of the event indication structure from a specified ID.
+
+ @param[in] eventIndId Event indicator ID.
+ @param[out] pEventIndSize Pointer to the size of the structure.
+
+ @return
+ TRUE -- The event ID was found. \n
+ FALSE -- Otherwise.
+
+ @dependencies
+ None. @newpage
+*/
+extern bool locClientGetSizeByEventIndId(
+ uint32_t eventIndId,
+ size_t *pEventIndSize);
+
+
+/*=============================================================================
+ locClientGetSizeByRespIndId */
+/** Gets the size of the response indication structure from a specified ID.
+
+ @param[in] respIndId Response indicator ID.
+ @param[out] pRespIndSize Pointer to the size of the structure.
+
+ @return
+ TRUE -- The response ID was found. \n
+ FALSE -- Otherwise.
+
+ @dependencies
+ None.
+*/
+extern bool locClientGetSizeByRespIndId(
+ uint32_t respIndId,
+ size_t *pRespIndSize);
+
+/** locClientRegisterEventMask
+ * @brief registers the event mask with loc service
+ * @param [in] clientHandle
+ * @param [in] eventRegMask
+ * @return true if indication was validated; else false */
+
+extern bool locClientRegisterEventMask(
+ locClientHandleType clientHandle,
+ locClientEventMaskType eventRegMask,
+ bool bIsMaster);
+
+/** validateRequest
+ @brief validates the input request
+ @param [in] reqId request ID
+ @param [in] reqPayload Union of pointers to message payload
+ @param [out] ppOutData Pointer to void *data if successful
+ @param [out] pOutLen Pointer to length of data if succesful.
+ @return false on failure, true on Success
+*/
+extern bool validateRequest(
+ uint32_t reqId,
+ const locClientReqUnionType reqPayload,
+ void **ppOutData,
+ uint32_t *pOutLen );
+
+/*=============================================================================*/
+/** @} */ /* end_addtogroup operation_functions */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_V02_CLIENT_H*/
diff --git a/location/loc_api/loc_api_v02/loc_api_v02_log.cpp b/location/loc_api/loc_api_v02/loc_api_v02_log.cpp
new file mode 100644
index 0000000..f84e234
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc_api_v02_log.cpp
@@ -0,0 +1,288 @@
+/* Copyright (c) 2011-2015, 2018-2020 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_api_v02_log.h>
+#include <location_service_v02.h>
+
+DECLARE_TBL(loc_v02_event_name) =
+{
+ NAME_VAL(QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_SUPPORTED_FIELDS_REQ_V02),
+ NAME_VAL(QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02),
+ NAME_VAL(QMI_LOC_REG_EVENTS_REQ_V02),
+ NAME_VAL(QMI_LOC_START_REQ_V02),
+ NAME_VAL(QMI_LOC_STOP_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_POSITION_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_NMEA_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_ENGINE_STATE_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_WIFI_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_TIME_SYNC_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_SET_SPI_STREAMING_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_GET_SERVICE_REVISION_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_FIX_CRITERIA_REQ_V02),
+ NAME_VAL(QMI_LOC_NI_USER_RESPONSE_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_UTC_TIME_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_POSITION_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_ENGINE_LOCK_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_ENGINE_LOCK_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_SBAS_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_SBAS_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_NMEA_TYPES_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_NMEA_TYPES_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_LOW_POWER_MODE_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_LOW_POWER_MODE_REQ_V02),
+ NAME_VAL(QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_SERVER_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_SERVER_REQ_V02),
+ NAME_VAL(QMI_LOC_DELETE_ASSIST_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_WIFI_POSITION_REQ_V02),
+ NAME_VAL(QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_REGISTERED_EVENTS_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_OPERATION_MODE_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_OPERATION_MODE_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_SPI_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_SENSOR_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02),
+ NAME_VAL(QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02),
+ NAME_VAL(QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02),
+ NAME_VAL(QMI_LOC_DELETE_GEOFENCE_REQ_V02),
+ NAME_VAL(QMI_LOC_QUERY_GEOFENCE_REQ_V02),
+ NAME_VAL(QMI_LOC_EDIT_GEOFENCE_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_MOTION_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02),
+ NAME_VAL(QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02),
+ NAME_VAL(QMI_LOC_PEDOMETER_REPORT_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_WCDMA_CELL_INFO_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_TDSCDMA_CELL_INFO_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_SUBSCRIBER_ID_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_BATCH_SIZE_REQ_V02),
+ NAME_VAL(QMI_LOC_START_BATCHING_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_READ_FROM_BATCH_REQ_V02),
+ NAME_VAL(QMI_LOC_STOP_BATCHING_REQ_V02),
+ NAME_VAL(QMI_LOC_RELEASE_BATCH_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_INJECT_WIFI_AP_DATA_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_INJECT_WIFI_AP_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_IND_V02),
+ NAME_VAL(QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_XTRA_VERSION_CHECK_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02),
+ NAME_VAL(QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_REQ_V02),
+ NAME_VAL(QMI_LOC_DELETE_GEOFENCE_CONTEXT_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_IND_V02),
+ NAME_VAL(QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_GDT_UPLOAD_END_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_START_DBT_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_DBT_SESSION_STATUS_IND_V02),
+ NAME_VAL(QMI_LOC_STOP_DBT_REQ_V02),
+ NAME_VAL(QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GET_TIME_ZONE_INFO_IND_V02),
+ NAME_VAL(QMI_LOC_INJECT_TIME_ZONE_INFO_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_APCACHE_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_APDONOTCACHE_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_BATCHING_STATUS_IND_V02),
+ NAME_VAL(QMI_LOC_QUERY_AON_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GTP_AP_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_XTRA_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_XTRA_PCID_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_INTERNAL_STATUS_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_INTERNAL_STATUS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_INJECT_SRN_AP_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ_V02),
+ NAME_VAL(QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_QUERY_XTRA_INFO_REQ_V02),
+ NAME_VAL(QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ_V02),
+ NAME_VAL(QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_FDCL_BS_LIST_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_FDCL_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_FDCL_SERVICE_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_SET_BLACKLIST_SV_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_BLACKLIST_SV_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_GET_BS_OBS_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02),
+ NAME_VAL(QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02),
+ NAME_VAL(QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_SYSTEM_INFO_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_REQ_V02),
+ NAME_VAL(QMI_LOC_INJECT_TEST_POSITION_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02),
+ NAME_VAL(QMI_LOC_GET_BS_OBS_DATA_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02),
+ NAME_VAL(QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02),
+ NAME_VAL(QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02),
+ NAME_VAL(QMI_LOC_EVENT_REPORT_IND_V02),
+ NAME_VAL(QMI_LOC_GET_BAND_MEASUREMENT_METRICS_IND_V02),
+ NAME_VAL(QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02),
+ NAME_VAL(QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ_V02),
+ NAME_VAL(QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ_V02),
+ NAME_VAL(QMI_LOC_GET_ROBUST_LOCATION_CONFIG_REQ_V02),
+};
+
+const char* loc_get_v02_event_name(uint32_t event)
+{
+ return loc_get_name_from_val(loc_v02_event_name_tbl, (int64_t) event);
+}
+
+DECLARE_TBL(loc_v02_client_status_name) =
+{
+ NAME_VAL(eLOC_CLIENT_SUCCESS),
+ NAME_VAL(eLOC_CLIENT_FAILURE_GENERAL),
+ NAME_VAL(eLOC_CLIENT_FAILURE_UNSUPPORTED),
+ NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_PARAMETER),
+ NAME_VAL(eLOC_CLIENT_FAILURE_ENGINE_BUSY),
+ NAME_VAL(eLOC_CLIENT_FAILURE_PHONE_OFFLINE),
+ NAME_VAL(eLOC_CLIENT_FAILURE_TIMEOUT),
+ NAME_VAL(eLOC_CLIENT_FAILURE_SERVICE_NOT_PRESENT),
+ NAME_VAL(eLOC_CLIENT_FAILURE_SERVICE_VERSION_UNSUPPORTED),
+ NAME_VAL(eLOC_CLIENT_FAILURE_CLIENT_VERSION_UNSUPPORTED),
+ NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_HANDLE),
+ NAME_VAL(eLOC_CLIENT_FAILURE_INTERNAL),
+ NAME_VAL(eLOC_CLIENT_FAILURE_NOT_INITIALIZED),
+ NAME_VAL(eLOC_CLIENT_FAILURE_NOT_ENOUGH_MEMORY),
+ NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_MESSAGE_ID),
+};
+
+const char* loc_get_v02_client_status_name(locClientStatusEnumType status)
+{
+ return loc_get_name_from_val(loc_v02_client_status_name_tbl, (int64_t) status);
+}
+
+
+DECLARE_TBL(loc_v02_qmi_status_name) =
+{
+ NAME_VAL(eQMI_LOC_SUCCESS_V02),
+ NAME_VAL(eQMI_LOC_GENERAL_FAILURE_V02),
+ NAME_VAL(eQMI_LOC_UNSUPPORTED_V02),
+ NAME_VAL(eQMI_LOC_INVALID_PARAMETER_V02),
+ NAME_VAL(eQMI_LOC_ENGINE_BUSY_V02),
+ NAME_VAL(eQMI_LOC_PHONE_OFFLINE_V02),
+ NAME_VAL(eQMI_LOC_TIMEOUT_V02),
+ NAME_VAL(eQMI_LOC_CONFIG_NOT_SUPPORTED_V02),
+ NAME_VAL(eQMI_LOC_INSUFFICIENT_MEMORY_V02),
+ NAME_VAL(eQMI_LOC_MAX_GEOFENCE_PROGRAMMED_V02),
+ NAME_VAL(eQMI_LOC_XTRA_VERSION_CHECK_FAILURE_V02),
+ NAME_VAL(eQMI_LOC_GNSS_DISABLED_V02),
+};
+
+const char* loc_get_v02_qmi_status_name(qmiLocStatusEnumT_v02 status)
+{
+ return loc_get_name_from_val(loc_v02_qmi_status_name_tbl, (int64_t) status);
+}
+
+
+DECLARE_TBL(loc_v02_qmi_reg_mk_status_name) =
+{
+ NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_SUCCESS_V02),
+ NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_INVALID_KEY_V02),
+ NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_ALREADY_HAVE_MASTER_CLIENT_V02),
+ NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_INTERNAL_FAILURE_V02),
+};
+
+const char* loc_get_v02_qmi_reg_mk_status_name(qmiLocRegisterMasterClientStatusEnumT_v02 status)
+{
+ return loc_get_name_from_val(loc_v02_qmi_reg_mk_status_name_tbl, (int64_t)status);
+}
diff --git a/location/loc_api/loc_api_v02/loc_api_v02_log.h b/location/loc_api/loc_api_v02/loc_api_v02_log.h
new file mode 100644
index 0000000..75acf8b
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc_api_v02_log.h
@@ -0,0 +1,51 @@
+/* Copyright (c) 2011, 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_API_V02_LOG_H
+#define LOC_API_V02_LOG_H
+
+#include <loc_log.h>
+#include <loc_api_v02_client.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+const char* loc_get_v02_event_name(uint32_t event);
+const char* loc_get_v02_client_status_name(locClientStatusEnumType status);
+const char* loc_get_v02_qmi_status_name(qmiLocStatusEnumT_v02 status);
+const char* loc_get_v02_qmi_reg_mk_status_name(qmiLocRegisterMasterClientStatusEnumT_v02 status);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_V02_LOG_H */
diff --git a/location/loc_api/loc_api_v02/loc_util_log.h b/location/loc_api/loc_api_v02/loc_util_log.h
new file mode 100644
index 0000000..db62686
--- /dev/null
+++ b/location/loc_api/loc_api_v02/loc_util_log.h
@@ -0,0 +1,78 @@
+/* Copyright (c) 2011-2012, 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_UTIL_LOG_H
+#define LOC_UTIL_LOG_H
+
+#include <log_util.h>
+
+#if defined(_ANDROID_)
+#include "loc_api_v02_log.h"
+
+#else // no _ANDROID_
+
+#if defined(__LOC_API_V02_LOG_SILENT__)
+#define MSG_LOG
+#define LOC_LOGE(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGW(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGD(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGI(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGV(...) MSG_LOG(__VA_ARGS__);
+#elif !defined(USE_GLIB)
+
+// common for QNX and Griffon
+
+//error logs
+#define LOC_LOGE(...) printf(__VA_ARGS__)
+//warning logs
+#define LOC_LOGW(...) printf(__VA_ARGS__)
+// debug logs
+#define LOC_LOGD(...) printf(__VA_ARGS__)
+//info logs
+#define LOC_LOGI(...) printf(__VA_ARGS__)
+//verbose logs
+#define LOC_LOGV(...) printf(__VA_ARGS__)
+#endif //__LOC_API_V02_LOG_SILENT__
+
+//specific to OFF TARGET
+#ifdef LOC_UTIL_TARGET_OFF_TARGET
+
+# include <stdio.h>
+# include <asm/errno.h>
+# include <sys/time.h>
+
+// get around strl*: not found in glibc
+// TBD:look for presence of eglibc other libraries
+// with strlcpy supported.
+#define strlcpy(X,Y,Z) strcpy(X,Y)
+#define strlcat(X,Y,Z) strcat(X,Y)
+
+#endif //LOC_UTIL_TARGET_OFF_TARGET
+
+#endif //_ANDROID_
+
+#endif //LOC_UTIL_LOG_H
diff --git a/location/loc_api/loc_api_v02/location_service_v02.c b/location/loc_api/loc_api_v02/location_service_v02.c
new file mode 100644
index 0000000..493ada7
--- /dev/null
+++ b/location/loc_api/loc_api_v02/location_service_v02.c
@@ -0,0 +1,9426 @@
+/* Copyright (c) 2011-2020, 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.
+ */
+/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*
+ *THIS IS AN AUTO GENERATED FILE. DO NOT ALTER IN ANY WAY
+ *====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
+
+/* This file was generated with Tool version 6.14.7
+ It was generated on: Thu Oct 29 2020 (Spin 0)
+ From IDL File: location_service_v02.idl */
+
+#include "stdint.h"
+#include "qmi_idl_lib_internal.h"
+#include "location_service_v02.h"
+#include "common_v01.h"
+
+
+/*Type Definitions*/
+static const uint8_t qmiLocApplicationIdStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocApplicationIdStructT_v02, applicationProvider),
+ QMI_LOC_MAX_APP_ID_PROVIDER_LENGTH_V02,
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocApplicationIdStructT_v02, applicationName),
+ QMI_LOC_MAX_APP_ID_NAME_LENGTH_V02,
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApplicationIdStructT_v02, applicationVersion_valid),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocApplicationIdStructT_v02, applicationVersion),
+ QMI_LOC_MAX_APP_ID_VERSION_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocPowerModeStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPowerModeStructT_v02, powerMode),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPowerModeStructT_v02, timeBetweenMeasurement),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGPSTimeStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGPSTimeStructT_v02, gpsWeek),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGPSTimeStructT_v02, gpsTimeOfWeekMs),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocDOPStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDOPStructT_v02, PDOP),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDOPStructT_v02, HDOP),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDOPStructT_v02, VDOP),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocExtDOPStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocExtDOPStructT_v02, PDOP),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocExtDOPStructT_v02, HDOP),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocExtDOPStructT_v02, VDOP),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocExtDOPStructT_v02, GDOP),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocExtDOPStructT_v02, TDOP),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSensorUsageIndicatorStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorUsageIndicatorStructT_v02, usageMask),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorUsageIndicatorStructT_v02, aidingIndicatorMask),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocJammerIndicatorStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocJammerIndicatorStructT_v02, agcMetricDb),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocJammerIndicatorStructT_v02, bpMetricDb),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSvInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, validMask),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, system),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, gnssSvId),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, healthStatus),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, svStatus),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, svInfoMask),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, elevation),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, azimuth),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSvInfoStructT_v02, snr),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocExpandedSvInfoStructT_data_v02[] = {
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocExpandedSvInfoStructT_v02, svInfo),
+ QMI_IDL_TYPE88(0, 7),
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocExpandedSvInfoStructT_v02, gloFrequency),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiVxNotifyVerifyStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, posQosIncl),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, posQos),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, numFixes),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, timeBetweenFixes),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, posMode),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, encodingScheme),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, requestorId),
+ QMI_LOC_NI_MAX_REQUESTOR_ID_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, requestorId) - QMI_IDL_OFFSET8(qmiLocNiVxNotifyVerifyStructT_v02, requestorId_len),
+
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiVxNotifyVerifyStructT_v02, userRespTimerInSeconds),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiSuplFormattedStringStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplFormattedStringStructT_v02, formatType),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplFormattedStringStructT_v02, formattedString),
+ QMI_LOC_NI_MAX_CLIENT_NAME_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocNiSuplFormattedStringStructT_v02, formattedString) - QMI_IDL_OFFSET8(qmiLocNiSuplFormattedStringStructT_v02, formattedString_len),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiSuplQopStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplQopStructT_v02, validMask),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplQopStructT_v02, horizontalAccuracy),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplQopStructT_v02, verticalAccuracy),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplQopStructT_v02, maxLocAge),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplQopStructT_v02, delay),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocIpV4AddrStructType_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocIpV4AddrStructType_v02, addr),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocIpV4AddrStructType_v02, port),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocIpV6AddrStructType_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocIpV6AddrStructType_v02, addr),
+ QMI_LOC_IPV6_ADDR_LENGTH_V02,
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocIpV6AddrStructType_v02, port),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiSuplServerInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplServerInfoStructT_v02, suplServerAddrTypeMask),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplServerInfoStructT_v02, ipv4Addr),
+ QMI_IDL_TYPE88(0, 12),
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplServerInfoStructT_v02, ipv6Addr),
+ QMI_IDL_TYPE88(0, 13),
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocNiSuplServerInfoStructT_v02, urlAddr),
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiSuplNotifyVerifyStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplNotifyVerifyStructT_v02, valid_flags),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplNotifyVerifyStructT_v02, suplServerInfo),
+ QMI_IDL_TYPE88(0, 14),
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, suplSessionId),
+ QMI_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH_V02,
+
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, suplHash),
+ QMI_LOC_NI_SUPL_HASH_LENGTH_V02,
+
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, posMethod),
+
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, dataCodingScheme),
+
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, requestorId),
+ QMI_IDL_TYPE88(0, 10),
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, clientName),
+ QMI_IDL_TYPE88(0, 10),
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, suplQop),
+ QMI_IDL_TYPE88(0, 11),
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiSuplNotifyVerifyStructT_v02, userResponseTimer),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiUmtsCpCodedStringStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpCodedStringStructT_v02, dataCodingScheme),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpCodedStringStructT_v02, codedString),
+ QMI_LOC_NI_CODEWORD_MAX_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpCodedStringStructT_v02, codedString) - QMI_IDL_OFFSET8(qmiLocNiUmtsCpCodedStringStructT_v02, codedString_len),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiUmtsCpNotifyVerifyStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, valid_flags),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, invokeId),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, dataCodingScheme),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, notificationText),
+ QMI_LOC_NI_MAX_CLIENT_NAME_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, notificationText) - QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, notificationText_len),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, clientAddress),
+ QMI_LOC_NI_MAX_EXT_CLIENT_ADDRESS_V02,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, clientAddress) - QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, clientAddress_len),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, locationType),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, requestorId),
+ QMI_IDL_TYPE88(0, 16),
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, codewordString),
+ QMI_IDL_TYPE88(0, 16),
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, lcsServiceTypeId),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUmtsCpNotifyVerifyStructT_v02, userResponseTimer),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiVxServiceInteractionStructT_data_v02[] = {
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNiVxServiceInteractionStructT_v02, niVxReq),
+ QMI_IDL_TYPE88(0, 9),
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiVxServiceInteractionStructT_v02, serviceInteractionType),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNiSuplVer2ExtStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplVer2ExtStructT_v02, supportedNetworksMask),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplVer2ExtStructT_v02, triggerType),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiSuplVer2ExtStructT_v02, gnssType),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocEmergencyNotificationStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocEmergencyNotificationStructT_v02, eslpUrl),
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocAssistanceServerUrlStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocAssistanceServerUrlStructT_v02, serverUrl),
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocTimeServerListStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocTimeServerListStructT_v02, delayThreshold),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocTimeServerListStructT_v02, timeServerList),
+ QMI_LOC_MAX_NTP_SERVERS_V02,
+ QMI_IDL_OFFSET8(qmiLocTimeServerListStructT_v02, timeServerList) - QMI_IDL_OFFSET8(qmiLocTimeServerListStructT_v02, timeServerList_len),
+ QMI_IDL_TYPE88(0, 21),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocPredictedOrbitsAllowedSizesStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPredictedOrbitsAllowedSizesStructT_v02, maxFileSizeInBytes),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPredictedOrbitsAllowedSizesStructT_v02, maxPartSize),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocPredictedOrbitsServerListStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocPredictedOrbitsServerListStructT_v02, serverList),
+ QMI_LOC_MAX_PREDICTED_ORBITS_SERVERS_V02,
+ QMI_IDL_OFFSET8(qmiLocPredictedOrbitsServerListStructT_v02, serverList) - QMI_IDL_OFFSET8(qmiLocPredictedOrbitsServerListStructT_v02, serverList_len),
+ QMI_IDL_TYPE88(0, 21),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSensorControlConfigSamplingSpecStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorControlConfigSamplingSpecStructT_v02, samplesPerBatch),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorControlConfigSamplingSpecStructT_v02, batchesPerSecond),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSensorReadyStatusStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorReadyStatusStructT_v02, injectEnable),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSensorReadyStatusStructT_v02, dataFrequency),
+ QMI_IDL_TYPE88(0, 25),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGeofencePositionStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, timestampUtc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, latitude),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, longitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, horUncEllipseSemiMinor),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, horUncEllipseSemiMajor),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, horUncEllipseOrientAzimuth),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, speedHorizontal_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, speedHorizontal),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, altitudeWrtEllipsoid_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, vertUnc_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, vertUnc),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, speedVertical_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, speedVertical),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, heading_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofencePositionStructT_v02, heading),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGeofenceIdContinuousStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofenceIdContinuousStructT_v02, idLow),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofenceIdContinuousStructT_v02, idHigh),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocPredictedOrbitsDataValidityStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPredictedOrbitsDataValidityStructT_v02, startTimeInUTC),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPredictedOrbitsDataValidityStructT_v02, durationHours),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocAltitudeSrcInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAltitudeSrcInfoStructT_v02, source),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAltitudeSrcInfoStructT_v02, linkage),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAltitudeSrcInfoStructT_v02, coverage),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocDeleteSvInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteSvInfoStructT_v02, gnssSvId),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteSvInfoStructT_v02, system),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteSvInfoStructT_v02, deleteSvInfoMask),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocDeleteBDSSvInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteBDSSvInfoStructT_v02, gnssSvId),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteBDSSvInfoStructT_v02, deleteSvInfoMask),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocDeleteGALSvInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGALSvInfoStructT_v02, gnssSvId),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGALSvInfoStructT_v02, deleteSvInfoMask),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiFixTimeStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiFixTimeStructT_v02, wifiPositionTime),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiFixPosStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiFixPosStructT_v02, lat),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiFixPosStructT_v02, lon),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiFixPosStructT_v02, hepe),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiFixPosStructT_v02, numApsUsed),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiFixPosStructT_v02, fixErrorCode),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiApInfoStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApInfoStructT_v02, macAddr),
+ QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02,
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApInfoStructT_v02, rssi),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApInfoStructT_v02, channel),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApInfoStructT_v02, apQualifier),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiApSsidStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocWifiApSsidStructT_v02, ssid),
+ QMI_LOC_MAX_WIFI_AP_SSID_STR_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLoc3AxisSensorSampleStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleStructT_v02, timeOffset),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleStructT_v02, xAxis),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleStructT_v02, yAxis),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleStructT_v02, zAxis),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLoc3AxisSensorSampleListStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleListStructT_v02, timeOfFirstSample),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleListStructT_v02, flags),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleListStructT_v02, sensorData),
+ QMI_LOC_SENSOR_DATA_MAX_SAMPLES_V02,
+ QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleListStructT_v02, sensorData) - QMI_IDL_OFFSET8(qmiLoc3AxisSensorSampleListStructT_v02, sensorData_len),
+ QMI_IDL_TYPE88(0, 38),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSensorTemperatureSampleStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorTemperatureSampleStructT_v02, timeOffset),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorTemperatureSampleStructT_v02, temperature),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSensorTemperatureSampleListStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorTemperatureSampleListStructT_v02, timeSource),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSensorTemperatureSampleListStructT_v02, timeOfFirstSample),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSensorTemperatureSampleListStructT_v02, temperatureData),
+ QMI_LOC_SENSOR_DATA_MAX_SAMPLES_V02,
+ QMI_IDL_OFFSET8(qmiLocSensorTemperatureSampleListStructT_v02, temperatureData) - QMI_IDL_OFFSET8(qmiLocSensorTemperatureSampleListStructT_v02, temperatureData_len),
+ QMI_IDL_TYPE88(0, 40),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocApnProfilesStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApnProfilesStructT_v02, pdnType),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocApnProfilesStructT_v02, apnName),
+ QMI_LOC_MAX_APN_NAME_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocCircularGeofenceArgsStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCircularGeofenceArgsStructT_v02, latitude),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCircularGeofenceArgsStructT_v02, longitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCircularGeofenceArgsStructT_v02, radius),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGeofenceMotionStateConfigStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofenceMotionStateConfigStructT_v02, motionState),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGeofenceMotionStateConfigStructT_v02, motionStateSpeed),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocTimeZoneStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocTimeZoneStructT_v02, dstOffset),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocTimeZoneStructT_v02, rawOffset),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocMotionDataStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMotionDataStructT_v02, motion_state),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMotionDataStructT_v02, motion_mode),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMotionDataStructT_v02, probability_of_state),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMotionDataStructT_v02, age),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMotionDataStructT_v02, timeout),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGSMCellIdStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGSMCellIdStructT_v02, MCC),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGSMCellIdStructT_v02, MNC),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGSMCellIdStructT_v02, LAC),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGSMCellIdStructT_v02, CID),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWCDMACellIdStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWCDMACellIdStructT_v02, mcc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWCDMACellIdStructT_v02, mnc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWCDMACellIdStructT_v02, cid),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocTDSCDMACellIdStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocTDSCDMACellIdStructT_v02, mcc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocTDSCDMACellIdStructT_v02, mnc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocTDSCDMACellIdStructT_v02, cid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocTDSCDMACellIdStructT_v02, lac),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocBatchedReportStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, fixId),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, validFields),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, latitude),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, longitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, horUncCircular),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, speedHorizontal),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, speedUnc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, speedVertical),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, heading),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, headingUnc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, technologyMask),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, timestampUtc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, timeUnc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, magneticDeviation),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, vertUnc),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, horConfidence),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocBatchedReportStructT_v02, gpsTime),
+ QMI_IDL_TYPE88(0, 2),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiApDataStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, wifiApDataMask),
+
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, macAddress),
+ QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02,
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apTransmitPower),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apAntennaGain),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apSignalToNoise),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apDeviceType),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apRssi),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apChannel),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apRoundTripDelay),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apRoundTripDelayUnit),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, apRoundTripDelayAccuracy),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, mobileSignalToNoise),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApDataStructT_v02, mobileRssi),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiApAdditionalDataStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApAdditionalDataStructT_v02, rssiTimestamp),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApAdditionalDataStructT_v02, measAge),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApAdditionalDataStructT_v02, servingAccessPoint),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApAdditionalDataStructT_v02, channelFrequency),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocWifiApAdditionalDataStructT_v02, ssid),
+ QMI_LOC_MAX_WIFI_AP_SSID_STR_LENGTH_V02,
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApAdditionalDataStructT_v02, apHighResolutionRssi),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocVehicleSensorSampleStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleStructT_v02, timeOffset),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleStructT_v02, axisSample),
+ QMI_LOC_VEHICLE_SENSOR_DATA_MAX_AXES_V02,
+ QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleStructT_v02, axisSample) - QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleStructT_v02, axisSample_len),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocVehicleSensorSampleListStructType_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleListStructType_v02, sampleTimeBase),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleListStructType_v02, axesValidity),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleListStructType_v02, sensorData),
+ QMI_LOC_VEHICLE_SENSOR_DATA_MAX_SAMPLES_V02,
+ QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleListStructType_v02, sensorData) - QMI_IDL_OFFSET8(qmiLocVehicleSensorSampleListStructType_v02, sensorData_len),
+ QMI_IDL_TYPE88(0, 53),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocVehicleOdometrySampleStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleStructT_v02, timeOffset),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleStructT_v02, distanceTravelled),
+ QMI_LOC_VEHICLE_ODOMETRY_MAX_MEASUREMENTS_V02,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleStructT_v02, distanceTravelled) - QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleStructT_v02, distanceTravelled_len),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocVehicleOdometrySampleListStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleListStructT_v02, sampleTimeBase),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleListStructT_v02, flags),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleListStructT_v02, wheelFlags),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleListStructT_v02, distanceTravelledBase),
+
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleListStructT_v02, odometryData),
+ QMI_LOC_VEHICLE_SENSOR_DATA_MAX_SAMPLES_V02,
+ QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleListStructT_v02, odometryData) - QMI_IDL_OFFSET8(qmiLocVehicleOdometrySampleListStructT_v02, odometryData_len),
+ QMI_IDL_TYPE88(0, 55),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocRcvrClockFrequencyInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRcvrClockFrequencyInfoStructT_v02, clockDrift),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRcvrClockFrequencyInfoStructT_v02, clockDriftUnc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRcvrClockFrequencyInfoStructT_v02, sourceOfFreq),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocLeapSecondInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLeapSecondInfoStructT_v02, leapSec),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLeapSecondInfoStructT_v02, leapSecUnc),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocInterSystemBiasStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInterSystemBiasStructT_v02, validMask),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInterSystemBiasStructT_v02, timeBias),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInterSystemBiasStructT_v02, timeBiasUnc),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGnssTimeStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeStructT_v02, system),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeStructT_v02, systemWeek),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeStructT_v02, systemMsec),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeStructT_v02, systemClkTimeBias),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeStructT_v02, systemClkTimeUncMs),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGloTimeStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloTimeStructT_v02, gloFourYear),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloTimeStructT_v02, gloDays),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloTimeStructT_v02, gloMsec),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloTimeStructT_v02, gloClkTimeBias),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloTimeStructT_v02, gloClkTimeUncMs),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGnssTimeExtStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeExtStructT_v02, refFCount),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeExtStructT_v02, systemRtc_valid),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeExtStructT_v02, systemRtcMs),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssTimeExtStructT_v02, sourceOfTime),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSVTimeSpeedStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVTimeSpeedStructT_v02, svTimeMs),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVTimeSpeedStructT_v02, svTimeSubMs),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVTimeSpeedStructT_v02, svTimeUncMs),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVTimeSpeedStructT_v02, dopplerShift),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVTimeSpeedStructT_v02, dopplerShiftUnc),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVTimeSpeedStructT_v02, dopplerAccel_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVTimeSpeedStructT_v02, dopplerAccel),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSVMeasurementStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, gnssSvId),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, gloFrequency),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, svStatus),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, validMask),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, healthStatus),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, svInfoMask),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, validMeasStatusMask),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, measurementStatus),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, CNo),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, gloRfLoss),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, measLatency),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, svTimeSpeed),
+ QMI_IDL_TYPE88(0, 63),
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, lossOfLock),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, multipathEstimate),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, fineSpeed),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, fineSpeedUnc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, carrierPhase),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, cycleSlipCount),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, svAzimuth),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSVMeasurementStructT_v02, svElevation),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocDgnssSVMeasurementStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDgnssSVMeasurementStructT_v02, dgnssMeasStatus),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDgnssSVMeasurementStructT_v02, diffDataEpochTimeMsec),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDgnssSVMeasurementStructT_v02, prCorrMeters),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDgnssSVMeasurementStructT_v02, prrCorrMetersPerSec),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiApMacAddressStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiApMacAddressStructT_v02, wifiApMacAddress),
+ QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocIBeaconIdStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN |QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocIBeaconIdStructT_v02, uuid),
+ QMI_LOC_MAX_IBEACON_UUID_STR_LENGTH_V02,
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocIBeaconIdStructT_v02, majorNumber),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocIBeaconIdStructT_v02, minorNumber),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGtpAsnVerStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpAsnVerStructT_v02, asnMajorVersion),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpAsnVerStructT_v02, asnMinorVersion),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpAsnVerStructT_v02, asnPointVersion),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocDbtPositionStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, timestampUtc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, latitude),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, longitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, horUncEllipseSemiMinor),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, horUncEllipseSemiMajor),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, horUncEllipseOrientAzimuth),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, speedHorizontal_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, speedHorizontal),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, altitudeWrtEllipsoid_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, vertUnc_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, vertUnc),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, speedVertical_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, speedVertical),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, heading_valid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDbtPositionStructT_v02, heading),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocApCacheStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApCacheStructT_v02, macAddress),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApCacheStructT_v02, xLat),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApCacheStructT_v02, yLon),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApCacheStructT_v02, mar),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocApCacheHepeRelStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApCacheHepeRelStructT_v02, hepeValid),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApCacheHepeRelStructT_v02, hepe),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApCacheHepeRelStructT_v02, apReliability),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocApDoNotCacheStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocApDoNotCacheStructT_v02, macAddress),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocDeleteSatelliteDataStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteSatelliteDataStructT_v02, system),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteSatelliteDataStructT_v02, deleteSatelliteDataMask),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocInternalStatusReportDataStructT_data_v02[] = {
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInternalStatusReportDataStructT_v02, data),
+ QMI_LOC_INTERNAL_STATUS_REPORT_DATA_LENGTH_V02,
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocSrnBtleApDeviceDataStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSrnBtleApDeviceDataStructT_v02, srnApDataMask),
+
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSrnBtleApDeviceDataStructT_v02, macAddress),
+ QMI_LOC_SRN_MAC_ADDR_LENGTH_V02,
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSrnBtleApDeviceDataStructT_v02, apSrnRssi),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSrnBtleApDeviceDataStructT_v02, apSrnTimestamp),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiCrowdSourcingLocalConfigStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingLocalConfigStructT_v02, enableCrowdSourcingOnDemand),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingLocalConfigStructT_v02, enableCrowdSourcingOnUnsolicitedGnss),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingLocalConfigStructT_v02, enableBatteryLevelBasedThrottling),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingLocalConfigStructT_v02, enableRttCrowdSourcing),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingLocalConfigStructT_v02, enableRtt3CrowdSourcing),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingLocalConfigStructT_v02, rttSignalDbmThresh),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingLocalConfigStructT_v02, maxDataTransferFormatVersionSupported),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocWifiCrowdSourcingCapabilityStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingCapabilityStructT_v02, onDemandCrowdSourcingSupported),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingCapabilityStructT_v02, UnsolicitedGnssCrowdSourcingSupported),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingCapabilityStructT_v02, majorVersionSupported),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingCapabilityStructT_v02, minorVersionSupported),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWifiCrowdSourcingCapabilityStructT_v02, maxDataTransferFormatVersionSupported),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocXtraInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocXtraInfoStructT_v02, reportMask),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocXtraInfoStructT_v02, absAgeHrs),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocXtraInfoStructT_v02, relAgeInUTC),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocXtraInfoStructT_v02, xtraServerInfo),
+ QMI_IDL_TYPE88(0, 24),
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocXtraInfoStructT_v02, ntpServerInfo),
+ QMI_IDL_TYPE88(0, 22),
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocXtraInfoStructT_v02, timeRequest),
+
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocXtraInfoStructT_v02, preferedValidAgeHrs),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocVersionStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVersionStructT_v02, majorVersion),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocVersionStructT_v02, minorVersion),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGtpClientSwVerStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpClientSwVerStructT_v02, gtpClientSwMajorVersion),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpClientSwVerStructT_v02, gtpClientSwMinorVersion),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocHomeCarrierIdStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocHomeCarrierIdStructT_v02, homeMncValid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocHomeCarrierIdStructT_v02, homeMcc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocHomeCarrierIdStructT_v02, homeMnc),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocPositionSourceStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPositionSourceStructT_v02, unspecifiedInternal),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPositionSourceStructT_v02, unspecifiedExternal),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPositionSourceStructT_v02, gnss),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPositionSourceStructT_v02, sensors),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPositionSourceStructT_v02, wifi),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPositionSourceStructT_v02, wwan),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocBsBestPositionStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsBestPositionStructT_v02, latitude),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsBestPositionStructT_v02, longitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsBestPositionStructT_v02, horizontalUnc),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsBestPositionStructT_v02, altitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsBestPositionStructT_v02, altitudeUnc),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocBsBestPositionStructT_v02, latestPositionSources),
+ QMI_IDL_TYPE88(0, 82),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocFdclCellIdStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellIdStructT_v02, airInterfaceType),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellIdStructT_v02, id1),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellIdStructT_v02, id2),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellIdStructT_v02, id3),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellIdStructT_v02, id4),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocFdclCellPosStructT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, validMask),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, cellId),
+ QMI_IDL_TYPE88(0, 84),
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, latitude),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, longitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, horCoverageRadius),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, horConfidence),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, horReliability),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, altitude),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, altUnc),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, altConfidence),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocFdclCellPosStructT_v02, altReliability),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocNextLeapSecondInfoStructT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, gpsTimeCurrent_valid),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, gpsTimeCurrent),
+ QMI_IDL_TYPE88(0, 2),
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, leapSecondsCurrent_valid),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, leapSecondsCurrent),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, gpsTimeNextLsEvent_valid),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, gpsTimeNextLsEvent),
+ QMI_IDL_TYPE88(0, 2),
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, leapSecondsNext_valid),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNextLeapSecondInfoStructT_v02, leapSecondsNext),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocBsObservedDataStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, validMask),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, cellId),
+ QMI_IDL_TYPE88(0, 84),
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, gpsWeek),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, gpsMilliseconds),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, bsLocalTimestamp),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, posDeltaTime),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, speed),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, speedUnc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, heading),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, headingUnc),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocBsObservedDataStructT_v02, bsBestPosition),
+ QMI_IDL_TYPE88(0, 83),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocEphGnssDataStructT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, gnssSvId),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, updateAction),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, IODE),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, aSqrt),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, deltaN),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, m0),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, eccentricity),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, omega0),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, i0),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, omega),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, omegaDot),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, iDot),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, cUc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, cUs),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, cRc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, cRs),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, cIc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, cIs),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, toe),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, toc),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, af0),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, af1),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEphGnssDataStructT_v02, af2),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGpsEphemerisT_data_v02[] = {
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, commonEphemerisData),
+ QMI_IDL_TYPE88(0, 88),
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, signalHealth),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, URAI),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, codeL2),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, dataFlagL2P),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, tgd),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, fitInterval),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisT_v02, IODC),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGloEphemerisT_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, gnssSvId),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, updateAction),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, bnHealth),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, lnHealth),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, tb),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, ft),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, gloM),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, enAge),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, gloFrequency),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, p1),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, p2),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, deltaTau),
+
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, position),
+ 3,
+
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, velocity),
+ 3,
+
+ QMI_IDL_FLAGS_IS_ARRAY |QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, acceleration),
+ 3,
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, tauN),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, gamma),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, toe),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisT_v02, nt),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocBdsEphemerisT_data_v02[] = {
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisT_v02, commonEphemerisData),
+ QMI_IDL_TYPE88(0, 88),
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisT_v02, svHealth),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisT_v02, AODC),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisT_v02, tgd1),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisT_v02, tgd2),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisT_v02, URAI),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocGalEphemerisT_data_v02[] = {
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisT_v02, commonEphemerisData),
+ QMI_IDL_TYPE88(0, 88),
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisT_v02, dataSourceSignal),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisT_v02, sisIndex),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisT_v02, bgdE1E5a),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisT_v02, bgdE1E5b),
+
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisT_v02, svHealth),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocKlobucharIonoModelT_data_v02[] = {
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, dataSource),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, alpha0),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, alpha1),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, alpha2),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, alpha3),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, beta0),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, beta1),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, beta2),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocKlobucharIonoModelT_v02, beta3),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocMePerGnssRfStructType_data_v02[] = {
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMePerGnssRfStructType_v02, bpAmpI),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMePerGnssRfStructType_v02, bpAmpQ),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocMePerGnssRfStructType_v02, jammerPwrDb),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocRobustLocationVersionT_data_v02[] = {
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRobustLocationVersionT_v02, major),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRobustLocationVersionT_v02, minor),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocEnvAidingReflectingPlaneStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingReflectingPlaneStructT_v02, latitudeDegrees),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingReflectingPlaneStructT_v02, longitudeDegrees),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingReflectingPlaneStructT_v02, altitudeMeters),
+
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingReflectingPlaneStructT_v02, azimuthDegrees),
+
+ QMI_IDL_FLAG_END_VALUE
+};
+
+static const uint8_t qmiLocEnvAidingSVCorrectionStructT_data_v02[] = {
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, svCorrectionFlags),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, constellation),
+
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, svid),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, carrierFrequencyHz),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, probabilitySvIsLineofSight),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, excessPathLengthMeters),
+
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, excessPathLengthUncMeters),
+
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEnvAidingSVCorrectionStructT_v02, reflectingPlane),
+ QMI_IDL_TYPE88(0, 96),
+ QMI_IDL_FLAG_END_VALUE
+};
+
+/*Message Definitions*/
+/*
+ * qmiLocGenReqMsgT is empty
+ * static const uint8_t qmiLocGenReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGenRespMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGenRespMsgT_v02, resp),
+ QMI_IDL_TYPE88(1, 0)
+};
+
+static const uint8_t qmiLocGenReqStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGenReqStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInformClientRevisionReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInformClientRevisionReqMsgT_v02, revision)
+};
+
+static const uint8_t qmiLocRegEventsReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, eventRegMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, clientStrId) - QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, clientStrId_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, clientStrId),
+ QMI_LOC_MAX_CLIENT_ID_STRING_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, clientType) - QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, clientType_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, clientType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, enablePosRequestNotification) - QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, enablePosRequestNotification_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRegEventsReqMsgT_v02, enablePosRequestNotification)
+};
+
+static const uint8_t qmiLocStartReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, fixRecurrence) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, fixRecurrence_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, fixRecurrence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, horizontalAccuracyLevel) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, horizontalAccuracyLevel_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, horizontalAccuracyLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, intermediateReportState) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, intermediateReportState_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, intermediateReportState),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, minInterval) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, minInterval_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, minInterval),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, applicationId) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, applicationId_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, applicationId),
+ QMI_IDL_TYPE88(0, 0),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, configAltitudeAssumed) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, configAltitudeAssumed_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, configAltitudeAssumed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, minIntermediatePositionReportInterval) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, minIntermediatePositionReportInterval_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, minIntermediatePositionReportInterval),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, positionReportTimeout) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, positionReportTimeout_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, positionReportTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, sharePosition) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, sharePosition_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, sharePosition),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, reportGnssOnlyPosition) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, reportGnssOnlyPosition_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, reportGnssOnlyPosition),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, powerMode) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, powerMode_valid)),
+ 0x1A,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, powerMode),
+ QMI_IDL_TYPE88(0, 1),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, specialReqType) - QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, specialReqType_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartReqMsgT_v02, specialReqType)
+};
+
+static const uint8_t qmiLocStopReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopReqMsgT_v02, sessionId)
+};
+
+static const uint8_t qmiLocEventPositionReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, sessionStatus),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, latitude) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, latitude_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, latitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, longitude) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, longitude_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, longitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncCircular) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncCircular_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncCircular),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseSemiMinor) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseSemiMinor_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseSemiMinor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseSemiMajor) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseSemiMajor_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseSemiMajor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseOrientAzimuth) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseOrientAzimuth_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horUncEllipseOrientAzimuth),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horConfidence) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horConfidence_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horReliability) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horReliability_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, horReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedHorizontal) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedHorizontal_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedHorizontal),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedUnc) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedUnc_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, altitudeWrtEllipsoid) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, altitudeWrtEllipsoid_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, altitudeWrtMeanSeaLevel) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, altitudeWrtMeanSeaLevel_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, altitudeWrtMeanSeaLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertUnc) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertUnc_valid)),
+ 0x1C,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertConfidence) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertConfidence_valid)),
+ 0x1D,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertReliability) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertReliability_valid)),
+ 0x1E,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, vertReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedVertical) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedVertical_valid)),
+ 0x1F,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, speedVertical),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, heading) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, heading_valid)),
+ 0x20,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, heading),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, headingUnc) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, headingUnc_valid)),
+ 0x21,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, headingUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, magneticDeviation) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, magneticDeviation_valid)),
+ 0x22,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, magneticDeviation),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, technologyMask) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, technologyMask_valid)),
+ 0x23,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, technologyMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, DOP) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, DOP_valid)),
+ 0x24,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, DOP),
+ QMI_IDL_TYPE88(0, 3),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, timestampUtc) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, timestampUtc_valid)),
+ 0x25,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, leapSeconds) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, leapSeconds_valid)),
+ 0x26,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, leapSeconds),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, gpsTime) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, gpsTime_valid)),
+ 0x27,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, gpsTime),
+ QMI_IDL_TYPE88(0, 2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, timeUnc) - QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, timeUnc_valid)),
+ 0x28,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPositionReportIndMsgT_v02, timeUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, timeSrc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, timeSrc_valid)),
+ 0x29,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, timeSrc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, sensorDataUsage) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, sensorDataUsage_valid)),
+ 0x2A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, sensorDataUsage),
+ QMI_IDL_TYPE88(0, 5),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, fixId) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, fixId_valid)),
+ 0x2B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, fixId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedList_valid)),
+ 0x2C,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedList),
+ QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, altitudeAssumed) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, altitudeAssumed_valid)),
+ 0x2D,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, altitudeAssumed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, velEnu) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, velEnu_valid)),
+ 0x2E,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, velEnu),
+ QMI_LOC_ENU_ARRAY_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, velUncEnu) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, velUncEnu_valid)),
+ 0x2F,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, velUncEnu),
+ QMI_LOC_ENU_ARRAY_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, navSolutionMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, navSolutionMask_valid)),
+ 0x30,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, navSolutionMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, sensorSubTechnologyMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, sensorSubTechnologyMask_valid)),
+ 0x31,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, sensorSubTechnologyMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssOnlyPosition) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssOnlyPosition_valid)),
+ 0x32,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, gnssOnlyPosition),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, extDOP) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, extDOP_valid)),
+ 0x33,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, extDOP),
+ QMI_IDL_TYPE88(0, 4),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssStationId) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssStationId_valid)),
+ 0x34,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, dgnssStationId),
+ QMI_LOC_DGNSS_STATION_ID_ARRAY_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssStationId) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssStationId_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, spoofReportMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, spoofReportMask_valid)),
+ 0x35,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, spoofReportMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, expandedGnssSvUsedList_valid)),
+ 0x36,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, expandedGnssSvUsedList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, expandedGnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList_valid)),
+ 0x37,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, jammerIndicatorList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, jammerIndicatorList_valid)),
+ 0x38,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, jammerIndicatorList),
+ QMI_LOC_MAX_GNSS_SIGNAL_TYPE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, jammerIndicatorList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, jammerIndicatorList_len),
+ QMI_IDL_TYPE88(0, 6),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssCorrectionSource) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssCorrectionSource_valid)),
+ 0x39,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, dgnssCorrectionSource),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssCorrectionSourceID) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssCorrectionSourceID_valid)),
+ 0x3A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, dgnssCorrectionSourceID),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssConstellationUsage) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssConstellationUsage_valid)),
+ 0x3B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, dgnssConstellationUsage),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssRefStationId) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssRefStationId_valid)),
+ 0x3C,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, dgnssRefStationId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssDataAgeMsec) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, dgnssDataAgeMsec_valid)),
+ 0x3D,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, dgnssDataAgeMsec),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, conformityIndex) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, conformityIndex_valid)),
+ 0x3E,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, conformityIndex),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemTick) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemTick_valid)),
+ 0x3F,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, systemTick),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemTickUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemTickUnc_valid)),
+ 0x40,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, systemTickUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemClkTimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemClkTimeBias_valid)),
+ 0x41,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, systemClkTimeBias),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemClkTimeBiasUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventPositionReportIndMsgT_v02, systemClkTimeBiasUnc_valid)),
+ 0x42,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventPositionReportIndMsgT_v02, systemClkTimeBiasUnc)
+};
+
+static const uint8_t qmiLocEventGnssSvInfoIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvInfoIndMsgT_v02, altitudeAssumed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvInfoIndMsgT_v02, svList) - QMI_IDL_OFFSET8(qmiLocEventGnssSvInfoIndMsgT_v02, svList_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvInfoIndMsgT_v02, svList),
+ QMI_LOC_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvInfoIndMsgT_v02, svList) - QMI_IDL_OFFSET8(qmiLocEventGnssSvInfoIndMsgT_v02, svList_len),
+ QMI_IDL_TYPE88(0, 7),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, expandedSvList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, expandedSvList_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvInfoIndMsgT_v02, expandedSvList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, expandedSvList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, expandedSvList_len),
+ QMI_IDL_TYPE88(0, 8),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, gnssSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, gnssSignalTypeList_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvInfoIndMsgT_v02, gnssSignalTypeList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, gnssSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, gnssSignalTypeList_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, rfLoss) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, rfLoss_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvInfoIndMsgT_v02, rfLoss),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, rfLoss) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvInfoIndMsgT_v02, rfLoss_len)
+};
+
+static const uint8_t qmiLocEventNmeaIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocEventNmeaIndMsgT_v02, nmea),
+ QMI_LOC_NMEA_STRING_MAX_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventNmeaIndMsgT_v02, expandedNmea) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventNmeaIndMsgT_v02, expandedNmea_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_STRING,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventNmeaIndMsgT_v02, expandedNmea),
+ ((QMI_LOC_EXPANDED_NMEA_STRING_MAX_LENGTH_V02) & 0xFF), ((QMI_LOC_EXPANDED_NMEA_STRING_MAX_LENGTH_V02) >> 8)
+};
+
+static const uint8_t qmiLocEventNiNotifyVerifyReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, notificationType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiVxInd) - QMI_IDL_OFFSET8(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiVxInd_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiVxInd),
+ QMI_IDL_TYPE88(0, 9),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiSuplInd) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiSuplInd_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiSuplInd),
+ QMI_IDL_TYPE88(0, 15),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiUmtsCpInd) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiUmtsCpInd_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiUmtsCpInd),
+ QMI_IDL_TYPE88(0, 17),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiVxServiceInteractionInd) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiVxServiceInteractionInd_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiVxServiceInteractionInd),
+ QMI_IDL_TYPE88(0, 18),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiSuplVer2ExtInd) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiSuplVer2ExtInd_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, NiSuplVer2ExtInd),
+ QMI_IDL_TYPE88(0, 19),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, suplEmergencyNotification) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, suplEmergencyNotification_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, suplEmergencyNotification),
+ QMI_IDL_TYPE88(0, 20),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, isInEmergencySession) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, isInEmergencySession_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventNiNotifyVerifyReqIndMsgT_v02, isInEmergencySession)
+};
+
+static const uint8_t qmiLocEventInjectTimeReqIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectTimeReqIndMsgT_v02, timeServerInfo) - QMI_IDL_OFFSET8(qmiLocEventInjectTimeReqIndMsgT_v02, timeServerInfo_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectTimeReqIndMsgT_v02, timeServerInfo),
+ QMI_IDL_TYPE88(0, 22)
+};
+
+static const uint8_t qmiLocEventInjectPredictedOrbitsReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, allowedSizes),
+ QMI_IDL_TYPE88(0, 23),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, serverList) - QMI_IDL_OFFSET8(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, serverList_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, serverList),
+ QMI_IDL_TYPE88(0, 24),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, serverUpdateMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, serverUpdateMask_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, serverUpdateMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, updateType) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, updateType_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, updateType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, updateRate) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, updateRate_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02, updateRate)
+};
+
+static const uint8_t qmiLocEventInjectPositionReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectPositionReqIndMsgT_v02, latitude),
+
+ 0x02,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectPositionReqIndMsgT_v02, longitude),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectPositionReqIndMsgT_v02, horUncCircular),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x04,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectPositionReqIndMsgT_v02, timestampUtc)
+};
+
+static const uint8_t qmiLocEventEngineStateIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventEngineStateIndMsgT_v02, engineState)
+};
+
+static const uint8_t qmiLocEventFixSessionStateIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventFixSessionStateIndMsgT_v02, sessionState),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventFixSessionStateIndMsgT_v02, sessionId) - QMI_IDL_OFFSET8(qmiLocEventFixSessionStateIndMsgT_v02, sessionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventFixSessionStateIndMsgT_v02, sessionId)
+};
+
+static const uint8_t qmiLocEventWifiReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventWifiReqIndMsgT_v02, requestType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventWifiReqIndMsgT_v02, tbfInMs) - QMI_IDL_OFFSET8(qmiLocEventWifiReqIndMsgT_v02, tbfInMs_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventWifiReqIndMsgT_v02, tbfInMs),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventWifiReqIndMsgT_v02, e911Mode) - QMI_IDL_OFFSET8(qmiLocEventWifiReqIndMsgT_v02, e911Mode_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventWifiReqIndMsgT_v02, e911Mode)
+};
+
+static const uint8_t qmiLocEventSensorStreamingReadyStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, accelReady) - QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, accelReady_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, accelReady),
+ QMI_IDL_TYPE88(0, 26),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, gyroReady) - QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, gyroReady_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, gyroReady),
+ QMI_IDL_TYPE88(0, 26),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, accelTemperatureReady) - QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, accelTemperatureReady_valid)),
+ 0x12,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, accelTemperatureReady),
+ QMI_IDL_TYPE88(0, 26),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, gyroTemperatureReady) - QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, gyroTemperatureReady_valid)),
+ 0x13,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, gyroTemperatureReady),
+ QMI_IDL_TYPE88(0, 26),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, calibratedMagReady) - QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, calibratedMagReady_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, calibratedMagReady),
+ QMI_IDL_TYPE88(0, 26),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, uncalibratedMagReady) - QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, uncalibratedMagReady_valid)),
+ 0x15,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02, uncalibratedMagReady),
+ QMI_IDL_TYPE88(0, 26)
+};
+
+static const uint8_t qmiLocEventTimeSyncReqIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventTimeSyncReqIndMsgT_v02, refCounter)
+};
+
+static const uint8_t qmiLocEventSetSpiStreamingReportIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventSetSpiStreamingReportIndMsgT_v02, enable)
+};
+
+static const uint8_t qmiLocEventLocationServerConnectionReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, connHandle),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, requestType),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, wwanType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, bearerType) - QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, bearerType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, bearerType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, apnTypeMask) - QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, apnTypeMask_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, apnTypeMask),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, subId) - QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, subId_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventLocationServerConnectionReqIndMsgT_v02, subId)
+};
+
+static const uint8_t qmiLocEventNiGeofenceNotificationIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventNiGeofenceNotificationIndMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventNiGeofenceNotificationIndMsgT_v02, operationType)
+};
+
+static const uint8_t qmiLocEventGeofenceGenAlertIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceGenAlertIndMsgT_v02, geofenceAlert)
+};
+
+static const uint8_t qmiLocEventGeofenceBreachIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, geofenceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, breachType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, geofencePosition) - QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, geofencePosition_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, geofencePosition),
+ QMI_IDL_TYPE88(0, 27),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, breachConfidence) - QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, breachConfidence_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBreachIndMsgT_v02, breachConfidence)
+};
+
+static const uint8_t qmiLocEventPedometerControlIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPedometerControlIndMsgT_v02, requestPedometerData),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPedometerControlIndMsgT_v02, resetStepCount) - QMI_IDL_OFFSET8(qmiLocEventPedometerControlIndMsgT_v02, resetStepCount_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPedometerControlIndMsgT_v02, resetStepCount),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventPedometerControlIndMsgT_v02, stepCountThreshold) - QMI_IDL_OFFSET8(qmiLocEventPedometerControlIndMsgT_v02, stepCountThreshold_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventPedometerControlIndMsgT_v02, stepCountThreshold)
+};
+
+static const uint8_t qmiLocEventMotionDataControlIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventMotionDataControlIndMsgT_v02, requestMotionData)
+};
+
+static const uint8_t qmiLocEventGeofenceBatchedBreachIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, breachType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdContinuousList) - QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdContinuousList_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdContinuousList),
+ QMI_LOC_MAX_GEOFENCE_ID_CONTINUOUS_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdContinuousList) - QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdContinuousList_len),
+ QMI_IDL_TYPE88(0, 28),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdDiscreteList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdDiscreteList_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdDiscreteList),
+ QMI_LOC_MAX_GEOFENCE_ID_DISCRETE_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdDiscreteList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofenceIdDiscreteList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofencePosition) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofencePosition_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, geofencePosition),
+ QMI_IDL_TYPE88(0, 27),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, breachConfidence) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, breachConfidence_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, breachConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, headingUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, headingUnc_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, headingUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, vertUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, vertUnc_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, vertUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, speedUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, speedUnc_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, speedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, horConfidence) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, horConfidence_valid)),
+ 0x17,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, horConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, vertConfidence) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, vertConfidence_valid)),
+ 0x18,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, DOP) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, DOP_valid)),
+ 0x19,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, DOP),
+ QMI_IDL_TYPE88(0, 3),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedList_valid)),
+ 0x1A,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedList),
+ QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, extDOP) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, extDOP_valid)),
+ 0x1B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, extDOP),
+ QMI_IDL_TYPE88(0, 4),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, expandedGnssSvUsedList_valid)),
+ 0x1C,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, expandedGnssSvUsedList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, expandedGnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedSignalTypeList_valid)),
+ 0x1D,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedSignalTypeList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedBreachIndMsgT_v02, gnssSvUsedSignalTypeList_len)
+};
+
+static const uint8_t qmiLocEventGeofenceProximityIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceProximityIndMsgT_v02, proximityType),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceProximityIndMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGeofenceProximityIndMsgT_v02, contextId) - QMI_IDL_OFFSET8(qmiLocEventGeofenceProximityIndMsgT_v02, contextId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceProximityIndMsgT_v02, contextId)
+};
+
+static const uint8_t qmiLocEventGeofenceBatchedDwellIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, dwellType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdContinuousList) - QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdContinuousList_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdContinuousList),
+ QMI_LOC_MAX_GEOFENCE_ID_CONTINUOUS_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdContinuousList) - QMI_IDL_OFFSET8(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdContinuousList_len),
+ QMI_IDL_TYPE88(0, 28),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdDiscreteList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdDiscreteList_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdDiscreteList),
+ QMI_LOC_MAX_GEOFENCE_ID_DISCRETE_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdDiscreteList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofenceIdDiscreteList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofencePosition) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofencePosition_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, geofencePosition),
+ QMI_IDL_TYPE88(0, 27),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, headingUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, headingUnc_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, headingUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, vertUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, vertUnc_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, vertUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, speedUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, speedUnc_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, speedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, horConfidence) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, horConfidence_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, horConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, vertConfidence) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, vertConfidence_valid)),
+ 0x17,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, DOP) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, DOP_valid)),
+ 0x18,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, DOP),
+ QMI_IDL_TYPE88(0, 3),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedList_valid)),
+ 0x19,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedList),
+ QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, extDOP) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, extDOP_valid)),
+ 0x1A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, extDOP),
+ QMI_IDL_TYPE88(0, 4),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, expandedGnssSvUsedList_valid)),
+ 0x1B,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, expandedGnssSvUsedList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, expandedGnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedSignalTypeList_valid)),
+ 0x1C,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedSignalTypeList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGeofenceBatchedDwellIndMsgT_v02, gnssSvUsedSignalTypeList_len)
+};
+
+static const uint8_t qmiLocEventGdtUploadBeginStatusReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02, filePath),
+ QMI_LOC_MAX_GDT_PATH_LEN_V02,
+ QMI_IDL_OFFSET8(qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02, filePath) - QMI_IDL_OFFSET8(qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02, filePath_len)
+};
+
+static const uint8_t qmiLocEventGdtUploadEndReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtUploadEndReqIndMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtUploadEndReqIndMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtUploadEndReqIndMsgT_v02, endStatus)
+};
+
+static const uint8_t qmiLocEventGdtDownloadBeginReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, sessionId),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, respTimeoutInterval),
+
+ 0x04,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, clientInfo),
+ ((QMI_LOC_MAX_GTP_CL_INFO_LEN_V02) & 0xFF), ((QMI_LOC_MAX_GTP_CL_INFO_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, clientInfo) - QMI_IDL_OFFSET8(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, clientInfo_len),
+
+ 0x05,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, mobileStatusData),
+ ((QMI_LOC_MAX_GTP_MSD_LEN_V02) & 0xFF), ((QMI_LOC_MAX_GTP_MSD_LEN_V02) >> 8),
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, mobileStatusData) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, mobileStatusData_len),
+
+ 0x06,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, filePath),
+ QMI_LOC_MAX_GDT_PATH_LEN_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, filePath) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, filePath_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, powerBudgetInfo) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, powerBudgetInfo_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, powerBudgetInfo),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, powerBudgetAllowance) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, powerBudgetAllowance_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, powerBudgetAllowance),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, downloadRequestMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, downloadRequestMask_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGdtDownloadBeginReqIndMsgT_v02, downloadRequestMask)
+};
+
+static const uint8_t qmiLocEventGdtReceiveDoneIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtReceiveDoneIndMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtReceiveDoneIndMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtReceiveDoneIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEventGdtDownloadEndReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadEndReqIndMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadEndReqIndMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGdtDownloadEndReqIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetServiceRevisionReqMsgT is empty
+ * static const uint8_t qmiLocGetServiceRevisionReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetServiceRevisionIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, revision),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, gnssMeFWVerString) - QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, gnssMeFWVerString_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, gnssMeFWVerString),
+ QMI_LOC_GNSS_ME_VERSION_STRING_MAX_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, gnssHostSWVerString) - QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, gnssHostSWVerString_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocGetServiceRevisionIndMsgT_v02, gnssHostSWVerString),
+ QMI_LOC_GNSS_HOSTED_SW_VERSION_STRING_MAX_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetServiceRevisionIndMsgT_v02, gnssSWVerString) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetServiceRevisionIndMsgT_v02, gnssSWVerString_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_STRING,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetServiceRevisionIndMsgT_v02, gnssSWVerString),
+ QMI_LOC_GNSS_SW_VERSION_STRING_MAX_LENGTH_V02
+};
+
+/*
+ * qmiLocGetFixCriteriaReqMsgT is empty
+ * static const uint8_t qmiLocGetFixCriteriaReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetFixCriteriaIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, horizontalAccuracyLevel) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, horizontalAccuracyLevel_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, horizontalAccuracyLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, intermediateReportState) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, intermediateReportState_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, intermediateReportState),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, minInterval) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, minInterval_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, minInterval),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, applicationId) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, applicationId_valid)),
+ 0x13,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, applicationId),
+ QMI_IDL_TYPE88(0, 0),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, configAltitudeAssumed) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, configAltitudeAssumed_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, configAltitudeAssumed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, minIntermediatePositionReportInterval) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, minIntermediatePositionReportInterval_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, minIntermediatePositionReportInterval),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, positionReportTimeout) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, positionReportTimeout_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, positionReportTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, sharePosition) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, sharePosition_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, sharePosition),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, powerMode) - QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, powerMode_valid)),
+ 0x18,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetFixCriteriaIndMsgT_v02, powerMode),
+ QMI_IDL_TYPE88(0, 1)
+};
+
+static const uint8_t qmiLocNiUserRespReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUserRespReqMsgT_v02, userResp),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUserRespReqMsgT_v02, notificationType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocNiUserRespReqMsgT_v02, NiVxPayload) - QMI_IDL_OFFSET8(qmiLocNiUserRespReqMsgT_v02, NiVxPayload_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocNiUserRespReqMsgT_v02, NiVxPayload),
+ QMI_IDL_TYPE88(0, 9),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiSuplPayload) - QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiSuplPayload_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiUserRespReqMsgT_v02, NiSuplPayload),
+ QMI_IDL_TYPE88(0, 15),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiUmtsCpPayload) - QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiUmtsCpPayload_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiUserRespReqMsgT_v02, NiUmtsCpPayload),
+ QMI_IDL_TYPE88(0, 17),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiVxServiceInteractionPayload) - QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiVxServiceInteractionPayload_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiUserRespReqMsgT_v02, NiVxServiceInteractionPayload),
+ QMI_IDL_TYPE88(0, 18),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiSuplVer2ExtPayload) - QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, NiSuplVer2ExtPayload_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiUserRespReqMsgT_v02, NiSuplVer2ExtPayload),
+ QMI_IDL_TYPE88(0, 19),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, suplEmergencyNotification) - QMI_IDL_OFFSET16RELATIVE(qmiLocNiUserRespReqMsgT_v02, suplEmergencyNotification_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocNiUserRespReqMsgT_v02, suplEmergencyNotification),
+ QMI_IDL_TYPE88(0, 20)
+};
+
+static const uint8_t qmiLocNiUserRespIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNiUserRespIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectPredictedOrbitsDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, totalSize),
+
+ 0x02,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, totalParts),
+
+ 0x03,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, partNum),
+
+ 0x04,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, partData),
+ ((QMI_LOC_MAX_PREDICTED_ORBITS_PART_LEN_V02) & 0xFF), ((QMI_LOC_MAX_PREDICTED_ORBITS_PART_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, partData) - QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, partData_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, formatType) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, formatType_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectPredictedOrbitsDataReqMsgT_v02, formatType)
+};
+
+static const uint8_t qmiLocInjectPredictedOrbitsDataIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataIndMsgT_v02, partNum) - QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataIndMsgT_v02, partNum_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPredictedOrbitsDataIndMsgT_v02, partNum)
+};
+
+/*
+ * qmiLocGetPredictedOrbitsDataSourceReqMsgT is empty
+ * static const uint8_t qmiLocGetPredictedOrbitsDataSourceReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetPredictedOrbitsDataSourceIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02, allowedSizes) - QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02, allowedSizes_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02, allowedSizes),
+ QMI_IDL_TYPE88(0, 23),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02, serverList) - QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02, serverList_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02, serverList),
+ QMI_IDL_TYPE88(0, 24)
+};
+
+/*
+ * qmiLocGetPredictedOrbitsDataValidityReqMsgT is empty
+ * static const uint8_t qmiLocGetPredictedOrbitsDataValidityReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetPredictedOrbitsDataValidityIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02, validityInfo) - QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02, validityInfo_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02, validityInfo),
+ QMI_IDL_TYPE88(0, 29)
+};
+
+static const uint8_t qmiLocInjectUtcTimeReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectUtcTimeReqMsgT_v02, timeUtc),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectUtcTimeReqMsgT_v02, timeUnc),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectUtcTimeReqMsgT_v02, timeSrc) - QMI_IDL_OFFSET8(qmiLocInjectUtcTimeReqMsgT_v02, timeSrc_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectUtcTimeReqMsgT_v02, timeSrc)
+};
+
+static const uint8_t qmiLocInjectUtcTimeIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectUtcTimeIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectPositionReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, latitude) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, latitude_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, latitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, longitude) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, longitude_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, longitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horUncCircular) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horUncCircular_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horUncCircular),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horConfidence) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horConfidence_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horReliability) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horReliability_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, horReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altitudeWrtEllipsoid) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altitudeWrtEllipsoid_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altitudeWrtMeanSeaLevel) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altitudeWrtMeanSeaLevel_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altitudeWrtMeanSeaLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertUnc) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertUnc_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertConfidence) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertConfidence_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertReliability) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertReliability_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, vertReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altSourceInfo) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altSourceInfo_valid)),
+ 0x1A,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, altSourceInfo),
+ QMI_IDL_TYPE88(0, 30),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timestampUtc) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timestampUtc_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timestampAge) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timestampAge_valid)),
+ 0x1C,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timestampAge),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, positionSrc) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, positionSrc_valid)),
+ 0x1D,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, positionSrc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, rawHorUncCircular) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, rawHorUncCircular_valid)),
+ 0x1E,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, rawHorUncCircular),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, rawHorConfidence) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, rawHorConfidence_valid)),
+ 0x1F,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, rawHorConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, onDemandCpi) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, onDemandCpi_valid)),
+ 0x20,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, onDemandCpi),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, positionSrcProvider) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, positionSrcProvider_valid)),
+ 0x21,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, positionSrcProvider),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, gpsTime) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, gpsTime_valid)),
+ 0x22,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, gpsTime),
+ QMI_IDL_TYPE88(0, 2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timeUnc) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timeUnc_valid)),
+ 0x23,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, timeUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, velEnu) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, velEnu_valid)),
+ 0x24,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, velEnu),
+ QMI_LOC_ENU_ARRAY_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, velUncEnu) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, velUncEnu_valid)),
+ 0x25,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, velUncEnu),
+ QMI_LOC_ENU_ARRAY_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, expandedGnssSvUsedList_valid)),
+ 0x26,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, expandedGnssSvUsedList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET8(qmiLocInjectPositionReqMsgT_v02, expandedGnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectPositionReqMsgT_v02, numSvInFix) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectPositionReqMsgT_v02, numSvInFix_valid)),
+ 0x27,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectPositionReqMsgT_v02, numSvInFix)
+};
+
+static const uint8_t qmiLocInjectPositionIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPositionIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocSetEngineLockReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetEngineLockReqMsgT_v02, lockType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetEngineLockReqMsgT_v02, subType) - QMI_IDL_OFFSET8(qmiLocSetEngineLockReqMsgT_v02, subType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetEngineLockReqMsgT_v02, subType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetEngineLockReqMsgT_v02, lockClient) - QMI_IDL_OFFSET8(qmiLocSetEngineLockReqMsgT_v02, lockClient_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetEngineLockReqMsgT_v02, lockClient)
+};
+
+static const uint8_t qmiLocSetEngineLockIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetEngineLockIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGetEngineLockReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetEngineLockReqMsgT_v02, subType) - QMI_IDL_OFFSET8(qmiLocGetEngineLockReqMsgT_v02, subType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetEngineLockReqMsgT_v02, subType)
+};
+
+static const uint8_t qmiLocGetEngineLockIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, lockType) - QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, lockType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, lockType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, subType) - QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, subType_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, subType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, lockClient) - QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, lockClient_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetEngineLockIndMsgT_v02, lockClient)
+};
+
+static const uint8_t qmiLocSetSbasConfigReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSbasConfigReqMsgT_v02, sbasConfig),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSbasConfigReqMsgT_v02, qzssL1sConfig) - QMI_IDL_OFFSET8(qmiLocSetSbasConfigReqMsgT_v02, qzssL1sConfig_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSbasConfigReqMsgT_v02, qzssL1sConfig)
+};
+
+static const uint8_t qmiLocSetSbasConfigIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSbasConfigIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetSbasConfigReqMsgT is empty
+ * static const uint8_t qmiLocGetSbasConfigReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetSbasConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSbasConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSbasConfigIndMsgT_v02, sbasConfig) - QMI_IDL_OFFSET8(qmiLocGetSbasConfigIndMsgT_v02, sbasConfig_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSbasConfigIndMsgT_v02, sbasConfig)
+};
+
+static const uint8_t qmiLocSetNmeaTypesReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetNmeaTypesReqMsgT_v02, nmeaSentenceType)
+};
+
+static const uint8_t qmiLocSetNmeaTypesIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetNmeaTypesIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetNmeaTypesReqMsgT is empty
+ * static const uint8_t qmiLocGetNmeaTypesReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetNmeaTypesIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetNmeaTypesIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetNmeaTypesIndMsgT_v02, nmeaSentenceType) - QMI_IDL_OFFSET8(qmiLocGetNmeaTypesIndMsgT_v02, nmeaSentenceType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetNmeaTypesIndMsgT_v02, nmeaSentenceType)
+};
+
+static const uint8_t qmiLocSetLowPowerModeReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetLowPowerModeReqMsgT_v02, lowPowerMode)
+};
+
+static const uint8_t qmiLocSetLowPowerModeIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetLowPowerModeIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetLowPowerModeReqMsgT is empty
+ * static const uint8_t qmiLocGetLowPowerModeReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetLowPowerModeIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetLowPowerModeIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetLowPowerModeIndMsgT_v02, lowPowerMode) - QMI_IDL_OFFSET8(qmiLocGetLowPowerModeIndMsgT_v02, lowPowerMode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetLowPowerModeIndMsgT_v02, lowPowerMode)
+};
+
+static const uint8_t qmiLocSetServerReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, serverType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, ipv4Addr) - QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, ipv4Addr_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, ipv4Addr),
+ QMI_IDL_TYPE88(0, 12),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, ipv6Addr) - QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, ipv6Addr_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, ipv6Addr),
+ QMI_IDL_TYPE88(0, 13),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, urlAddr) - QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, urlAddr_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocSetServerReqMsgT_v02, urlAddr),
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02
+};
+
+static const uint8_t qmiLocSetServerIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetServerIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGetServerReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetServerReqMsgT_v02, serverType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetServerReqMsgT_v02, serverAddrTypeMask) - QMI_IDL_OFFSET8(qmiLocGetServerReqMsgT_v02, serverAddrTypeMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetServerReqMsgT_v02, serverAddrTypeMask)
+};
+
+static const uint8_t qmiLocGetServerIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, serverType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, ipv4Addr) - QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, ipv4Addr_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, ipv4Addr),
+ QMI_IDL_TYPE88(0, 12),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, ipv6Addr) - QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, ipv6Addr_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, ipv6Addr),
+ QMI_IDL_TYPE88(0, 13),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, urlAddr) - QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, urlAddr_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocGetServerIndMsgT_v02, urlAddr),
+ QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02
+};
+
+static const uint8_t qmiLocDeleteAssistDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteAssistDataReqMsgT_v02, deleteAllFlag),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteAssistDataReqMsgT_v02, deleteSvInfoList) - QMI_IDL_OFFSET8(qmiLocDeleteAssistDataReqMsgT_v02, deleteSvInfoList_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocDeleteAssistDataReqMsgT_v02, deleteSvInfoList),
+ QMI_LOC_DELETE_MAX_SV_INFO_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocDeleteAssistDataReqMsgT_v02, deleteSvInfoList) - QMI_IDL_OFFSET8(qmiLocDeleteAssistDataReqMsgT_v02, deleteSvInfoList_len),
+ QMI_IDL_TYPE88(0, 31),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteGnssDataMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteGnssDataMask_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocDeleteAssistDataReqMsgT_v02, deleteGnssDataMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteCellDbDataMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteCellDbDataMask_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocDeleteAssistDataReqMsgT_v02, deleteCellDbDataMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteClockInfoMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteClockInfoMask_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocDeleteAssistDataReqMsgT_v02, deleteClockInfoMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteBdsSvInfoList) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteBdsSvInfoList_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocDeleteAssistDataReqMsgT_v02, deleteBdsSvInfoList),
+ QMI_LOC_DELETE_MAX_BDS_SV_INFO_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteBdsSvInfoList) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteBdsSvInfoList_len),
+ QMI_IDL_TYPE88(0, 32),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteGalSvInfoList) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteGalSvInfoList_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocDeleteAssistDataReqMsgT_v02, deleteGalSvInfoList),
+ QMI_LOC_DELETE_MAX_GAL_SV_INFO_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteGalSvInfoList) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteGalSvInfoList_len),
+ QMI_IDL_TYPE88(0, 33),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteQzssL1sDataFlag) - QMI_IDL_OFFSET16RELATIVE(qmiLocDeleteAssistDataReqMsgT_v02, deleteQzssL1sDataFlag_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocDeleteAssistDataReqMsgT_v02, deleteQzssL1sDataFlag)
+};
+
+static const uint8_t qmiLocDeleteAssistDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteAssistDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocSetXtraTSessionControlReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetXtraTSessionControlReqMsgT_v02, xtraTSessionControl)
+};
+
+static const uint8_t qmiLocSetXtraTSessionControlIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetXtraTSessionControlIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetXtraTSessionControlReqMsgT is empty
+ * static const uint8_t qmiLocGetXtraTSessionControlReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetXtraTSessionControlIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetXtraTSessionControlIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetXtraTSessionControlIndMsgT_v02, xtraTSessionControl) - QMI_IDL_OFFSET8(qmiLocGetXtraTSessionControlIndMsgT_v02, xtraTSessionControl_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetXtraTSessionControlIndMsgT_v02, xtraTSessionControl)
+};
+
+static const uint8_t qmiLocInjectWifiPositionReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, wifiFixTime) - QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, wifiFixTime_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, wifiFixTime),
+ QMI_IDL_TYPE88(0, 34),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, wifiFixPosition) - QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, wifiFixPosition_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, wifiFixPosition),
+ QMI_IDL_TYPE88(0, 35),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, apInfo) - QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, apInfo_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, apInfo),
+ QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, apInfo) - QMI_IDL_OFFSET8(qmiLocInjectWifiPositionReqMsgT_v02, apInfo_len),
+ QMI_IDL_TYPE88(0, 36),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, horizontalReliability) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, horizontalReliability_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiPositionReqMsgT_v02, horizontalReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, rawHepe) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, rawHepe_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiPositionReqMsgT_v02, rawHepe),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, wifiApSsidInfo) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, wifiApSsidInfo_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiPositionReqMsgT_v02, wifiApSsidInfo),
+ QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, wifiApSsidInfo) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiPositionReqMsgT_v02, wifiApSsidInfo_len),
+ QMI_IDL_TYPE88(0, 37)
+};
+
+static const uint8_t qmiLocInjectWifiPositionIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiPositionIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocNotifyWifiStatusReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiStatusReqMsgT_v02, wifiStatus)
+};
+
+static const uint8_t qmiLocNotifyWifiStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiStatusIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetRegisteredEventsReqMsgT is empty
+ * static const uint8_t qmiLocGetRegisteredEventsReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetRegisteredEventsIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetRegisteredEventsIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetRegisteredEventsIndMsgT_v02, eventRegMask) - QMI_IDL_OFFSET8(qmiLocGetRegisteredEventsIndMsgT_v02, eventRegMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetRegisteredEventsIndMsgT_v02, eventRegMask)
+};
+
+static const uint8_t qmiLocSetOperationModeReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetOperationModeReqMsgT_v02, operationMode),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetOperationModeReqMsgT_v02, minInterval) - QMI_IDL_OFFSET8(qmiLocSetOperationModeReqMsgT_v02, minInterval_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetOperationModeReqMsgT_v02, minInterval)
+};
+
+static const uint8_t qmiLocSetOperationModeIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetOperationModeIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetOperationModeReqMsgT is empty
+ * static const uint8_t qmiLocGetOperationModeReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetOperationModeIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetOperationModeIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetOperationModeIndMsgT_v02, operationMode) - QMI_IDL_OFFSET8(qmiLocGetOperationModeIndMsgT_v02, operationMode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetOperationModeIndMsgT_v02, operationMode)
+};
+
+static const uint8_t qmiLocSetSpiStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSpiStatusReqMsgT_v02, stationary),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSpiStatusReqMsgT_v02, confidenceStationary) - QMI_IDL_OFFSET8(qmiLocSetSpiStatusReqMsgT_v02, confidenceStationary_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSpiStatusReqMsgT_v02, confidenceStationary)
+};
+
+static const uint8_t qmiLocSetSpiStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSpiStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectSensorDataReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataReqMsgT_v02, opaqueIdentifier) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataReqMsgT_v02, opaqueIdentifier_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataReqMsgT_v02, opaqueIdentifier),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataReqMsgT_v02, threeAxisAccelData) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataReqMsgT_v02, threeAxisAccelData_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataReqMsgT_v02, threeAxisAccelData),
+ QMI_IDL_TYPE88(0, 39),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisGyroData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisGyroData_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSensorDataReqMsgT_v02, threeAxisGyroData),
+ QMI_IDL_TYPE88(0, 39),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisAccelDataTimeSource) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisAccelDataTimeSource_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSensorDataReqMsgT_v02, threeAxisAccelDataTimeSource),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisGyroDataTimeSource) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisGyroDataTimeSource_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSensorDataReqMsgT_v02, threeAxisGyroDataTimeSource),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, accelTemperatureData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, accelTemperatureData_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSensorDataReqMsgT_v02, accelTemperatureData),
+ QMI_IDL_TYPE88(0, 41),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, gyroTemperatureData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, gyroTemperatureData_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSensorDataReqMsgT_v02, gyroTemperatureData),
+ QMI_IDL_TYPE88(0, 41),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisMagData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisMagData_valid)),
+ 0x17,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSensorDataReqMsgT_v02, threeAxisMagData),
+ QMI_IDL_TYPE88(0, 39),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisMagDataTimeSource) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSensorDataReqMsgT_v02, threeAxisMagDataTimeSource_valid)),
+ 0x18,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSensorDataReqMsgT_v02, threeAxisMagDataTimeSource)
+};
+
+static const uint8_t qmiLocInjectSensorDataIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, opaqueIdentifier) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, opaqueIdentifier_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, opaqueIdentifier),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisAccelSamplesAccepted) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisAccelSamplesAccepted_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisAccelSamplesAccepted),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisGyroSamplesAccepted) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisGyroSamplesAccepted_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisGyroSamplesAccepted),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, accelTemperatureSamplesAccepted) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, accelTemperatureSamplesAccepted_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, accelTemperatureSamplesAccepted),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, gyroTemperatureSamplesAccepted) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, gyroTemperatureSamplesAccepted_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, gyroTemperatureSamplesAccepted),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisMagSamplesAccepted) - QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisMagSamplesAccepted_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSensorDataIndMsgT_v02, threeAxisMagSamplesAccepted)
+};
+
+static const uint8_t qmiLocInjectTimeSyncDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTimeSyncDataReqMsgT_v02, refCounter),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTimeSyncDataReqMsgT_v02, sensorProcRxTime),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTimeSyncDataReqMsgT_v02, sensorProcTxTime)
+};
+
+static const uint8_t qmiLocInjectTimeSyncDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTimeSyncDataIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetCradleMountConfigReqMsgT is empty
+ * static const uint8_t qmiLocGetCradleMountConfigReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetCradleMountConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetCradleMountConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetCradleMountConfigIndMsgT_v02, cradleMountState) - QMI_IDL_OFFSET8(qmiLocGetCradleMountConfigIndMsgT_v02, cradleMountState_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetCradleMountConfigIndMsgT_v02, cradleMountState),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetCradleMountConfigIndMsgT_v02, confidenceCradleMountState) - QMI_IDL_OFFSET8(qmiLocGetCradleMountConfigIndMsgT_v02, confidenceCradleMountState_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetCradleMountConfigIndMsgT_v02, confidenceCradleMountState)
+};
+
+static const uint8_t qmiLocSetCradleMountConfigReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetCradleMountConfigReqMsgT_v02, cradleMountState),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetCradleMountConfigReqMsgT_v02, confidenceCradleMountState) - QMI_IDL_OFFSET8(qmiLocSetCradleMountConfigReqMsgT_v02, confidenceCradleMountState_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetCradleMountConfigReqMsgT_v02, confidenceCradleMountState)
+};
+
+static const uint8_t qmiLocSetCradleMountConfigIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetCradleMountConfigIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetExternalPowerConfigReqMsgT is empty
+ * static const uint8_t qmiLocGetExternalPowerConfigReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetExternalPowerConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetExternalPowerConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetExternalPowerConfigIndMsgT_v02, externalPowerState) - QMI_IDL_OFFSET8(qmiLocGetExternalPowerConfigIndMsgT_v02, externalPowerState_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetExternalPowerConfigIndMsgT_v02, externalPowerState)
+};
+
+static const uint8_t qmiLocSetExternalPowerConfigReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetExternalPowerConfigReqMsgT_v02, externalPowerState),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetExternalPowerConfigReqMsgT_v02, batteryLevel) - QMI_IDL_OFFSET8(qmiLocSetExternalPowerConfigReqMsgT_v02, batteryLevel_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetExternalPowerConfigReqMsgT_v02, batteryLevel)
+};
+
+static const uint8_t qmiLocSetExternalPowerConfigIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetExternalPowerConfigIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInformLocationServerConnStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, connHandle),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, requestType),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, statusType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, apnProfile) - QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, apnProfile_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, apnProfile),
+ QMI_IDL_TYPE88(0, 42),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, apnTypeMask) - QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, apnTypeMask_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusReqMsgT_v02, apnTypeMask)
+};
+
+static const uint8_t qmiLocInformLocationServerConnStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInformLocationServerConnStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocSetProtocolConfigParametersReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplSecurity) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplSecurity_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplSecurity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, vxVersion) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, vxVersion_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, vxVersion),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplVersion) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplVersion_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplVersion),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppConfig) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppConfig_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, assistedGlonassProtocolMask) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, assistedGlonassProtocolMask_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, assistedGlonassProtocolMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplHashAlgo) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplHashAlgo_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplHashAlgo),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplTlsVersion) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplTlsVersion_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, suplTlsVersion),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, emergencyProtocol) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, emergencyProtocol_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, emergencyProtocol),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, wifiScanInjectTimeout) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, wifiScanInjectTimeout_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, wifiScanInjectTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppeUpConfig) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppeUpConfig_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppeUpConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppeCpConfig) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppeCpConfig_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, lppeCpConfig),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, emergencyCallbackWindow) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, emergencyCallbackWindow_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersReqMsgT_v02, emergencyCallbackWindow)
+};
+
+static const uint8_t qmiLocSetProtocolConfigParametersIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersIndMsgT_v02, failedProtocolConfigParamMask) - QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersIndMsgT_v02, failedProtocolConfigParamMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetProtocolConfigParametersIndMsgT_v02, failedProtocolConfigParamMask)
+};
+
+static const uint8_t qmiLocGetProtocolConfigParametersReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersReqMsgT_v02, getProtocolConfigParamMask)
+};
+
+static const uint8_t qmiLocGetProtocolConfigParametersIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplSecurity) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplSecurity_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplSecurity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, vxVersion) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, vxVersion_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, vxVersion),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplVersion) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplVersion_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplVersion),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppConfig) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppConfig_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, assistedGlonassProtocolMask) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, assistedGlonassProtocolMask_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, assistedGlonassProtocolMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplHashAlgo) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplHashAlgo_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplHashAlgo),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplTlsVersion) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplTlsVersion_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, suplTlsVersion),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, emergencyProtocol) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, emergencyProtocol_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, emergencyProtocol),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, wifiScanInjectTimeout) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, wifiScanInjectTimeout_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, wifiScanInjectTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppeUpConfig) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppeUpConfig_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppeUpConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppeCpConfig) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppeCpConfig_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, lppeCpConfig),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, emergencyCallbackWindow) - QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, emergencyCallbackWindow_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetProtocolConfigParametersIndMsgT_v02, emergencyCallbackWindow)
+};
+
+static const uint8_t qmiLocSetSensorControlConfigReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorControlConfigReqMsgT_v02, sensorsUsage) - QMI_IDL_OFFSET8(qmiLocSetSensorControlConfigReqMsgT_v02, sensorsUsage_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorControlConfigReqMsgT_v02, sensorsUsage),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorControlConfigReqMsgT_v02, sensorProvider) - QMI_IDL_OFFSET8(qmiLocSetSensorControlConfigReqMsgT_v02, sensorProvider_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorControlConfigReqMsgT_v02, sensorProvider)
+};
+
+static const uint8_t qmiLocSetSensorControlConfigIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorControlConfigIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetSensorControlConfigReqMsgT is empty
+ * static const uint8_t qmiLocGetSensorControlConfigReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetSensorControlConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorControlConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorControlConfigIndMsgT_v02, sensorsUsage) - QMI_IDL_OFFSET8(qmiLocGetSensorControlConfigIndMsgT_v02, sensorsUsage_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorControlConfigIndMsgT_v02, sensorsUsage),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorControlConfigIndMsgT_v02, sensorProvider) - QMI_IDL_OFFSET8(qmiLocGetSensorControlConfigIndMsgT_v02, sensorProvider_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorControlConfigIndMsgT_v02, sensorProvider)
+};
+
+static const uint8_t qmiLocSetSensorPropertiesReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, gyroBiasVarianceRandomWalk) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, gyroBiasVarianceRandomWalk_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, gyroBiasVarianceRandomWalk),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, velocityRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, velocityRandomWalkSpectralDensity_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, velocityRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, accelerationRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, accelerationRandomWalkSpectralDensity_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, accelerationRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, angleRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, angleRandomWalkSpectralDensity_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, angleRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, rateRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, rateRandomWalkSpectralDensity_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, rateRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleDataUse) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleDataUse_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleDataUse),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleVelocityRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleVelocityRandomWalkSpectralDensity_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleVelocityRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAccelRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAccelRandomWalkSpectralDensity_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAccelRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAngleRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAngleRandomWalkSpectralDensity_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAngleRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAngularRateRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAngularRateRandomWalkSpectralDensity_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleAngularRateRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleOdometryScaleFactorRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleOdometryScaleFactorRandomWalkSpectralDensity_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleOdometryScaleFactorRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleOdometryVariance) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleOdometryVariance_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesReqMsgT_v02, vehicleOdometryVariance)
+};
+
+static const uint8_t qmiLocSetSensorPropertiesIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesIndMsgT_v02, failedSensorPropertiesMask) - QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesIndMsgT_v02, failedSensorPropertiesMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPropertiesIndMsgT_v02, failedSensorPropertiesMask)
+};
+
+static const uint8_t qmiLocGetSensorPropertiesReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesReqMsgT_v02, getSensorPropertiesMask)
+};
+
+static const uint8_t qmiLocGetSensorPropertiesIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, gyroBiasVarianceRandomWalk) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, gyroBiasVarianceRandomWalk_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, gyroBiasVarianceRandomWalk),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, velocityRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, velocityRandomWalkSpectralDensity_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, velocityRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, accelerationRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, accelerationRandomWalkSpectralDensity_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, accelerationRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, angleRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, angleRandomWalkSpectralDensity_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, angleRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, rateRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, rateRandomWalkSpectralDensity_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, rateRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleDataUse) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleDataUse_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleDataUse),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleVelocityRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleVelocityRandomWalkSpectralDensity_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleVelocityRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAccelRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAccelRandomWalkSpectralDensity_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAccelRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAngleRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAngleRandomWalkSpectralDensity_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAngleRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAngularRateRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAngularRateRandomWalkSpectralDensity_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleAngularRateRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleOdometryScaleFactorRandomWalkSpectralDensity) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleOdometryScaleFactorRandomWalkSpectralDensity_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleOdometryScaleFactorRandomWalkSpectralDensity),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleOdometryVariance) - QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleOdometryVariance_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPropertiesIndMsgT_v02, vehicleOdometryVariance)
+};
+
+static const uint8_t qmiLocSetSensorPerformanceControlConfigReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, performanceControlMode) - QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, performanceControlMode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, performanceControlMode),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, accelSamplingSpec) - QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, accelSamplingSpec_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, accelSamplingSpec),
+ QMI_IDL_TYPE88(0, 25),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, gyroSamplingSpec) - QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, gyroSamplingSpec_valid)),
+ 0x12,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, gyroSamplingSpec),
+ QMI_IDL_TYPE88(0, 25),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, algorithmConfig) - QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, algorithmConfig_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, algorithmConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, accelSamplingSpecHigh) - QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, accelSamplingSpecHigh_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, accelSamplingSpecHigh),
+ QMI_IDL_TYPE88(0, 25),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, gyroSamplingSpecHigh) - QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, gyroSamplingSpecHigh_valid)),
+ 0x15,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02, gyroSamplingSpecHigh),
+ QMI_IDL_TYPE88(0, 25)
+};
+
+static const uint8_t qmiLocSetSensorPerformanceControlConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigIndMsgT_v02, failedConfiguration) - QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigIndMsgT_v02, failedConfiguration_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetSensorPerformanceControlConfigIndMsgT_v02, failedConfiguration)
+};
+
+/*
+ * qmiLocGetSensorPerformanceControlConfigReqMsgT is empty
+ * static const uint8_t qmiLocGetSensorPerformanceControlConfigReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetSensorPerformanceControlConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, performanceControlMode) - QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, performanceControlMode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, performanceControlMode),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, accelSamplingSpec) - QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, accelSamplingSpec_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, accelSamplingSpec),
+ QMI_IDL_TYPE88(0, 25),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, gyroSamplingSpec) - QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, gyroSamplingSpec_valid)),
+ 0x12,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, gyroSamplingSpec),
+ QMI_IDL_TYPE88(0, 25),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, algorithmConfig) - QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, algorithmConfig_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, algorithmConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, accelSamplingSpecHigh) - QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, accelSamplingSpecHigh_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, accelSamplingSpecHigh),
+ QMI_IDL_TYPE88(0, 25),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, gyroSamplingSpecHigh) - QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, gyroSamplingSpecHigh_valid)),
+ 0x15,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02, gyroSamplingSpecHigh),
+ QMI_IDL_TYPE88(0, 25)
+};
+
+static const uint8_t qmiLocInjectSuplCertificateReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSuplCertificateReqMsgT_v02, suplCertId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSuplCertificateReqMsgT_v02, suplCertData),
+ ((QMI_LOC_MAX_SUPL_CERT_LENGTH_V02) & 0xFF), ((QMI_LOC_MAX_SUPL_CERT_LENGTH_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocInjectSuplCertificateReqMsgT_v02, suplCertData) - QMI_IDL_OFFSET8(qmiLocInjectSuplCertificateReqMsgT_v02, suplCertData_len)
+};
+
+static const uint8_t qmiLocInjectSuplCertificateIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSuplCertificateIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocDeleteSuplCertificateReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteSuplCertificateReqMsgT_v02, suplCertId) - QMI_IDL_OFFSET8(qmiLocDeleteSuplCertificateReqMsgT_v02, suplCertId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteSuplCertificateReqMsgT_v02, suplCertId)
+};
+
+static const uint8_t qmiLocDeleteSuplCertificateIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteSuplCertificateIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocSetPositionEngineConfigParametersReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, injectedPositionControl) - QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, injectedPositionControl_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, injectedPositionControl),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, filterSvUsage) - QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, filterSvUsage_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, filterSvUsage),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, storeAssistData) - QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, storeAssistData_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, storeAssistData),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, enableFasterTTFF) - QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, enableFasterTTFF_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersReqMsgT_v02, enableFasterTTFF)
+};
+
+static const uint8_t qmiLocSetPositionEngineConfigParametersIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersIndMsgT_v02, failedPositionEngineConfigParamMask) - QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersIndMsgT_v02, failedPositionEngineConfigParamMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPositionEngineConfigParametersIndMsgT_v02, failedPositionEngineConfigParamMask)
+};
+
+static const uint8_t qmiLocGetPositionEngineConfigParametersReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersReqMsgT_v02, getPositionEngineConfigParamMask)
+};
+
+static const uint8_t qmiLocGetPositionEngineConfigParametersIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, injectedPositionControl) - QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, injectedPositionControl_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, injectedPositionControl),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, filterSvUsage) - QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, filterSvUsage_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, filterSvUsage),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, storeAssistData) - QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, storeAssistData_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, storeAssistData),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, enableFasterTTFF) - QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, enableFasterTTFF_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetPositionEngineConfigParametersIndMsgT_v02, enableFasterTTFF)
+};
+
+static const uint8_t qmiLocAddCircularGeofenceReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, transactionId),
+
+ 0x02,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, circularGeofenceArgs),
+ QMI_IDL_TYPE88(0, 43),
+
+ 0x03,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, breachMask),
+
+ 0x04,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, includePosition),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, responsiveness) - QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, responsiveness_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, responsiveness),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, confidence) - QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, confidence_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, confidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, customResponsivenessValue) - QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, customResponsivenessValue_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, customResponsivenessValue),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, dwellTime) - QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, dwellTime_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, dwellTime),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, dwellTypeMask) - QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, dwellTypeMask_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceReqMsgT_v02, dwellTypeMask)
+};
+
+static const uint8_t qmiLocAddCircularGeofenceIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceIndMsgT_v02, geofenceId) - QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceIndMsgT_v02, geofenceId_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddCircularGeofenceIndMsgT_v02, geofenceId)
+};
+
+static const uint8_t qmiLocDeleteGeofenceReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceReqMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceReqMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocDeleteGeofenceIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGeofenceIndMsgT_v02, geofenceId) - QMI_IDL_OFFSET8(qmiLocDeleteGeofenceIndMsgT_v02, geofenceId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceIndMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGeofenceIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocDeleteGeofenceIndMsgT_v02, transactionId_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceIndMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocQueryGeofenceReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceReqMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceReqMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocQueryGeofenceIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceId) - QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, transactionId_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceOrigin) - QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceOrigin_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceOrigin),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, posWrtGeofence) - QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, posWrtGeofence_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, posWrtGeofence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, circularGeofenceArgs) - QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, circularGeofenceArgs_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, circularGeofenceArgs),
+ QMI_IDL_TYPE88(0, 43),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceState) - QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceState_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGeofenceIndMsgT_v02, geofenceState)
+};
+
+static const uint8_t qmiLocSetGeofenceEngineConfigReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssUnavailableIndicationTimeout) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssUnavailableIndicationTimeout_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssUnavailableIndicationTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, maxGeofences) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, maxGeofences_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, maxGeofences),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, enableMotionDetectionSources) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, enableMotionDetectionSources_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, enableMotionDetectionSources),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, enableCpiUsage) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, enableCpiUsage_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, enableCpiUsage),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssPositionSessionTimeout) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssPositionSessionTimeout_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssPositionSessionTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssPositionMaxPuncAcceptable) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssPositionMaxPuncAcceptable_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, gnssPositionMaxPuncAcceptable),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, mediumResponsivenessValue) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, mediumResponsivenessValue_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, mediumResponsivenessValue),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, chalGnssEnvMinCpiWaitInterval) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, chalGnssEnvMinCpiWaitInterval_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, chalGnssEnvMinCpiWaitInterval),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, motionStateInfo) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, motionStateInfo_valid)),
+ 0x18,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, motionStateInfo),
+ QMI_LOC_GEOFENCE_MAX_MOTION_STATES_V02,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, motionStateInfo) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigReqMsgT_v02, motionStateInfo_len),
+ QMI_IDL_TYPE88(0, 44)
+};
+
+static const uint8_t qmiLocSetGeofenceEngineConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineConfigIndMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocGetGeofenceEngineConfigReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigReqMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocGetGeofenceEngineConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, gnssUnavailableIndicationTimeout) - QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, gnssUnavailableIndicationTimeout_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, gnssUnavailableIndicationTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, maxGeofences) - QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, maxGeofences_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, maxGeofences),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, enabledMotionDetectionSources) - QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, enabledMotionDetectionSources_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, enabledMotionDetectionSources),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, enabledCpiUsage) - QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, enabledCpiUsage_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGeofenceEngineConfigIndMsgT_v02, enabledCpiUsage)
+};
+
+static const uint8_t qmiLocEditGeofenceReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, geofenceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, geofenceState) - QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, geofenceState_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, geofenceState),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, breachMask) - QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, breachMask_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, breachMask),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, responsiveness) - QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, responsiveness_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceReqMsgT_v02, responsiveness)
+};
+
+static const uint8_t qmiLocEditGeofenceIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, geofenceId) - QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, geofenceId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, transactionId_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, failedParams) - QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, failedParams_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEditGeofenceIndMsgT_v02, failedParams)
+};
+
+static const uint8_t qmiLocEventGetTimeZoneReqIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGetTimeZoneReqIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectTimeZoneInfoReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTimeZoneInfoReqMsgT_v02, timeUtc),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectTimeZoneInfoReqMsgT_v02, timeZone),
+ QMI_IDL_TYPE88(0, 45)
+};
+
+static const uint8_t qmiLocInjectTimeZoneInfoIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTimeZoneInfoIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGetBestAvailablePositionReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionReqMsgT_v02, specialReqType) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionReqMsgT_v02, specialReqType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionReqMsgT_v02, specialReqType)
+};
+
+static const uint8_t qmiLocGetBestAvailablePositionIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, latitude) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, latitude_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, latitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, longitude) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, longitude_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, longitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncCircular) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncCircular_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncCircular),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, altitudeWrtEllipsoid) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, altitudeWrtEllipsoid_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertUnc) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertUnc_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, timestampUtc) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, timestampUtc_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, timeUnc) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, timeUnc_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, timeUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseSemiMinor) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseSemiMinor_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseSemiMinor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseSemiMajor) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseSemiMajor_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseSemiMajor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseOrientAzimuth) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseOrientAzimuth_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horUncEllipseOrientAzimuth),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horCircularConfidence) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horCircularConfidence_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horCircularConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horEllipticalConfidence) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horEllipticalConfidence_valid)),
+ 0x1C,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horEllipticalConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horReliability) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horReliability_valid)),
+ 0x1D,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horSpeed) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horSpeed_valid)),
+ 0x1E,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horSpeed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horSpeedUnc) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horSpeedUnc_valid)),
+ 0x1F,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, horSpeedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, altitudeWrtMeanSeaLevel) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, altitudeWrtMeanSeaLevel_valid)),
+ 0x20,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, altitudeWrtMeanSeaLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertConfidence) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertConfidence_valid)),
+ 0x21,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertReliability) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertReliability_valid)),
+ 0x22,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertSpeed) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertSpeed_valid)),
+ 0x23,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertSpeed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertSpeedUnc) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertSpeedUnc_valid)),
+ 0x24,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, vertSpeedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, heading) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, heading_valid)),
+ 0x25,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, heading),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, headingUnc) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, headingUnc_valid)),
+ 0x26,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, headingUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, magneticDeviation) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, magneticDeviation_valid)),
+ 0x27,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, magneticDeviation),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, technologyMask) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, technologyMask_valid)),
+ 0x28,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, technologyMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, DOP) - QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, DOP_valid)),
+ 0x29,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBestAvailablePositionIndMsgT_v02, DOP),
+ QMI_IDL_TYPE88(0, 3),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gpsTime) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gpsTime_valid)),
+ 0x2A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, gpsTime),
+ QMI_IDL_TYPE88(0, 2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, timeSrc) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, timeSrc_valid)),
+ 0x2B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, timeSrc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, sensorDataUsage) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, sensorDataUsage_valid)),
+ 0x2C,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, sensorDataUsage),
+ QMI_IDL_TYPE88(0, 5),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedList_valid)),
+ 0x2D,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedList),
+ QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, extDOP) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, extDOP_valid)),
+ 0x2E,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, extDOP),
+ QMI_IDL_TYPE88(0, 4),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, spoofReportMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, spoofReportMask_valid)),
+ 0x2F,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, spoofReportMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, expandedGnssSvUsedList_valid)),
+ 0x30,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, expandedGnssSvUsedList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, expandedGnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedSignalTypeList_valid)),
+ 0x31,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedSignalTypeList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBestAvailablePositionIndMsgT_v02, gnssSvUsedSignalTypeList_len)
+};
+
+static const uint8_t qmiLocInjectMotionDataReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectMotionDataReqMsgT_v02, motion_data),
+ QMI_IDL_TYPE88(0, 46)
+};
+
+static const uint8_t qmiLocInjectMotionDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectMotionDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGetNiGeofenceIdListReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListReqMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocGetNiGeofenceIdListIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, niGeofenceIdList) - QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, niGeofenceIdList_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, niGeofenceIdList),
+ QMI_LOC_MAX_NI_GEOFENCE_ID_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, niGeofenceIdList) - QMI_IDL_OFFSET8(qmiLocGetNiGeofenceIdListIndMsgT_v02, niGeofenceIdList_len)
+};
+
+static const uint8_t qmiLocInjectGSMCellInfoReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectGSMCellInfoReqMsgT_v02, gsmCellId),
+ QMI_IDL_TYPE88(0, 47),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectGSMCellInfoReqMsgT_v02, roamingStatus),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectGSMCellInfoReqMsgT_v02, timingAdvance) - QMI_IDL_OFFSET8(qmiLocInjectGSMCellInfoReqMsgT_v02, timingAdvance_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectGSMCellInfoReqMsgT_v02, timingAdvance)
+};
+
+static const uint8_t qmiLocInjectGSMCellInfoIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectGSMCellInfoIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectWCDMACellInfoReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, wcdmaCellId),
+ QMI_IDL_TYPE88(0, 48),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, roamingStatus),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, freq) - QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, freq_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, freq),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, psc) - QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, psc_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoReqMsgT_v02, psc)
+};
+
+static const uint8_t qmiLocInjectWCDMACellInfoIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectWCDMACellInfoIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectTDSCDMACellInfoReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectTDSCDMACellInfoReqMsgT_v02, tdscdmaCellId),
+ QMI_IDL_TYPE88(0, 49),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTDSCDMACellInfoReqMsgT_v02, roamingStatus),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectTDSCDMACellInfoReqMsgT_v02, freq) - QMI_IDL_OFFSET8(qmiLocInjectTDSCDMACellInfoReqMsgT_v02, freq_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTDSCDMACellInfoReqMsgT_v02, freq)
+};
+
+static const uint8_t qmiLocInjectTDSCDMACellInfoIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTDSCDMACellInfoIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectSubscriberIDReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSubscriberIDReqMsgT_v02, preferredIMSI) - QMI_IDL_OFFSET8(qmiLocInjectSubscriberIDReqMsgT_v02, preferredIMSI_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSubscriberIDReqMsgT_v02, preferredIMSI),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSubscriberIDReqMsgT_v02, preferredMSISDN) - QMI_IDL_OFFSET8(qmiLocInjectSubscriberIDReqMsgT_v02, preferredMSISDN_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSubscriberIDReqMsgT_v02, preferredMSISDN)
+};
+
+static const uint8_t qmiLocInjectSubscriberIDIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSubscriberIDIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectNetworkInitiatedMessageReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectNetworkInitiatedMessageReqMsgT_v02, injectedNIMessageType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectNetworkInitiatedMessageReqMsgT_v02, injectedNIMessage),
+ ((QMI_LOC_MAX_INJECTED_NETWORK_INITIATED_MESSAGE_LENGTH_V02) & 0xFF), ((QMI_LOC_MAX_INJECTED_NETWORK_INITIATED_MESSAGE_LENGTH_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocInjectNetworkInitiatedMessageReqMsgT_v02, injectedNIMessage) - QMI_IDL_OFFSET8(qmiLocInjectNetworkInitiatedMessageReqMsgT_v02, injectedNIMessage_len)
+};
+
+static const uint8_t qmiLocInjectNetworkInitiatedMessageIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectNetworkInitiatedMessageIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocWWANOutOfServiceNotificationReqMsgT is empty
+ * static const uint8_t qmiLocWWANOutOfServiceNotificationReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocWWANOutOfServiceNotificationIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocWWANOutOfServiceNotificationIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocPedometerReportReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, timeSource),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, timestamp),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, timeInterval),
+
+ 0x04,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepCount),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepConfidence) - QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepConfidence_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepCountUncertainty) - QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepCountUncertainty_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepCountUncertainty),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepRate) - QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepRate_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportReqMsgT_v02, stepRate)
+};
+
+static const uint8_t qmiLocPedometerReportIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocPedometerReportIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGetBatchSizeReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBatchSizeReqMsgT_v02, transactionId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBatchSizeReqMsgT_v02, batchSize),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBatchSizeReqMsgT_v02, batchType) - QMI_IDL_OFFSET8(qmiLocGetBatchSizeReqMsgT_v02, batchType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBatchSizeReqMsgT_v02, batchType)
+};
+
+static const uint8_t qmiLocGetBatchSizeIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBatchSizeIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBatchSizeIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBatchSizeIndMsgT_v02, batchSize)
+};
+
+static const uint8_t qmiLocStartBatchingReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, minInterval) - QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, minInterval_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, minInterval),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, horizontalAccuracyLevel) - QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, horizontalAccuracyLevel_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, horizontalAccuracyLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, fixSessionTimeout) - QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, fixSessionTimeout_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, fixSessionTimeout),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, minDistance) - QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, minDistance_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, minDistance),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, batchAllPos) - QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, batchAllPos_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, batchAllPos),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, requestId) - QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, requestId_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingReqMsgT_v02, requestId)
+};
+
+static const uint8_t qmiLocStartBatchingIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartBatchingIndMsgT_v02, requestId) - QMI_IDL_OFFSET8(qmiLocStartBatchingIndMsgT_v02, requestId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartBatchingIndMsgT_v02, requestId)
+};
+
+static const uint8_t qmiLocEventBatchFullIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, batchCount),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, batchType) - QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, batchType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, batchType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, accumulatedDistance) - QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, accumulatedDistance_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, accumulatedDistance),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, batchedPosition) - QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, batchedPosition_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventBatchFullIndMsgT_v02, batchedPosition)
+};
+
+static const uint8_t qmiLocEventLiveBatchedPositionReportIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventLiveBatchedPositionReportIndMsgT_v02, liveBatchedReport),
+ QMI_IDL_TYPE88(0, 50)
+};
+
+static const uint8_t qmiLocReadFromBatchReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchReqMsgT_v02, numberOfEntries),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocReadFromBatchReqMsgT_v02, batchType) - QMI_IDL_OFFSET8(qmiLocReadFromBatchReqMsgT_v02, batchType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchReqMsgT_v02, batchType)
+};
+
+static const uint8_t qmiLocReadFromBatchIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, numberOfEntries) - QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, numberOfEntries_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, numberOfEntries),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, batchedReportList) - QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, batchedReportList_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, batchedReportList),
+ QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, batchedReportList) - QMI_IDL_OFFSET8(qmiLocReadFromBatchIndMsgT_v02, batchedReportList_len),
+ QMI_IDL_TYPE88(0, 50)
+};
+
+static const uint8_t qmiLocStopBatchingReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopBatchingReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStopBatchingReqMsgT_v02, requestId) - QMI_IDL_OFFSET8(qmiLocStopBatchingReqMsgT_v02, requestId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopBatchingReqMsgT_v02, requestId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStopBatchingReqMsgT_v02, batchType) - QMI_IDL_OFFSET8(qmiLocStopBatchingReqMsgT_v02, batchType_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopBatchingReqMsgT_v02, batchType)
+};
+
+static const uint8_t qmiLocStopBatchingIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopBatchingIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopBatchingIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStopBatchingIndMsgT_v02, requestId) - QMI_IDL_OFFSET8(qmiLocStopBatchingIndMsgT_v02, requestId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopBatchingIndMsgT_v02, requestId)
+};
+
+static const uint8_t qmiLocReleaseBatchReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReleaseBatchReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocReleaseBatchReqMsgT_v02, batchType) - QMI_IDL_OFFSET8(qmiLocReleaseBatchReqMsgT_v02, batchType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReleaseBatchReqMsgT_v02, batchType)
+};
+
+static const uint8_t qmiLocReleaseBatchIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReleaseBatchIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocReleaseBatchIndMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocEventInjectWifiApDataReqIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectWifiApDataReqIndMsgT_v02, e911Mode) - QMI_IDL_OFFSET8(qmiLocEventInjectWifiApDataReqIndMsgT_v02, e911Mode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectWifiApDataReqIndMsgT_v02, e911Mode)
+};
+
+static const uint8_t qmiLocInjectWifiApDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfo),
+ QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfo) - QMI_IDL_OFFSET8(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfo_len),
+ QMI_IDL_TYPE88(0, 51),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, errorCause) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, errorCause_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiApDataReqMsgT_v02, errorCause),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, requestTimestamp) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, requestTimestamp_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiApDataReqMsgT_v02, requestTimestamp),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, receiveTimestamp) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, receiveTimestamp_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiApDataReqMsgT_v02, receiveTimestamp),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, onDemandScan) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, onDemandScan_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiApDataReqMsgT_v02, onDemandScan),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfoA) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfoA_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfoA),
+ QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfoA) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, wifiApInfoA_len),
+ QMI_IDL_TYPE88(0, 52),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, ueMacAddress) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectWifiApDataReqMsgT_v02, ueMacAddress_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectWifiApDataReqMsgT_v02, ueMacAddress),
+ QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02
+};
+
+static const uint8_t qmiLocInjectWifiApDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectWifiApDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocNotifyWifiAttachmentStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02, attachState),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02, accessPointMacAddress) - QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02, accessPointMacAddress_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02, accessPointMacAddress),
+ QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02, wifiApSsid) - QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02, wifiApSsid_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02, wifiApSsid),
+ QMI_LOC_MAX_WIFI_AP_SSID_STR_LENGTH_V02
+};
+
+static const uint8_t qmiLocNotifyWifiAttachmentStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiAttachmentStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocNotifyWifiEnabledStatusReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiEnabledStatusReqMsgT_v02, enabledStatus)
+};
+
+static const uint8_t qmiLocNotifyWifiEnabledStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocNotifyWifiEnabledStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEventVehicleDataReadyIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleAccelReadyStatus) - QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleAccelReadyStatus_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleAccelReadyStatus),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleAngularRateReadyStatus) - QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleAngularRateReadyStatus_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleAngularRateReadyStatus),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleOdometryReadyStatus) - QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleOdometryReadyStatus_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventVehicleDataReadyIndMsgT_v02, vehicleOdometryReadyStatus)
+};
+
+static const uint8_t qmiLocInjectVehicleSensorDataReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectVehicleSensorDataReqMsgT_v02, accelData) - QMI_IDL_OFFSET8(qmiLocInjectVehicleSensorDataReqMsgT_v02, accelData_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectVehicleSensorDataReqMsgT_v02, accelData),
+ QMI_IDL_TYPE88(0, 54),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectVehicleSensorDataReqMsgT_v02, angRotationData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectVehicleSensorDataReqMsgT_v02, angRotationData_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectVehicleSensorDataReqMsgT_v02, angRotationData),
+ QMI_IDL_TYPE88(0, 54),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectVehicleSensorDataReqMsgT_v02, odometryData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectVehicleSensorDataReqMsgT_v02, odometryData_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectVehicleSensorDataReqMsgT_v02, odometryData),
+ QMI_IDL_TYPE88(0, 56),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectVehicleSensorDataReqMsgT_v02, changeInTimeScales) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectVehicleSensorDataReqMsgT_v02, changeInTimeScales_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectVehicleSensorDataReqMsgT_v02, changeInTimeScales)
+};
+
+static const uint8_t qmiLocInjectVehicleSensorDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectVehicleSensorDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGetAvailWwanPositionReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionReqMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocGetAvailWwanPositionIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, latitude) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, latitude_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, latitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, longitude) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, longitude_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, longitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncCircular) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncCircular_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncCircular),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, altitudeWrtEllipsoid) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, altitudeWrtEllipsoid_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertUnc) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertUnc_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timestampUtc) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timestampUtc_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timeUnc) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timeUnc_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timeUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseSemiMinor) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseSemiMinor_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseSemiMinor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseSemiMajor) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseSemiMajor_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseSemiMajor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseOrientAzimuth) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseOrientAzimuth_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horUncEllipseOrientAzimuth),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horCircularConfidence) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horCircularConfidence_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horCircularConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horEllipticalConfidence) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horEllipticalConfidence_valid)),
+ 0x1C,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horEllipticalConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horReliability) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horReliability_valid)),
+ 0x1D,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, horReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, altitudeWrtMeanSeaLevel) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, altitudeWrtMeanSeaLevel_valid)),
+ 0x1E,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, altitudeWrtMeanSeaLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertConfidence) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertConfidence_valid)),
+ 0x1F,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertReliability) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertReliability_valid)),
+ 0x20,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, vertReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, gpsTime) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, gpsTime_valid)),
+ 0x21,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, gpsTime),
+ QMI_IDL_TYPE88(0, 2),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timeSrc) - QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timeSrc_valid)),
+ 0x22,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetAvailWwanPositionIndMsgT_v02, timeSrc)
+};
+
+static const uint8_t qmiLocSetPremiumServicesCfgReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPremiumServicesCfgReqMsgT_v02, premiumServiceType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPremiumServicesCfgReqMsgT_v02, premiumServiceCfg)
+};
+
+static const uint8_t qmiLocSetPremiumServicesCfgIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetPremiumServicesCfgIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocSetXtraVersionCheckReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetXtraVersionCheckReqMsgT_v02, xtraVersionCheckMode)
+};
+
+static const uint8_t qmiLocSetXtraVersionCheckIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetXtraVersionCheckIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocSetGNSSConstRepConfigReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, measReportConfig) - QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, measReportConfig_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, measReportConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, svPolyReportConfig) - QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, svPolyReportConfig_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, svPolyReportConfig),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullEphemerisDb) - QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullEphemerisDb_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullEphemerisDb),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullSvPolyDb) - QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullSvPolyDb_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullSvPolyDb),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullIonoDb) - QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullIonoDb_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigReqMsgT_v02, reportFullIonoDb)
+};
+
+static const uint8_t qmiLocSetGNSSConstRepConfigIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGNSSConstRepConfigIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEventGnssSvMeasInfoIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, seqNum),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, maxMessageNum),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, system),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, rcvrClockFrequencyInfo) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, rcvrClockFrequencyInfo_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, rcvrClockFrequencyInfo),
+ QMI_IDL_TYPE88(0, 57),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, leapSecondInfo) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, leapSecondInfo_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, leapSecondInfo),
+ QMI_IDL_TYPE88(0, 58),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsGloInterSystemBias) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsGloInterSystemBias_valid)),
+ 0x12,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsGloInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsBdsInterSystemBias) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsBdsInterSystemBias_valid)),
+ 0x13,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsBdsInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsGalInterSystemBias) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsGalInterSystemBias_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsGalInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, bdsGloInterSystemBias) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, bdsGloInterSystemBias_valid)),
+ 0x15,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, bdsGloInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galGloInterSystemBias) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galGloInterSystemBias_valid)),
+ 0x16,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galGloInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galBdsInterSystemBias) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galBdsInterSystemBias_valid)),
+ 0x17,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galBdsInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, systemTime) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, systemTime_valid)),
+ 0x18,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, systemTime),
+ QMI_IDL_TYPE88(0, 60),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gloTime) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gloTime_valid)),
+ 0x19,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gloTime),
+ QMI_IDL_TYPE88(0, 61),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, systemTimeExt) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, systemTimeExt_valid)),
+ 0x1A,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, systemTimeExt),
+ QMI_IDL_TYPE88(0, 62),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svMeasurement) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svMeasurement_valid)),
+ 0x1B,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svMeasurement),
+ QMI_LOC_SV_MEAS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svMeasurement) - QMI_IDL_OFFSET8(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svMeasurement_len),
+ QMI_IDL_TYPE88(0, 64),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, numClockResets) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, numClockResets_valid)),
+ 0x1C,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, numClockResets),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svCarrierPhaseUncertainty) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svCarrierPhaseUncertainty_valid)),
+ 0x1D,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svCarrierPhaseUncertainty),
+ QMI_LOC_SV_MEAS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svCarrierPhaseUncertainty) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, svCarrierPhaseUncertainty_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gnssSignalType) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gnssSignalType_valid)),
+ 0x1E,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gnssSignalType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, jammerIndicator) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, jammerIndicator_valid)),
+ 0x1F,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, jammerIndicator),
+ QMI_IDL_TYPE88(0, 6),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GpsL1L2cTimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GpsL1L2cTimeBias_valid)),
+ 0x20,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GpsL1L2cTimeBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GpsL1L5TimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GpsL1L5TimeBias_valid)),
+ 0x21,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GpsL1L5TimeBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GloG1G2TimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GloG1G2TimeBias_valid)),
+ 0x22,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GloG1G2TimeBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, BdsB1iB2aTimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, BdsB1iB2aTimeBias_valid)),
+ 0x23,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, BdsB1iB2aTimeBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, BdsB1iB1cTimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, BdsB1iB1cTimeBias_valid)),
+ 0x24,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, BdsB1iB1cTimeBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GalE1E5aTimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GalE1E5aTimeBias_valid)),
+ 0x25,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GalE1E5aTimeBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GalE1E5bTimeBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GalE1E5bTimeBias_valid)),
+ 0x26,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, GalE1E5bTimeBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, nHzMeasurement) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, nHzMeasurement_valid)),
+ 0x27,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, nHzMeasurement),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, measurementCodeType) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, measurementCodeType_valid)),
+ 0x28,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, measurementCodeType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, otherCodeTypeName) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, otherCodeTypeName_valid)),
+ 0x29,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, otherCodeTypeName),
+ QMI_LOC_SV_MEAS_OTHER_CODE_TYPE_NAME_MAX_LEN_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, otherCodeTypeName) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, otherCodeTypeName_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsNavicInterSystemBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsNavicInterSystemBias_valid)),
+ 0x2A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gpsNavicInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galNavicInterSystemBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galNavicInterSystemBias_valid)),
+ 0x2B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, galNavicInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gloNavicInterSystemBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gloNavicInterSystemBias_valid)),
+ 0x2C,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, gloNavicInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, bdsNavicInterSystemBias) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, bdsNavicInterSystemBias_valid)),
+ 0x2D,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, bdsNavicInterSystemBias),
+ QMI_IDL_TYPE88(0, 59),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvMeasurement) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvMeasurement_valid)),
+ 0x2E,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvMeasurement),
+ QMI_LOC_EXT_SV_MEAS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvMeasurement) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvMeasurement_len),
+ QMI_IDL_TYPE88(0, 64),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvCarrierPhaseUncertainty) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvCarrierPhaseUncertainty_valid)),
+ 0x2F,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvCarrierPhaseUncertainty),
+ QMI_LOC_EXT_SV_MEAS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvCarrierPhaseUncertainty) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, extSvCarrierPhaseUncertainty_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, refCountTicks) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, refCountTicks_valid)),
+ 0x30,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, refCountTicks),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssCorrectionSourceT) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssCorrectionSourceT_valid)),
+ 0x31,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssCorrectionSourceT),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssCorrectionSourceID) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssCorrectionSourceID_valid)),
+ 0x32,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssCorrectionSourceID),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssRefStationId) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssRefStationId_valid)),
+ 0x33,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssRefStationId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssSvMeasurement) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssSvMeasurement_valid)),
+ 0x34,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssSvMeasurement),
+ QMI_LOC_DGNSS_SV_MEAS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssSvMeasurement) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, dgnssSvMeasurement_len),
+ QMI_IDL_TYPE88(0, 65),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, refCountTicksUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, refCountTicksUnc_valid)),
+ 0x35,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, refCountTicksUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, subSeqNum) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, subSeqNum_valid)),
+ 0x36,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, subSeqNum),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, maxSubSeqNum) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvMeasInfoIndMsgT_v02, maxSubSeqNum_valid)),
+ 0x37,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvMeasInfoIndMsgT_v02, maxSubSeqNum)
+};
+
+static const uint8_t qmiLocEventGnssSvPolyIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, gnssSvId),
+
+ 0x02,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, T0),
+
+ 0x03,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, svPolyFlagValid),
+
+ 0x04,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, svPolyFlags),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoeffXYZ0) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoeffXYZ0_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoeffXYZ0),
+ QMI_LOC_SV_POLY_XYZ_0_TH_ORDER_COEFF_SIZE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoefXYZN) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoefXYZN_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoefXYZN),
+ QMI_LOC_SV_POLY_XYZ_N_TH_ORDER_COEFF_SIZE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoefClockBias) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoefClockBias_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, polyCoefClockBias),
+ QMI_LOC_SV_POLY_SV_CLKBIAS_COEFF_SIZE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, gloFrequency) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, gloFrequency_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, gloFrequency),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, IODE) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, IODE_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, IODE),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, enhancedIOD) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, enhancedIOD_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, enhancedIOD),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, svPosUnc) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, svPosUnc_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, svPosUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, ionoDelay) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, ionoDelay_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, ionoDelay),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, ionoDot) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, ionoDot_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, ionoDot),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, sbasIonoDelay) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, sbasIonoDelay_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, sbasIonoDelay),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, sbasIonoDot) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, sbasIonoDot_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, sbasIonoDot),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, tropoDelay) - QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, tropoDelay_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventGnssSvPolyIndMsgT_v02, tropoDelay),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, elevation) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, elevation_valid)),
+ 0x1C,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, elevation),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, elevationDot) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, elevationDot_valid)),
+ 0x1D,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, elevationDot),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, elenationUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, elenationUnc_valid)),
+ 0x1E,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, elenationUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, velCoef) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, velCoef_valid)),
+ 0x1F,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, velCoef),
+ QMI_LOC_SV_POLY_VELOCITY_COEF_SIZE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL1ca) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL1ca_valid)),
+ 0x20,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL1ca),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL2c) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL2c_valid)),
+ 0x21,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL2c),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL5I5) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL5I5_valid)),
+ 0x22,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL5I5),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL5Q5) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL5Q5_valid)),
+ 0x23,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, gpsIscL5Q5),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsTgd) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gpsTgd_valid)),
+ 0x24,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, gpsTgd),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gloTgdG1G2) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, gloTgdG1G2_valid)),
+ 0x25,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, gloTgdG1G2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB1) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB1_valid)),
+ 0x26,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB1),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB2) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB2_valid)),
+ 0x27,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB2a) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB2a_valid)),
+ 0x28,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB2a),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsIscB2a) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsIscB2a_valid)),
+ 0x29,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, bdsIscB2a),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, galBgdE1E5a) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, galBgdE1E5a_valid)),
+ 0x2A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, galBgdE1E5a),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, galBgdE1E5b) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, galBgdE1E5b_valid)),
+ 0x2B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, galBgdE1E5b),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, navicTgdL5) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, navicTgdL5_valid)),
+ 0x2C,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, navicTgdL5),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB1c) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB1c_valid)),
+ 0x2D,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, bdsTgdB1c),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsIscB1c) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, bdsIscB1c_valid)),
+ 0x2E,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, bdsIscB1c),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, multibandHealth) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventGnssSvPolyIndMsgT_v02, multibandHealth_valid)),
+ 0x2F,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventGnssSvPolyIndMsgT_v02, multibandHealth)
+};
+
+static const uint8_t qmiLocAddGeofenceContextReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, geofenceId) - QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, geofenceId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, wifiApSsidInfo) - QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, wifiApSsidInfo_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, wifiApSsidInfo),
+ QMI_LOC_WIFI_AREA_ID_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, wifiApSsidInfo) - QMI_IDL_OFFSET8(qmiLocAddGeofenceContextReqMsgT_v02, wifiApSsidInfo_len),
+ QMI_IDL_TYPE88(0, 37),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wifiApMacAddressList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wifiApMacAddressList_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocAddGeofenceContextReqMsgT_v02, wifiApMacAddressList),
+ QMI_LOC_WIFI_AREA_ID_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wifiApMacAddressList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wifiApMacAddressList_len),
+ QMI_IDL_TYPE88(0, 66),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, tdsCdmaCellIDList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, tdsCdmaCellIDList_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocAddGeofenceContextReqMsgT_v02, tdsCdmaCellIDList),
+ QMI_LOC_CELL_ID_LIST_LENGTH_V02,
+ QMI_IDL_TYPE88(0, 49),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wcdmaCellIDList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wcdmaCellIDList_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocAddGeofenceContextReqMsgT_v02, wcdmaCellIDList),
+ QMI_LOC_CELL_ID_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wcdmaCellIDList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, wcdmaCellIDList_len),
+ QMI_IDL_TYPE88(0, 48),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, gsmCellIDList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, gsmCellIDList_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocAddGeofenceContextReqMsgT_v02, gsmCellIDList),
+ QMI_LOC_CELL_ID_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, gsmCellIDList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, gsmCellIDList_len),
+ QMI_IDL_TYPE88(0, 47),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, iBeaconList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, iBeaconList_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocAddGeofenceContextReqMsgT_v02, iBeaconList),
+ QMI_LOC_IBEACON_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, iBeaconList) - QMI_IDL_OFFSET16RELATIVE(qmiLocAddGeofenceContextReqMsgT_v02, iBeaconList_len),
+ QMI_IDL_TYPE88(0, 67)
+};
+
+static const uint8_t qmiLocAddGeofenceContextIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, geofenceId) - QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, geofenceId_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, contextId) - QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, contextId_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocAddGeofenceContextIndMsgT_v02, contextId)
+};
+
+static const uint8_t qmiLocSetGeofenceEngineContextReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextReqMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextReqMsgT_v02, utcTimeOfDay) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextReqMsgT_v02, utcTimeOfDay_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextReqMsgT_v02, utcTimeOfDay),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextReqMsgT_v02, temperature) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextReqMsgT_v02, temperature_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextReqMsgT_v02, temperature)
+};
+
+static const uint8_t qmiLocSetGeofenceEngineContextIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGeofenceEngineContextIndMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocDeleteGeofenceContextReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextReqMsgT_v02, transactionId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextReqMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextReqMsgT_v02, contextId) - QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextReqMsgT_v02, contextId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextReqMsgT_v02, contextId)
+};
+
+static const uint8_t qmiLocDeleteGeofenceContextIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, geofenceId) - QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, geofenceId_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, geofenceId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, contextId) - QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, contextId_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGeofenceContextIndMsgT_v02, contextId)
+};
+
+static const uint8_t qmiLocInjectGtpClientDownloadedDataReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectGtpClientDownloadedDataReqMsgT_v02, ClientDownloadedData),
+ ((QMI_LOC_MAX_GTP_WWAN_CLIENT_DOWNLOADED_DATA_LEN_V02) & 0xFF), ((QMI_LOC_MAX_GTP_WWAN_CLIENT_DOWNLOADED_DATA_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocInjectGtpClientDownloadedDataReqMsgT_v02, ClientDownloadedData) - QMI_IDL_OFFSET8(qmiLocInjectGtpClientDownloadedDataReqMsgT_v02, ClientDownloadedData_len)
+};
+
+static const uint8_t qmiLocInjectGtpClientDownloadedDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectGtpClientDownloadedDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGdtUploadBeginStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadBeginStatusReqMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadBeginStatusReqMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadBeginStatusReqMsgT_v02, gdtAccessStatus)
+};
+
+static const uint8_t qmiLocGdtUploadBeginStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadBeginStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGdtUploadEndReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadEndReqMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadEndReqMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadEndReqMsgT_v02, gdtEndStatus)
+};
+
+static const uint8_t qmiLocGdtUploadEndIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtUploadEndIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGtpApStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, gtpApDbStatus),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, gtpApPcid64) - QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, gtpApPcid64_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, gtpApPcid64),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, oemId) - QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, oemId_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, oemId),
+ ((QMI_LOC_MAX_OEM_ID_LEN_V02) & 0xFF), ((QMI_LOC_MAX_OEM_ID_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, oemId) - QMI_IDL_OFFSET8(qmiLocGtpApStatusReqMsgT_v02, oemId_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGtpApStatusReqMsgT_v02, modelId) - QMI_IDL_OFFSET16RELATIVE(qmiLocGtpApStatusReqMsgT_v02, modelId_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGtpApStatusReqMsgT_v02, modelId),
+ ((QMI_LOC_MAX_MODEL_ID_LEN_V02) & 0xFF), ((QMI_LOC_MAX_MODEL_ID_LEN_V02) >> 8),
+ QMI_IDL_OFFSET16RELATIVE(qmiLocGtpApStatusReqMsgT_v02, modelId) - QMI_IDL_OFFSET16RELATIVE(qmiLocGtpApStatusReqMsgT_v02, modelId_len)
+};
+
+static const uint8_t qmiLocGtpApStatusIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpApStatusIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGtpApStatusIndMsgT_v02, clientSoftwareVersion),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGtpApStatusIndMsgT_v02, asnVersion),
+ QMI_IDL_TYPE88(0, 68)
+};
+
+static const uint8_t qmiLocGdtDownloadBeginStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, sessionId),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, processingStatus),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, wwanDownloadFlag) - QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, wwanDownloadFlag_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, wwanDownloadFlag),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, respLocInfo) - QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, respLocInfo_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, respLocInfo),
+ ((QMI_LOC_MAX_GTP_RLI_LEN_V02) & 0xFF), ((QMI_LOC_MAX_GTP_RLI_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, respLocInfo) - QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusReqMsgT_v02, respLocInfo_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGdtDownloadBeginStatusReqMsgT_v02, apRemainingThrottleTime) - QMI_IDL_OFFSET16RELATIVE(qmiLocGdtDownloadBeginStatusReqMsgT_v02, apRemainingThrottleTime_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGdtDownloadBeginStatusReqMsgT_v02, apRemainingThrottleTime)
+};
+
+static const uint8_t qmiLocGdtDownloadBeginStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadBeginStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGdtDownloadReadyStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadReadyStatusReqMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadReadyStatusReqMsgT_v02, sessionId),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadReadyStatusReqMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x04,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadReadyStatusReqMsgT_v02, filePath),
+ QMI_LOC_MAX_GDT_PATH_LEN_V02,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadReadyStatusReqMsgT_v02, filePath) - QMI_IDL_OFFSET8(qmiLocGdtDownloadReadyStatusReqMsgT_v02, filePath_len)
+};
+
+static const uint8_t qmiLocGdtDownloadReadyStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadReadyStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGdtReceiveDoneStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtReceiveDoneStatusReqMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtReceiveDoneStatusReqMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtReceiveDoneStatusReqMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGdtReceiveDoneStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtReceiveDoneStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGdtDownloadEndStatusReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadEndStatusReqMsgT_v02, serviceId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadEndStatusReqMsgT_v02, sessionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadEndStatusReqMsgT_v02, status)
+};
+
+static const uint8_t qmiLocGdtDownloadEndStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGdtDownloadEndStatusIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocStartDbtReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, reqId),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, minDistance),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, distanceType),
+
+ 0x04,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, needOriginLocation),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, maxLatency) - QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, maxLatency_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, maxLatency),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, usageType) - QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, usageType_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtReqMsgT_v02, usageType)
+};
+
+static const uint8_t qmiLocStartDbtIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartDbtIndMsgT_v02, reqId) - QMI_IDL_OFFSET8(qmiLocStartDbtIndMsgT_v02, reqId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartDbtIndMsgT_v02, reqId)
+};
+
+static const uint8_t qmiLocStopDbtReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopDbtReqMsgT_v02, reqId)
+};
+
+static const uint8_t qmiLocStopDbtIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopDbtIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStopDbtIndMsgT_v02, reqId) - QMI_IDL_OFFSET8(qmiLocStopDbtIndMsgT_v02, reqId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStopDbtIndMsgT_v02, reqId)
+};
+
+static const uint8_t qmiLocEventDbtPositionReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, reqId),
+
+ 0x02,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, dbtPosition),
+ QMI_IDL_TYPE88(0, 69),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, positionType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, headingUnc) - QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, headingUnc_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, headingUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, speedUnc) - QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, speedUnc_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, speedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, horConfidence) - QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, horConfidence_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, horConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, vertConfidence) - QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, vertConfidence_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, DOP) - QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, DOP_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, DOP),
+ QMI_IDL_TYPE88(0, 3),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedList_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedList),
+ QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedList) - QMI_IDL_OFFSET8(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, positionSrc) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, positionSrc_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventDbtPositionReportIndMsgT_v02, positionSrc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, extDOP) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, extDOP_valid)),
+ 0x17,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventDbtPositionReportIndMsgT_v02, extDOP),
+ QMI_IDL_TYPE88(0, 4),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, expandedGnssSvUsedList_valid)),
+ 0x18,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventDbtPositionReportIndMsgT_v02, expandedGnssSvUsedList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, expandedGnssSvUsedList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, expandedGnssSvUsedList_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList_valid)),
+ 0x19,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventDbtPositionReportIndMsgT_v02, gnssSvUsedSignalTypeList_len)
+};
+
+static const uint8_t qmiLocEventDbtSessionStatusIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtSessionStatusIndMsgT_v02, dbtSessionStatus),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDbtSessionStatusIndMsgT_v02, reqId) - QMI_IDL_OFFSET8(qmiLocEventDbtSessionStatusIndMsgT_v02, reqId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDbtSessionStatusIndMsgT_v02, reqId)
+};
+
+static const uint8_t qmiLocSecureGetAvailablePositionReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionReqMsgT_v02, secureLocDataMode),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionReqMsgT_v02, qmilocSecureGetAvailablePositionRequestData),
+ ((QMI_LOC_SECURE_GET_AVAILABLE_POS_REQUEST_ENCRYPTED_MAX_V02) & 0xFF), ((QMI_LOC_SECURE_GET_AVAILABLE_POS_REQUEST_ENCRYPTED_MAX_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionReqMsgT_v02, qmilocSecureGetAvailablePositionRequestData) - QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionReqMsgT_v02, qmilocSecureGetAvailablePositionRequestData_len)
+};
+
+static const uint8_t qmiLocSecureGetAvailablePositionIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionIndMsgT_v02, sessionStatus),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionIndMsgT_v02, secureLocDataMode),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionIndMsgT_v02, qmilocSecureGetAvailablePositionInd) - QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionIndMsgT_v02, qmilocSecureGetAvailablePositionInd_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionIndMsgT_v02, qmilocSecureGetAvailablePositionInd),
+ ((QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_ENCRYPTED_MAX_V02) & 0xFF), ((QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_ENCRYPTED_MAX_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionIndMsgT_v02, qmilocSecureGetAvailablePositionInd) - QMI_IDL_OFFSET8(qmiLocSecureGetAvailablePositionIndMsgT_v02, qmilocSecureGetAvailablePositionInd_len)
+};
+
+static const uint8_t qmiLocInjectApCacheDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataReqMsgT_v02, versionNumber),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataReqMsgT_v02, partNumber),
+
+ 0x03,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataReqMsgT_v02, totalParts),
+
+ 0x04,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataReqMsgT_v02, apCacheData),
+ QMI_LOC_APCACHE_DATA_MAX_SAMPLES_V02,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataReqMsgT_v02, apCacheData) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataReqMsgT_v02, apCacheData_len),
+ QMI_IDL_TYPE88(0, 70),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectApCacheDataReqMsgT_v02, apCacheHepeRelData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectApCacheDataReqMsgT_v02, apCacheHepeRelData_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectApCacheDataReqMsgT_v02, apCacheHepeRelData),
+ QMI_LOC_APCACHE_DATA_MAX_SAMPLES_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocInjectApCacheDataReqMsgT_v02, apCacheHepeRelData) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectApCacheDataReqMsgT_v02, apCacheHepeRelData_len),
+ QMI_IDL_TYPE88(0, 71)
+};
+
+static const uint8_t qmiLocInjectApCacheDataIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apCacheSize) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apCacheSize_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apCacheSize),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apDoNotCacheSize) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apDoNotCacheSize_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apDoNotCacheSize),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apCacheHits) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apCacheHits_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apCacheHits),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apDoNotCacheHits) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apDoNotCacheHits_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, apDoNotCacheHits),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, unknownAps) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, unknownAps_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, unknownAps),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, asyncScans) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, asyncScans_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, asyncScans),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, asyncFixes) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, asyncFixes_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, asyncFixes),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, syncScans) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, syncScans_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, syncScans),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, syncFixes) - QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, syncFixes_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApCacheDataIndMsgT_v02, syncFixes)
+};
+
+static const uint8_t qmiLocInjectApDoNotCacheDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApDoNotCacheDataReqMsgT_v02, versionNumber),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApDoNotCacheDataReqMsgT_v02, partNumber),
+
+ 0x03,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApDoNotCacheDataReqMsgT_v02, totalParts),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x04,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectApDoNotCacheDataReqMsgT_v02, apDoNotCacheData),
+ QMI_LOC_APCACHE_DATA_MAX_SAMPLES_V02,
+ QMI_IDL_OFFSET8(qmiLocInjectApDoNotCacheDataReqMsgT_v02, apDoNotCacheData) - QMI_IDL_OFFSET8(qmiLocInjectApDoNotCacheDataReqMsgT_v02, apDoNotCacheData_len),
+ QMI_IDL_TYPE88(0, 72)
+};
+
+static const uint8_t qmiLocInjectApDoNotCacheDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectApDoNotCacheDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEventBatchingStatusIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventBatchingStatusIndMsgT_v02, batchingStatus)
+};
+
+static const uint8_t qmiLocQueryAonConfigReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryAonConfigReqMsgT_v02, transactionId)
+};
+
+static const uint8_t qmiLocQueryAonConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryAonConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryAonConfigIndMsgT_v02, transactionId) - QMI_IDL_OFFSET8(qmiLocQueryAonConfigIndMsgT_v02, transactionId_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryAonConfigIndMsgT_v02, transactionId),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryAonConfigIndMsgT_v02, aonCapability) - QMI_IDL_OFFSET8(qmiLocQueryAonConfigIndMsgT_v02, aonCapability_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryAonConfigIndMsgT_v02, aonCapability)
+};
+
+static const uint8_t qmiLocDeleteGNSSServiceDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteAllFlag),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteClockInfoMask) - QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteClockInfoMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteClockInfoMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteCellDbDataMask) - QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteCellDbDataMask_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteCellDbDataMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteCommonDataMask) - QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteCommonDataMask_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteCommonDataMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteSatelliteData) - QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteSatelliteData_valid)),
+ 0x13,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteSatelliteData),
+ QMI_IDL_TYPE88(0, 73),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteExtClockInfoMask) - QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteExtClockInfoMask_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataReqMsgT_v02, deleteExtClockInfoMask)
+};
+
+static const uint8_t qmiLocDeleteGNSSServiceDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocDeleteGNSSServiceDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocInjectXtraDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataReqMsgT_v02, totalSize),
+
+ 0x02,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataReqMsgT_v02, totalParts),
+
+ 0x03,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataReqMsgT_v02, partNum),
+
+ 0x04,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataReqMsgT_v02, partData),
+ ((QMI_LOC_MAX_XTRA_PART_LEN_V02) & 0xFF), ((QMI_LOC_MAX_XTRA_PART_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataReqMsgT_v02, partData) - QMI_IDL_OFFSET8(qmiLocInjectXtraDataReqMsgT_v02, partData_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectXtraDataReqMsgT_v02, formatType) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectXtraDataReqMsgT_v02, formatType_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectXtraDataReqMsgT_v02, formatType)
+};
+
+static const uint8_t qmiLocInjectXtraDataIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectXtraDataIndMsgT_v02, partNum) - QMI_IDL_OFFSET8(qmiLocInjectXtraDataIndMsgT_v02, partNum_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataIndMsgT_v02, partNum),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectXtraDataIndMsgT_v02, ConstellationMask) - QMI_IDL_OFFSET8(qmiLocInjectXtraDataIndMsgT_v02, ConstellationMask_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraDataIndMsgT_v02, ConstellationMask)
+};
+
+static const uint8_t qmiLocInjectXtraPcidReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraPcidReqMsgT_v02, xtraPcid)
+};
+
+static const uint8_t qmiLocInjectXtraPcidIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectXtraPcidIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocGetSupportedFeatureReqMsgT is empty
+ * static const uint8_t qmiLocGetSupportedFeatureReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocGetSupportedFeatureIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSupportedFeatureIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSupportedFeatureIndMsgT_v02, feature),
+ QMI_LOC_SUPPORTED_FEATURE_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocGetSupportedFeatureIndMsgT_v02, feature) - QMI_IDL_OFFSET8(qmiLocGetSupportedFeatureIndMsgT_v02, feature_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetSupportedFeatureIndMsgT_v02, featureStatusReport) - QMI_IDL_OFFSET8(qmiLocGetSupportedFeatureIndMsgT_v02, featureStatusReport_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetSupportedFeatureIndMsgT_v02, featureStatusReport)
+};
+
+static const uint8_t qmiLocSetInternalStatusConfigReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetInternalStatusConfigReqMsgT_v02, config)
+};
+
+static const uint8_t qmiLocSetInternalStatusConfigIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetInternalStatusConfigIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEventInternalStatusReportIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventInternalStatusReportIndMsgT_v02, reportData),
+ QMI_LOC_INTERNAL_STATUS_MAX_LIST_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocEventInternalStatusReportIndMsgT_v02, reportData) - QMI_IDL_OFFSET8(qmiLocEventInternalStatusReportIndMsgT_v02, reportData_len),
+ QMI_IDL_TYPE88(0, 74)
+};
+
+static const uint8_t qmiLocEventInjectSrnApDataReqIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, srnTechMask),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, srnRequest),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, e911Mode) - QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, e911Mode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, e911Mode),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, srnApMacAddrType) - QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, srnApMacAddrType_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectSrnApDataReqIndMsgT_v02, srnApMacAddrType)
+};
+
+static const uint8_t qmiLocInjectSrnApDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSrnApDataReqMsgT_v02, apDeviceTechType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectSrnApDataReqMsgT_v02, srnBtleApInfo) - QMI_IDL_OFFSET8(qmiLocInjectSrnApDataReqMsgT_v02, srnBtleApInfo_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectSrnApDataReqMsgT_v02, srnBtleApInfo),
+ QMI_LOC_SRN_MAX_REPORTED_APS_PER_MSG_V02,
+ QMI_IDL_OFFSET8(qmiLocInjectSrnApDataReqMsgT_v02, srnBtleApInfo) - QMI_IDL_OFFSET8(qmiLocInjectSrnApDataReqMsgT_v02, srnBtleApInfo_len),
+ QMI_IDL_TYPE88(0, 75),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSrnApDataReqMsgT_v02, requestTimestamp) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSrnApDataReqMsgT_v02, requestTimestamp_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSrnApDataReqMsgT_v02, requestTimestamp),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSrnApDataReqMsgT_v02, receiveTimestamp) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSrnApDataReqMsgT_v02, receiveTimestamp_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSrnApDataReqMsgT_v02, receiveTimestamp),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSrnApDataReqMsgT_v02, errorCause) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectSrnApDataReqMsgT_v02, errorCause_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectSrnApDataReqMsgT_v02, errorCause)
+};
+
+static const uint8_t qmiLocInjectSrnApDataIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectSrnApDataIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocCrowdSourceManagerControlReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, enableCrowdSourcingMask) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, enableCrowdSourcingMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, enableCrowdSourcingMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingLocalConfig) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingLocalConfig_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingLocalConfig),
+ QMI_IDL_TYPE88(0, 76),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingServerConfig) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingServerConfig_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingServerConfig),
+ ((QMI_LOC_MAX_WIFI_CROWDSOURCING_SERVER_CONFIG_LEN_V02) & 0xFF), ((QMI_LOC_MAX_WIFI_CROWDSOURCING_SERVER_CONFIG_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingServerConfig) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlReqMsgT_v02, wifiCrowdSourcingServerConfig_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocCrowdSourceManagerControlReqMsgT_v02, enableSourceMask) - QMI_IDL_OFFSET16RELATIVE(qmiLocCrowdSourceManagerControlReqMsgT_v02, enableSourceMask_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocCrowdSourceManagerControlReqMsgT_v02, enableSourceMask)
+};
+
+static const uint8_t qmiLocCrowdSourceManagerControlIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, supportedCrowdSourcingMask) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, supportedCrowdSourcingMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, supportedCrowdSourcingMask),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, wifiCrowdSourcingCapabaility) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, wifiCrowdSourcingCapabaility_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, wifiCrowdSourcingCapabaility),
+ QMI_IDL_TYPE88(0, 77),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, modemClientInfo) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, modemClientInfo_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_SZ_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, modemClientInfo),
+ ((QMI_LOC_MAX_CROWDSOURCING_MODEM_CLIENT_INFO_LEN_V02) & 0xFF), ((QMI_LOC_MAX_CROWDSOURCING_MODEM_CLIENT_INFO_LEN_V02) >> 8),
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, modemClientInfo) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerControlIndMsgT_v02, modemClientInfo_len)
+};
+
+static const uint8_t qmiLocCrowdSourceManagerReadDataReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerReadDataReqMsgT_v02, crowdSourcingTechMask) - QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerReadDataReqMsgT_v02, crowdSourcingTechMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocCrowdSourceManagerReadDataReqMsgT_v02, crowdSourcingTechMask)
+};
+
+static const uint8_t qmiLocQueryXtraInfoReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryXtraInfoReqMsgT_v02, xtraConfig),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocQueryXtraInfoReqMsgT_v02, xcVersion) - QMI_IDL_OFFSET8(qmiLocQueryXtraInfoReqMsgT_v02, xcVersion_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocQueryXtraInfoReqMsgT_v02, xcVersion),
+ QMI_IDL_TYPE88(0, 79)
+};
+
+static const uint8_t qmiLocQueryXtraInfoIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryXtraInfoIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocQueryXtraInfoIndMsgT_v02, xtraInfo),
+ QMI_IDL_TYPE88(0, 78),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocQueryXtraInfoIndMsgT_v02, mpVersion) - QMI_IDL_OFFSET16RELATIVE(qmiLocQueryXtraInfoIndMsgT_v02, mpVersion_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocQueryXtraInfoIndMsgT_v02, mpVersion),
+ QMI_IDL_TYPE88(0, 79)
+};
+
+static const uint8_t qmiLocStartOutdoorTripBatchingReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, batchDistance),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, minTimeInterval),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, fixSessionTimeout) - QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, fixSessionTimeout_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, fixSessionTimeout),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, batchAllPos) - QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, batchAllPos_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingReqMsgT_v02, batchAllPos)
+};
+
+static const uint8_t qmiLocStartOutdoorTripBatchingIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocStartOutdoorTripBatchingIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocQueryOTBAccumulatedDistanceReqMsgT is empty
+ * static const uint8_t qmiLocQueryOTBAccumulatedDistanceReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocQueryOTBAccumulatedDistanceIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02, accumulatedDistance),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02, batchedPosition)
+};
+
+static const uint8_t qmiLocEventFdclServiceReqIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventFdclServiceReqIndMsgT_v02, gtpClientSwVer) - QMI_IDL_OFFSET8(qmiLocEventFdclServiceReqIndMsgT_v02, gtpClientSwVer_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventFdclServiceReqIndMsgT_v02, gtpClientSwVer),
+ QMI_IDL_TYPE88(0, 80),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventFdclServiceReqIndMsgT_v02, modemSwVersion) - QMI_IDL_OFFSET8(qmiLocEventFdclServiceReqIndMsgT_v02, modemSwVersion_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocEventFdclServiceReqIndMsgT_v02, modemSwVersion),
+ QMI_LOC_GNSS_SW_VERSION_STRING_MAX_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, homeCarrierId) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, homeCarrierId_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, homeCarrierId),
+ QMI_IDL_TYPE88(0, 81),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, cdmaRealm) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, cdmaRealm_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_STRING,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, cdmaRealm),
+ QMI_LOC_GNSS_SW_VERSION_STRING_MAX_LENGTH_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, gtpMaxNumRecordsAccepted) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, gtpMaxNumRecordsAccepted_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, gtpMaxNumRecordsAccepted),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, gpsWeek) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, gpsWeek_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, gpsWeek),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, gpsMilliseconds) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, gpsMilliseconds_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, gpsMilliseconds),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, bsBestPosition) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, bsBestPosition_valid)),
+ 0x17,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, bsBestPosition),
+ QMI_IDL_TYPE88(0, 83),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, currentCellId) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, currentCellId_valid)),
+ 0x18,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, currentCellId),
+ QMI_IDL_TYPE88(0, 84),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, requestedDataTypes) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, requestedDataTypes_valid)),
+ 0x19,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, requestedDataTypes),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, restrictedRegionVersion) - QMI_IDL_OFFSET16RELATIVE(qmiLocEventFdclServiceReqIndMsgT_v02, restrictedRegionVersion_valid)),
+ 0x1A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocEventFdclServiceReqIndMsgT_v02, restrictedRegionVersion)
+};
+
+static const uint8_t qmiLocGetFdclBsListReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, expireInDays) - QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, expireInDays_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, expireInDays),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, timestampUtc) - QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, timestampUtc_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, maxNumBs) - QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, maxNumBs_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFdclBsListReqMsgT_v02, maxNumBs)
+};
+
+static const uint8_t qmiLocGetFdclBsListIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetFdclBsListIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetFdclBsListIndMsgT_v02, BsList),
+ QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocGetFdclBsListIndMsgT_v02, BsList) - QMI_IDL_OFFSET8(qmiLocGetFdclBsListIndMsgT_v02, BsList_len),
+ QMI_IDL_TYPE88(0, 84),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, moreBsAvailable) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, moreBsAvailable_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetFdclBsListIndMsgT_v02, moreBsAvailable),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, bsLocalTimestampList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, bsLocalTimestampList_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetFdclBsListIndMsgT_v02, bsLocalTimestampList),
+ QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, bsLocalTimestampList) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, bsLocalTimestampList_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, bsBestPosition) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetFdclBsListIndMsgT_v02, bsBestPosition_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetFdclBsListIndMsgT_v02, bsBestPosition),
+ QMI_IDL_TYPE88(0, 83)
+};
+
+static const uint8_t qmiLocInjectFdclDataReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocInjectFdclDataReqMsgT_v02, cellPosList),
+ QMI_LOC_FDCL_CELL_POS_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET8(qmiLocInjectFdclDataReqMsgT_v02, cellPosList) - QMI_IDL_OFFSET8(qmiLocInjectFdclDataReqMsgT_v02, cellPosList_len),
+ QMI_IDL_TYPE88(0, 85),
+
+ 0x02,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, daysValid),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, timestampUtc) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, timestampUtc_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, cellRecordTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, cellRecordTypeList_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, cellRecordTypeList),
+ QMI_LOC_FDCL_CELL_POS_LIST_LENGTH_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, cellRecordTypeList) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, cellRecordTypeList_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, moreBsAvailable) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, moreBsAvailable_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, moreBsAvailable),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, clientControls) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, clientControls_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, clientControls),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, maxNumCellsToUpload) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, maxNumCellsToUpload_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, maxNumCellsToUpload),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, minSecsBtwRequests) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, minSecsBtwRequests_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, minSecsBtwRequests),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegionVersion) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegionVersion_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegionVersion),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegions) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegions_valid)),
+ 0x17,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegions),
+ QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegions) - QMI_IDL_OFFSET16RELATIVE(qmiLocInjectFdclDataReqMsgT_v02, restrictedRegions_len),
+ QMI_IDL_TYPE88(0, 81)
+};
+
+static const uint8_t qmiLocInjectFdclDataIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectFdclDataIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectFdclDataIndMsgT_v02, inject_status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectFdclDataIndMsgT_v02, errorMsg) - QMI_IDL_OFFSET8(qmiLocInjectFdclDataIndMsgT_v02, errorMsg_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocInjectFdclDataIndMsgT_v02, errorMsg),
+ QMI_LOC_INJECT_FDCL_DATA_ERROR_MSG_LEN_V02
+};
+
+static const uint8_t qmiLocSetBlacklistSvReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, glo_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, glo_persist_blacklist_sv_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, glo_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, glo_clear_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, glo_clear_persist_blacklist_sv_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, glo_clear_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, bds_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, bds_persist_blacklist_sv_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, bds_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, bds_clear_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, bds_clear_persist_blacklist_sv_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, bds_clear_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, qzss_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, qzss_persist_blacklist_sv_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, qzss_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, qzss_clear_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, qzss_clear_persist_blacklist_sv_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, qzss_clear_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, gal_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, gal_persist_blacklist_sv_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, gal_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, gal_clear_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, gal_clear_persist_blacklist_sv_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, gal_clear_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, sbas_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, sbas_persist_blacklist_sv_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, sbas_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, sbas_clear_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, sbas_clear_persist_blacklist_sv_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, sbas_clear_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, navic_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, navic_persist_blacklist_sv_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, navic_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, navic_clear_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, navic_clear_persist_blacklist_sv_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetBlacklistSvReqMsgT_v02, navic_clear_persist_blacklist_sv)
+};
+
+static const uint8_t qmiLocGetBlacklistSvIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, glo_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, glo_persist_blacklist_sv_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, glo_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, bds_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, bds_persist_blacklist_sv_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, bds_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, qzss_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, qzss_persist_blacklist_sv_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, qzss_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, gal_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, gal_persist_blacklist_sv_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, gal_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, sbas_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, sbas_persist_blacklist_sv_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, sbas_persist_blacklist_sv),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, navic_persist_blacklist_sv) - QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, navic_persist_blacklist_sv_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBlacklistSvIndMsgT_v02, navic_persist_blacklist_sv)
+};
+
+static const uint8_t qmiLocSetConstellationConfigReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetConstellationConfigReqMsgT_v02, resetConstellations),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetConstellationConfigReqMsgT_v02, enableMask) - QMI_IDL_OFFSET8(qmiLocSetConstellationConfigReqMsgT_v02, enableMask_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetConstellationConfigReqMsgT_v02, enableMask),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetConstellationConfigReqMsgT_v02, disableMask) - QMI_IDL_OFFSET8(qmiLocSetConstellationConfigReqMsgT_v02, disableMask_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetConstellationConfigReqMsgT_v02, disableMask)
+};
+
+static const uint8_t qmiLocEventDcReportIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, msgType) - QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, msgType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, msgType),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, numValidBits) - QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, numValidBits_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, numValidBits),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, dcReportData) - QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, dcReportData_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, dcReportData),
+ QMI_LOC_MAX_DCREPORT_LEN_V02,
+ QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, dcReportData) - QMI_IDL_OFFSET8(qmiLocEventDcReportIndMsgT_v02, dcReportData_len)
+};
+
+static const uint8_t qmiLocRegisterMasterClientReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRegisterMasterClientReqMsgT_v02, key)
+};
+
+static const uint8_t qmiLocRegisterMasterClientIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocRegisterMasterClientIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEventEngineLockStateIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventEngineLockStateIndMsgT_v02, engineLockState),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventEngineLockStateIndMsgT_v02, subType) - QMI_IDL_OFFSET8(qmiLocEventEngineLockStateIndMsgT_v02, subType_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventEngineLockStateIndMsgT_v02, subType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventEngineLockStateIndMsgT_v02, lockClient) - QMI_IDL_OFFSET8(qmiLocEventEngineLockStateIndMsgT_v02, lockClient_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventEngineLockStateIndMsgT_v02, lockClient)
+};
+
+/*
+ * qmiLocStartListenPositionReqMsgT is empty
+ * static const uint8_t qmiLocStartListenPositionReqMsgT_data_v02[] = {
+ * };
+ */
+
+/*
+ * qmiLocStopListenPositionReqMsgT is empty
+ * static const uint8_t qmiLocStopListenPositionReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocSystemInfoReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSystemInfoReqMsgT_v02, systemInfo)
+};
+
+static const uint8_t qmiLocSystemInfoIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSystemInfoIndMsgT_v02, systemInfo),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSystemInfoIndMsgT_v02, nextLeapSecondInfo) - QMI_IDL_OFFSET8(qmiLocSystemInfoIndMsgT_v02, nextLeapSecondInfo_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSystemInfoIndMsgT_v02, nextLeapSecondInfo),
+ QMI_IDL_TYPE88(0, 86)
+};
+
+static const uint8_t qmiLocGetConstellationConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, gps_status) - QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, gps_status_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, gps_status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, glonass_status) - QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, glonass_status_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, glonass_status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, bds_status) - QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, bds_status_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, bds_status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, qzss_status) - QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, qzss_status_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, qzss_status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, galileo_status) - QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, galileo_status_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, galileo_status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, navic_status) - QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, navic_status_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetConstellationConfigIndMsgT_v02, navic_status)
+};
+
+static const uint8_t qmiLocEnablePositionInjectionTestModeReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnablePositionInjectionTestModeReqMsgT_v02, enableTestMode)
+};
+
+static const uint8_t qmiLocEnablePositionInjectionTestModeIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnablePositionInjectionTestModeIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEnablePositionInjectionTestModeIndMsgT_v02, testModeState) - QMI_IDL_OFFSET8(qmiLocEnablePositionInjectionTestModeIndMsgT_v02, testModeState_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnablePositionInjectionTestModeIndMsgT_v02, testModeState)
+};
+
+static const uint8_t qmiLocInjectTestPositionReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTestPositionReqMsgT_v02, latitude),
+
+ 0x02,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTestPositionReqMsgT_v02, longitude),
+
+ 0x03,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTestPositionReqMsgT_v02, horUncCircular),
+
+ 0x04,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTestPositionReqMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocInjectTestPositionReqMsgT_v02, positionSource) - QMI_IDL_OFFSET8(qmiLocInjectTestPositionReqMsgT_v02, positionSource_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTestPositionReqMsgT_v02, positionSource)
+};
+
+static const uint8_t qmiLocInjectTestPositionIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectTestPositionIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEventBsObsDataServiceReqIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventBsObsDataServiceReqIndMsgT_v02, numCellsAvailable)
+};
+
+static const uint8_t qmiLocGetBsObsDataReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBsObsDataReqMsgT_v02, timestampUtc) - QMI_IDL_OFFSET8(qmiLocGetBsObsDataReqMsgT_v02, timestampUtc_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBsObsDataReqMsgT_v02, timestampUtc),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBsObsDataReqMsgT_v02, numCellsUpload) - QMI_IDL_OFFSET8(qmiLocGetBsObsDataReqMsgT_v02, numCellsUpload_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBsObsDataReqMsgT_v02, numCellsUpload)
+};
+
+static const uint8_t qmiLocGetBsObsDataIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBsObsDataIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBsObsDataIndMsgT_v02, bsData),
+ QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocGetBsObsDataIndMsgT_v02, bsData) - QMI_IDL_OFFSET8(qmiLocGetBsObsDataIndMsgT_v02, bsData_len),
+ QMI_IDL_TYPE88(0, 87),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGetBsObsDataIndMsgT_v02, moreBsAvailable) - QMI_IDL_OFFSET16RELATIVE(qmiLocGetBsObsDataIndMsgT_v02, moreBsAvailable_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGetBsObsDataIndMsgT_v02, moreBsAvailable)
+};
+
+static const uint8_t qmiLocGpsEphemerisReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisReportIndMsgT_v02, gpsEphemerisList),
+ QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocGpsEphemerisReportIndMsgT_v02, gpsEphemerisList) - QMI_IDL_OFFSET8(qmiLocGpsEphemerisReportIndMsgT_v02, gpsEphemerisList_len),
+ QMI_IDL_TYPE88(0, 89),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGpsEphemerisReportIndMsgT_v02, gpsSystemTime) - QMI_IDL_OFFSET16RELATIVE(qmiLocGpsEphemerisReportIndMsgT_v02, gpsSystemTime_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGpsEphemerisReportIndMsgT_v02, gpsSystemTime),
+ QMI_IDL_TYPE88(0, 60)
+};
+
+static const uint8_t qmiLocGloEphemerisReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisReportIndMsgT_v02, gloEphemerisList),
+ QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocGloEphemerisReportIndMsgT_v02, gloEphemerisList) - QMI_IDL_OFFSET8(qmiLocGloEphemerisReportIndMsgT_v02, gloEphemerisList_len),
+ QMI_IDL_TYPE88(0, 90),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGloEphemerisReportIndMsgT_v02, gpsSystemTime) - QMI_IDL_OFFSET16RELATIVE(qmiLocGloEphemerisReportIndMsgT_v02, gpsSystemTime_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGloEphemerisReportIndMsgT_v02, gpsSystemTime),
+ QMI_IDL_TYPE88(0, 60)
+};
+
+static const uint8_t qmiLocBdsEphemerisReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisReportIndMsgT_v02, bdsEphemerisList),
+ QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocBdsEphemerisReportIndMsgT_v02, bdsEphemerisList) - QMI_IDL_OFFSET8(qmiLocBdsEphemerisReportIndMsgT_v02, bdsEphemerisList_len),
+ QMI_IDL_TYPE88(0, 91),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocBdsEphemerisReportIndMsgT_v02, gpsSystemTime) - QMI_IDL_OFFSET16RELATIVE(qmiLocBdsEphemerisReportIndMsgT_v02, gpsSystemTime_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocBdsEphemerisReportIndMsgT_v02, gpsSystemTime),
+ QMI_IDL_TYPE88(0, 60)
+};
+
+static const uint8_t qmiLocGalEphemerisReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisReportIndMsgT_v02, galEphemerisList),
+ QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocGalEphemerisReportIndMsgT_v02, galEphemerisList) - QMI_IDL_OFFSET8(qmiLocGalEphemerisReportIndMsgT_v02, galEphemerisList_len),
+ QMI_IDL_TYPE88(0, 92),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocGalEphemerisReportIndMsgT_v02, gpsSystemTime) - QMI_IDL_OFFSET16RELATIVE(qmiLocGalEphemerisReportIndMsgT_v02, gpsSystemTime_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocGalEphemerisReportIndMsgT_v02, gpsSystemTime),
+ QMI_IDL_TYPE88(0, 60)
+};
+
+static const uint8_t qmiLocQzssEphemerisReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocQzssEphemerisReportIndMsgT_v02, qzssEphemerisList),
+ QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET8(qmiLocQzssEphemerisReportIndMsgT_v02, qzssEphemerisList) - QMI_IDL_OFFSET8(qmiLocQzssEphemerisReportIndMsgT_v02, qzssEphemerisList_len),
+ QMI_IDL_TYPE88(0, 89),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocQzssEphemerisReportIndMsgT_v02, gpsSystemTime) - QMI_IDL_OFFSET16RELATIVE(qmiLocQzssEphemerisReportIndMsgT_v02, gpsSystemTime_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocQzssEphemerisReportIndMsgT_v02, gpsSystemTime),
+ QMI_IDL_TYPE88(0, 60)
+};
+
+static const uint8_t qmiLocSetConstrainedTuncModeReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeReqMsgT_v02, tuncConstraintOn),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeReqMsgT_v02, tuncConstraint) - QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeReqMsgT_v02, tuncConstraint_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeReqMsgT_v02, tuncConstraint),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeReqMsgT_v02, energyBudget) - QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeReqMsgT_v02, energyBudget_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeReqMsgT_v02, energyBudget)
+};
+
+static const uint8_t qmiLocSetConstrainedTuncModeIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetConstrainedTuncModeIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocEnablePositionAssistedClockEstReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnablePositionAssistedClockEstReqMsgT_v02, enablePositionAssistedClockEst)
+};
+
+static const uint8_t qmiLocEnablePositionAssistedClockEstIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEnablePositionAssistedClockEstIndMsgT_v02, status)
+};
+
+/*
+ * qmiLocQueryGNSSEnergyConsumedReqMsgT is empty
+ * static const uint8_t qmiLocQueryGNSSEnergyConsumedReqMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocQueryGNSSEnergyConsumedIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGNSSEnergyConsumedIndMsgT_v02, energyConsumedSinceLastBoot),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x02,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocQueryGNSSEnergyConsumedIndMsgT_v02, energyConsumedSinceFirstBoot)
+};
+
+static const uint8_t qmiLocEventReportIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, eventReport),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, gpsSystemTime) - QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, gpsSystemTime_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, gpsSystemTime),
+ QMI_IDL_TYPE88(0, 60),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, klobucharIonoModel) - QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, klobucharIonoModel_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, klobucharIonoModel),
+ QMI_IDL_TYPE88(0, 93),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, tauC) - QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, tauC_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, tauC),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, leapSec) - QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, leapSec_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, leapSec),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, featureStatusReport) - QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, featureStatusReport_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventReportIndMsgT_v02, featureStatusReport)
+};
+
+static const uint8_t qmiLocGetBandMeasurementMetricsIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, systemTick),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, band1PgaGainDb),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL1caRfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL1caRfStats_valid)),
+ 0x10,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL1caRfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gloG1RfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gloG1RfStats_valid)),
+ 0x11,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gloG1RfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, bdsB1RfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, bdsB1RfStats_valid)),
+ 0x12,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, bdsB1RfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, galE1RfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, galE1RfStats_valid)),
+ 0x13,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, galE1RfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL2cRfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL2cRfStats_valid)),
+ 0x14,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL2cRfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gloG2RfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gloG2RfStats_valid)),
+ 0x15,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gloG2RfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, bdsB2RfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, bdsB2RfStats_valid)),
+ 0x16,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, bdsB2RfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, band5PgaGainDb) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, band5PgaGainDb_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, band5PgaGainDb),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL5RfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL5RfStats_valid)),
+ 0x18,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, gpsL5RfStats),
+ QMI_IDL_TYPE88(0, 94),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, galE5ARfStats) - QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, galE5ARfStats_valid)),
+ 0x19,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetBandMeasurementMetricsIndMsgT_v02, galE5ARfStats),
+ QMI_IDL_TYPE88(0, 94)
+};
+
+static const uint8_t qmiLocLocationRequestNotificationIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, protocolStack),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, requestor),
+
+ 0x03,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, requestorId),
+ QMI_LOC_MAX_REQUESTOR_ID_STRING_LENGTH_V02,
+
+ 0x04,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, responseType),
+
+ 0x05,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, responseProtocol),
+
+ 0x06,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, inEmergencyMode),
+
+ 0x07,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, isCachedLocation),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, clientStrId) - QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, clientStrId_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_STRING,
+ QMI_IDL_OFFSET8(qmiLocLocationRequestNotificationIndMsgT_v02, clientStrId),
+ QMI_LOC_MAX_CLIENT_ID_STRING_LENGTH_V02
+};
+
+static const uint8_t qmiLocInjectPlatformPowerStateReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPlatformPowerStateReqMsgT_v02, powerState)
+};
+
+static const uint8_t qmiLocInjectPlatformPowerStateIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocInjectPlatformPowerStateIndMsgT_v02, status)
+};
+
+static const uint8_t qmiLocSetRobustLocationReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetRobustLocationReqMsgT_v02, enable),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetRobustLocationReqMsgT_v02, enableForE911) - QMI_IDL_OFFSET8(qmiLocSetRobustLocationReqMsgT_v02, enableForE911_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetRobustLocationReqMsgT_v02, enableForE911)
+};
+
+static const uint8_t qmiLocGetRobustLocationConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, isEnabled) - QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, isEnabled_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, isEnabled),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, isEnabledForE911) - QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, isEnabledForE911_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, isEnabledForE911),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, robustLocationVersion) - QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, robustLocationVersion_valid)),
+ 0x12,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocGetRobustLocationConfigIndMsgT_v02, robustLocationVersion),
+ QMI_IDL_TYPE88(0, 95)
+};
+
+static const uint8_t qmiLocEventInjectEnvAidingReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, seqNum),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, maxMessageNum),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingValidity) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingValidity_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingValidity),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingDegrees) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingDegrees_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingDegrees),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingUncDegrees) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingUncDegrees_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, envBearingUncDegrees),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, latitudeDegrees) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, latitudeDegrees_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, latitudeDegrees),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, longitudeDegrees) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, longitudeDegrees_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, longitudeDegrees),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, horizontalPositionUncMeters) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, horizontalPositionUncMeters_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, horizontalPositionUncMeters),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, altitudeMeters) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, altitudeMeters_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, altitudeMeters),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, altitudeUncMeters) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, altitudeUncMeters_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, altitudeUncMeters),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, toaGpsNanosecondsOfWeek) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, toaGpsNanosecondsOfWeek_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, toaGpsNanosecondsOfWeek),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, svCorrection) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, svCorrection_valid)),
+ 0x19,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, svCorrection),
+ QMI_LOC_ENV_AIDING_CORRECTION_MAX_SV_USED_V02,
+ QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, svCorrection) - QMI_IDL_OFFSET8(qmiLocEventInjectEnvAidingReqMsgT_v02, svCorrection_len),
+ QMI_IDL_TYPE88(0, 97)
+};
+
+static const uint8_t qmiLocSetMinGpsWeekNumberReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetMinGpsWeekNumberReqMsgT_v02, minGpsWeekNumber)
+};
+
+static const uint8_t qmiLocGetMinGpsWeekNumberIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetMinGpsWeekNumberIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetMinGpsWeekNumberIndMsgT_v02, minGpsWeekNumber) - QMI_IDL_OFFSET8(qmiLocGetMinGpsWeekNumberIndMsgT_v02, minGpsWeekNumber_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetMinGpsWeekNumberIndMsgT_v02, minGpsWeekNumber)
+};
+
+static const uint8_t qmiLocSapInsParamsIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, fixStatus),
+
+ 0x03,
+ QMI_IDL_AGGREGATE,
+ QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, systemTime),
+ QMI_IDL_TYPE88(0, 60),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, state) - QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, state_valid)),
+ 0x10,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, state),
+ QMI_LOC_FILTER_ELEMENT_SIZE_SEVENTEEN_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, var) - QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, var_valid)),
+ 0x11,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSapInsParamsIndMsgT_v02, var),
+ QMI_LOC_FILTER_ELEMENT_SIZE_SEVENTEEN_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rel1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rel1_valid)),
+ 0x12,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, rel1),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rel2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rel2_valid)),
+ 0x13,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, rel2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual1_valid)),
+ 0x14,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, residual1),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, obs1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, obs1_valid)),
+ 0x15,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, obs1),
+ QMI_LOC_FILTER_ELEMENT_SIZE_SIX_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var1_valid)),
+ 0x16,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, var1),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result1_valid)),
+ 0x17,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, result1),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual2_valid)),
+ 0x18,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, residual2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, obs2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, obs2_valid)),
+ 0x19,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, obs2),
+ QMI_LOC_FILTER_ELEMENT_SIZE_SIX_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var2_valid)),
+ 0x1A,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, var2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result2_valid)),
+ 0x1B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, result2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual3) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual3_valid)),
+ 0x1C,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, residual3),
+ QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var3) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var3_valid)),
+ 0x1D,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, var3),
+ QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result3) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result3_valid)),
+ 0x1E,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, result3),
+ QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual4) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, residual4_valid)),
+ 0x1F,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, residual4),
+ QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var4) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, var4_valid)),
+ 0x20,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, var4),
+ QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result4) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, result4_valid)),
+ 0x21,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, result4),
+ QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, acc) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, acc_valid)),
+ 0x22,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, acc),
+ QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, quat) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, quat_valid)),
+ 0x23,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, quat),
+ QMI_LOC_FILTER_ELEMENT_SIZE_FOUR_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasM1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasM1_valid)),
+ 0x24,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, biasM1),
+ QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasV1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasV1_valid)),
+ 0x25,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, biasV1),
+ QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasM2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasM2_valid)),
+ 0x26,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, biasM2),
+ QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasV2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, biasV2_valid)),
+ 0x27,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, biasV2),
+ QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rMat1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rMat1_valid)),
+ 0x28,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, rMat1),
+ QMI_LOC_IPM_ELEMENT_SIZE_NINE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rMat1Count) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rMat1Count_valid)),
+ 0x29,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, rMat1Count),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rMat2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, rMat2_valid)),
+ 0x2A,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, rMat2),
+ QMI_LOC_IPM_ELEMENT_SIZE_NINE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det1Reset) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det1Reset_valid)),
+ 0x2B,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det1Reset),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det2Status) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det2Status_valid)),
+ 0x2C,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det2Status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det2Position) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det2Position_valid)),
+ 0x2D,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det2Position),
+ QMI_LOC_INS_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det2PositionUnc) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det2PositionUnc_valid)),
+ 0x2E,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det2PositionUnc),
+ QMI_LOC_INS_ELEMENT_SIZE_TWO_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det3Status) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det3Status_valid)),
+ 0x2F,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det3Status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det3Variance1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det3Variance1_valid)),
+ 0x30,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det3Variance1),
+ QMI_LOC_INS_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det3Variance2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det3Variance2_valid)),
+ 0x31,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det3Variance2),
+ QMI_LOC_INS_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det4Status) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det4Status_valid)),
+ 0x32,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det4Status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det4Position) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det4Position_valid)),
+ 0x33,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det4Position),
+ QMI_LOC_INS_ELEMENT_SIZE_THREE_V02,
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det5Status) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det5Status_valid)),
+ 0x34,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det5Status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det6Status) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, det6Status_valid)),
+ 0x35,
+ QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, det6Status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, gnssSvId) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, gnssSvId_valid)),
+ 0x36,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, gnssSvId),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, gnssSvId) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, gnssSvId_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measType) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measType_valid)),
+ 0x37,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, measType),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measType) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measType_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar1_valid)),
+ 0x38,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, measVar1),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar1_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse1_valid)),
+ 0x39,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, measUse1),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse1) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse1_len),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar2_valid)),
+ 0x3A,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, measVar2),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measVar2_len),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse2_valid)),
+ 0x3B,
+ QMI_IDL_FLAGS_IS_ARRAY | QMI_IDL_FLAGS_IS_VARIABLE_LEN | QMI_IDL_FLAGS_OFFSET_IS_16 | QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET16ARRAY(qmiLocSapInsParamsIndMsgT_v02, measUse2),
+ QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02,
+ QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse2) - QMI_IDL_OFFSET16RELATIVE(qmiLocSapInsParamsIndMsgT_v02, measUse2_len)
+};
+
+/*
+ * qmiLocEventQueryXtraInfoReqIndMsgT is empty
+ * static const uint8_t qmiLocEventQueryXtraInfoReqIndMsgT_data_v02[] = {
+ * };
+ */
+
+static const uint8_t qmiLocSetParameterReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetParameterReqMsgT_v02, paramType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetParameterReqMsgT_v02, minSvElevation) - QMI_IDL_OFFSET8(qmiLocSetParameterReqMsgT_v02, minSvElevation_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetParameterReqMsgT_v02, minSvElevation)
+};
+
+static const uint8_t qmiLocGetParameterReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetParameterReqMsgT_v02, paramType)
+};
+
+static const uint8_t qmiLocGetParameterIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetParameterIndMsgT_v02, status),
+
+ 0x02,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetParameterIndMsgT_v02, paramType),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetParameterIndMsgT_v02, minSvElevation) - QMI_IDL_OFFSET8(qmiLocGetParameterIndMsgT_v02, minSvElevation_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetParameterIndMsgT_v02, minSvElevation)
+};
+
+static const uint8_t qmiLocSetStatisticsConfigReqMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetStatisticsConfigReqMsgT_v02, enable),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetStatisticsConfigReqMsgT_v02, interval) - QMI_IDL_OFFSET8(qmiLocSetStatisticsConfigReqMsgT_v02, interval_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetStatisticsConfigReqMsgT_v02, interval)
+};
+
+static const uint8_t qmiLocGetStatisticsConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetStatisticsConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetStatisticsConfigIndMsgT_v02, enabled) - QMI_IDL_OFFSET8(qmiLocGetStatisticsConfigIndMsgT_v02, enabled_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetStatisticsConfigIndMsgT_v02, enabled),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetStatisticsConfigIndMsgT_v02, interval) - QMI_IDL_OFFSET8(qmiLocGetStatisticsConfigIndMsgT_v02, interval_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetStatisticsConfigIndMsgT_v02, interval)
+};
+
+static const uint8_t qmiLocGnssStatisticsReportIndMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, absValidAge) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, absValidAge_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, absValidAge),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, averagePowerConsumed) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, averagePowerConsumed_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, averagePowerConsumed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, powerConsumptionDuration) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, powerConsumptionDuration_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, powerConsumptionDuration),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, latitude) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, latitude_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, latitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, longitude) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, longitude_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, longitude),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, altitudeWrtEllipsoid) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, altitudeWrtEllipsoid_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, altitudeWrtEllipsoid),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, altitudeWrtMeanSeaLevel) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, altitudeWrtMeanSeaLevel_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, altitudeWrtMeanSeaLevel),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncCircular) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncCircular_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncCircular),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertUnc) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertUnc_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncEllipseSemiMinor) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncEllipseSemiMinor_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncEllipseSemiMinor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncEllipseSemiMajor) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncEllipseSemiMajor_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horUncEllipseSemiMajor),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horCircularConfidence) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horCircularConfidence_valid)),
+ 0x1B,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horCircularConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horReliability) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horReliability_valid)),
+ 0x1C,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horSpeed) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horSpeed_valid)),
+ 0x1D,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horSpeed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horSpeedUnc) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horSpeedUnc_valid)),
+ 0x1E,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, horSpeedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertConfidence) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertConfidence_valid)),
+ 0x1F,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertConfidence),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertReliability) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertReliability_valid)),
+ 0x20,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertReliability),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertSpeed) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertSpeed_valid)),
+ 0x21,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertSpeed),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertSpeedUnc) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertSpeedUnc_valid)),
+ 0x22,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, vertSpeedUnc),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, gpsWeek) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, gpsWeek_valid)),
+ 0x23,
+ QMI_IDL_GENERIC_2_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, gpsWeek),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, gpsMsec) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, gpsMsec_valid)),
+ 0x24,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, gpsMsec),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, clkTimeBias) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, clkTimeBias_valid)),
+ 0x25,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, clkTimeBias),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, clkTimeBiasUnc) - QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, clkTimeBiasUnc_valid)),
+ 0x26,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGnssStatisticsReportIndMsgT_v02, clkTimeBiasUnc)
+};
+
+static const uint8_t qmiLocSetGnssPdrModeReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetGnssPdrModeReqMsgT_v02, mode) - QMI_IDL_OFFSET8(qmiLocSetGnssPdrModeReqMsgT_v02, mode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetGnssPdrModeReqMsgT_v02, mode)
+};
+
+static const uint8_t qmiLocGetGnssPdrModeIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGnssPdrModeIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetGnssPdrModeIndMsgT_v02, mode) - QMI_IDL_OFFSET8(qmiLocGetGnssPdrModeIndMsgT_v02, mode_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetGnssPdrModeIndMsgT_v02, mode)
+};
+
+static const uint8_t qmiLocGetMagCalStatePdrIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetMagCalStatePdrIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetMagCalStatePdrIndMsgT_v02, isCalibrated) - QMI_IDL_OFFSET8(qmiLocGetMagCalStatePdrIndMsgT_v02, isCalibrated_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_1_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetMagCalStatePdrIndMsgT_v02, isCalibrated)
+};
+
+static const uint8_t qmiLocSetMultibandConfigReqMsgT_data_v02[] = {
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocSetMultibandConfigReqMsgT_v02, secondaryGnssConfig) - QMI_IDL_OFFSET8(qmiLocSetMultibandConfigReqMsgT_v02, secondaryGnssConfig_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocSetMultibandConfigReqMsgT_v02, secondaryGnssConfig)
+};
+
+static const uint8_t qmiLocGetMultibandConfigIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetMultibandConfigIndMsgT_v02, status),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocGetMultibandConfigIndMsgT_v02, secondaryGnssConfig) - QMI_IDL_OFFSET8(qmiLocGetMultibandConfigIndMsgT_v02, secondaryGnssConfig_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocGetMultibandConfigIndMsgT_v02, secondaryGnssConfig)
+};
+
+static const uint8_t qmiLocLatencyInformationIndMsgT_data_v02[] = {
+ 0x01,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, latencyInfo),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt1) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt1_valid)),
+ 0x10,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt1),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt2) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt2_valid)),
+ 0x11,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt2),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt3) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt3_valid)),
+ 0x12,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt3),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt4) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt4_valid)),
+ 0x13,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt4),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt5) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt5_valid)),
+ 0x14,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt5),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt6) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt6_valid)),
+ 0x15,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt6),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt7) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt7_valid)),
+ 0x16,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt7),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt8) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt8_valid)),
+ 0x17,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt8),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt9) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt9_valid)),
+ 0x18,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt9),
+
+ QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt10) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt10_valid)),
+ 0x19,
+ QMI_IDL_GENERIC_8_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, sysTickAtChkPt10),
+
+ QMI_IDL_TLV_FLAGS_LAST_TLV | QMI_IDL_TLV_FLAGS_OPTIONAL | (QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, fCountOfMeasBlk) - QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, fCountOfMeasBlk_valid)),
+ 0x1A,
+ QMI_IDL_GENERIC_4_BYTE,
+ QMI_IDL_OFFSET8(qmiLocLatencyInformationIndMsgT_v02, fCountOfMeasBlk)
+};
+
+/* Type Table */
+static const qmi_idl_type_table_entry loc_type_table_v02[] = {
+ {sizeof(qmiLocApplicationIdStructT_v02), qmiLocApplicationIdStructT_data_v02},
+ {sizeof(qmiLocPowerModeStructT_v02), qmiLocPowerModeStructT_data_v02},
+ {sizeof(qmiLocGPSTimeStructT_v02), qmiLocGPSTimeStructT_data_v02},
+ {sizeof(qmiLocDOPStructT_v02), qmiLocDOPStructT_data_v02},
+ {sizeof(qmiLocExtDOPStructT_v02), qmiLocExtDOPStructT_data_v02},
+ {sizeof(qmiLocSensorUsageIndicatorStructT_v02), qmiLocSensorUsageIndicatorStructT_data_v02},
+ {sizeof(qmiLocJammerIndicatorStructT_v02), qmiLocJammerIndicatorStructT_data_v02},
+ {sizeof(qmiLocSvInfoStructT_v02), qmiLocSvInfoStructT_data_v02},
+ {sizeof(qmiLocExpandedSvInfoStructT_v02), qmiLocExpandedSvInfoStructT_data_v02},
+ {sizeof(qmiLocNiVxNotifyVerifyStructT_v02), qmiLocNiVxNotifyVerifyStructT_data_v02},
+ {sizeof(qmiLocNiSuplFormattedStringStructT_v02), qmiLocNiSuplFormattedStringStructT_data_v02},
+ {sizeof(qmiLocNiSuplQopStructT_v02), qmiLocNiSuplQopStructT_data_v02},
+ {sizeof(qmiLocIpV4AddrStructType_v02), qmiLocIpV4AddrStructType_data_v02},
+ {sizeof(qmiLocIpV6AddrStructType_v02), qmiLocIpV6AddrStructType_data_v02},
+ {sizeof(qmiLocNiSuplServerInfoStructT_v02), qmiLocNiSuplServerInfoStructT_data_v02},
+ {sizeof(qmiLocNiSuplNotifyVerifyStructT_v02), qmiLocNiSuplNotifyVerifyStructT_data_v02},
+ {sizeof(qmiLocNiUmtsCpCodedStringStructT_v02), qmiLocNiUmtsCpCodedStringStructT_data_v02},
+ {sizeof(qmiLocNiUmtsCpNotifyVerifyStructT_v02), qmiLocNiUmtsCpNotifyVerifyStructT_data_v02},
+ {sizeof(qmiLocNiVxServiceInteractionStructT_v02), qmiLocNiVxServiceInteractionStructT_data_v02},
+ {sizeof(qmiLocNiSuplVer2ExtStructT_v02), qmiLocNiSuplVer2ExtStructT_data_v02},
+ {sizeof(qmiLocEmergencyNotificationStructT_v02), qmiLocEmergencyNotificationStructT_data_v02},
+ {sizeof(qmiLocAssistanceServerUrlStructT_v02), qmiLocAssistanceServerUrlStructT_data_v02},
+ {sizeof(qmiLocTimeServerListStructT_v02), qmiLocTimeServerListStructT_data_v02},
+ {sizeof(qmiLocPredictedOrbitsAllowedSizesStructT_v02), qmiLocPredictedOrbitsAllowedSizesStructT_data_v02},
+ {sizeof(qmiLocPredictedOrbitsServerListStructT_v02), qmiLocPredictedOrbitsServerListStructT_data_v02},
+ {sizeof(qmiLocSensorControlConfigSamplingSpecStructT_v02), qmiLocSensorControlConfigSamplingSpecStructT_data_v02},
+ {sizeof(qmiLocSensorReadyStatusStructT_v02), qmiLocSensorReadyStatusStructT_data_v02},
+ {sizeof(qmiLocGeofencePositionStructT_v02), qmiLocGeofencePositionStructT_data_v02},
+ {sizeof(qmiLocGeofenceIdContinuousStructT_v02), qmiLocGeofenceIdContinuousStructT_data_v02},
+ {sizeof(qmiLocPredictedOrbitsDataValidityStructT_v02), qmiLocPredictedOrbitsDataValidityStructT_data_v02},
+ {sizeof(qmiLocAltitudeSrcInfoStructT_v02), qmiLocAltitudeSrcInfoStructT_data_v02},
+ {sizeof(qmiLocDeleteSvInfoStructT_v02), qmiLocDeleteSvInfoStructT_data_v02},
+ {sizeof(qmiLocDeleteBDSSvInfoStructT_v02), qmiLocDeleteBDSSvInfoStructT_data_v02},
+ {sizeof(qmiLocDeleteGALSvInfoStructT_v02), qmiLocDeleteGALSvInfoStructT_data_v02},
+ {sizeof(qmiLocWifiFixTimeStructT_v02), qmiLocWifiFixTimeStructT_data_v02},
+ {sizeof(qmiLocWifiFixPosStructT_v02), qmiLocWifiFixPosStructT_data_v02},
+ {sizeof(qmiLocWifiApInfoStructT_v02), qmiLocWifiApInfoStructT_data_v02},
+ {sizeof(qmiLocWifiApSsidStructT_v02), qmiLocWifiApSsidStructT_data_v02},
+ {sizeof(qmiLoc3AxisSensorSampleStructT_v02), qmiLoc3AxisSensorSampleStructT_data_v02},
+ {sizeof(qmiLoc3AxisSensorSampleListStructT_v02), qmiLoc3AxisSensorSampleListStructT_data_v02},
+ {sizeof(qmiLocSensorTemperatureSampleStructT_v02), qmiLocSensorTemperatureSampleStructT_data_v02},
+ {sizeof(qmiLocSensorTemperatureSampleListStructT_v02), qmiLocSensorTemperatureSampleListStructT_data_v02},
+ {sizeof(qmiLocApnProfilesStructT_v02), qmiLocApnProfilesStructT_data_v02},
+ {sizeof(qmiLocCircularGeofenceArgsStructT_v02), qmiLocCircularGeofenceArgsStructT_data_v02},
+ {sizeof(qmiLocGeofenceMotionStateConfigStructT_v02), qmiLocGeofenceMotionStateConfigStructT_data_v02},
+ {sizeof(qmiLocTimeZoneStructT_v02), qmiLocTimeZoneStructT_data_v02},
+ {sizeof(qmiLocMotionDataStructT_v02), qmiLocMotionDataStructT_data_v02},
+ {sizeof(qmiLocGSMCellIdStructT_v02), qmiLocGSMCellIdStructT_data_v02},
+ {sizeof(qmiLocWCDMACellIdStructT_v02), qmiLocWCDMACellIdStructT_data_v02},
+ {sizeof(qmiLocTDSCDMACellIdStructT_v02), qmiLocTDSCDMACellIdStructT_data_v02},
+ {sizeof(qmiLocBatchedReportStructT_v02), qmiLocBatchedReportStructT_data_v02},
+ {sizeof(qmiLocWifiApDataStructT_v02), qmiLocWifiApDataStructT_data_v02},
+ {sizeof(qmiLocWifiApAdditionalDataStructT_v02), qmiLocWifiApAdditionalDataStructT_data_v02},
+ {sizeof(qmiLocVehicleSensorSampleStructT_v02), qmiLocVehicleSensorSampleStructT_data_v02},
+ {sizeof(qmiLocVehicleSensorSampleListStructType_v02), qmiLocVehicleSensorSampleListStructType_data_v02},
+ {sizeof(qmiLocVehicleOdometrySampleStructT_v02), qmiLocVehicleOdometrySampleStructT_data_v02},
+ {sizeof(qmiLocVehicleOdometrySampleListStructT_v02), qmiLocVehicleOdometrySampleListStructT_data_v02},
+ {sizeof(qmiLocRcvrClockFrequencyInfoStructT_v02), qmiLocRcvrClockFrequencyInfoStructT_data_v02},
+ {sizeof(qmiLocLeapSecondInfoStructT_v02), qmiLocLeapSecondInfoStructT_data_v02},
+ {sizeof(qmiLocInterSystemBiasStructT_v02), qmiLocInterSystemBiasStructT_data_v02},
+ {sizeof(qmiLocGnssTimeStructT_v02), qmiLocGnssTimeStructT_data_v02},
+ {sizeof(qmiLocGloTimeStructT_v02), qmiLocGloTimeStructT_data_v02},
+ {sizeof(qmiLocGnssTimeExtStructT_v02), qmiLocGnssTimeExtStructT_data_v02},
+ {sizeof(qmiLocSVTimeSpeedStructT_v02), qmiLocSVTimeSpeedStructT_data_v02},
+ {sizeof(qmiLocSVMeasurementStructT_v02), qmiLocSVMeasurementStructT_data_v02},
+ {sizeof(qmiLocDgnssSVMeasurementStructT_v02), qmiLocDgnssSVMeasurementStructT_data_v02},
+ {sizeof(qmiLocWifiApMacAddressStructT_v02), qmiLocWifiApMacAddressStructT_data_v02},
+ {sizeof(qmiLocIBeaconIdStructT_v02), qmiLocIBeaconIdStructT_data_v02},
+ {sizeof(qmiLocGtpAsnVerStructT_v02), qmiLocGtpAsnVerStructT_data_v02},
+ {sizeof(qmiLocDbtPositionStructT_v02), qmiLocDbtPositionStructT_data_v02},
+ {sizeof(qmiLocApCacheStructT_v02), qmiLocApCacheStructT_data_v02},
+ {sizeof(qmiLocApCacheHepeRelStructT_v02), qmiLocApCacheHepeRelStructT_data_v02},
+ {sizeof(qmiLocApDoNotCacheStructT_v02), qmiLocApDoNotCacheStructT_data_v02},
+ {sizeof(qmiLocDeleteSatelliteDataStructT_v02), qmiLocDeleteSatelliteDataStructT_data_v02},
+ {sizeof(qmiLocInternalStatusReportDataStructT_v02), qmiLocInternalStatusReportDataStructT_data_v02},
+ {sizeof(qmiLocSrnBtleApDeviceDataStructT_v02), qmiLocSrnBtleApDeviceDataStructT_data_v02},
+ {sizeof(qmiLocWifiCrowdSourcingLocalConfigStructT_v02), qmiLocWifiCrowdSourcingLocalConfigStructT_data_v02},
+ {sizeof(qmiLocWifiCrowdSourcingCapabilityStructT_v02), qmiLocWifiCrowdSourcingCapabilityStructT_data_v02},
+ {sizeof(qmiLocXtraInfoStructT_v02), qmiLocXtraInfoStructT_data_v02},
+ {sizeof(qmiLocVersionStructT_v02), qmiLocVersionStructT_data_v02},
+ {sizeof(qmiLocGtpClientSwVerStructT_v02), qmiLocGtpClientSwVerStructT_data_v02},
+ {sizeof(qmiLocHomeCarrierIdStructT_v02), qmiLocHomeCarrierIdStructT_data_v02},
+ {sizeof(qmiLocPositionSourceStructT_v02), qmiLocPositionSourceStructT_data_v02},
+ {sizeof(qmiLocBsBestPositionStructT_v02), qmiLocBsBestPositionStructT_data_v02},
+ {sizeof(qmiLocFdclCellIdStructT_v02), qmiLocFdclCellIdStructT_data_v02},
+ {sizeof(qmiLocFdclCellPosStructT_v02), qmiLocFdclCellPosStructT_data_v02},
+ {sizeof(qmiLocNextLeapSecondInfoStructT_v02), qmiLocNextLeapSecondInfoStructT_data_v02},
+ {sizeof(qmiLocBsObservedDataStructT_v02), qmiLocBsObservedDataStructT_data_v02},
+ {sizeof(qmiLocEphGnssDataStructT_v02), qmiLocEphGnssDataStructT_data_v02},
+ {sizeof(qmiLocGpsEphemerisT_v02), qmiLocGpsEphemerisT_data_v02},
+ {sizeof(qmiLocGloEphemerisT_v02), qmiLocGloEphemerisT_data_v02},
+ {sizeof(qmiLocBdsEphemerisT_v02), qmiLocBdsEphemerisT_data_v02},
+ {sizeof(qmiLocGalEphemerisT_v02), qmiLocGalEphemerisT_data_v02},
+ {sizeof(qmiLocKlobucharIonoModelT_v02), qmiLocKlobucharIonoModelT_data_v02},
+ {sizeof(qmiLocMePerGnssRfStructType_v02), qmiLocMePerGnssRfStructType_data_v02},
+ {sizeof(qmiLocRobustLocationVersionT_v02), qmiLocRobustLocationVersionT_data_v02},
+ {sizeof(qmiLocEnvAidingReflectingPlaneStructT_v02), qmiLocEnvAidingReflectingPlaneStructT_data_v02},
+ {sizeof(qmiLocEnvAidingSVCorrectionStructT_v02), qmiLocEnvAidingSVCorrectionStructT_data_v02}
+};
+
+/* Message Table */
+static const qmi_idl_message_table_entry loc_message_table_v02[] = {
+ {sizeof(qmiLocGenReqMsgT_v02), 0},
+ {sizeof(qmiLocGenRespMsgT_v02), qmiLocGenRespMsgT_data_v02},
+ {sizeof(qmiLocGenReqStatusIndMsgT_v02), qmiLocGenReqStatusIndMsgT_data_v02},
+ {sizeof(qmiLocInformClientRevisionReqMsgT_v02), qmiLocInformClientRevisionReqMsgT_data_v02},
+ {sizeof(qmiLocRegEventsReqMsgT_v02), qmiLocRegEventsReqMsgT_data_v02},
+ {sizeof(qmiLocStartReqMsgT_v02), qmiLocStartReqMsgT_data_v02},
+ {sizeof(qmiLocStopReqMsgT_v02), qmiLocStopReqMsgT_data_v02},
+ {sizeof(qmiLocEventPositionReportIndMsgT_v02), qmiLocEventPositionReportIndMsgT_data_v02},
+ {sizeof(qmiLocEventGnssSvInfoIndMsgT_v02), qmiLocEventGnssSvInfoIndMsgT_data_v02},
+ {sizeof(qmiLocEventNmeaIndMsgT_v02), qmiLocEventNmeaIndMsgT_data_v02},
+ {sizeof(qmiLocEventNiNotifyVerifyReqIndMsgT_v02), qmiLocEventNiNotifyVerifyReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventInjectTimeReqIndMsgT_v02), qmiLocEventInjectTimeReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02), qmiLocEventInjectPredictedOrbitsReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventInjectPositionReqIndMsgT_v02), qmiLocEventInjectPositionReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventEngineStateIndMsgT_v02), qmiLocEventEngineStateIndMsgT_data_v02},
+ {sizeof(qmiLocEventFixSessionStateIndMsgT_v02), qmiLocEventFixSessionStateIndMsgT_data_v02},
+ {sizeof(qmiLocEventWifiReqIndMsgT_v02), qmiLocEventWifiReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventSensorStreamingReadyStatusIndMsgT_v02), qmiLocEventSensorStreamingReadyStatusIndMsgT_data_v02},
+ {sizeof(qmiLocEventTimeSyncReqIndMsgT_v02), qmiLocEventTimeSyncReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventSetSpiStreamingReportIndMsgT_v02), qmiLocEventSetSpiStreamingReportIndMsgT_data_v02},
+ {sizeof(qmiLocEventLocationServerConnectionReqIndMsgT_v02), qmiLocEventLocationServerConnectionReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventNiGeofenceNotificationIndMsgT_v02), qmiLocEventNiGeofenceNotificationIndMsgT_data_v02},
+ {sizeof(qmiLocEventGeofenceGenAlertIndMsgT_v02), qmiLocEventGeofenceGenAlertIndMsgT_data_v02},
+ {sizeof(qmiLocEventGeofenceBreachIndMsgT_v02), qmiLocEventGeofenceBreachIndMsgT_data_v02},
+ {sizeof(qmiLocEventPedometerControlIndMsgT_v02), qmiLocEventPedometerControlIndMsgT_data_v02},
+ {sizeof(qmiLocEventMotionDataControlIndMsgT_v02), qmiLocEventMotionDataControlIndMsgT_data_v02},
+ {sizeof(qmiLocEventGeofenceBatchedBreachIndMsgT_v02), qmiLocEventGeofenceBatchedBreachIndMsgT_data_v02},
+ {sizeof(qmiLocEventGeofenceProximityIndMsgT_v02), qmiLocEventGeofenceProximityIndMsgT_data_v02},
+ {sizeof(qmiLocEventGeofenceBatchedDwellIndMsgT_v02), qmiLocEventGeofenceBatchedDwellIndMsgT_data_v02},
+ {sizeof(qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02), qmiLocEventGdtUploadBeginStatusReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventGdtUploadEndReqIndMsgT_v02), qmiLocEventGdtUploadEndReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventGdtDownloadBeginReqIndMsgT_v02), qmiLocEventGdtDownloadBeginReqIndMsgT_data_v02},
+ {sizeof(qmiLocEventGdtReceiveDoneIndMsgT_v02), qmiLocEventGdtReceiveDoneIndMsgT_data_v02},
+ {sizeof(qmiLocEventGdtDownloadEndReqIndMsgT_v02), qmiLocEventGdtDownloadEndReqIndMsgT_data_v02},
+ {sizeof(qmiLocGetServiceRevisionReqMsgT_v02), 0},
+ {sizeof(qmiLocGetServiceRevisionIndMsgT_v02), qmiLocGetServiceRevisionIndMsgT_data_v02},
+ {sizeof(qmiLocGetFixCriteriaReqMsgT_v02), 0},
+ {sizeof(qmiLocGetFixCriteriaIndMsgT_v02), qmiLocGetFixCriteriaIndMsgT_data_v02},
+ {sizeof(qmiLocNiUserRespReqMsgT_v02), qmiLocNiUserRespReqMsgT_data_v02},
+ {sizeof(qmiLocNiUserRespIndMsgT_v02), qmiLocNiUserRespIndMsgT_data_v02},
+ {sizeof(qmiLocInjectPredictedOrbitsDataReqMsgT_v02), qmiLocInjectPredictedOrbitsDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectPredictedOrbitsDataIndMsgT_v02), qmiLocInjectPredictedOrbitsDataIndMsgT_data_v02},
+ {sizeof(qmiLocGetPredictedOrbitsDataSourceReqMsgT_v02), 0},
+ {sizeof(qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02), qmiLocGetPredictedOrbitsDataSourceIndMsgT_data_v02},
+ {sizeof(qmiLocGetPredictedOrbitsDataValidityReqMsgT_v02), 0},
+ {sizeof(qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02), qmiLocGetPredictedOrbitsDataValidityIndMsgT_data_v02},
+ {sizeof(qmiLocInjectUtcTimeReqMsgT_v02), qmiLocInjectUtcTimeReqMsgT_data_v02},
+ {sizeof(qmiLocInjectUtcTimeIndMsgT_v02), qmiLocInjectUtcTimeIndMsgT_data_v02},
+ {sizeof(qmiLocInjectPositionReqMsgT_v02), qmiLocInjectPositionReqMsgT_data_v02},
+ {sizeof(qmiLocInjectPositionIndMsgT_v02), qmiLocInjectPositionIndMsgT_data_v02},
+ {sizeof(qmiLocSetEngineLockReqMsgT_v02), qmiLocSetEngineLockReqMsgT_data_v02},
+ {sizeof(qmiLocSetEngineLockIndMsgT_v02), qmiLocSetEngineLockIndMsgT_data_v02},
+ {sizeof(qmiLocGetEngineLockReqMsgT_v02), qmiLocGetEngineLockReqMsgT_data_v02},
+ {sizeof(qmiLocGetEngineLockIndMsgT_v02), qmiLocGetEngineLockIndMsgT_data_v02},
+ {sizeof(qmiLocSetSbasConfigReqMsgT_v02), qmiLocSetSbasConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetSbasConfigIndMsgT_v02), qmiLocSetSbasConfigIndMsgT_data_v02},
+ {sizeof(qmiLocGetSbasConfigReqMsgT_v02), 0},
+ {sizeof(qmiLocGetSbasConfigIndMsgT_v02), qmiLocGetSbasConfigIndMsgT_data_v02},
+ {sizeof(qmiLocSetNmeaTypesReqMsgT_v02), qmiLocSetNmeaTypesReqMsgT_data_v02},
+ {sizeof(qmiLocSetNmeaTypesIndMsgT_v02), qmiLocSetNmeaTypesIndMsgT_data_v02},
+ {sizeof(qmiLocGetNmeaTypesReqMsgT_v02), 0},
+ {sizeof(qmiLocGetNmeaTypesIndMsgT_v02), qmiLocGetNmeaTypesIndMsgT_data_v02},
+ {sizeof(qmiLocSetLowPowerModeReqMsgT_v02), qmiLocSetLowPowerModeReqMsgT_data_v02},
+ {sizeof(qmiLocSetLowPowerModeIndMsgT_v02), qmiLocSetLowPowerModeIndMsgT_data_v02},
+ {sizeof(qmiLocGetLowPowerModeReqMsgT_v02), 0},
+ {sizeof(qmiLocGetLowPowerModeIndMsgT_v02), qmiLocGetLowPowerModeIndMsgT_data_v02},
+ {sizeof(qmiLocSetServerReqMsgT_v02), qmiLocSetServerReqMsgT_data_v02},
+ {sizeof(qmiLocSetServerIndMsgT_v02), qmiLocSetServerIndMsgT_data_v02},
+ {sizeof(qmiLocGetServerReqMsgT_v02), qmiLocGetServerReqMsgT_data_v02},
+ {sizeof(qmiLocGetServerIndMsgT_v02), qmiLocGetServerIndMsgT_data_v02},
+ {sizeof(qmiLocDeleteAssistDataReqMsgT_v02), qmiLocDeleteAssistDataReqMsgT_data_v02},
+ {sizeof(qmiLocDeleteAssistDataIndMsgT_v02), qmiLocDeleteAssistDataIndMsgT_data_v02},
+ {sizeof(qmiLocSetXtraTSessionControlReqMsgT_v02), qmiLocSetXtraTSessionControlReqMsgT_data_v02},
+ {sizeof(qmiLocSetXtraTSessionControlIndMsgT_v02), qmiLocSetXtraTSessionControlIndMsgT_data_v02},
+ {sizeof(qmiLocGetXtraTSessionControlReqMsgT_v02), 0},
+ {sizeof(qmiLocGetXtraTSessionControlIndMsgT_v02), qmiLocGetXtraTSessionControlIndMsgT_data_v02},
+ {sizeof(qmiLocInjectWifiPositionReqMsgT_v02), qmiLocInjectWifiPositionReqMsgT_data_v02},
+ {sizeof(qmiLocInjectWifiPositionIndMsgT_v02), qmiLocInjectWifiPositionIndMsgT_data_v02},
+ {sizeof(qmiLocNotifyWifiStatusReqMsgT_v02), qmiLocNotifyWifiStatusReqMsgT_data_v02},
+ {sizeof(qmiLocNotifyWifiStatusIndMsgT_v02), qmiLocNotifyWifiStatusIndMsgT_data_v02},
+ {sizeof(qmiLocGetRegisteredEventsReqMsgT_v02), 0},
+ {sizeof(qmiLocGetRegisteredEventsIndMsgT_v02), qmiLocGetRegisteredEventsIndMsgT_data_v02},
+ {sizeof(qmiLocSetOperationModeReqMsgT_v02), qmiLocSetOperationModeReqMsgT_data_v02},
+ {sizeof(qmiLocSetOperationModeIndMsgT_v02), qmiLocSetOperationModeIndMsgT_data_v02},
+ {sizeof(qmiLocGetOperationModeReqMsgT_v02), 0},
+ {sizeof(qmiLocGetOperationModeIndMsgT_v02), qmiLocGetOperationModeIndMsgT_data_v02},
+ {sizeof(qmiLocSetSpiStatusReqMsgT_v02), qmiLocSetSpiStatusReqMsgT_data_v02},
+ {sizeof(qmiLocSetSpiStatusIndMsgT_v02), qmiLocSetSpiStatusIndMsgT_data_v02},
+ {sizeof(qmiLocInjectSensorDataReqMsgT_v02), qmiLocInjectSensorDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectSensorDataIndMsgT_v02), qmiLocInjectSensorDataIndMsgT_data_v02},
+ {sizeof(qmiLocInjectTimeSyncDataReqMsgT_v02), qmiLocInjectTimeSyncDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectTimeSyncDataIndMsgT_v02), qmiLocInjectTimeSyncDataIndMsgT_data_v02},
+ {sizeof(qmiLocGetCradleMountConfigReqMsgT_v02), 0},
+ {sizeof(qmiLocGetCradleMountConfigIndMsgT_v02), qmiLocGetCradleMountConfigIndMsgT_data_v02},
+ {sizeof(qmiLocSetCradleMountConfigReqMsgT_v02), qmiLocSetCradleMountConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetCradleMountConfigIndMsgT_v02), qmiLocSetCradleMountConfigIndMsgT_data_v02},
+ {sizeof(qmiLocGetExternalPowerConfigReqMsgT_v02), 0},
+ {sizeof(qmiLocGetExternalPowerConfigIndMsgT_v02), qmiLocGetExternalPowerConfigIndMsgT_data_v02},
+ {sizeof(qmiLocSetExternalPowerConfigReqMsgT_v02), qmiLocSetExternalPowerConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetExternalPowerConfigIndMsgT_v02), qmiLocSetExternalPowerConfigIndMsgT_data_v02},
+ {sizeof(qmiLocInformLocationServerConnStatusReqMsgT_v02), qmiLocInformLocationServerConnStatusReqMsgT_data_v02},
+ {sizeof(qmiLocInformLocationServerConnStatusIndMsgT_v02), qmiLocInformLocationServerConnStatusIndMsgT_data_v02},
+ {sizeof(qmiLocSetProtocolConfigParametersReqMsgT_v02), qmiLocSetProtocolConfigParametersReqMsgT_data_v02},
+ {sizeof(qmiLocSetProtocolConfigParametersIndMsgT_v02), qmiLocSetProtocolConfigParametersIndMsgT_data_v02},
+ {sizeof(qmiLocGetProtocolConfigParametersReqMsgT_v02), qmiLocGetProtocolConfigParametersReqMsgT_data_v02},
+ {sizeof(qmiLocGetProtocolConfigParametersIndMsgT_v02), qmiLocGetProtocolConfigParametersIndMsgT_data_v02},
+ {sizeof(qmiLocSetSensorControlConfigReqMsgT_v02), qmiLocSetSensorControlConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetSensorControlConfigIndMsgT_v02), qmiLocSetSensorControlConfigIndMsgT_data_v02},
+ {sizeof(qmiLocGetSensorControlConfigReqMsgT_v02), 0},
+ {sizeof(qmiLocGetSensorControlConfigIndMsgT_v02), qmiLocGetSensorControlConfigIndMsgT_data_v02},
+ {sizeof(qmiLocSetSensorPropertiesReqMsgT_v02), qmiLocSetSensorPropertiesReqMsgT_data_v02},
+ {sizeof(qmiLocSetSensorPropertiesIndMsgT_v02), qmiLocSetSensorPropertiesIndMsgT_data_v02},
+ {sizeof(qmiLocGetSensorPropertiesReqMsgT_v02), qmiLocGetSensorPropertiesReqMsgT_data_v02},
+ {sizeof(qmiLocGetSensorPropertiesIndMsgT_v02), qmiLocGetSensorPropertiesIndMsgT_data_v02},
+ {sizeof(qmiLocSetSensorPerformanceControlConfigReqMsgT_v02), qmiLocSetSensorPerformanceControlConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetSensorPerformanceControlConfigIndMsgT_v02), qmiLocSetSensorPerformanceControlConfigIndMsgT_data_v02},
+ {sizeof(qmiLocGetSensorPerformanceControlConfigReqMsgT_v02), 0},
+ {sizeof(qmiLocGetSensorPerformanceControlConfigIndMsgT_v02), qmiLocGetSensorPerformanceControlConfigIndMsgT_data_v02},
+ {sizeof(qmiLocInjectSuplCertificateReqMsgT_v02), qmiLocInjectSuplCertificateReqMsgT_data_v02},
+ {sizeof(qmiLocInjectSuplCertificateIndMsgT_v02), qmiLocInjectSuplCertificateIndMsgT_data_v02},
+ {sizeof(qmiLocDeleteSuplCertificateReqMsgT_v02), qmiLocDeleteSuplCertificateReqMsgT_data_v02},
+ {sizeof(qmiLocDeleteSuplCertificateIndMsgT_v02), qmiLocDeleteSuplCertificateIndMsgT_data_v02},
+ {sizeof(qmiLocSetPositionEngineConfigParametersReqMsgT_v02), qmiLocSetPositionEngineConfigParametersReqMsgT_data_v02},
+ {sizeof(qmiLocSetPositionEngineConfigParametersIndMsgT_v02), qmiLocSetPositionEngineConfigParametersIndMsgT_data_v02},
+ {sizeof(qmiLocGetPositionEngineConfigParametersReqMsgT_v02), qmiLocGetPositionEngineConfigParametersReqMsgT_data_v02},
+ {sizeof(qmiLocGetPositionEngineConfigParametersIndMsgT_v02), qmiLocGetPositionEngineConfigParametersIndMsgT_data_v02},
+ {sizeof(qmiLocAddCircularGeofenceReqMsgT_v02), qmiLocAddCircularGeofenceReqMsgT_data_v02},
+ {sizeof(qmiLocAddCircularGeofenceIndMsgT_v02), qmiLocAddCircularGeofenceIndMsgT_data_v02},
+ {sizeof(qmiLocDeleteGeofenceReqMsgT_v02), qmiLocDeleteGeofenceReqMsgT_data_v02},
+ {sizeof(qmiLocDeleteGeofenceIndMsgT_v02), qmiLocDeleteGeofenceIndMsgT_data_v02},
+ {sizeof(qmiLocQueryGeofenceReqMsgT_v02), qmiLocQueryGeofenceReqMsgT_data_v02},
+ {sizeof(qmiLocQueryGeofenceIndMsgT_v02), qmiLocQueryGeofenceIndMsgT_data_v02},
+ {sizeof(qmiLocSetGeofenceEngineConfigReqMsgT_v02), qmiLocSetGeofenceEngineConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetGeofenceEngineConfigIndMsgT_v02), qmiLocSetGeofenceEngineConfigIndMsgT_data_v02},
+ {sizeof(qmiLocGetGeofenceEngineConfigReqMsgT_v02), qmiLocGetGeofenceEngineConfigReqMsgT_data_v02},
+ {sizeof(qmiLocGetGeofenceEngineConfigIndMsgT_v02), qmiLocGetGeofenceEngineConfigIndMsgT_data_v02},
+ {sizeof(qmiLocEditGeofenceReqMsgT_v02), qmiLocEditGeofenceReqMsgT_data_v02},
+ {sizeof(qmiLocEditGeofenceIndMsgT_v02), qmiLocEditGeofenceIndMsgT_data_v02},
+ {sizeof(qmiLocEventGetTimeZoneReqIndMsgT_v02), qmiLocEventGetTimeZoneReqIndMsgT_data_v02},
+ {sizeof(qmiLocInjectTimeZoneInfoReqMsgT_v02), qmiLocInjectTimeZoneInfoReqMsgT_data_v02},
+ {sizeof(qmiLocInjectTimeZoneInfoIndMsgT_v02), qmiLocInjectTimeZoneInfoIndMsgT_data_v02},
+ {sizeof(qmiLocGetBestAvailablePositionReqMsgT_v02), qmiLocGetBestAvailablePositionReqMsgT_data_v02},
+ {sizeof(qmiLocGetBestAvailablePositionIndMsgT_v02), qmiLocGetBestAvailablePositionIndMsgT_data_v02},
+ {sizeof(qmiLocInjectMotionDataReqMsgT_v02), qmiLocInjectMotionDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectMotionDataIndMsgT_v02), qmiLocInjectMotionDataIndMsgT_data_v02},
+ {sizeof(qmiLocGetNiGeofenceIdListReqMsgT_v02), qmiLocGetNiGeofenceIdListReqMsgT_data_v02},
+ {sizeof(qmiLocGetNiGeofenceIdListIndMsgT_v02), qmiLocGetNiGeofenceIdListIndMsgT_data_v02},
+ {sizeof(qmiLocInjectGSMCellInfoReqMsgT_v02), qmiLocInjectGSMCellInfoReqMsgT_data_v02},
+ {sizeof(qmiLocInjectGSMCellInfoIndMsgT_v02), qmiLocInjectGSMCellInfoIndMsgT_data_v02},
+ {sizeof(qmiLocInjectWCDMACellInfoReqMsgT_v02), qmiLocInjectWCDMACellInfoReqMsgT_data_v02},
+ {sizeof(qmiLocInjectWCDMACellInfoIndMsgT_v02), qmiLocInjectWCDMACellInfoIndMsgT_data_v02},
+ {sizeof(qmiLocInjectTDSCDMACellInfoReqMsgT_v02), qmiLocInjectTDSCDMACellInfoReqMsgT_data_v02},
+ {sizeof(qmiLocInjectTDSCDMACellInfoIndMsgT_v02), qmiLocInjectTDSCDMACellInfoIndMsgT_data_v02},
+ {sizeof(qmiLocInjectSubscriberIDReqMsgT_v02), qmiLocInjectSubscriberIDReqMsgT_data_v02},
+ {sizeof(qmiLocInjectSubscriberIDIndMsgT_v02), qmiLocInjectSubscriberIDIndMsgT_data_v02},
+ {sizeof(qmiLocInjectNetworkInitiatedMessageReqMsgT_v02), qmiLocInjectNetworkInitiatedMessageReqMsgT_data_v02},
+ {sizeof(qmiLocInjectNetworkInitiatedMessageIndMsgT_v02), qmiLocInjectNetworkInitiatedMessageIndMsgT_data_v02},
+ {sizeof(qmiLocWWANOutOfServiceNotificationReqMsgT_v02), 0},
+ {sizeof(qmiLocWWANOutOfServiceNotificationIndMsgT_v02), qmiLocWWANOutOfServiceNotificationIndMsgT_data_v02},
+ {sizeof(qmiLocPedometerReportReqMsgT_v02), qmiLocPedometerReportReqMsgT_data_v02},
+ {sizeof(qmiLocPedometerReportIndMsgT_v02), qmiLocPedometerReportIndMsgT_data_v02},
+ {sizeof(qmiLocGetBatchSizeReqMsgT_v02), qmiLocGetBatchSizeReqMsgT_data_v02},
+ {sizeof(qmiLocGetBatchSizeIndMsgT_v02), qmiLocGetBatchSizeIndMsgT_data_v02},
+ {sizeof(qmiLocStartBatchingReqMsgT_v02), qmiLocStartBatchingReqMsgT_data_v02},
+ {sizeof(qmiLocStartBatchingIndMsgT_v02), qmiLocStartBatchingIndMsgT_data_v02},
+ {sizeof(qmiLocEventBatchFullIndMsgT_v02), qmiLocEventBatchFullIndMsgT_data_v02},
+ {sizeof(qmiLocEventLiveBatchedPositionReportIndMsgT_v02), qmiLocEventLiveBatchedPositionReportIndMsgT_data_v02},
+ {sizeof(qmiLocReadFromBatchReqMsgT_v02), qmiLocReadFromBatchReqMsgT_data_v02},
+ {sizeof(qmiLocReadFromBatchIndMsgT_v02), qmiLocReadFromBatchIndMsgT_data_v02},
+ {sizeof(qmiLocStopBatchingReqMsgT_v02), qmiLocStopBatchingReqMsgT_data_v02},
+ {sizeof(qmiLocStopBatchingIndMsgT_v02), qmiLocStopBatchingIndMsgT_data_v02},
+ {sizeof(qmiLocReleaseBatchReqMsgT_v02), qmiLocReleaseBatchReqMsgT_data_v02},
+ {sizeof(qmiLocReleaseBatchIndMsgT_v02), qmiLocReleaseBatchIndMsgT_data_v02},
+ {sizeof(qmiLocEventInjectWifiApDataReqIndMsgT_v02), qmiLocEventInjectWifiApDataReqIndMsgT_data_v02},
+ {sizeof(qmiLocInjectWifiApDataReqMsgT_v02), qmiLocInjectWifiApDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectWifiApDataIndMsgT_v02), qmiLocInjectWifiApDataIndMsgT_data_v02},
+ {sizeof(qmiLocNotifyWifiAttachmentStatusReqMsgT_v02), qmiLocNotifyWifiAttachmentStatusReqMsgT_data_v02},
+ {sizeof(qmiLocNotifyWifiAttachmentStatusIndMsgT_v02), qmiLocNotifyWifiAttachmentStatusIndMsgT_data_v02},
+ {sizeof(qmiLocNotifyWifiEnabledStatusReqMsgT_v02), qmiLocNotifyWifiEnabledStatusReqMsgT_data_v02},
+ {sizeof(qmiLocNotifyWifiEnabledStatusIndMsgT_v02), qmiLocNotifyWifiEnabledStatusIndMsgT_data_v02},
+ {sizeof(qmiLocEventVehicleDataReadyIndMsgT_v02), qmiLocEventVehicleDataReadyIndMsgT_data_v02},
+ {sizeof(qmiLocInjectVehicleSensorDataReqMsgT_v02), qmiLocInjectVehicleSensorDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectVehicleSensorDataIndMsgT_v02), qmiLocInjectVehicleSensorDataIndMsgT_data_v02},
+ {sizeof(qmiLocGetAvailWwanPositionReqMsgT_v02), qmiLocGetAvailWwanPositionReqMsgT_data_v02},
+ {sizeof(qmiLocGetAvailWwanPositionIndMsgT_v02), qmiLocGetAvailWwanPositionIndMsgT_data_v02},
+ {sizeof(qmiLocSetPremiumServicesCfgReqMsgT_v02), qmiLocSetPremiumServicesCfgReqMsgT_data_v02},
+ {sizeof(qmiLocSetPremiumServicesCfgIndMsgT_v02), qmiLocSetPremiumServicesCfgIndMsgT_data_v02},
+ {sizeof(qmiLocSetXtraVersionCheckReqMsgT_v02), qmiLocSetXtraVersionCheckReqMsgT_data_v02},
+ {sizeof(qmiLocSetXtraVersionCheckIndMsgT_v02), qmiLocSetXtraVersionCheckIndMsgT_data_v02},
+ {sizeof(qmiLocSetGNSSConstRepConfigReqMsgT_v02), qmiLocSetGNSSConstRepConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetGNSSConstRepConfigIndMsgT_v02), qmiLocSetGNSSConstRepConfigIndMsgT_data_v02},
+ {sizeof(qmiLocEventGnssSvMeasInfoIndMsgT_v02), qmiLocEventGnssSvMeasInfoIndMsgT_data_v02},
+ {sizeof(qmiLocEventGnssSvPolyIndMsgT_v02), qmiLocEventGnssSvPolyIndMsgT_data_v02},
+ {sizeof(qmiLocAddGeofenceContextReqMsgT_v02), qmiLocAddGeofenceContextReqMsgT_data_v02},
+ {sizeof(qmiLocAddGeofenceContextIndMsgT_v02), qmiLocAddGeofenceContextIndMsgT_data_v02},
+ {sizeof(qmiLocSetGeofenceEngineContextReqMsgT_v02), qmiLocSetGeofenceEngineContextReqMsgT_data_v02},
+ {sizeof(qmiLocSetGeofenceEngineContextIndMsgT_v02), qmiLocSetGeofenceEngineContextIndMsgT_data_v02},
+ {sizeof(qmiLocDeleteGeofenceContextReqMsgT_v02), qmiLocDeleteGeofenceContextReqMsgT_data_v02},
+ {sizeof(qmiLocDeleteGeofenceContextIndMsgT_v02), qmiLocDeleteGeofenceContextIndMsgT_data_v02},
+ {sizeof(qmiLocInjectGtpClientDownloadedDataReqMsgT_v02), qmiLocInjectGtpClientDownloadedDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectGtpClientDownloadedDataIndMsgT_v02), qmiLocInjectGtpClientDownloadedDataIndMsgT_data_v02},
+ {sizeof(qmiLocGdtUploadBeginStatusReqMsgT_v02), qmiLocGdtUploadBeginStatusReqMsgT_data_v02},
+ {sizeof(qmiLocGdtUploadBeginStatusIndMsgT_v02), qmiLocGdtUploadBeginStatusIndMsgT_data_v02},
+ {sizeof(qmiLocGdtUploadEndReqMsgT_v02), qmiLocGdtUploadEndReqMsgT_data_v02},
+ {sizeof(qmiLocGdtUploadEndIndMsgT_v02), qmiLocGdtUploadEndIndMsgT_data_v02},
+ {sizeof(qmiLocGtpApStatusReqMsgT_v02), qmiLocGtpApStatusReqMsgT_data_v02},
+ {sizeof(qmiLocGtpApStatusIndMsgT_v02), qmiLocGtpApStatusIndMsgT_data_v02},
+ {sizeof(qmiLocGdtDownloadBeginStatusReqMsgT_v02), qmiLocGdtDownloadBeginStatusReqMsgT_data_v02},
+ {sizeof(qmiLocGdtDownloadBeginStatusIndMsgT_v02), qmiLocGdtDownloadBeginStatusIndMsgT_data_v02},
+ {sizeof(qmiLocGdtDownloadReadyStatusReqMsgT_v02), qmiLocGdtDownloadReadyStatusReqMsgT_data_v02},
+ {sizeof(qmiLocGdtDownloadReadyStatusIndMsgT_v02), qmiLocGdtDownloadReadyStatusIndMsgT_data_v02},
+ {sizeof(qmiLocGdtReceiveDoneStatusReqMsgT_v02), qmiLocGdtReceiveDoneStatusReqMsgT_data_v02},
+ {sizeof(qmiLocGdtReceiveDoneStatusIndMsgT_v02), qmiLocGdtReceiveDoneStatusIndMsgT_data_v02},
+ {sizeof(qmiLocGdtDownloadEndStatusReqMsgT_v02), qmiLocGdtDownloadEndStatusReqMsgT_data_v02},
+ {sizeof(qmiLocGdtDownloadEndStatusIndMsgT_v02), qmiLocGdtDownloadEndStatusIndMsgT_data_v02},
+ {sizeof(qmiLocStartDbtReqMsgT_v02), qmiLocStartDbtReqMsgT_data_v02},
+ {sizeof(qmiLocStartDbtIndMsgT_v02), qmiLocStartDbtIndMsgT_data_v02},
+ {sizeof(qmiLocStopDbtReqMsgT_v02), qmiLocStopDbtReqMsgT_data_v02},
+ {sizeof(qmiLocStopDbtIndMsgT_v02), qmiLocStopDbtIndMsgT_data_v02},
+ {sizeof(qmiLocEventDbtPositionReportIndMsgT_v02), qmiLocEventDbtPositionReportIndMsgT_data_v02},
+ {sizeof(qmiLocEventDbtSessionStatusIndMsgT_v02), qmiLocEventDbtSessionStatusIndMsgT_data_v02},
+ {sizeof(qmiLocSecureGetAvailablePositionReqMsgT_v02), qmiLocSecureGetAvailablePositionReqMsgT_data_v02},
+ {sizeof(qmiLocSecureGetAvailablePositionIndMsgT_v02), qmiLocSecureGetAvailablePositionIndMsgT_data_v02},
+ {sizeof(qmiLocInjectApCacheDataReqMsgT_v02), qmiLocInjectApCacheDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectApCacheDataIndMsgT_v02), qmiLocInjectApCacheDataIndMsgT_data_v02},
+ {sizeof(qmiLocInjectApDoNotCacheDataReqMsgT_v02), qmiLocInjectApDoNotCacheDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectApDoNotCacheDataIndMsgT_v02), qmiLocInjectApDoNotCacheDataIndMsgT_data_v02},
+ {sizeof(qmiLocEventBatchingStatusIndMsgT_v02), qmiLocEventBatchingStatusIndMsgT_data_v02},
+ {sizeof(qmiLocQueryAonConfigReqMsgT_v02), qmiLocQueryAonConfigReqMsgT_data_v02},
+ {sizeof(qmiLocQueryAonConfigIndMsgT_v02), qmiLocQueryAonConfigIndMsgT_data_v02},
+ {sizeof(qmiLocDeleteGNSSServiceDataReqMsgT_v02), qmiLocDeleteGNSSServiceDataReqMsgT_data_v02},
+ {sizeof(qmiLocDeleteGNSSServiceDataIndMsgT_v02), qmiLocDeleteGNSSServiceDataIndMsgT_data_v02},
+ {sizeof(qmiLocInjectXtraDataReqMsgT_v02), qmiLocInjectXtraDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectXtraDataIndMsgT_v02), qmiLocInjectXtraDataIndMsgT_data_v02},
+ {sizeof(qmiLocInjectXtraPcidReqMsgT_v02), qmiLocInjectXtraPcidReqMsgT_data_v02},
+ {sizeof(qmiLocInjectXtraPcidIndMsgT_v02), qmiLocInjectXtraPcidIndMsgT_data_v02},
+ {sizeof(qmiLocGetSupportedFeatureReqMsgT_v02), 0},
+ {sizeof(qmiLocGetSupportedFeatureIndMsgT_v02), qmiLocGetSupportedFeatureIndMsgT_data_v02},
+ {sizeof(qmiLocSetInternalStatusConfigReqMsgT_v02), qmiLocSetInternalStatusConfigReqMsgT_data_v02},
+ {sizeof(qmiLocSetInternalStatusConfigIndMsgT_v02), qmiLocSetInternalStatusConfigIndMsgT_data_v02},
+ {sizeof(qmiLocEventInternalStatusReportIndMsgT_v02), qmiLocEventInternalStatusReportIndMsgT_data_v02},
+ {sizeof(qmiLocEventInjectSrnApDataReqIndMsgT_v02), qmiLocEventInjectSrnApDataReqIndMsgT_data_v02},
+ {sizeof(qmiLocInjectSrnApDataReqMsgT_v02), qmiLocInjectSrnApDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectSrnApDataIndMsgT_v02), qmiLocInjectSrnApDataIndMsgT_data_v02},
+ {sizeof(qmiLocCrowdSourceManagerControlReqMsgT_v02), qmiLocCrowdSourceManagerControlReqMsgT_data_v02},
+ {sizeof(qmiLocCrowdSourceManagerControlIndMsgT_v02), qmiLocCrowdSourceManagerControlIndMsgT_data_v02},
+ {sizeof(qmiLocCrowdSourceManagerReadDataReqMsgT_v02), qmiLocCrowdSourceManagerReadDataReqMsgT_data_v02},
+ {sizeof(qmiLocQueryXtraInfoReqMsgT_v02), qmiLocQueryXtraInfoReqMsgT_data_v02},
+ {sizeof(qmiLocQueryXtraInfoIndMsgT_v02), qmiLocQueryXtraInfoIndMsgT_data_v02},
+ {sizeof(qmiLocStartOutdoorTripBatchingReqMsgT_v02), qmiLocStartOutdoorTripBatchingReqMsgT_data_v02},
+ {sizeof(qmiLocStartOutdoorTripBatchingIndMsgT_v02), qmiLocStartOutdoorTripBatchingIndMsgT_data_v02},
+ {sizeof(qmiLocQueryOTBAccumulatedDistanceReqMsgT_v02), 0},
+ {sizeof(qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02), qmiLocQueryOTBAccumulatedDistanceIndMsgT_data_v02},
+ {sizeof(qmiLocEventFdclServiceReqIndMsgT_v02), qmiLocEventFdclServiceReqIndMsgT_data_v02},
+ {sizeof(qmiLocGetFdclBsListReqMsgT_v02), qmiLocGetFdclBsListReqMsgT_data_v02},
+ {sizeof(qmiLocGetFdclBsListIndMsgT_v02), qmiLocGetFdclBsListIndMsgT_data_v02},
+ {sizeof(qmiLocInjectFdclDataReqMsgT_v02), qmiLocInjectFdclDataReqMsgT_data_v02},
+ {sizeof(qmiLocInjectFdclDataIndMsgT_v02), qmiLocInjectFdclDataIndMsgT_data_v02},
+ {sizeof(qmiLocSetBlacklistSvReqMsgT_v02), qmiLocSetBlacklistSvReqMsgT_data_v02},
+ {sizeof(qmiLocGetBlacklistSvIndMsgT_v02), qmiLocGetBlacklistSvIndMsgT_data_v02},
+ {sizeof(qmiLocSetConstellationConfigReqMsgT_v02), qmiLocSetConstellationConfigReqMsgT_data_v02},
+ {sizeof(qmiLocEventDcReportIndMsgT_v02), qmiLocEventDcReportIndMsgT_data_v02},
+ {sizeof(qmiLocRegisterMasterClientReqMsgT_v02), qmiLocRegisterMasterClientReqMsgT_data_v02},
+ {sizeof(qmiLocRegisterMasterClientIndMsgT_v02), qmiLocRegisterMasterClientIndMsgT_data_v02},
+ {sizeof(qmiLocEventEngineLockStateIndMsgT_v02), qmiLocEventEngineLockStateIndMsgT_data_v02},
+ {sizeof(qmiLocStartListenPositionReqMsgT_v02), 0},
+ {sizeof(qmiLocStopListenPositionReqMsgT_v02), 0},
+ {sizeof(qmiLocSystemInfoReqMsgT_v02), qmiLocSystemInfoReqMsgT_data_v02},
+ {sizeof(qmiLocSystemInfoIndMsgT_v02), qmiLocSystemInfoIndMsgT_data_v02},
+ {sizeof(qmiLocGetConstellationConfigIndMsgT_v02), qmiLocGetConstellationConfigIndMsgT_data_v02},
+ {sizeof(qmiLocEnablePositionInjectionTestModeReqMsgT_v02), qmiLocEnablePositionInjectionTestModeReqMsgT_data_v02},
+ {sizeof(qmiLocEnablePositionInjectionTestModeIndMsgT_v02), qmiLocEnablePositionInjectionTestModeIndMsgT_data_v02},
+ {sizeof(qmiLocInjectTestPositionReqMsgT_v02), qmiLocInjectTestPositionReqMsgT_data_v02},
+ {sizeof(qmiLocInjectTestPositionIndMsgT_v02), qmiLocInjectTestPositionIndMsgT_data_v02},
+ {sizeof(qmiLocEventBsObsDataServiceReqIndMsgT_v02), qmiLocEventBsObsDataServiceReqIndMsgT_data_v02},
+ {sizeof(qmiLocGetBsObsDataReqMsgT_v02), qmiLocGetBsObsDataReqMsgT_data_v02},
+ {sizeof(qmiLocGetBsObsDataIndMsgT_v02), qmiLocGetBsObsDataIndMsgT_data_v02},
+ {sizeof(qmiLocGpsEphemerisReportIndMsgT_v02), qmiLocGpsEphemerisReportIndMsgT_data_v02},
+ {sizeof(qmiLocGloEphemerisReportIndMsgT_v02), qmiLocGloEphemerisReportIndMsgT_data_v02},
+ {sizeof(qmiLocBdsEphemerisReportIndMsgT_v02), qmiLocBdsEphemerisReportIndMsgT_data_v02},
+ {sizeof(qmiLocGalEphemerisReportIndMsgT_v02), qmiLocGalEphemerisReportIndMsgT_data_v02},
+ {sizeof(qmiLocQzssEphemerisReportIndMsgT_v02), qmiLocQzssEphemerisReportIndMsgT_data_v02},
+ {sizeof(qmiLocSetConstrainedTuncModeReqMsgT_v02), qmiLocSetConstrainedTuncModeReqMsgT_data_v02},
+ {sizeof(qmiLocSetConstrainedTuncModeIndMsgT_v02), qmiLocSetConstrainedTuncModeIndMsgT_data_v02},
+ {sizeof(qmiLocEnablePositionAssistedClockEstReqMsgT_v02), qmiLocEnablePositionAssistedClockEstReqMsgT_data_v02},
+ {sizeof(qmiLocEnablePositionAssistedClockEstIndMsgT_v02), qmiLocEnablePositionAssistedClockEstIndMsgT_data_v02},
+ {sizeof(qmiLocQueryGNSSEnergyConsumedReqMsgT_v02), 0},
+ {sizeof(qmiLocQueryGNSSEnergyConsumedIndMsgT_v02), qmiLocQueryGNSSEnergyConsumedIndMsgT_data_v02},
+ {sizeof(qmiLocEventReportIndMsgT_v02), qmiLocEventReportIndMsgT_data_v02},
+ {sizeof(qmiLocGetBandMeasurementMetricsIndMsgT_v02), qmiLocGetBandMeasurementMetricsIndMsgT_data_v02},
+ {sizeof(qmiLocLocationRequestNotificationIndMsgT_v02), qmiLocLocationRequestNotificationIndMsgT_data_v02},
+ {sizeof(qmiLocInjectPlatformPowerStateReqMsgT_v02), qmiLocInjectPlatformPowerStateReqMsgT_data_v02},
+ {sizeof(qmiLocInjectPlatformPowerStateIndMsgT_v02), qmiLocInjectPlatformPowerStateIndMsgT_data_v02},
+ {sizeof(qmiLocSetRobustLocationReqMsgT_v02), qmiLocSetRobustLocationReqMsgT_data_v02},
+ {sizeof(qmiLocGetRobustLocationConfigIndMsgT_v02), qmiLocGetRobustLocationConfigIndMsgT_data_v02},
+ {sizeof(qmiLocEventInjectEnvAidingReqMsgT_v02), qmiLocEventInjectEnvAidingReqMsgT_data_v02},
+ {sizeof(qmiLocSetMinGpsWeekNumberReqMsgT_v02), qmiLocSetMinGpsWeekNumberReqMsgT_data_v02},
+ {sizeof(qmiLocGetMinGpsWeekNumberIndMsgT_v02), qmiLocGetMinGpsWeekNumberIndMsgT_data_v02},
+ {sizeof(qmiLocSapInsParamsIndMsgT_v02), qmiLocSapInsParamsIndMsgT_data_v02},
+ {sizeof(qmiLocEventQueryXtraInfoReqIndMsgT_v02), 0},
+ {sizeof(qmiLocSetParameterReqMsgT_v02), qmiLocSetParameterReqMsgT_data_v02},
+ {sizeof(qmiLocGetParameterReqMsgT_v02), qmiLocGetParameterReqMsgT_data_v02},
+ {sizeof(qmiLocGetParameterIndMsgT_v02), qmiLocGetParameterIndMsgT_data_v02},
+ {sizeof(qmiLocSetStatisticsConfigReqMsgT_v02), qmiLocSetStatisticsConfigReqMsgT_data_v02},
+ {sizeof(qmiLocGetStatisticsConfigIndMsgT_v02), qmiLocGetStatisticsConfigIndMsgT_data_v02},
+ {sizeof(qmiLocGnssStatisticsReportIndMsgT_v02), qmiLocGnssStatisticsReportIndMsgT_data_v02},
+ {sizeof(qmiLocSetGnssPdrModeReqMsgT_v02), qmiLocSetGnssPdrModeReqMsgT_data_v02},
+ {sizeof(qmiLocGetGnssPdrModeIndMsgT_v02), qmiLocGetGnssPdrModeIndMsgT_data_v02},
+ {sizeof(qmiLocGetMagCalStatePdrIndMsgT_v02), qmiLocGetMagCalStatePdrIndMsgT_data_v02},
+ {sizeof(qmiLocSetMultibandConfigReqMsgT_v02), qmiLocSetMultibandConfigReqMsgT_data_v02},
+ {sizeof(qmiLocGetMultibandConfigIndMsgT_v02), qmiLocGetMultibandConfigIndMsgT_data_v02},
+ {sizeof(qmiLocLatencyInformationIndMsgT_v02), qmiLocLatencyInformationIndMsgT_data_v02}
+};
+
+/* Range Table */
+/* No Ranges Defined in IDL */
+
+/* Predefine the Type Table Object */
+static const qmi_idl_type_table_object loc_qmi_idl_type_table_object_v02;
+
+/*Referenced Tables Array*/
+static const qmi_idl_type_table_object *loc_qmi_idl_type_table_object_referenced_tables_v02[] =
+{&loc_qmi_idl_type_table_object_v02, &common_qmi_idl_type_table_object_v01};
+
+/*Type Table Object*/
+static const qmi_idl_type_table_object loc_qmi_idl_type_table_object_v02 = {
+ sizeof(loc_type_table_v02)/sizeof(qmi_idl_type_table_entry ),
+ sizeof(loc_message_table_v02)/sizeof(qmi_idl_message_table_entry),
+ 1,
+ loc_type_table_v02,
+ loc_message_table_v02,
+ loc_qmi_idl_type_table_object_referenced_tables_v02,
+ NULL
+};
+
+/*Arrays of service_message_table_entries for commands, responses and indications*/
+static const qmi_idl_service_message_table_entry loc_service_command_messages_v02[] = {
+ {QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02, QMI_IDL_TYPE16(1, 0), 0},
+ {QMI_LOC_GET_SUPPORTED_FIELDS_REQ_V02, QMI_IDL_TYPE16(1, 2), 5},
+ {QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02, QMI_IDL_TYPE16(0, 3), 7},
+ {QMI_LOC_REG_EVENTS_REQ_V02, QMI_IDL_TYPE16(0, 4), 29},
+ {QMI_LOC_START_REQ_V02, QMI_IDL_TYPE16(0, 5), 150},
+ {QMI_LOC_STOP_REQ_V02, QMI_IDL_TYPE16(0, 6), 4},
+ {QMI_LOC_GET_SERVICE_REVISION_REQ_V02, QMI_IDL_TYPE16(0, 34), 0},
+ {QMI_LOC_GET_FIX_CRITERIA_REQ_V02, QMI_IDL_TYPE16(0, 36), 0},
+ {QMI_LOC_NI_USER_RESPONSE_REQ_V02, QMI_IDL_TYPE16(0, 38), 1345},
+ {QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02, QMI_IDL_TYPE16(0, 40), 1053},
+ {QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02, QMI_IDL_TYPE16(0, 42), 0},
+ {QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_REQ_V02, QMI_IDL_TYPE16(0, 44), 0},
+ {QMI_LOC_INJECT_UTC_TIME_REQ_V02, QMI_IDL_TYPE16(0, 46), 25},
+ {QMI_LOC_INJECT_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 48), 540},
+ {QMI_LOC_SET_ENGINE_LOCK_REQ_V02, QMI_IDL_TYPE16(0, 50), 25},
+ {QMI_LOC_GET_ENGINE_LOCK_REQ_V02, QMI_IDL_TYPE16(0, 52), 7},
+ {QMI_LOC_SET_SBAS_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 54), 8},
+ {QMI_LOC_GET_SBAS_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 56), 0},
+ {QMI_LOC_SET_NMEA_TYPES_REQ_V02, QMI_IDL_TYPE16(0, 58), 7},
+ {QMI_LOC_GET_NMEA_TYPES_REQ_V02, QMI_IDL_TYPE16(0, 60), 0},
+ {QMI_LOC_SET_LOW_POWER_MODE_REQ_V02, QMI_IDL_TYPE16(0, 62), 4},
+ {QMI_LOC_GET_LOW_POWER_MODE_REQ_V02, QMI_IDL_TYPE16(0, 64), 0},
+ {QMI_LOC_SET_SERVER_REQ_V02, QMI_IDL_TYPE16(0, 66), 297},
+ {QMI_LOC_GET_SERVER_REQ_V02, QMI_IDL_TYPE16(0, 68), 11},
+ {QMI_LOC_DELETE_ASSIST_DATA_REQ_V02, QMI_IDL_TYPE16(0, 70), 1160},
+ {QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02, QMI_IDL_TYPE16(0, 72), 4},
+ {QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ_V02, QMI_IDL_TYPE16(0, 74), 0},
+ {QMI_LOC_INJECT_WIFI_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 76), 2353},
+ {QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 78), 7},
+ {QMI_LOC_GET_REGISTERED_EVENTS_REQ_V02, QMI_IDL_TYPE16(0, 80), 0},
+ {QMI_LOC_SET_OPERATION_MODE_REQ_V02, QMI_IDL_TYPE16(0, 82), 14},
+ {QMI_LOC_GET_OPERATION_MODE_REQ_V02, QMI_IDL_TYPE16(0, 84), 0},
+ {QMI_LOC_SET_SPI_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 86), 8},
+ {QMI_LOC_INJECT_SENSOR_DATA_REQ_V02, QMI_IDL_TYPE16(0, 88), 2779},
+ {QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02, QMI_IDL_TYPE16(0, 90), 21},
+ {QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 94), 11},
+ {QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 92), 0},
+ {QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 98), 14},
+ {QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 96), 0},
+ {QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 100), 140},
+ {QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02, QMI_IDL_TYPE16(0, 102), 86},
+ {QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02, QMI_IDL_TYPE16(0, 104), 11},
+ {QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 106), 14},
+ {QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 108), 0},
+ {QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02, QMI_IDL_TYPE16(0, 110), 88},
+ {QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02, QMI_IDL_TYPE16(0, 112), 7},
+ {QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02, QMI_IDL_TYPE16(0, 114), 42},
+ {QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02, QMI_IDL_TYPE16(0, 116), 0},
+ {QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02, QMI_IDL_TYPE16(0, 118), 2009},
+ {QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02, QMI_IDL_TYPE16(0, 120), 4},
+ {QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02, QMI_IDL_TYPE16(0, 122), 16},
+ {QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02, QMI_IDL_TYPE16(0, 124), 7},
+ {QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02, QMI_IDL_TYPE16(0, 126), 70},
+ {QMI_LOC_DELETE_GEOFENCE_REQ_V02, QMI_IDL_TYPE16(0, 128), 14},
+ {QMI_LOC_QUERY_GEOFENCE_REQ_V02, QMI_IDL_TYPE16(0, 130), 14},
+ {QMI_LOC_EDIT_GEOFENCE_REQ_V02, QMI_IDL_TYPE16(0, 136), 32},
+ {QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 141), 14},
+ {QMI_LOC_INJECT_MOTION_DATA_REQ_V02, QMI_IDL_TYPE16(0, 143), 19},
+ {QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02, QMI_IDL_TYPE16(0, 145), 7},
+ {QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02, QMI_IDL_TYPE16(0, 147), 30},
+ {QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02, QMI_IDL_TYPE16(0, 155), 1036},
+ {QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02, QMI_IDL_TYPE16(0, 157), 0},
+ {QMI_LOC_PEDOMETER_REPORT_REQ_V02, QMI_IDL_TYPE16(0, 159), 46},
+ {QMI_LOC_INJECT_WCDMA_CELL_INFO_REQ_V02, QMI_IDL_TYPE16(0, 149), 36},
+ {QMI_LOC_INJECT_TDSCDMA_CELL_INFO_REQ_V02, QMI_IDL_TYPE16(0, 151), 33},
+ {QMI_LOC_INJECT_SUBSCRIBER_ID_REQ_V02, QMI_IDL_TYPE16(0, 153), 22},
+ {QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 132), 224},
+ {QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 134), 7},
+ {QMI_LOC_GET_BATCH_SIZE_REQ_V02, QMI_IDL_TYPE16(0, 161), 21},
+ {QMI_LOC_START_BATCHING_REQ_V02, QMI_IDL_TYPE16(0, 163), 39},
+ {QMI_LOC_READ_FROM_BATCH_REQ_V02, QMI_IDL_TYPE16(0, 167), 21},
+ {QMI_LOC_STOP_BATCHING_REQ_V02, QMI_IDL_TYPE16(0, 169), 21},
+ {QMI_LOC_RELEASE_BATCH_REQ_V02, QMI_IDL_TYPE16(0, 171), 14},
+ {QMI_LOC_INJECT_WIFI_AP_DATA_REQ_V02, QMI_IDL_TYPE16(0, 174), 5200},
+ {QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 176), 51},
+ {QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 178), 7},
+ {QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02, QMI_IDL_TYPE16(0, 181), 3360},
+ {QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 183), 7},
+ {QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 185), 14},
+ {QMI_LOC_SET_XTRA_VERSION_CHECK_REQ_V02, QMI_IDL_TYPE16(0, 187), 7},
+ {QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02, QMI_IDL_TYPE16(0, 189), 34},
+ {QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ_V02, QMI_IDL_TYPE16(0, 193), 2517},
+ {QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_REQ_V02, QMI_IDL_TYPE16(0, 195), 25},
+ {QMI_LOC_DELETE_GEOFENCE_CONTEXT_REQ_V02, QMI_IDL_TYPE16(0, 197), 21},
+ {QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_REQ_V02, QMI_IDL_TYPE16(0, 199), 517},
+ {QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 201), 21},
+ {QMI_LOC_GDT_UPLOAD_END_REQ_V02, QMI_IDL_TYPE16(0, 203), 21},
+ {QMI_LOC_START_DBT_REQ_V02, QMI_IDL_TYPE16(0, 215), 36},
+ {QMI_LOC_STOP_DBT_REQ_V02, QMI_IDL_TYPE16(0, 217), 4},
+ {QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 221), 268},
+ {QMI_LOC_INJECT_TIME_ZONE_INFO_REQ_V02, QMI_IDL_TYPE16(0, 139), 30},
+ {QMI_LOC_INJECT_APCACHE_DATA_REQ_V02, QMI_IDL_TYPE16(0, 223), 2180},
+ {QMI_LOC_INJECT_APDONOTCACHE_DATA_REQ_V02, QMI_IDL_TYPE16(0, 225), 656},
+ {QMI_LOC_QUERY_AON_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 228), 7},
+ {QMI_LOC_GTP_AP_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 205), 540},
+ {QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 207), 294},
+ {QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 209), 280},
+ {QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 211), 21},
+ {QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02, QMI_IDL_TYPE16(0, 213), 21},
+ {QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02, QMI_IDL_TYPE16(0, 230), 47},
+ {QMI_LOC_INJECT_XTRA_DATA_REQ_V02, QMI_IDL_TYPE16(0, 232), 1053},
+ {QMI_LOC_INJECT_XTRA_PCID_REQ_V02, QMI_IDL_TYPE16(0, 234), 11},
+ {QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02, QMI_IDL_TYPE16(0, 236), 0},
+ {QMI_LOC_SET_INTERNAL_STATUS_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 238), 4},
+ {QMI_LOC_INJECT_SRN_AP_DATA_REQ_V02, QMI_IDL_TYPE16(0, 242), 1448},
+ {QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ_V02, QMI_IDL_TYPE16(0, 244), 545},
+ {QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_REQ_V02, QMI_IDL_TYPE16(0, 246), 7},
+ {QMI_LOC_QUERY_XTRA_INFO_REQ_V02, QMI_IDL_TYPE16(0, 247), 12},
+ {QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ_V02, QMI_IDL_TYPE16(0, 249), 25},
+ {QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02, QMI_IDL_TYPE16(0, 251), 0},
+ {QMI_LOC_GET_FDCL_BS_LIST_REQ_V02, QMI_IDL_TYPE16(0, 254), 23},
+ {QMI_LOC_INJECT_FDCL_DATA_REQ_V02, QMI_IDL_TYPE16(0, 256), 2273},
+ {QMI_LOC_SET_BLACKLIST_SV_REQ_V02, QMI_IDL_TYPE16(0, 258), 132},
+ {QMI_LOC_GET_BLACKLIST_SV_REQ_V02, QMI_IDL_TYPE16(0, 0), 0},
+ {QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02, QMI_IDL_TYPE16(0, 260), 26},
+ {QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02, QMI_IDL_TYPE16(0, 262), 7},
+ {QMI_LOC_START_LISTEN_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 265), 0},
+ {QMI_LOC_STOP_LISTEN_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 266), 0},
+ {QMI_LOC_SYSTEM_INFO_REQ_V02, QMI_IDL_TYPE16(0, 267), 7},
+ {QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02, QMI_IDL_TYPE16(0, 0), 0},
+ {QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_REQ_V02, QMI_IDL_TYPE16(0, 270), 4},
+ {QMI_LOC_INJECT_TEST_POSITION_REQ_V02, QMI_IDL_TYPE16(0, 272), 47},
+ {QMI_LOC_GET_BS_OBS_DATA_REQ_V02, QMI_IDL_TYPE16(0, 275), 16},
+ {QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02, QMI_IDL_TYPE16(0, 282), 18},
+ {QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02, QMI_IDL_TYPE16(0, 284), 4},
+ {QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02, QMI_IDL_TYPE16(0, 286), 0},
+ {QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ_V02, QMI_IDL_TYPE16(0, 291), 7},
+ {QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 293), 8},
+ {QMI_LOC_GET_ROBUST_LOCATION_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 0), 0},
+ {QMI_LOC_INJECT_ENV_AIDING_REQ_V02, QMI_IDL_TYPE16(0, 295), 3816},
+ {QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_REQ_V02, QMI_IDL_TYPE16(0, 296), 5},
+ {QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_REQ_V02, QMI_IDL_TYPE16(0, 0), 0},
+ {QMI_LOC_SET_PARAMETER_REQ_V02, QMI_IDL_TYPE16(0, 300), 11},
+ {QMI_LOC_GET_PARAMETER_REQ_V02, QMI_IDL_TYPE16(0, 301), 7},
+ {QMI_LOC_SET_STATISTICS_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 303), 11},
+ {QMI_LOC_GET_STATISTICS_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 0), 0},
+ {QMI_LOC_SET_GNSS_PDR_MODE_REQ_V02, QMI_IDL_TYPE16(0, 306), 7},
+ {QMI_LOC_GET_GNSS_PDR_MODE_REQ_V02, QMI_IDL_TYPE16(0, 0), 0},
+ {QMI_LOC_GET_MAG_CAL_STATE_PDR_REQ_V02, QMI_IDL_TYPE16(0, 0), 0},
+ {QMI_LOC_SET_MULTIBAND_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 309), 11},
+ {QMI_LOC_GET_MULTIBAND_CONFIG_REQ_V02, QMI_IDL_TYPE16(0, 0), 0}
+};
+
+static const qmi_idl_service_message_table_entry loc_service_response_messages_v02[] = {
+ {QMI_LOC_GET_SUPPORTED_MSGS_RESP_V02, QMI_IDL_TYPE16(1, 1), 8204},
+ {QMI_LOC_GET_SUPPORTED_FIELDS_RESP_V02, QMI_IDL_TYPE16(1, 3), 115},
+ {QMI_LOC_INFORM_CLIENT_REVISION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_REG_EVENTS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_START_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_STOP_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_SERVICE_REVISION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_FIX_CRITERIA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_NI_USER_RESPONSE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_UTC_TIME_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_ENGINE_LOCK_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_ENGINE_LOCK_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_SBAS_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_SBAS_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_NMEA_TYPES_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_NMEA_TYPES_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_LOW_POWER_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_LOW_POWER_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_SERVER_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_SERVER_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_DELETE_ASSIST_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_XTRA_T_SESSION_CONTROL_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_XTRA_T_SESSION_CONTROL_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_WIFI_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_NOTIFY_WIFI_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_REGISTERED_EVENTS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_OPERATION_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_OPERATION_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_SPI_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_SENSOR_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_TIME_SYNC_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_CRADLE_MOUNT_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_CRADLE_MOUNT_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_EXTERNAL_POWER_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_EXTERNAL_POWER_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_SENSOR_CONTROL_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_SENSOR_CONTROL_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_SENSOR_PROPERTIES_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_SENSOR_PROPERTIES_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_SUPL_CERTIFICATE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_DELETE_SUPL_CERTIFICATE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_ADD_CIRCULAR_GEOFENCE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_DELETE_GEOFENCE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_QUERY_GEOFENCE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_EDIT_GEOFENCE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_BEST_AVAILABLE_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_MOTION_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_NI_GEOFENCE_ID_LIST_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_GSM_CELL_INFO_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_PEDOMETER_REPORT_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_WCDMA_CELL_INFO_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_TDSCDMA_CELL_INFO_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_SUBSCRIBER_ID_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_BATCH_SIZE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_START_BATCHING_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_READ_FROM_BATCH_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_STOP_BATCHING_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_RELEASE_BATCH_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_WIFI_AP_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_AVAILABLE_WWAN_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_XTRA_VERSION_CHECK_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_ADD_GEOFENCE_CONTEXT_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_DELETE_GEOFENCE_CONTEXT_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GDT_UPLOAD_END_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_START_DBT_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_STOP_DBT_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SECURE_GET_AVAILABLE_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_TIME_ZONE_INFO_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_APCACHE_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_APDONOTCACHE_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_QUERY_AON_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GTP_AP_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GDT_DOWNLOAD_READY_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GDT_RECEIVE_DONE_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GDT_DOWNLOAD_END_STATUS_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_DELETE_GNSS_SERVICE_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_XTRA_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_XTRA_PCID_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_SUPPORTED_FEATURE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_INTERNAL_STATUS_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_SRN_AP_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_QUERY_XTRA_INFO_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_START_OUTDOOR_TRIP_BATCHING_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_FDCL_BS_LIST_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_FDCL_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_BLACKLIST_SV_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_BLACKLIST_SV_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_CONSTELLATION_CONTROL_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_REGISTER_MASTER_CLIENT_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_START_LISTEN_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_STOP_LISTEN_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SYSTEM_INFO_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_CONSTELLATION_CONTROL_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_TEST_POSITION_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_BS_OBS_DATA_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_CONSTRAINED_TUNC_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_PLATFORM_POWER_STATE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_ROBUST_LOCATION_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_ROBUST_LOCATION_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_INJECT_ENV_AIDING_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_PARAMETER_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_PARAMETER_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_STATISTICS_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_STATISTICS_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_GNSS_PDR_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_GNSS_PDR_MODE_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_MAG_CAL_STATE_PDR_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_SET_MULTIBAND_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7},
+ {QMI_LOC_GET_MULTIBAND_CONFIG_RESP_V02, QMI_IDL_TYPE16(0, 1), 7}
+};
+
+static const qmi_idl_service_message_table_entry loc_service_indication_messages_v02[] = {
+ {QMI_LOC_EVENT_POSITION_REPORT_IND_V02, QMI_IDL_TYPE16(0, 7), 2488},
+ {QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02, QMI_IDL_TYPE16(0, 8), 9476},
+ {QMI_LOC_EVENT_NMEA_IND_V02, QMI_IDL_TYPE16(0, 9), 4301},
+ {QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02, QMI_IDL_TYPE16(0, 10), 1342},
+ {QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02, QMI_IDL_TYPE16(0, 11), 776},
+ {QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02, QMI_IDL_TYPE16(0, 12), 808},
+ {QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02, QMI_IDL_TYPE16(0, 13), 40},
+ {QMI_LOC_EVENT_ENGINE_STATE_IND_V02, QMI_IDL_TYPE16(0, 14), 7},
+ {QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02, QMI_IDL_TYPE16(0, 15), 11},
+ {QMI_LOC_EVENT_WIFI_REQ_IND_V02, QMI_IDL_TYPE16(0, 16), 16},
+ {QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_IND_V02, QMI_IDL_TYPE16(0, 17), 48},
+ {QMI_LOC_EVENT_TIME_SYNC_REQ_IND_V02, QMI_IDL_TYPE16(0, 18), 7},
+ {QMI_LOC_EVENT_SET_SPI_STREAMING_REPORT_IND_V02, QMI_IDL_TYPE16(0, 19), 4},
+ {QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02, QMI_IDL_TYPE16(0, 20), 46},
+ {QMI_LOC_GET_SERVICE_REVISION_IND_V02, QMI_IDL_TYPE16(0, 35), 532},
+ {QMI_LOC_GET_FIX_CRITERIA_IND_V02, QMI_IDL_TYPE16(0, 37), 135},
+ {QMI_LOC_NI_USER_RESPONSE_IND_V02, QMI_IDL_TYPE16(0, 39), 7},
+ {QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02, QMI_IDL_TYPE16(0, 41), 12},
+ {QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_IND_V02, QMI_IDL_TYPE16(0, 43), 790},
+ {QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_IND_V02, QMI_IDL_TYPE16(0, 45), 20},
+ {QMI_LOC_INJECT_UTC_TIME_IND_V02, QMI_IDL_TYPE16(0, 47), 7},
+ {QMI_LOC_INJECT_POSITION_IND_V02, QMI_IDL_TYPE16(0, 49), 7},
+ {QMI_LOC_SET_ENGINE_LOCK_IND_V02, QMI_IDL_TYPE16(0, 51), 7},
+ {QMI_LOC_GET_ENGINE_LOCK_IND_V02, QMI_IDL_TYPE16(0, 53), 32},
+ {QMI_LOC_SET_SBAS_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 55), 7},
+ {QMI_LOC_GET_SBAS_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 57), 11},
+ {QMI_LOC_SET_NMEA_TYPES_IND_V02, QMI_IDL_TYPE16(0, 59), 7},
+ {QMI_LOC_GET_NMEA_TYPES_IND_V02, QMI_IDL_TYPE16(0, 61), 14},
+ {QMI_LOC_SET_LOW_POWER_MODE_IND_V02, QMI_IDL_TYPE16(0, 63), 7},
+ {QMI_LOC_GET_LOW_POWER_MODE_IND_V02, QMI_IDL_TYPE16(0, 65), 11},
+ {QMI_LOC_SET_SERVER_IND_V02, QMI_IDL_TYPE16(0, 67), 7},
+ {QMI_LOC_GET_SERVER_IND_V02, QMI_IDL_TYPE16(0, 69), 304},
+ {QMI_LOC_DELETE_ASSIST_DATA_IND_V02, QMI_IDL_TYPE16(0, 71), 7},
+ {QMI_LOC_SET_XTRA_T_SESSION_CONTROL_IND_V02, QMI_IDL_TYPE16(0, 73), 7},
+ {QMI_LOC_GET_XTRA_T_SESSION_CONTROL_IND_V02, QMI_IDL_TYPE16(0, 75), 11},
+ {QMI_LOC_INJECT_WIFI_POSITION_IND_V02, QMI_IDL_TYPE16(0, 77), 7},
+ {QMI_LOC_NOTIFY_WIFI_STATUS_IND_V02, QMI_IDL_TYPE16(0, 79), 7},
+ {QMI_LOC_GET_REGISTERED_EVENTS_IND_V02, QMI_IDL_TYPE16(0, 81), 18},
+ {QMI_LOC_SET_OPERATION_MODE_IND_V02, QMI_IDL_TYPE16(0, 83), 7},
+ {QMI_LOC_GET_OPERATION_MODE_IND_V02, QMI_IDL_TYPE16(0, 85), 14},
+ {QMI_LOC_SET_SPI_STATUS_IND_V02, QMI_IDL_TYPE16(0, 87), 7},
+ {QMI_LOC_INJECT_SENSOR_DATA_IND_V02, QMI_IDL_TYPE16(0, 89), 34},
+ {QMI_LOC_INJECT_TIME_SYNC_DATA_IND_V02, QMI_IDL_TYPE16(0, 91), 7},
+ {QMI_LOC_SET_CRADLE_MOUNT_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 95), 7},
+ {QMI_LOC_GET_CRADLE_MOUNT_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 93), 18},
+ {QMI_LOC_SET_EXTERNAL_POWER_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 99), 7},
+ {QMI_LOC_GET_EXTERNAL_POWER_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 97), 14},
+ {QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02, QMI_IDL_TYPE16(0, 101), 7},
+ {QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02, QMI_IDL_TYPE16(0, 103), 18},
+ {QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_IND_V02, QMI_IDL_TYPE16(0, 105), 93},
+ {QMI_LOC_SET_SENSOR_CONTROL_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 107), 7},
+ {QMI_LOC_GET_SENSOR_CONTROL_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 109), 21},
+ {QMI_LOC_SET_SENSOR_PROPERTIES_IND_V02, QMI_IDL_TYPE16(0, 111), 14},
+ {QMI_LOC_GET_SENSOR_PROPERTIES_IND_V02, QMI_IDL_TYPE16(0, 113), 95},
+ {QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02, QMI_IDL_TYPE16(0, 115), 14},
+ {QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02, QMI_IDL_TYPE16(0, 117), 49},
+ {QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02, QMI_IDL_TYPE16(0, 119), 7},
+ {QMI_LOC_DELETE_SUPL_CERTIFICATE_IND_V02, QMI_IDL_TYPE16(0, 121), 7},
+ {QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02, QMI_IDL_TYPE16(0, 123), 14},
+ {QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02, QMI_IDL_TYPE16(0, 125), 23},
+ {QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 21), 14},
+ {QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02, QMI_IDL_TYPE16(0, 22), 7},
+ {QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 23), 85},
+ {QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02, QMI_IDL_TYPE16(0, 127), 21},
+ {QMI_LOC_DELETE_GEOFENCE_IND_V02, QMI_IDL_TYPE16(0, 129), 21},
+ {QMI_LOC_QUERY_GEOFENCE_IND_V02, QMI_IDL_TYPE16(0, 131), 65},
+ {QMI_LOC_EDIT_GEOFENCE_IND_V02, QMI_IDL_TYPE16(0, 137), 28},
+ {QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02, QMI_IDL_TYPE16(0, 142), 2193},
+ {QMI_LOC_INJECT_MOTION_DATA_IND_V02, QMI_IDL_TYPE16(0, 144), 7},
+ {QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02, QMI_IDL_TYPE16(0, 146), 82},
+ {QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02, QMI_IDL_TYPE16(0, 148), 7},
+ {QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02, QMI_IDL_TYPE16(0, 156), 7},
+ {QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 158), 7},
+ {QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02, QMI_IDL_TYPE16(0, 24), 15},
+ {QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02, QMI_IDL_TYPE16(0, 25), 4},
+ {QMI_LOC_PEDOMETER_REPORT_IND_V02, QMI_IDL_TYPE16(0, 160), 7},
+ {QMI_LOC_INJECT_WCDMA_CELL_INFO_IND_V02, QMI_IDL_TYPE16(0, 150), 7},
+ {QMI_LOC_INJECT_TDSCDMA_CELL_INFO_IND_V02, QMI_IDL_TYPE16(0, 152), 7},
+ {QMI_LOC_INJECT_SUBSCRIBER_ID_IND_V02, QMI_IDL_TYPE16(0, 154), 7},
+ {QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 133), 14},
+ {QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 135), 39},
+ {QMI_LOC_GET_BATCH_SIZE_IND_V02, QMI_IDL_TYPE16(0, 162), 21},
+ {QMI_LOC_START_BATCHING_IND_V02, QMI_IDL_TYPE16(0, 164), 14},
+ {QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 165), 28},
+ {QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02, QMI_IDL_TYPE16(0, 166), 90},
+ {QMI_LOC_READ_FROM_BATCH_IND_V02, QMI_IDL_TYPE16(0, 168), 460},
+ {QMI_LOC_STOP_BATCHING_IND_V02, QMI_IDL_TYPE16(0, 170), 21},
+ {QMI_LOC_RELEASE_BATCH_IND_V02, QMI_IDL_TYPE16(0, 172), 14},
+ {QMI_LOC_EVENT_INJECT_WIFI_AP_DATA_REQ_IND_V02, QMI_IDL_TYPE16(0, 173), 4},
+ {QMI_LOC_INJECT_WIFI_AP_DATA_IND_V02, QMI_IDL_TYPE16(0, 175), 7},
+ {QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_IND_V02, QMI_IDL_TYPE16(0, 177), 7},
+ {QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_IND_V02, QMI_IDL_TYPE16(0, 179), 7},
+ {QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 26), 3045},
+ {QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_IND_V02, QMI_IDL_TYPE16(0, 180), 12},
+ {QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_IND_V02, QMI_IDL_TYPE16(0, 182), 7},
+ {QMI_LOC_GET_AVAILABLE_WWAN_POSITION_IND_V02, QMI_IDL_TYPE16(0, 184), 145},
+ {QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 186), 7},
+ {QMI_LOC_SET_XTRA_VERSION_CHECK_IND_V02, QMI_IDL_TYPE16(0, 188), 7},
+ {QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02, QMI_IDL_TYPE16(0, 191), 3151},
+ {QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02, QMI_IDL_TYPE16(0, 192), 441},
+ {QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 190), 7},
+ {QMI_LOC_ADD_GEOFENCE_CONTEXT_IND_V02, QMI_IDL_TYPE16(0, 194), 28},
+ {QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_IND_V02, QMI_IDL_TYPE16(0, 196), 14},
+ {QMI_LOC_DELETE_GEOFENCE_CONTEXT_IND_V02, QMI_IDL_TYPE16(0, 198), 28},
+ {QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 27), 21},
+ {QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_IND_V02, QMI_IDL_TYPE16(0, 200), 7},
+ {QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_IND_V02, QMI_IDL_TYPE16(0, 202), 7},
+ {QMI_LOC_GDT_UPLOAD_END_IND_V02, QMI_IDL_TYPE16(0, 204), 7},
+ {QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_IND_V02, QMI_IDL_TYPE16(0, 29), 273},
+ {QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_IND_V02, QMI_IDL_TYPE16(0, 30), 21},
+ {QMI_LOC_START_DBT_IND_V02, QMI_IDL_TYPE16(0, 216), 11},
+ {QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02, QMI_IDL_TYPE16(0, 219), 2074},
+ {QMI_LOC_EVENT_DBT_SESSION_STATUS_IND_V02, QMI_IDL_TYPE16(0, 220), 11},
+ {QMI_LOC_STOP_DBT_IND_V02, QMI_IDL_TYPE16(0, 218), 11},
+ {QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_V02, QMI_IDL_TYPE16(0, 222), 1043},
+ {QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 28), 3038},
+ {QMI_LOC_EVENT_GET_TIME_ZONE_INFO_IND_V02, QMI_IDL_TYPE16(0, 138), 7},
+ {QMI_LOC_INJECT_TIME_ZONE_INFO_IND_V02, QMI_IDL_TYPE16(0, 140), 7},
+ {QMI_LOC_INJECT_APCACHE_DATA_IND_V02, QMI_IDL_TYPE16(0, 224), 70},
+ {QMI_LOC_INJECT_APDONOTCACHE_DATA_IND_V02, QMI_IDL_TYPE16(0, 226), 7},
+ {QMI_LOC_EVENT_BATCHING_STATUS_IND_V02, QMI_IDL_TYPE16(0, 227), 7},
+ {QMI_LOC_QUERY_AON_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 229), 21},
+ {QMI_LOC_GTP_AP_STATUS_IND_V02, QMI_IDL_TYPE16(0, 206), 18},
+ {QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_IND_V02, QMI_IDL_TYPE16(0, 208), 7},
+ {QMI_LOC_GDT_DOWNLOAD_READY_STATUS_IND_V02, QMI_IDL_TYPE16(0, 210), 7},
+ {QMI_LOC_GDT_RECEIVE_DONE_STATUS_IND_V02, QMI_IDL_TYPE16(0, 212), 7},
+ {QMI_LOC_GDT_DOWNLOAD_END_STATUS_IND_V02, QMI_IDL_TYPE16(0, 214), 7},
+ {QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02, QMI_IDL_TYPE16(0, 31), 5811},
+ {QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02, QMI_IDL_TYPE16(0, 32), 21},
+ {QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02, QMI_IDL_TYPE16(0, 33), 21},
+ {QMI_LOC_DELETE_GNSS_SERVICE_DATA_IND_V02, QMI_IDL_TYPE16(0, 231), 7},
+ {QMI_LOC_INJECT_XTRA_DATA_IND_V02, QMI_IDL_TYPE16(0, 233), 23},
+ {QMI_LOC_INJECT_XTRA_PCID_IND_V02, QMI_IDL_TYPE16(0, 235), 7},
+ {QMI_LOC_GET_SUPPORTED_FEATURE_IND_V02, QMI_IDL_TYPE16(0, 237), 122},
+ {QMI_LOC_SET_INTERNAL_STATUS_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 239), 7},
+ {QMI_LOC_EVENT_INTERNAL_STATUS_REPORT_IND_V02, QMI_IDL_TYPE16(0, 240), 3756},
+ {QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_IND_V02, QMI_IDL_TYPE16(0, 241), 22},
+ {QMI_LOC_INJECT_SRN_AP_DATA_IND_V02, QMI_IDL_TYPE16(0, 243), 7},
+ {QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_IND_V02, QMI_IDL_TYPE16(0, 245), 540},
+ {QMI_LOC_QUERY_XTRA_INFO_IND_V02, QMI_IDL_TYPE16(0, 248), 1574},
+ {QMI_LOC_START_OUTDOOR_TRIP_BATCHING_IND_V02, QMI_IDL_TYPE16(0, 250), 7},
+ {QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_IND_V02, QMI_IDL_TYPE16(0, 252), 21},
+ {QMI_LOC_EVENT_FDCL_SERVICE_REQ_IND_V02, QMI_IDL_TYPE16(0, 253), 618},
+ {QMI_LOC_GET_FDCL_BS_LIST_IND_V02, QMI_IDL_TYPE16(0, 255), 2456},
+ {QMI_LOC_INJECT_FDCL_DATA_IND_V02, QMI_IDL_TYPE16(0, 257), 272},
+ {QMI_LOC_SET_BLACKLIST_SV_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_GET_BLACKLIST_SV_IND_V02, QMI_IDL_TYPE16(0, 259), 73},
+ {QMI_LOC_SET_CONSTELLATION_CONTROL_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_DC_REPORT_IND_V02, QMI_IDL_TYPE16(0, 261), 80},
+ {QMI_LOC_REGISTER_MASTER_CLIENT_IND_V02, QMI_IDL_TYPE16(0, 263), 7},
+ {QMI_LOC_EVENT_ENGINE_LOCK_STATE_IND_V02, QMI_IDL_TYPE16(0, 264), 25},
+ {QMI_LOC_SYSTEM_INFO_IND_V02, QMI_IDL_TYPE16(0, 268), 28},
+ {QMI_LOC_GET_CONSTELLATION_CONTROL_IND_V02, QMI_IDL_TYPE16(0, 269), 49},
+ {QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02, QMI_IDL_TYPE16(0, 7), 2488},
+ {QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_IND_V02, QMI_IDL_TYPE16(0, 271), 14},
+ {QMI_LOC_INJECT_TEST_POSITION_IND_V02, QMI_IDL_TYPE16(0, 273), 7},
+ {QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02, QMI_IDL_TYPE16(0, 274), 5},
+ {QMI_LOC_GET_BS_OBS_DATA_IND_V02, QMI_IDL_TYPE16(0, 276), 10015},
+ {QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02, QMI_IDL_TYPE16(0, 277), 1425},
+ {QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02, QMI_IDL_TYPE16(0, 278), 897},
+ {QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02, QMI_IDL_TYPE16(0, 279), 1457},
+ {QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02, QMI_IDL_TYPE16(0, 280), 1481},
+ {QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02, QMI_IDL_TYPE16(0, 281), 1425},
+ {QMI_LOC_SET_CONSTRAINED_TUNC_MODE_IND_V02, QMI_IDL_TYPE16(0, 283), 7},
+ {QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_IND_V02, QMI_IDL_TYPE16(0, 285), 7},
+ {QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_IND_V02, QMI_IDL_TYPE16(0, 287), 22},
+ {QMI_LOC_EVENT_REPORT_IND_V02, QMI_IDL_TYPE16(0, 288), 97},
+ {QMI_LOC_GET_BAND_MEASUREMENT_METRICS_IND_V02, QMI_IDL_TYPE16(0, 289), 124},
+ {QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02, QMI_IDL_TYPE16(0, 290), 66},
+ {QMI_LOC_INJECT_PLATFORM_POWER_STATE_IND_V02, QMI_IDL_TYPE16(0, 292), 7},
+ {QMI_LOC_SET_ROBUST_LOCATION_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_GET_ROBUST_LOCATION_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 294), 21},
+ {QMI_LOC_INJECT_ENV_AIDING_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_IND_V02, QMI_IDL_TYPE16(0, 297), 12},
+ {QMI_LOC_EVENT_QUERY_XTRA_INFO_REQ_IND_V02, QMI_IDL_TYPE16(0, 299), 0},
+ {QMI_LOC_SET_PARAMETER_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_GET_PARAMETER_IND_V02, QMI_IDL_TYPE16(0, 302), 18},
+ {QMI_LOC_SET_STATISTICS_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_GET_STATISTICS_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 304), 18},
+ {QMI_LOC_GNSS_STATISTICS_REPORT_IND_V02, QMI_IDL_TYPE16(0, 305), 161},
+ {QMI_LOC_SET_GNSS_PDR_MODE_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_GET_GNSS_PDR_MODE_IND_V02, QMI_IDL_TYPE16(0, 307), 14},
+ {QMI_LOC_GET_MAG_CAL_STATE_PDR_IND_V02, QMI_IDL_TYPE16(0, 308), 11},
+ {QMI_LOC_EVENT_SAP_INS_PARAMETERS_IND_V02, QMI_IDL_TYPE16(0, 298), 5590},
+ {QMI_LOC_SET_MULTIBAND_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 2), 7},
+ {QMI_LOC_GET_MULTIBAND_CONFIG_IND_V02, QMI_IDL_TYPE16(0, 310), 18},
+ {QMI_LOC_LATENCY_INFORMATION_IND_V02, QMI_IDL_TYPE16(0, 311), 124}
+};
+
+/*Service Object*/
+struct qmi_idl_service_object loc_qmi_idl_service_object_v02 = {
+ 0x06,
+ 0x02,
+ 0x10,
+ 10015,
+ { sizeof(loc_service_command_messages_v02)/sizeof(qmi_idl_service_message_table_entry),
+ sizeof(loc_service_response_messages_v02)/sizeof(qmi_idl_service_message_table_entry),
+ sizeof(loc_service_indication_messages_v02)/sizeof(qmi_idl_service_message_table_entry) },
+ { loc_service_command_messages_v02, loc_service_response_messages_v02, loc_service_indication_messages_v02},
+ &loc_qmi_idl_type_table_object_v02,
+ 0x86,
+ NULL
+};
+
+/* Service Object Accessor */
+qmi_idl_service_object_type loc_get_service_object_internal_v02
+ ( int32_t idl_maj_version, int32_t idl_min_version, int32_t library_version ){
+ if ( LOC_V02_IDL_MAJOR_VERS != idl_maj_version || LOC_V02_IDL_MINOR_VERS != idl_min_version
+ || LOC_V02_IDL_TOOL_VERS != library_version)
+ {
+ return NULL;
+ }
+ return (qmi_idl_service_object_type)&loc_qmi_idl_service_object_v02;
+}
+
diff --git a/location/loc_api/loc_api_v02/location_service_v02.h b/location/loc_api/loc_api_v02/location_service_v02.h
new file mode 100644
index 0000000..d14b422
--- /dev/null
+++ b/location/loc_api/loc_api_v02/location_service_v02.h
@@ -0,0 +1,23602 @@
+/* Copyright (c) 2011-2020, 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_SERVICE_02_H
+#define LOC_SERVICE_02_H
+/**
+ @file location_service_v02.h
+
+ @brief This is the public header file which defines the loc service Data structures.
+
+ This header file defines the types and structures that were defined in
+ loc. It contains the constant values defined, enums, structures,
+ messages, and service message IDs (in that order) Structures that were
+ defined in the IDL as messages contain mandatory elements, optional
+ elements, a combination of mandatory and optional elements (mandatory
+ always come before optionals in the structure), or nothing (null message)
+
+ An optional element in a message is preceded by a uint8_t value that must be
+ set to true if the element is going to be included. When decoding a received
+ message, the uint8_t values will be set to true or false by the decode
+ routine, and should be checked before accessing the values that they
+ correspond to.
+
+ Variable sized arrays are defined as static sized arrays with an unsigned
+ integer (32 bit) preceding it that must be set to the number of elements
+ in the array that are valid. For Example:
+
+ uint32_t test_opaque_len;
+ uint8_t test_opaque[16];
+
+ If only 4 elements are added to test_opaque[] then test_opaque_len must be
+ set to 4 before sending the message. When decoding, the _len value is set
+ by the decode routine and should be checked so that the correct number of
+ elements in the array will be accessed.
+
+*/
+/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*
+ *THIS IS AN AUTO GENERATED FILE. DO NOT ALTER IN ANY WAY
+ *====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
+
+/* This file was generated with Tool version 6.14.7
+ It was generated on: Thu Oct 29 2020 (Spin 0)
+ From IDL File: location_service_v02.idl */
+
+/** @defgroup loc_qmi_consts Constant values defined in the IDL */
+/** @defgroup loc_qmi_msg_ids Constant values for QMI message IDs */
+/** @defgroup loc_qmi_enums Enumerated types used in QMI messages */
+/** @defgroup loc_qmi_messages Structures sent as QMI messages */
+/** @defgroup loc_qmi_aggregates Aggregate types used in QMI messages */
+/** @defgroup loc_qmi_accessor Accessor for QMI service object */
+/** @defgroup loc_qmi_version Constant values for versioning information */
+
+#include <stdint.h>
+#include "qmi_idl_lib.h"
+#include "common_v01.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup loc_qmi_version
+ @{
+ */
+/** Major Version Number of the IDL used to generate this file */
+#define LOC_V02_IDL_MAJOR_VERS 0x02
+/** Revision Number of the IDL used to generate this file */
+#define LOC_V02_IDL_MINOR_VERS 0x86
+/** Major Version Number of the qmi_idl_compiler used to generate this file */
+#define LOC_V02_IDL_TOOL_VERS 0x06
+/** Maximum Defined Message ID */
+#define LOC_V02_MAX_MESSAGE_ID 0x00E2
+/**
+ @}
+ */
+
+
+/** @addtogroup loc_qmi_consts
+ @{
+ */
+
+/** Maximum string length for the client string ID */
+#define QMI_LOC_MAX_CLIENT_ID_STRING_LENGTH_V02 4
+
+/** Maximum string length for the provider field in the application ID.\n */
+#define QMI_LOC_MAX_APP_ID_PROVIDER_LENGTH_V02 24
+
+/** Maximum string length for the name field in the application ID. \n */
+#define QMI_LOC_MAX_APP_ID_NAME_LENGTH_V02 32
+
+/** Maximum string length for the version field in the application ID. */
+#define QMI_LOC_MAX_APP_ID_VERSION_LENGTH_V02 8
+
+/** Maximum length of the list containing the SVs that were used to generate
+ a position report. */
+#define QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02 80
+
+/** Maximum expanded length of the list containing the SVs that were used to generate
+ a position report. */
+#define QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02 176
+
+/** Maximum number of GNSS signal type */
+#define QMI_LOC_MAX_GNSS_SIGNAL_TYPE_V02 19
+
+/** East, North, up array length */
+#define QMI_LOC_ENU_ARRAY_LENGTH_V02 3
+
+/** Maximum length of the list containing station IDs providing DGNSS
+ correction. */
+#define QMI_LOC_DGNSS_STATION_ID_ARRAY_LENGTH_V02 3
+
+/** Maximum length of the list containing the SVs Enviroment Aiding Correction
+ Data to inject. */
+#define QMI_LOC_ENV_AIDING_CORRECTION_MAX_SV_USED_V02 60
+
+/** Maximum number of satellites in the satellite report. */
+#define QMI_LOC_SV_INFO_LIST_MAX_SIZE_V02 80
+
+/** Maximum NMEA string length. */
+#define QMI_LOC_NMEA_STRING_MAX_LENGTH_V02 200
+
+/** Maximum expanded NMEA string length. */
+#define QMI_LOC_EXPANDED_NMEA_STRING_MAX_LENGTH_V02 4095
+
+/** Maximum length of the requestor ID string. */
+#define QMI_LOC_NI_MAX_REQUESTOR_ID_LENGTH_V02 200
+
+/** Session ID byte length. */
+#define QMI_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH_V02 4
+
+/** Maximum client name length allowed. */
+#define QMI_LOC_NI_MAX_CLIENT_NAME_LENGTH_V02 64
+
+/** Maximum URL length accepted by the location engine. */
+#define QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02 255
+
+/** IPv6 address length in bytes. */
+#define QMI_LOC_IPV6_ADDR_LENGTH_V02 8
+
+/** SUPL hash length. */
+#define QMI_LOC_NI_SUPL_HASH_LENGTH_V02 8
+
+/** Maximum client address length allowed. */
+#define QMI_LOC_NI_MAX_EXT_CLIENT_ADDRESS_V02 20
+
+/** Maximum codeword length allowed. */
+#define QMI_LOC_NI_CODEWORD_MAX_LENGTH_V02 20
+
+/** Maximum number of NTP Servers sent out with this event. */
+#define QMI_LOC_MAX_NTP_SERVERS_V02 3
+
+/** Maximum number of predicted orbits servers supported in the location
+ engine. */
+#define QMI_LOC_MAX_PREDICTED_ORBITS_SERVERS_V02 3
+
+/** Maximum length of the list, where each element of the list contains the
+ continuous range of Geofences that were breached at a given position. */
+#define QMI_LOC_MAX_GEOFENCE_ID_CONTINUOUS_LIST_LENGTH_V02 80
+
+/** Maximum length of the list that contains a discrete number Geofences that
+ were breached at a given position. */
+#define QMI_LOC_MAX_GEOFENCE_ID_DISCRETE_LIST_LENGTH_V02 80
+
+/** Maximum length that can be injected. */
+#define QMI_LOC_MAX_GDT_PATH_LEN_V02 255
+
+/** Maximum client information size in bytes. */
+#define QMI_LOC_MAX_GTP_CL_INFO_LEN_V02 1500
+
+/** Maximum mobile status data size in bytes. */
+#define QMI_LOC_MAX_GTP_MSD_LEN_V02 4000
+
+/** Maximum GNSS Measurement Engine Firmware Version String length. */
+#define QMI_LOC_GNSS_ME_VERSION_STRING_MAX_LENGTH_V02 127
+
+/** Maximum GNSS Measurement Engine Hosted Software Version String length. */
+#define QMI_LOC_GNSS_HOSTED_SW_VERSION_STRING_MAX_LENGTH_V02 127
+
+/** Maximum GNSS Measurement Engine Full Version String length. */
+#define QMI_LOC_GNSS_SW_VERSION_STRING_MAX_LENGTH_V02 255
+
+/** Maximum part length that can be injected. The client
+ also looks at the maxPartSize field in the predicted orbits injection
+ request indication and picks the minimum of the two. */
+#define QMI_LOC_MAX_PREDICTED_ORBITS_PART_LEN_V02 1024
+
+/** Maximum length of the delete SV information list */
+#define QMI_LOC_DELETE_MAX_SV_INFO_LENGTH_V02 128
+
+/** Maximum length of the delete BDS SV information list. */
+#define QMI_LOC_DELETE_MAX_BDS_SV_INFO_LENGTH_V02 37
+
+/** Maximum length of the delete GAL SV information list. */
+#define QMI_LOC_DELETE_MAX_GAL_SV_INFO_LENGTH_V02 36
+
+/** MAC address length in bytes. */
+#define QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02 6
+
+/** Wi-Fi SSID string maximum length. */
+#define QMI_LOC_MAX_WIFI_AP_SSID_STR_LENGTH_V02 32
+
+/** Maximum number of APs that the sender can report. */
+#define QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02 50
+
+/** Maximum number of samples that can be injected in a TLV. */
+#define QMI_LOC_SENSOR_DATA_MAX_SAMPLES_V02 50
+
+/** Maximum APN string length allowed. */
+#define QMI_LOC_MAX_APN_NAME_LENGTH_V02 100
+
+/** Maximum APN profiles supported. */
+#define QMI_LOC_MAX_APN_PROFILES_V02 6
+
+/** Maximum length of the SUPL certificate. */
+#define QMI_LOC_MAX_SUPL_CERT_LENGTH_V02 2000
+
+/** Maximum number of motion states used by the Geofence engine. */
+#define QMI_LOC_GEOFENCE_MAX_MOTION_STATES_V02 20
+
+/** Maximum length of the network-initiated Geofence ID
+ list. */
+#define QMI_LOC_MAX_NI_GEOFENCE_ID_LIST_LENGTH_V02 16
+
+/** Maximum value of WDMA frequency for injection of WCDMA cell
+ information. */
+#define QMI_LOC_MAX_WCDMA_FREQ_V02 16383
+
+/** Maximum value of PSC for injection of WCDMA cell information. */
+#define QMI_LOC_MAX_WCDMA_PSC_V02 511
+
+/** Maximum value of TDSCDMA frequency for injection of TDSCDMA cell
+ information. */
+#define QMI_LOC_MAX_TDSCDMA_FREQ_V02 16383
+
+/** Maximum length of the injected network-initiated message. */
+#define QMI_LOC_MAX_INJECTED_NETWORK_INITIATED_MESSAGE_LENGTH_V02 1024
+
+/** Maximum number of entries returned from a batch in each indication. */
+#define QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02 5
+
+/** Maximum number of vehicle sensor samples that can be injected. */
+#define QMI_LOC_VEHICLE_SENSOR_DATA_MAX_SAMPLES_V02 65
+
+/** Maximum number of axes that can be provided in each sample. */
+#define QMI_LOC_VEHICLE_SENSOR_DATA_MAX_AXES_V02 3
+
+/** Maximum number of measurements from an odometer. */
+#define QMI_LOC_VEHICLE_ODOMETRY_MAX_MEASUREMENTS_V02 3
+#define QMI_LOC_MEAS_STATUS_DONT_USE_BITS_V02 0xFFC0000000000000
+
+/** Maximum number of satellites in a measurement block for a specified system. */
+#define QMI_LOC_SV_MEAS_LIST_MAX_SIZE_V02 16
+
+/** Maximum number of satellites in a extended measurement block. */
+#define QMI_LOC_EXT_SV_MEAS_LIST_MAX_SIZE_V02 8
+
+/** Maximum length of the Other Code Type Name string, when the code used for the measurement is other. */
+#define QMI_LOC_SV_MEAS_OTHER_CODE_TYPE_NAME_MAX_LEN_V02 8
+
+/** Maximum number of satellites for which DGNSS corrections are provided. */
+#define QMI_LOC_DGNSS_SV_MEAS_LIST_MAX_SIZE_V02 24
+#define QMI_LOC_SV_POLY_VELOCITY_COEF_SIZE_V02 12
+#define QMI_LOC_SV_POLY_XYZ_0_TH_ORDER_COEFF_SIZE_V02 3
+#define QMI_LOC_SV_POLY_XYZ_N_TH_ORDER_COEFF_SIZE_V02 9
+#define QMI_LOC_SV_POLY_SV_CLKBIAS_COEFF_SIZE_V02 4
+
+/** IBeacon string maximum length. */
+#define QMI_LOC_MAX_IBEACON_UUID_STR_LENGTH_V02 32
+
+/** Wi-Fi area ID list length. */
+#define QMI_LOC_WIFI_AREA_ID_LIST_LENGTH_V02 20
+
+/** Cell ID list length. */
+#define QMI_LOC_CELL_ID_LIST_LENGTH_V02 20
+
+/** IBeacon list length. */
+#define QMI_LOC_IBEACON_LIST_LENGTH_V02 20
+
+/** Maximum length that can be injected. */
+#define QMI_LOC_MAX_GTP_WWAN_CLIENT_DOWNLOADED_DATA_LEN_V02 512
+
+/** Maximum length of the OEM ID. */
+#define QMI_LOC_MAX_OEM_ID_LEN_V02 256
+
+/** Maximum length of the model ID. */
+#define QMI_LOC_MAX_MODEL_ID_LEN_V02 256
+
+/** Maximum length that can be injected. */
+#define QMI_LOC_MAX_GTP_RLI_LEN_V02 256
+
+/** Maximum buffer length of the encrypted data blob for the QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ request. */
+#define QMI_LOC_SECURE_GET_AVAILABLE_POS_REQUEST_ENCRYPTED_MAX_V02 256
+
+/** Horizontal uncertainty circular
+ Altitude With respect to ellipsoid
+ Vertical uncertainty
+ Horizontal elliptical uncertainty (semi-minor axis)
+ Horizontal elliptical uncertainty (semi-major axis)
+ Elliptical horizontal uncertainty azimuth
+ Horizontal confidence
+ Horizontal Elliptical Uncertainty Confidence
+ Horizontal Reliability
+ Horizontal Speed
+ Horizontal Speed Uncertainty
+ Altitude with respect to sea level
+ Vertical confidence
+ Vertical Reliability
+ Vertical speed
+ Vertical speed uncertainty
+ Heading
+ Heading uncertainty
+ Magnetic Deviation
+ Technology used
+ Position dilution of precision
+ Horizontal dilution of precision
+ Vertical dilution of precision
+ GPS week
+ GPS time of week MS
+ Time source
+ Sensor data usage MASK
+ Position Data aided by sensor
+ SVs used to calculate the fix
+ Time dilution of precision
+ Geometrical dilution of precision */
+#define QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_ENCRYPTED_MAX_V02 1024
+
+/** Maximum number of APs that can be injected in a TLV. */
+#define QMI_LOC_APCACHE_DATA_MAX_SAMPLES_V02 80
+
+/** Maximum part length that can be injected. The client should
+ also look at the maxPartSize field in the predicted orbits injection
+ request indication and pick the minimum of the two. */
+#define QMI_LOC_MAX_XTRA_PART_LEN_V02 1024
+#define QMI_LOC_SUPPORTED_FEATURE_LENGTH_V02 100
+
+/** The location service internal status report data length in bytes */
+#define QMI_LOC_INTERNAL_STATUS_REPORT_DATA_LENGTH_V02 56
+
+/** The maximum size of the internal status report list */
+#define QMI_LOC_INTERNAL_STATUS_MAX_LIST_SIZE_V02 67
+
+/** Maximum number of APs that the sender can report. */
+#define QMI_LOC_SRN_MAX_REPORTED_APS_PER_MSG_V02 64
+
+/** MAC address length in bytes. */
+#define QMI_LOC_SRN_MAC_ADDR_LENGTH_V02 6
+#define QMI_LOC_MAX_WIFI_CROWDSOURCING_SERVER_CONFIG_LEN_V02 512
+#define QMI_LOC_MAX_CROWDSOURCING_MODEM_CLIENT_INFO_LEN_V02 512
+
+/** Maximum number of BS info in the BS list.
+ */
+#define QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02 100
+
+/** FDCL cell-position list length. */
+#define QMI_LOC_FDCL_CELL_POS_LIST_LENGTH_V02 20
+#define QMI_LOC_INJECT_FDCL_DATA_ERROR_MSG_LEN_V02 255
+
+/** Maximum length of Disaster & Crisis report in bits */
+#define QMI_LOC_MAX_DCREPORT_LEN_BITS_V02 512
+
+/** Maximum length of Disaster & Crisis report. Corresponds to 512 bits of storage */
+#define QMI_LOC_MAX_DCREPORT_LEN_V02 64
+
+/** Maximum number of satellites in an ephemeris report. */
+#define QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02 8
+
+/** */
+#define QMI_LOC_DEFAULT_CONSTRAINED_TUNC_MS_V02 9.5
+
+/** Maximum string length for the requestor string ID */
+#define QMI_LOC_MAX_REQUESTOR_ID_STRING_LENGTH_V02 20
+
+/** Number of filter element size seventeen. */
+#define QMI_LOC_FILTER_ELEMENT_SIZE_SEVENTEEN_V02 17
+
+/** Number of filter element size six. */
+#define QMI_LOC_FILTER_ELEMENT_SIZE_SIX_V02 6
+
+/** Number of filter element size three. */
+#define QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02 3
+
+/** Number of filter element size four. */
+#define QMI_LOC_FILTER_ELEMENT_SIZE_FOUR_V02 4
+
+/** Number of IPM element size three. */
+#define QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02 3
+
+/** Number of IPM element size nine. */
+#define QMI_LOC_IPM_ELEMENT_SIZE_NINE_V02 9
+
+/** Number of INS element size three. */
+#define QMI_LOC_INS_ELEMENT_SIZE_THREE_V02 3
+
+/** Number of INS element size two. */
+#define QMI_LOC_INS_ELEMENT_SIZE_TWO_V02 2
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SUCCESS_V02 = 0, /**< Request was completed successfully \n */
+ eQMI_LOC_GENERAL_FAILURE_V02 = 1, /**< Request failed because of a general failure \n */
+ eQMI_LOC_UNSUPPORTED_V02 = 2, /**< Request failed because it is not supported \n */
+ eQMI_LOC_INVALID_PARAMETER_V02 = 3, /**< Request failed because it contained invalid parameters \n */
+ eQMI_LOC_ENGINE_BUSY_V02 = 4, /**< Request failed because the engine is busy \n */
+ eQMI_LOC_PHONE_OFFLINE_V02 = 5, /**< Request failed because the phone is offline \n */
+ eQMI_LOC_TIMEOUT_V02 = 6, /**< Request failed because it has timed out \n */
+ eQMI_LOC_CONFIG_NOT_SUPPORTED_V02 = 7, /**< Request failed because an undefined configuration was requested \n */
+ eQMI_LOC_INSUFFICIENT_MEMORY_V02 = 8, /**< Request failed because the engine could not allocate sufficient memory for the request \n */
+ eQMI_LOC_MAX_GEOFENCE_PROGRAMMED_V02 = 9, /**< Request failed because the maximum number of Geofences are already programmed \n */
+ eQMI_LOC_XTRA_VERSION_CHECK_FAILURE_V02 = 10, /**< Location service failed because of an XTRA version-based file format check failure \n */
+ eQMI_LOC_GNSS_DISABLED_V02 = 11, /**< Request failed because the location service is disabled */
+ QMILOCSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Generic response definition. This message is used to tell
+ clients whether their message was accepted for further
+ processing or rejected. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGenReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Response Message; Generic response definition. This message is used to tell
+ clients whether their message was accepted for further
+ processing or rejected. */
+typedef struct {
+
+ /* Mandatory */
+ /* Result Code */
+ qmi_response_type_v01 resp;
+}qmiLocGenRespMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Generic response definition. This message is used to tell
+ clients whether their message was accepted for further
+ processing or rejected. */
+typedef struct {
+
+ /* Mandatory */
+ /* Success / Failure Status of QMI Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocGenReqStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Informs the service of the minor revision of the interface
+ definition that the control point implements. */
+typedef struct {
+
+ /* Mandatory */
+ /* Revision */
+ uint32_t revision;
+ /**< Revision that the control point is using. */
+}qmiLocInformClientRevisionReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocEventRegMaskT_v02;
+#define QMI_LOC_EVENT_MASK_POSITION_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x00000001ull) /**< Position report event indications. \n */
+#define QMI_LOC_EVENT_MASK_GNSS_SV_INFO_V02 ((qmiLocEventRegMaskT_v02)0x00000002ull) /**< Satellite report event indications. These reports are sent at a 1 Hz rate. \n */
+#define QMI_LOC_EVENT_MASK_NMEA_V02 ((qmiLocEventRegMaskT_v02)0x00000004ull) /**< NMEA reports for
+ position and satellites in view. The report is at a 1 Hz rate. \n */
+#define QMI_LOC_EVENT_MASK_NI_NOTIFY_VERIFY_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00000008ull) /**< NI Notify/Verify request event indications. \n */
+#define QMI_LOC_EVENT_MASK_INJECT_TIME_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00000010ull) /**< Time injection request event indications. \n */
+#define QMI_LOC_EVENT_MASK_INJECT_PREDICTED_ORBITS_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00000020ull) /**< Predicted orbits request
+ event indications. \n */
+#define QMI_LOC_EVENT_MASK_INJECT_POSITION_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00000040ull) /**< Position injection request event indications. \n */
+#define QMI_LOC_EVENT_MASK_ENGINE_STATE_V02 ((qmiLocEventRegMaskT_v02)0x00000080ull) /**< Engine state report
+ event indications. \n */
+#define QMI_LOC_EVENT_MASK_FIX_SESSION_STATE_V02 ((qmiLocEventRegMaskT_v02)0x00000100ull) /**< Fix session status report event indications. \n */
+#define QMI_LOC_EVENT_MASK_WIFI_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00000200ull) /**< Wi-Fi position request event indications. \n */
+#define QMI_LOC_EVENT_MASK_SENSOR_STREAMING_READY_STATUS_V02 ((qmiLocEventRegMaskT_v02)0x00000400ull) /**< Notifications from the location engine indicating its readiness to accept data from the
+ sensors (accelerometer, gyroscope, and so on). \n */
+#define QMI_LOC_EVENT_MASK_TIME_SYNC_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00000800ull) /**< Time sync requests
+ from the GPS engine. Time sync enables the GPS engine to synchronize
+ its clock with the sensor processor's clock. \n */
+#define QMI_LOC_EVENT_MASK_SET_SPI_STREAMING_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x00001000ull) /**< Stationary Position Indicator (SPI) streaming report indications. \n */
+#define QMI_LOC_EVENT_MASK_LOCATION_SERVER_CONNECTION_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00002000ull) /**< Location server requests; generated when the service wishes to
+ establish a connection with a location server. \n */
+#define QMI_LOC_EVENT_MASK_NI_GEOFENCE_NOTIFICATION_V02 ((qmiLocEventRegMaskT_v02)0x00004000ull) /**< Notifications related to network-initiated Geofences. These events notify the client
+ when a network-initiated Geofence is added, deleted, or edited. \n */
+#define QMI_LOC_EVENT_MASK_GEOFENCE_GEN_ALERT_V02 ((qmiLocEventRegMaskT_v02)0x00008000ull) /**< Geofence alerts; generated to inform the client of the changes that can
+ affect a Geofence, for example, if GPS is turned off or if the network is
+ unavailable. \n */
+#define QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION_V02 ((qmiLocEventRegMaskT_v02)0x00010000ull) /**< Geofence breach; when a UE enters or leaves the perimeter of a Geofence.
+ This breach report is for a single Geofence. \n */
+#define QMI_LOC_EVENT_MASK_PEDOMETER_CONTROL_V02 ((qmiLocEventRegMaskT_v02)0x00020000ull) /**< Pedometer control requests from the location engine. The location engine sends
+ this event to control the injection of pedometer reports. \n */
+#define QMI_LOC_EVENT_MASK_MOTION_DATA_CONTROL_V02 ((qmiLocEventRegMaskT_v02)0x00040000ull) /**< Motion data control requests from the location engine. The location engine sends
+ this event to control the injection of motion data. \n */
+#define QMI_LOC_EVENT_MASK_BATCH_FULL_NOTIFICATION_V02 ((qmiLocEventRegMaskT_v02)0x00080000ull) /**< Notification when a batch is full. The location engine sends this event to
+ notify of batch full for ongoing batching session. \n */
+#define QMI_LOC_EVENT_MASK_LIVE_BATCHED_POSITION_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x00100000ull) /**< Position report indications along with an ongoing batching session.
+ The location engine sends this event to notify the batched position
+ report while a batching session is ongoing. \n */
+#define QMI_LOC_EVENT_MASK_INJECT_WIFI_AP_DATA_REQ_V02 ((qmiLocEventRegMaskT_v02)0x00200000ull) /**< Wi-Fi AP data inject request event indications. \n */
+#define QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_BREACH_NOTIFICATION_V02 ((qmiLocEventRegMaskT_v02)0x00400000ull) /**< Notifications when a Geofence is breached. These events are generated when a UE enters
+ or leaves the perimeter of a Geofence. This breach notification is for
+ multiple Geofences. Breaches from multiple Geofences are all batched and
+ sent in the same notification. \n */
+#define QMI_LOC_EVENT_MASK_VEHICLE_DATA_READY_STATUS_V02 ((qmiLocEventRegMaskT_v02)0x00800000ull) /**< Notifications from the
+ location engine indicating its readiness to accept vehicle data (vehicle
+ accelerometer, vehicle angular rate, vehicle odometry, and so on).\n */
+#define QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x01000000ull) /**< System clock and satellite measurement report events (system clock, SV time,
+ Doppler, and so on). Reports are generated only for the GNSS satellite constellations
+ that are enabled using QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n */
+#define QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x02000000ull) /**< Satellite position reports as polynomials. Reports are generated only for the GNSS satellite
+ constellations that are enabled using QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n */
+#define QMI_LOC_EVENT_MASK_GEOFENCE_PROXIMITY_NOTIFICATION_V02 ((qmiLocEventRegMaskT_v02)0x04000000ull) /**< Notifications when a Geofence proximity is entered and exited. The proximity of
+ a Geofence might be due to different contexts. These contexts are identified
+ using the context ID in this indication. The context of a Geofence can contain Wi-Fi area
+ ID lists, IBeacon lists, Cell-ID list, and so forth. \n */
+#define QMI_LOC_EVENT_MASK_GDT_UPLOAD_BEGIN_REQ_V02 ((qmiLocEventRegMaskT_v02)0x08000000ull) /**< Generic Data Transport (GDT) upload session begin request event indications. \n */
+#define QMI_LOC_EVENT_MASK_GDT_UPLOAD_END_REQ_V02 ((qmiLocEventRegMaskT_v02)0x10000000ull) /**< GDT upload session end request event indications. \n */
+#define QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_DWELL_NOTIFICATION_V02 ((qmiLocEventRegMaskT_v02)0x20000000ull) /**< Notifications when a Geofence is dwelled. These events are generated when a UE enters
+ or leaves the perimeter of a Geofence and dwells inside or outside for a specified time.
+ This dwell notification is for multiple Geofences. Dwells from multiple Geofences are all batched and
+ sent in the same notification. \n */
+#define QMI_LOC_EVENT_MASK_GET_TIME_ZONE_REQ_V02 ((qmiLocEventRegMaskT_v02)0x40000000ull) /**< Requests for time zone information from the service.
+ These events are generated when there is a need for time zone information in the
+ service. \n */
+#define QMI_LOC_EVENT_MASK_BATCHING_STATUS_V02 ((qmiLocEventRegMaskT_v02)0x80000000ull) /**< Asynchronous events related to batching. n */
+#define QMI_LOC_EVENT_MASK_INTERNAL_STATUS_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x100000000ull) /**< The location service internal status report mask. \n */
+#define QMI_LOC_EVENT_MASK_INJECT_SRN_AP_DATA_REQ_V02 ((qmiLocEventRegMaskT_v02)0x200000000ull) /**< Asynchronous events for
+ short range node (SRN) RSSI scans, for example, BT, BTLE, NFC, and so on. \n */
+#define QMI_LOC_EVENT_MASK_GNSS_ONLY_POSITION_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x400000000ull) /**< Position report event indications that contain a GNSS only position. \n */
+#define QMI_LOC_EVENT_MASK_FDCL_SERVICE_REQ_V02 ((qmiLocEventRegMaskT_v02)0x800000000ull) /**< FDCL service request. \n */
+#define QMI_LOC_EVENT_MASK_DC_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x1000000000ull) /**< DC report event indications that contains disaster and crisis reports. \n */
+#define QMI_LOC_EVENT_MASK_ENGINE_LOCK_STATE_V02 ((qmiLocEventRegMaskT_v02)0x2000000000ull) /**< Asynchronous events related to the engine lock state. \n */
+#define QMI_LOC_EVENT_MASK_UNPROPAGATED_POSITION_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x4000000000ull) /**< Unpropagated fix. \n */
+#define QMI_LOC_EVENT_MASK_BS_OBS_DATA_SERVICE_REQ_V02 ((qmiLocEventRegMaskT_v02)0x8000000000ull) /**< Base station observed data service request. \n */
+#define QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x10000000000ull) /**< Ephemeris data for all GNSS constellations. \n */
+#define QMI_LOC_EVENT_MASK_NEXT_LS_INFO_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x20000000000ull) /**< Upcoming leap second information from the service. \n */
+#define QMI_LOC_EVENT_MASK_GET_BAND_MEASUREMENT_METRICS_V02 ((qmiLocEventRegMaskT_v02)0x40000000000ull) /**< The band measurement metrics from the ME. \n */
+#define QMI_LOC_EVENT_MASK_GNSS_NHZ_MEASUREMENT_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x80000000000ull) /**< System clock and satellite
+ measurement report events (system clock, SV time, Doppler, and so on) at a rate greater
+ than 1 Hz.
+ Reports are generated only for the GNSS satellite constellations that are enabled using
+ QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n */
+#define QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x100000000000ull) /**< The QMI_LOC_EVENT_REPORT indication. \n */
+#define QMI_LOC_EVENT_MASK_QUERY_XTRA_INFO_V02 ((qmiLocEventRegMaskT_v02)0x200000000000ull) /**< Event indication to trigger XTRA config query from the control point. \n */
+#define QMI_LOC_EVENT_MASK_SAP_INS_PARAMETERS_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x400000000000ull) /**< QMI_LOC_EVENT_SAP_INS_PARAMETERS indication. \n */
+#define QMI_LOC_EVENT_MASK_LATENCY_INFORMATION_REPORT_V02 ((qmiLocEventRegMaskT_v02)0x800000000000ull) /**< QMI_LOC_LATENCY_INFORMATION indication. */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCCLIENTTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_CLIENT_AFW_V02 = 1, /**< Application FrameWork client \n */
+ eQMI_LOC_CLIENT_NFW_V02 = 2, /**< Non-AFW client \n */
+ eQMI_LOC_CLIENT_PRIVILEGED_V02 = 3, /**< Privileged client */
+ QMILOCCLIENTTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocClientTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to register for events from the
+ location subsystem. */
+typedef struct {
+
+ /* Mandatory */
+ /* Event Registration Mask */
+ qmiLocEventRegMaskT_v02 eventRegMask;
+ /**< Specifies the events that the control point is interested in receiving.
+ The control point must enable the following masks to receive the events:\n
+ - QMI_LOC_EVENT_MASK_POSITION_REPORT (0x00000001) -- Position report event indications. \n
+ - QMI_LOC_EVENT_MASK_GNSS_SV_INFO (0x00000002) -- Satellite report event indications. These reports are sent at a 1 Hz rate. \n
+ - QMI_LOC_EVENT_MASK_NMEA (0x00000004) -- NMEA reports for
+ position and satellites in view. The report is at a 1 Hz rate. \n
+ - QMI_LOC_EVENT_MASK_NI_NOTIFY_VERIFY_REQ (0x00000008) -- NI Notify/Verify request event indications. \n
+ - QMI_LOC_EVENT_MASK_INJECT_TIME_REQ (0x00000010) -- Time injection request event indications. \n
+ - QMI_LOC_EVENT_MASK_INJECT_PREDICTED_ORBITS_REQ (0x00000020) -- Predicted orbits request
+ event indications. \n
+ - QMI_LOC_EVENT_MASK_INJECT_POSITION_REQ (0x00000040) -- Position injection request event indications. \n
+ - QMI_LOC_EVENT_MASK_ENGINE_STATE (0x00000080) -- Engine state report
+ event indications. \n
+ - QMI_LOC_EVENT_MASK_FIX_SESSION_STATE (0x00000100) -- Fix session status report event indications. \n
+ - QMI_LOC_EVENT_MASK_WIFI_REQ (0x00000200) -- Wi-Fi position request event indications. \n
+ - QMI_LOC_EVENT_MASK_SENSOR_STREAMING_READY_STATUS (0x00000400) -- Notifications from the location engine indicating its readiness to accept data from the
+ sensors (accelerometer, gyroscope, and so on). \n
+ - QMI_LOC_EVENT_MASK_TIME_SYNC_REQ (0x00000800) -- Time sync requests
+ from the GPS engine. Time sync enables the GPS engine to synchronize
+ its clock with the sensor processor's clock. \n
+ - QMI_LOC_EVENT_MASK_SET_SPI_STREAMING_REPORT (0x00001000) -- Stationary Position Indicator (SPI) streaming report indications. \n
+ - QMI_LOC_EVENT_MASK_LOCATION_SERVER_CONNECTION_REQ (0x00002000) -- Location server requests; generated when the service wishes to
+ establish a connection with a location server. \n
+ - QMI_LOC_EVENT_MASK_NI_GEOFENCE_NOTIFICATION (0x00004000) -- Notifications related to network-initiated Geofences. These events notify the client
+ when a network-initiated Geofence is added, deleted, or edited. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_GEN_ALERT (0x00008000) -- Geofence alerts; generated to inform the client of the changes that can
+ affect a Geofence, for example, if GPS is turned off or if the network is
+ unavailable. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION (0x00010000) -- Geofence breach; when a UE enters or leaves the perimeter of a Geofence.
+ This breach report is for a single Geofence. \n
+ - QMI_LOC_EVENT_MASK_PEDOMETER_CONTROL (0x00020000) -- Pedometer control requests from the location engine. The location engine sends
+ this event to control the injection of pedometer reports. \n
+ - QMI_LOC_EVENT_MASK_MOTION_DATA_CONTROL (0x00040000) -- Motion data control requests from the location engine. The location engine sends
+ this event to control the injection of motion data. \n
+ - QMI_LOC_EVENT_MASK_BATCH_FULL_NOTIFICATION (0x00080000) -- Notification when a batch is full. The location engine sends this event to
+ notify of batch full for ongoing batching session. \n
+ - QMI_LOC_EVENT_MASK_LIVE_BATCHED_POSITION_REPORT (0x00100000) -- Position report indications along with an ongoing batching session.
+ The location engine sends this event to notify the batched position
+ report while a batching session is ongoing. \n
+ - QMI_LOC_EVENT_MASK_INJECT_WIFI_AP_DATA_REQ (0x00200000) -- Wi-Fi AP data inject request event indications. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_BREACH_NOTIFICATION (0x00400000) -- Notifications when a Geofence is breached. These events are generated when a UE enters
+ or leaves the perimeter of a Geofence. This breach notification is for
+ multiple Geofences. Breaches from multiple Geofences are all batched and
+ sent in the same notification. \n
+ - QMI_LOC_EVENT_MASK_VEHICLE_DATA_READY_STATUS (0x00800000) -- Notifications from the
+ location engine indicating its readiness to accept vehicle data (vehicle
+ accelerometer, vehicle angular rate, vehicle odometry, and so on).\n
+ - QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT (0x01000000) -- System clock and satellite measurement report events (system clock, SV time,
+ Doppler, and so on). Reports are generated only for the GNSS satellite constellations
+ that are enabled using QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n
+ - QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT (0x02000000) -- Satellite position reports as polynomials. Reports are generated only for the GNSS satellite
+ constellations that are enabled using QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_PROXIMITY_NOTIFICATION (0x04000000) -- Notifications when a Geofence proximity is entered and exited. The proximity of
+ a Geofence might be due to different contexts. These contexts are identified
+ using the context ID in this indication. The context of a Geofence can contain Wi-Fi area
+ ID lists, IBeacon lists, Cell-ID list, and so forth. \n
+ - QMI_LOC_EVENT_MASK_GDT_UPLOAD_BEGIN_REQ (0x08000000) -- Generic Data Transport (GDT) upload session begin request event indications. \n
+ - QMI_LOC_EVENT_MASK_GDT_UPLOAD_END_REQ (0x10000000) -- GDT upload session end request event indications. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_DWELL_NOTIFICATION (0x20000000) -- Notifications when a Geofence is dwelled. These events are generated when a UE enters
+ or leaves the perimeter of a Geofence and dwells inside or outside for a specified time.
+ This dwell notification is for multiple Geofences. Dwells from multiple Geofences are all batched and
+ sent in the same notification. \n
+ - QMI_LOC_EVENT_MASK_GET_TIME_ZONE_REQ (0x40000000) -- Requests for time zone information from the service.
+ These events are generated when there is a need for time zone information in the
+ service. \n
+ - QMI_LOC_EVENT_MASK_BATCHING_STATUS (0x80000000) -- Asynchronous events related to batching. n
+ - QMI_LOC_EVENT_MASK_INTERNAL_STATUS_REPORT (0x100000000) -- The location service internal status report mask. \n
+ - QMI_LOC_EVENT_MASK_INJECT_SRN_AP_DATA_REQ (0x200000000) -- Asynchronous events for
+ short range node (SRN) RSSI scans, for example, BT, BTLE, NFC, and so on. \n
+ - QMI_LOC_EVENT_MASK_GNSS_ONLY_POSITION_REPORT (0x400000000) -- Position report event indications that contain a GNSS only position. \n
+ - QMI_LOC_EVENT_MASK_FDCL_SERVICE_REQ (0x800000000) -- FDCL service request. \n
+ - QMI_LOC_EVENT_MASK_DC_REPORT (0x1000000000) -- DC report event indications that contains disaster and crisis reports. \n
+ - QMI_LOC_EVENT_MASK_ENGINE_LOCK_STATE (0x2000000000) -- Asynchronous events related to the engine lock state. \n
+ - QMI_LOC_EVENT_MASK_UNPROPAGATED_POSITION_REPORT (0x4000000000) -- Unpropagated fix. \n
+ - QMI_LOC_EVENT_MASK_BS_OBS_DATA_SERVICE_REQ (0x8000000000) -- Base station observed data service request. \n
+ - QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT (0x10000000000) -- Ephemeris data for all GNSS constellations. \n
+ - QMI_LOC_EVENT_MASK_NEXT_LS_INFO_REPORT (0x20000000000) -- Upcoming leap second information from the service. \n
+ - QMI_LOC_EVENT_MASK_GET_BAND_MEASUREMENT_METRICS (0x40000000000) -- The band measurement metrics from the ME. \n
+ - QMI_LOC_EVENT_MASK_GNSS_NHZ_MEASUREMENT_REPORT (0x80000000000) -- System clock and satellite
+ measurement report events (system clock, SV time, Doppler, and so on) at a rate greater
+ than 1 Hz.
+ Reports are generated only for the GNSS satellite constellations that are enabled using
+ QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n
+ - QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT (0x100000000000) -- The QMI_LOC_EVENT_REPORT indication. \n
+ - QMI_LOC_EVENT_MASK_QUERY_XTRA_INFO (0x200000000000) -- Event indication to trigger XTRA config query from the control point. \n
+ - QMI_LOC_EVENT_MASK_SAP_INS_PARAMETERS_REPORT (0x400000000000) -- QMI_LOC_EVENT_SAP_INS_PARAMETERS indication. \n
+ - QMI_LOC_EVENT_MASK_LATENCY_INFORMATION_REPORT (0x800000000000) -- QMI_LOC_LATENCY_INFORMATION indication.
+
+ Multiple events can be registered by ORing the individual masks and
+ sending them in this TLV. Set all unused bits in this mask to 0.
+
+ */
+
+ /* Optional */
+ /* Client Identification String */
+ uint8_t clientStrId_valid; /**< Must be set to true if clientStrId is being passed */
+ char clientStrId[QMI_LOC_MAX_CLIENT_ID_STRING_LENGTH_V02 + 1];
+ /**< String identification of this client.
+ This string is sent to the application framework in the
+ QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND indication.
+ */
+
+ /* Optional */
+ /* Client Type */
+ uint8_t clientType_valid; /**< Must be set to true if clientType is being passed */
+ qmiLocClientTypeEnumT_v02 clientType;
+ /**< If not specified, defaults to NFW client.
+ If specifically set as the NFW or PRIVILEGED client, the control point
+ must set the value for enablePosRequestNotification.\n
+ Note: Location requests from privileged client(s) are always allowed,
+ regardless of user privacy settings. This might violate OEM, carrier,
+ or government privacy requirements. Contact privacy counsel
+ for advice before choosing privileged as the clientType. \n
+ Values: \n
+ - eQMI_LOC_CLIENT_AFW (1) -- Application FrameWork client \n
+ - eQMI_LOC_CLIENT_NFW (2) -- Non-AFW client \n
+ - eQMI_LOC_CLIENT_PRIVILEGED (3) -- Privileged client
+ */
+
+ /* Optional */
+ /* Enable Positioning Request Notification */
+ uint8_t enablePosRequestNotification_valid; /**< Must be set to true if enablePosRequestNotification is being passed */
+ uint8_t enablePosRequestNotification;
+ /**< If not specified, defaults to FALSE.
+ If set to TRUE, each positioning request made by this client
+ generates a notification to the application framework.
+ The value is ignored when the client registers as an AFW client.
+ */
+}qmiLocRegEventsReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCFIXRECURRENCEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_RECURRENCE_PERIODIC_V02 = 1, /**< Request periodic position fixes \n */
+ eQMI_LOC_RECURRENCE_SINGLE_V02 = 2, /**< Request a single position fix */
+ QMILOCFIXRECURRENCEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocFixRecurrenceEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCACCURACYLEVELENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_ACCURACY_LOW_V02 = 1, /**< Low accuracy \n */
+ eQMI_LOC_ACCURACY_MED_V02 = 2, /**< Medium accuracy \n */
+ eQMI_LOC_ACCURACY_HIGH_V02 = 3, /**< High accuracy */
+ QMILOCACCURACYLEVELENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocAccuracyLevelEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCINTERMEDIATEREPORTSTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_INTERMEDIATE_REPORTS_ON_V02 = 1, /**< Intermediate reports are turned on \n */
+ eQMI_LOC_INTERMEDIATE_REPORTS_OFF_V02 = 2, /**< Intermediate reports are turned off */
+ QMILOCINTERMEDIATEREPORTSTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocIntermediateReportStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCCONFIGINCLUDEALTITUDEASSUMEDINGNSSSVINFOENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_ENABLED_V02 = 1, /**< Enable altitude assumed information in GNSS SV Info Event.\n */
+ eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_DISABLED_V02 = 2, /**< Disable altitude assumed information in GNSS SV Info Event. */
+ QMILOCCONFIGINCLUDEALTITUDEASSUMEDINGNSSSVINFOENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocConfigIncludeAltitudeAssumedInGnssSvInfoEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ char applicationProvider[QMI_LOC_MAX_APP_ID_PROVIDER_LENGTH_V02 + 1];
+ /**< Application provider. */
+
+ char applicationName[QMI_LOC_MAX_APP_ID_NAME_LENGTH_V02 + 1];
+ /**< Application name. */
+
+ uint8_t applicationVersion_valid;
+ /**< Specifies whether the application version string contains
+ a valid value: \n
+ - 0x00 (FALSE) -- Application version string is invalid \n
+ - 0x01 (TRUE) -- Application version string is valid
+ */
+
+ char applicationVersion[QMI_LOC_MAX_APP_ID_VERSION_LENGTH_V02 + 1];
+ /**< Application version. */
+}qmiLocApplicationIdStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPOWERMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_POWER_MODE_IMPROVED_ACCURACY_V02 = 1, /**< The GNSS receiver operates in full power mode (non-DPO). \n */
+ eQMI_LOC_POWER_MODE_NORMAL_V02 = 2, /**< The GNSS receiver operates with GNSS receiver autonomously
+ duty cycling while meeting position criteria. \n */
+ eQMI_LOC_POWER_MODE_BACKGROUND_DEFINED_POWER_V02 = 3, /**< The GNSS receiver duty cycles at a variable rate to meet
+ the target power budget. The power budget is defined as 1/N
+ of the GNSS full power during 1 Hz navigation.\n
+ N = timeBetweenMeasurement/1000. \n */
+ eQMI_LOC_POWER_MODE_BACKGROUND_DEFINED_TIME_V02 = 4, /**< The GNSS receiver duty cycles at a fixed time interval. \n */
+ eQMI_LOC_POWER_MODE_BACKGROUND_KEEP_WARM_V02 = 5, /**< The GNSS receiver operates in very-low power (less than 1mA)
+ duty cycling mode, to keep GNSS receiver warm for faster signal
+ acquisition & tracking. */
+ QMILOCPOWERMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPowerModeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocPowerModeEnumT_v02 powerMode;
+ /**< GNSS power mode option to let the client choose the power-accuracy trade-off.
+ Values: \n
+ - eQMI_LOC_POWER_MODE_IMPROVED_ACCURACY (1) -- The GNSS receiver operates in full power mode (non-DPO). \n
+ - eQMI_LOC_POWER_MODE_NORMAL (2) -- The GNSS receiver operates with GNSS receiver autonomously
+ duty cycling while meeting position criteria. \n
+ - eQMI_LOC_POWER_MODE_BACKGROUND_DEFINED_POWER (3) -- The GNSS receiver duty cycles at a variable rate to meet
+ the target power budget. The power budget is defined as 1/N
+ of the GNSS full power during 1 Hz navigation.\n
+ N = timeBetweenMeasurement/1000. \n
+ - eQMI_LOC_POWER_MODE_BACKGROUND_DEFINED_TIME (4) -- The GNSS receiver duty cycles at a fixed time interval. \n
+ - eQMI_LOC_POWER_MODE_BACKGROUND_KEEP_WARM (5) -- The GNSS receiver operates in very-low power (less than 1mA)
+ duty cycling mode, to keep GNSS receiver warm for faster signal
+ acquisition & tracking.
+ */
+
+ uint32_t timeBetweenMeasurement;
+ /**< Maximum time interval between measurements,
+ applies to the BACKGROUND_DEFINED_POWER and BACKGROUND_DEFINED_TIME
+ power modes. For BACKGROUND_DEFINED_POWER, set timeBetweenMeasurement to 1000 * N;
+ timeBetweenMeasurement is ignored for the other power modes. \n
+ - Units -- Milliseconds
+ */
+}qmiLocPowerModeStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSPECIALREQENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SPECIAL_REQUEST_SHORT_CODE_V02 = 1, /**< The QMI_LOC client requests for location fix with Special
+ Service type set with Short Code, allow even when GPS and privacy NVs
+ do not allow fix requests for this client. */
+ QMILOCSPECIALREQENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSpecialReqEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to initiate a GPS session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Session ID */
+ uint8_t sessionId;
+ /**< ID of the session as identified by the control point. The session ID
+ is reported back in the position reports. The control point must
+ specify the same session ID in the QMI_LOC_STOP_REQ request. \n
+ - Range: 0 to 255
+ */
+
+ /* Optional */
+ /* Recurrence Type */
+ uint8_t fixRecurrence_valid; /**< Must be set to true if fixRecurrence is being passed */
+ qmiLocFixRecurrenceEnumT_v02 fixRecurrence;
+ /**< Specifies the type of session in which the control point is interested.
+ If this TLV is not specified, recurrence defaults to single. \n
+ Values: \n
+ - eQMI_LOC_RECURRENCE_PERIODIC (1) -- Request periodic position fixes \n
+ - eQMI_LOC_RECURRENCE_SINGLE (2) -- Request a single position fix
+ */
+
+ /* Optional */
+ /* Horizontal Accuracy */
+ uint8_t horizontalAccuracyLevel_valid; /**< Must be set to true if horizontalAccuracyLevel is being passed */
+ qmiLocAccuracyLevelEnumT_v02 horizontalAccuracyLevel;
+ /**< Specifies the horizontal accuracy level required by the control point.
+ If not specified, accuracy defaults to LOW.
+ Values: \n
+ - eQMI_LOC_ACCURACY_LOW (1) -- Low accuracy \n
+ - eQMI_LOC_ACCURACY_MED (2) -- Medium accuracy \n
+ - eQMI_LOC_ACCURACY_HIGH (3) -- High accuracy
+ */
+
+ /* Optional */
+ /* Enable/Disable Intermediate Reports */
+ uint8_t intermediateReportState_valid; /**< Must be set to true if intermediateReportState is being passed */
+ qmiLocIntermediateReportStateEnumT_v02 intermediateReportState;
+ /**< Specifies whether the control point is interested in receiving intermediate
+ reports. The control point must explicitly set this field to OFF if it
+ does not wish to receive intermediate position reports. Intermediate
+ position reports are generated at 1 Hz and are ON by default. If
+ intermediate reports are turned ON, the client receives position reports
+ even if the accuracy criteria are not met. The status in such a position
+ report is set to IN_PROGRESS for the control point to identify
+ intermediate reports.
+ Values: \n
+ - eQMI_LOC_INTERMEDIATE_REPORTS_ON (1) -- Intermediate reports are turned on \n
+ - eQMI_LOC_INTERMEDIATE_REPORTS_OFF (2) -- Intermediate reports are turned off
+ */
+
+ /* Optional */
+ /* Minimum Interval Between Final Position Reports */
+ uint8_t minInterval_valid; /**< Must be set to true if minInterval is being passed */
+ uint32_t minInterval;
+ /**< Minimum time interval, specified by the control point, that must elapse between
+ final position reports. \n
+ - Units -- Milliseconds \n
+ - Default -- 1000 ms
+ */
+
+ /* Optional */
+ /* ID of the Application that Sent this Request */
+ uint8_t applicationId_valid; /**< Must be set to true if applicationId is being passed */
+ qmiLocApplicationIdStructT_v02 applicationId;
+ /**< \n Application provider, name, and version.*/
+
+ /* Optional */
+ /* Configuration for Altitude Assumed Info in GNSS SV Info Event */
+ uint8_t configAltitudeAssumed_valid; /**< Must be set to true if configAltitudeAssumed is being passed */
+ qmiLocConfigIncludeAltitudeAssumedInGnssSvInfoEnumT_v02 configAltitudeAssumed;
+ /**< Specifies the configuration to include altitude assumed information in the GNSS SV Info event.
+ When enabled, an additional GNSS SV Info event indication is sent to the control
+ point that also includes the altitude assumed information.
+ If not specified, the configuration defaults to enabled.\n
+ Values: \n
+ - eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_ENABLED (1) -- Enable altitude assumed information in GNSS SV Info Event.\n
+ - eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_DISABLED (2) -- Disable altitude assumed information in GNSS SV Info Event.
+ */
+
+ /* Optional */
+ /* Minimum Interval Between Intermediate Position Reports */
+ uint8_t minIntermediatePositionReportInterval_valid; /**< Must be set to true if minIntermediatePositionReportInterval is being passed */
+ uint32_t minIntermediatePositionReportInterval;
+ /**< Minimum time interval for intermediate position reports, specified by the control point,
+ that, between the position reports elapsed time, must be longer than the interval time.
+ If this optional value is not set or set to the default value (0), the intermediate position
+ is reported when it is ready. \n
+ - Units -- Milliseconds \n
+ - Default -- 0 milliseconds
+ */
+
+ /* Optional */
+ /* Maximum Wait Time to Get a Position Report */
+ uint8_t positionReportTimeout_valid; /**< Must be set to true if positionReportTimeout is being passed */
+ uint32_t positionReportTimeout;
+ /**< Maximum time to work on each fix, specified by the control point.
+ The GPS engine returns QMI_ERR_INTERNAL if a position cannot be obtained
+ within the positionReportTimeout value. \n
+ - Units -- Milliseconds \n
+ - Default -- 255*1000 ms \n
+ - Range -- 1000 - 255*1000 ms
+ */
+
+ /* Optional */
+ /* Share Position Report with Other Clients */
+ uint8_t sharePosition_valid; /**< Must be set to true if sharePosition is being passed */
+ uint8_t sharePosition;
+ /**< Indicates whether to share the position report with the other QMI_LOC clients: \n
+ - 0x00 (FALSE) -- Do not share \n
+ - 0x01 (TRUE) -- Share \n
+ If this optional TLV is not set, the GPS engine allows the position sharing.
+ */
+
+ /* Optional */
+ /* Report GNSS Only Position */
+ uint8_t reportGnssOnlyPosition_valid; /**< Must be set to true if reportGnssOnlyPosition is being passed */
+ uint8_t reportGnssOnlyPosition;
+ /**< Requests the GPS engine to report positions that could be GNSS only or
+ combined with other technologies, such as sensors. Values: \n
+ - 0x00 (FALSE) -- Report GNSS only positions is disabled (default) \n
+ - 0x01 (TRUE) -- Report GNSS only positions is enabled
+ */
+
+ /* Optional */
+ /* GNSS Power Mode */
+ uint8_t powerMode_valid; /**< Must be set to true if powerMode is being passed */
+ qmiLocPowerModeStructT_v02 powerMode;
+ /**< \n When the power mode is not set by the client,
+ eQMI_LOC_POWER_MODE_NORMAL is the default value.
+ When there are other clients with different powerMode settings,
+ the GNSS receiver is configured as powerMode with the highest
+ power consumption among the requesting clients.
+ */
+
+ /* Optional */
+ /* GNSS Special Request Type */
+ uint8_t specialReqType_valid; /**< Must be set to true if specialReqType is being passed */
+ qmiLocSpecialReqEnumT_v02 specialReqType;
+ /**< QMI_LOC client requests for location fix with Special
+ Service request types set, honor even when GPS and Privacy NVs
+ do not allow fix requests for this client.
+ If not set, ignore the field and process the client request
+ according to GPS lock and privacy settings.
+ Values: \n
+ - eQMI_LOC_SPECIAL_REQUEST_SHORT_CODE (1) -- The QMI_LOC client requests for location fix with Special
+ Service type set with Short Code, allow even when GPS and privacy NVs
+ do not allow fix requests for this client.
+ */
+}qmiLocStartReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to stop a GPS session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Session ID */
+ uint8_t sessionId;
+ /**< ID of the session that was specified in the QMI_LOC_START_REQ request. \n
+ - Range -- 0 to 255 */
+}qmiLocStopReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocPosTechMaskT_v02;
+#define QMI_LOC_POS_TECH_MASK_SATELLITE_V02 ((qmiLocPosTechMaskT_v02)0x00000001) /**< Satellites were used to generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_CELLID_V02 ((qmiLocPosTechMaskT_v02)0x00000002) /**< Cell towers were used to generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_WIFI_V02 ((qmiLocPosTechMaskT_v02)0x00000004) /**< Wi-Fi access points were used to generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_SENSORS_V02 ((qmiLocPosTechMaskT_v02)0x00000008) /**< Sensors were used to generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_REFERENCE_LOCATION_V02 ((qmiLocPosTechMaskT_v02)0x00000010) /**< Reference location was used to generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION_V02 ((qmiLocPosTechMaskT_v02)0x00000020) /**< Coarse position injected into the location engine was used to
+ generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_AFLT_V02 ((qmiLocPosTechMaskT_v02)0x00000040) /**< AFLT was used to generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_HYBRID_V02 ((qmiLocPosTechMaskT_v02)0x00000080) /**< GNSS and network-provided measurements were used to
+ generate the fix. \n */
+#define QMI_LOC_POS_TECH_MASK_DRE_V02 ((qmiLocPosTechMaskT_v02)0x00000100) /**< Dead reckoning engine (DRE) was used to generate the fix. */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSESSIONSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SESS_STATUS_SUCCESS_V02 = 0, /**< Session was successful \n */
+ eQMI_LOC_SESS_STATUS_IN_PROGRESS_V02 = 1, /**< Session is still in progress; further position reports are generated
+ until either the fix criteria specified by the client are met or the
+ client response timeout occurs \n */
+ eQMI_LOC_SESS_STATUS_GENERAL_FAILURE_V02 = 2, /**< Session failed \n */
+ eQMI_LOC_SESS_STATUS_TIMEOUT_V02 = 3, /**< Fix request failed because the session timed out \n */
+ eQMI_LOC_SESS_STATUS_USER_END_V02 = 4, /**< Fix request failed because the session was ended by the user \n */
+ eQMI_LOC_SESS_STATUS_BAD_PARAMETER_V02 = 5, /**< Fix request failed due to bad parameters in the request \n */
+ eQMI_LOC_SESS_STATUS_PHONE_OFFLINE_V02 = 6, /**< Fix request failed because the phone is offline \n */
+ eQMI_LOC_SESS_STATUS_ENGINE_LOCKED_V02 = 7, /**< Fix request failed because the engine is locked */
+ QMILOCSESSIONSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSessionStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t gpsWeek;
+ /**< Current GPS week as calculated from midnight, Jan. 6, 1980. \n
+ - Units -- Weeks */
+
+ uint32_t gpsTimeOfWeekMs;
+ /**< Amount of time into the current GPS week. \n
+ - Units -- Milliseconds */
+}qmiLocGPSTimeStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ float PDOP;
+ /**< Position dilution of precision. \n
+ - Range -- 0 (highest accuracy) to 50 (lowest accuracy) \n
+ - PDOP = square root of (HDOP^2 + VDOP^2)
+ */
+
+ float HDOP;
+ /**< Horizontal dilution of precision. \n
+ - Range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+
+ float VDOP;
+ /**< Vertical dilution of precision. \n
+ - Range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+}qmiLocDOPStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ float PDOP;
+ /**< Position dilution of precision. \n
+ - Range: 0 (highest accuracy) to 50 (lowest accuracy) \n
+ - PDOP = square root of (HDOP\textsuperscript{2} + VDOP\textsuperscript{2})
+ */
+
+ float HDOP;
+ /**< Horizontal dilution of precision. \n
+ - Range: 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+
+ float VDOP;
+ /**< Vertical dilution of precision. \n
+ - Range: 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+
+ float GDOP;
+ /**< Geometric dilution of precision. \n
+ - Range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+
+ float TDOP;
+ /**< Time dilution of precision. \n
+ - Range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+}qmiLocExtDOPStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocSensorUsageMaskT_v02;
+#define QMI_LOC_SENSOR_MASK_USED_ACCEL_V02 ((qmiLocSensorUsageMaskT_v02)0x00000001) /**< Bitmask specifying whether an accelerometer was used. */
+#define QMI_LOC_SENSOR_MASK_USED_GYRO_V02 ((qmiLocSensorUsageMaskT_v02)0x00000002) /**< Bitmask specifying whether a gyroscope was used. */
+typedef uint32_t qmiLocSensorAidedMaskT_v02;
+#define QMI_LOC_SENSOR_AIDED_MASK_HEADING_V02 ((qmiLocSensorAidedMaskT_v02)0x00000001) /**< Bitmask specifying whether a sensor was used to calculate heading. \n */
+#define QMI_LOC_SENSOR_AIDED_MASK_SPEED_V02 ((qmiLocSensorAidedMaskT_v02)0x00000002) /**< Bitmask specifying whether a sensor was used to calculate speed. \n */
+#define QMI_LOC_SENSOR_AIDED_MASK_POSITION_V02 ((qmiLocSensorAidedMaskT_v02)0x00000004) /**< Bitmask specifying whether a sensor was used to calculate position. \n */
+#define QMI_LOC_SENSOR_AIDED_MASK_VELOCITY_V02 ((qmiLocSensorAidedMaskT_v02)0x00000008) /**< Bitmask specifying whether a sensor was used to calculate velocity. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSensorUsageMaskT_v02 usageMask;
+ /**< Specifies the sensors used in calculating the position in the
+ position report.
+ Valid bitmasks: \n
+ - QMI_LOC_SENSOR_MASK_USED_ACCEL (0x00000001) -- Bitmask specifying whether an accelerometer was used.
+ - QMI_LOC_SENSOR_MASK_USED_GYRO (0x00000002) -- Bitmask specifying whether a gyroscope was used. */
+
+ qmiLocSensorAidedMaskT_v02 aidingIndicatorMask;
+ /**< Specifies the results aided by sensors.
+ Valid bitmasks: \n
+ - QMI_LOC_SENSOR_AIDED_MASK_HEADING (0x00000001) -- Bitmask specifying whether a sensor was used to calculate heading. \n
+ - QMI_LOC_SENSOR_AIDED_MASK_SPEED (0x00000002) -- Bitmask specifying whether a sensor was used to calculate speed. \n
+ - QMI_LOC_SENSOR_AIDED_MASK_POSITION (0x00000004) -- Bitmask specifying whether a sensor was used to calculate position. \n
+ - QMI_LOC_SENSOR_AIDED_MASK_VELOCITY (0x00000008) -- Bitmask specifying whether a sensor was used to calculate velocity. */
+}qmiLocSensorUsageIndicatorStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCTIMESOURCEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_TIME_SRC_INVALID_V02 = 0, /**< Invalid time \n */
+ eQMI_LOC_TIME_SRC_NETWORK_TIME_TRANSFER_V02 = 1, /**< Time is set by the 1X system \n */
+ eQMI_LOC_TIME_SRC_NETWORK_TIME_TAGGING_V02 = 2, /**< Time is set by WCDMA/GSM time tagging (that is,
+ associating network time with GPS time) \n */
+ eQMI_LOC_TIME_SRC_EXTERNAL_INPUT_V02 = 3, /**< Time is set by an external injection \n */
+ eQMI_LOC_TIME_SRC_TOW_DECODE_V02 = 4, /**< Time is set after decoding over-the-air GPS navigation data
+ from one GPS satellite \n */
+ eQMI_LOC_TIME_SRC_TOW_CONFIRMED_V02 = 5, /**< Time is set after decoding over-the-air GPS navigation data
+ from multiple satellites \n */
+ eQMI_LOC_TIME_SRC_TOW_AND_WEEK_CONFIRMED_V02 = 6, /**< Both time of the week and the GPS week number are known \n */
+ eQMI_LOC_TIME_SRC_NAV_SOLUTION_V02 = 7, /**< Time is set by the position engine after the fix is obtained \n */
+ eQMI_LOC_TIME_SRC_SOLVE_FOR_TIME_V02 = 8, /**< Time is set by the position engine after performing SFT;
+ this is done when the clock time uncertainty is large \n */
+ eQMI_LOC_TIME_SRC_GLO_TOW_DECODE_V02 = 9, /**< Time is set after decoding GLO satellites \n */
+ eQMI_LOC_TIME_SRC_TIME_TRANSFORM_V02 = 10, /**< Time is set after transforming the GPS to GLO time \n */
+ eQMI_LOC_TIME_SRC_WCDMA_SLEEP_TIME_TAGGING_V02 = 11, /**< Time is set by the sleep time tag provided by the WCDMA network \n */
+ eQMI_LOC_TIME_SRC_GSM_SLEEP_TIME_TAGGING_V02 = 12, /**< Time is set by the sleep time tag provided by the GSM network \n */
+ eQMI_LOC_TIME_SRC_UNKNOWN_V02 = 13, /**< Source of the time is unknown \n */
+ eQMI_LOC_TIME_SRC_SYSTEM_TIMETICK_V02 = 14, /**< Time is derived from the system clock (better known as the slow clock);
+ GNSS time is maintained irrespective of the GNSS receiver state \n */
+ eQMI_LOC_TIME_SRC_QZSS_TOW_DECODE_V02 = 15, /**< Time is set after decoding QZSS satellites \n */
+ eQMI_LOC_TIME_SRC_BDS_TOW_DECODE_V02 = 16, /**< Time is set after decoding BDS satellites \n */
+ eQMI_LOC_TIME_SRC_GAL_TOW_DECODE_V02 = 17, /**< Time is set after decoding Galileo satellites \n */
+ eQMI_LOC_TIME_SRC_NAVIC_TOW_DECODE_V02 = 18, /**< Time is set after decoding NavIC satellites */
+ QMILOCTIMESOURCEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocTimeSourceEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCRELIABILITYENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_RELIABILITY_NOT_SET_V02 = 0, /**< Location reliability is not set \n */
+ eQMI_LOC_RELIABILITY_VERY_LOW_V02 = 1, /**< Location reliability is very low; use it at your own risk \n */
+ eQMI_LOC_RELIABILITY_LOW_V02 = 2, /**< Location reliability is low; little or no cross-checking is possible \n */
+ eQMI_LOC_RELIABILITY_MEDIUM_V02 = 3, /**< Location reliability is medium; limited cross-check passed \n */
+ eQMI_LOC_RELIABILITY_HIGH_V02 = 4, /**< Location reliability is high; strong cross-check passed */
+ QMILOCRELIABILITYENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocReliabilityEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocNavSolutionMaskT_v02;
+#define QMI_LOC_NAV_MASK_SBAS_CORRECTION_IONO_V02 ((qmiLocNavSolutionMaskT_v02)0x00000001ull) /**< Indicates SBAS ionospheric correction \n */
+#define QMI_LOC_NAV_MASK_SBAS_CORRECTION_FAST_V02 ((qmiLocNavSolutionMaskT_v02)0x00000002ull) /**< Indicates SBAS fast correction \n */
+#define QMI_LOC_NAV_MASK_SBAS_CORRECTION_LONG_V02 ((qmiLocNavSolutionMaskT_v02)0x00000004ull) /**< Indicates long-tem correction \n */
+#define QMI_LOC_NAV_MASK_SBAS_INTEGRITY_V02 ((qmiLocNavSolutionMaskT_v02)0x00000008ull) /**< Indicates SBAS integrity information \n */
+#define QMI_LOC_NAV_MASK_CORRECTION_DGNSS_V02 ((qmiLocNavSolutionMaskT_v02)0x00000010ull) /**< Indicates DGNSS information is used \n */
+#define QMI_LOC_NAV_MASK_ONLY_SBAS_CORRECTED_SV_USED_V02 ((qmiLocNavSolutionMaskT_v02)0x00000020ull) /**< Only SBAS corrected SVs are used for the fix; \n
+ if mask is not set, all-in-view SVs are used for fix */
+typedef uint32_t qmiLocSensorSubTechnologyMaskT_v02;
+#define QMI_LOC_SENSOR_SUB_MASK_PDR_ENABLED_V02 ((qmiLocSensorSubTechnologyMaskT_v02)0x00000001) /**< Indicates whether PDR is enabled \n */
+#define QMI_LOC_SENSOR_SUB_MASK_PEDOMETER_ENABLED_V02 ((qmiLocSensorSubTechnologyMaskT_v02)0x00000002) /**< Indicates whether a pedometer was used \n */
+#define QMI_LOC_SENSOR_SUB_MASK_VEHICULAR_ENABLED_V02 ((qmiLocSensorSubTechnologyMaskT_v02)0x00000004) /**< Indicates whether vehicular sensor assistance is enabled */
+typedef uint64_t qmiLocSpoofMaskT_v02;
+#define QMI_LOC_POSITION_SPOOFED_V02 ((qmiLocSpoofMaskT_v02)0x00000001ull) /**< Position \n */
+#define QMI_LOC_TIME_SPOOFED_V02 ((qmiLocSpoofMaskT_v02)0x00000002ull) /**< Time \n */
+#define QMI_LOC_NAVIGATION_DATA_SPOOFED_V02 ((qmiLocSpoofMaskT_v02)0x00000004ull) /**< Navigation data */
+typedef uint64_t qmiLocGnssSignalTypeMaskT_v02;
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000001ull) /**< GPS L1CA RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000002ull) /**< GPS L1C RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000004ull) /**< GPS L2C_L RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000008ull) /**< GPS L5_Q RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000010ull) /**< GLONASS G1 (L1OF) RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000020ull) /**< GLONASS G2 (L2OF) RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000040ull) /**< Galileo E1_C RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000080ull) /**< Galileo E5A_Q RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000100ull) /**< Galileo E5B_Q RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000200ull) /**< BeiDou B1_I RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000400ull) /**< BeiDou B1C RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00000800ull) /**< BeiDou B2_I RF band */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00001000ull) /**< BeiDou B2A_I RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00002000ull) /**< QZSS L1CA RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00004000ull) /**< QZSS L1S RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00008000ull) /**< QZSS L2C_L RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00010000ull) /**< QZSS L5_Q RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00020000ull) /**< SBAS L1_CA RF band */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00040000ull) /**< NavIC L5 RF band \n */
+#define QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q_V02 ((qmiLocGnssSignalTypeMaskT_v02)0x00080000ull) /**< BeiDou B2A_Q RF band */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGNSSSIGNALTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GNSS_SIGNAL_TYPE_INVALID_V02 = 0, /**< Invalid RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GPS_L1CA_V02 = 1, /**< GPS L1CA RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GPS_L1C_V02 = 2, /**< GPS L1C RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GPS_L2C_L_V02 = 3, /**< GPS L2C_L RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GPS_L5_Q_V02 = 4, /**< GPS L5_Q RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GLONASS_G1_V02 = 5, /**< GLONASS G1 (L1OF) RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GLONASS_G2_V02 = 6, /**< GLONASS G2 (L2OF) RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GALILEO_E1_C_V02 = 7, /**< Galileo E1_C RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q_V02 = 8, /**< Galileo E5A_Q RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q_V02 = 9, /**< Galileo E5B_Q RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_BEIDOU_B1_I_V02 = 10, /**< BeiDou B1_I RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_BEIDOU_B1C_V02 = 11, /**< BeiDou B1C RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_BEIDOU_B2_I_V02 = 12, /**< BeiDou B2_I RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I_V02 = 13, /**< BeiDou B2A_I RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_QZSS_L1CA_V02 = 14, /**< QZSS L1CA RF band\n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_QZSS_L1S_V02 = 15, /**< QZSS L1S RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_QZSS_L2C_L_V02 = 16, /**< QZSS L2C_L RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_QZSS_L5_Q_V02 = 17, /**< QZSS L5_Q RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_SBAS_L1_CA_V02 = 18, /**< SBAS L1_CA RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_NAVIC_L5_V02 = 19, /**< NavIC L5 RF band \n */
+ eQMI_LOC_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q_V02 = 20, /**< BeiDou B2A_Q RF band */
+ QMILOCGNSSSIGNALTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGnssSignalTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ int32_t agcMetricDb;
+ /**< AGC metric in 0.01 dB */
+
+ int32_t bpMetricDb;
+ /**< BP metric in 0.01 dB */
+}qmiLocJammerIndicatorStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocGNSSConstellEnumT_v02;
+#define eQMI_SYSTEM_GPS_V02 ((qmiLocGNSSConstellEnumT_v02)0x01ull) /**< Enable GPS \n */
+#define eQMI_SYSTEM_GLO_V02 ((qmiLocGNSSConstellEnumT_v02)0x02ull) /**< Enable GLONASS \n */
+#define eQMI_SYSTEM_BDS_V02 ((qmiLocGNSSConstellEnumT_v02)0x04ull) /**< Enable BDS \n */
+#define eQMI_SYSTEM_GAL_V02 ((qmiLocGNSSConstellEnumT_v02)0x08ull) /**< Enable Galileo \n */
+#define eQMI_SYSTEM_QZSS_V02 ((qmiLocGNSSConstellEnumT_v02)0x10ull) /**< Enable QZSS \n */
+#define eQMI_SYSTEM_NAVIC_V02 ((qmiLocGNSSConstellEnumT_v02)0x20ull) /**< Enable NavIC */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCDGNSSCORRECTIONSOURCETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_INVALID_V02 = 0, /**< Invalid DGNSS correction source type \n */
+ eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_RTCM_V02 = 1, /**< DGNSS correction source type RTCM \n */
+ eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_3GPP_V02 = 2, /**< DGNSS correction source type 3GPP */
+ QMILOCDGNSSCORRECTIONSOURCETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocDgnssCorrectionSourceTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the position report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Session Status */
+ qmiLocSessionStatusEnumT_v02 sessionStatus;
+ /**< Session status. Values: \n
+ - eQMI_LOC_SESS_STATUS_SUCCESS (0) -- Session was successful \n
+ - eQMI_LOC_SESS_STATUS_IN_PROGRESS (1) -- Session is still in progress; further position reports are generated
+ until either the fix criteria specified by the client are met or the
+ client response timeout occurs \n
+ - eQMI_LOC_SESS_STATUS_GENERAL_FAILURE (2) -- Session failed \n
+ - eQMI_LOC_SESS_STATUS_TIMEOUT (3) -- Fix request failed because the session timed out \n
+ - eQMI_LOC_SESS_STATUS_USER_END (4) -- Fix request failed because the session was ended by the user \n
+ - eQMI_LOC_SESS_STATUS_BAD_PARAMETER (5) -- Fix request failed due to bad parameters in the request \n
+ - eQMI_LOC_SESS_STATUS_PHONE_OFFLINE (6) -- Fix request failed because the phone is offline \n
+ - eQMI_LOC_SESS_STATUS_ENGINE_LOCKED (7) -- Fix request failed because the engine is locked
+ */
+
+ /* Mandatory */
+ /* Session ID */
+ uint8_t sessionId;
+ /**< ID of the session specified in the QMI_LOC_START_REQ request. \n
+ - Range: 0 to 255 */
+
+ /* Optional */
+ /* Latitude */
+ uint8_t latitude_valid; /**< Must be set to true if latitude is being passed */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ /* Optional */
+ /* Longitude */
+ uint8_t longitude_valid; /**< Must be set to true if longitude is being passed */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ /* Optional */
+ /* Circular Horizontal Position Uncertainty */
+ uint8_t horUncCircular_valid; /**< Must be set to true if horUncCircular is being passed */
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular).\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty (Semi-Minor Axis) */
+ uint8_t horUncEllipseSemiMinor_valid; /**< Must be set to true if horUncEllipseSemiMinor is being passed */
+ float horUncEllipseSemiMinor;
+ /**< Semi-minor axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty (Semi-Major Axis) */
+ uint8_t horUncEllipseSemiMajor_valid; /**< Must be set to true if horUncEllipseSemiMajor is being passed */
+ float horUncEllipseSemiMajor;
+ /**< Semi-major axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Elliptical Horizontal Uncertainty Azimuth */
+ uint8_t horUncEllipseOrientAzimuth_valid; /**< Must be set to true if horUncEllipseOrientAzimuth is being passed */
+ float horUncEllipseOrientAzimuth;
+ /**< Elliptical horizontal uncertainty azimuth of orientation.\n
+ - Units -- Decimal degrees \n
+ - Range -- 0 to 180 */
+
+ /* Optional */
+ /* Horizontal Confidence */
+ uint8_t horConfidence_valid; /**< Must be set to true if horConfidence is being passed */
+ uint8_t horConfidence;
+ /**< Horizontal uncertainty confidence.
+ If both elliptical and horizontal uncertainties are specified in this message,
+ the confidence corresponds to the elliptical uncertainty. \n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Horizontal Reliability */
+ uint8_t horReliability_valid; /**< Must be set to true if horReliability is being passed */
+ qmiLocReliabilityEnumT_v02 horReliability;
+ /**< Specifies the reliability of the horizontal position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Horizontal Speed */
+ uint8_t speedHorizontal_valid; /**< Must be set to true if speedHorizontal is being passed */
+ float speedHorizontal;
+ /**< Horizontal speed.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Speed Uncertainty */
+ uint8_t speedUnc_valid; /**< Must be set to true if speedUnc is being passed */
+ float speedUnc;
+ /**< 3D speed uncertainty.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Altitude With Respect to Ellipsoid */
+ uint8_t altitudeWrtEllipsoid_valid; /**< Must be set to true if altitudeWrtEllipsoid is being passed */
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid.\n
+ - Units -- Meters \n
+ - Range-- -500 to 15883 */
+
+ /* Optional */
+ /* Altitude With Respect to Sea Level */
+ uint8_t altitudeWrtMeanSeaLevel_valid; /**< Must be set to true if altitudeWrtMeanSeaLevel is being passed */
+ float altitudeWrtMeanSeaLevel;
+ /**< Altitude with respect to mean sea level.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Vertical Uncertainty */
+ uint8_t vertUnc_valid; /**< Must be set to true if vertUnc is being passed */
+ float vertUnc;
+ /**< - Units -- Meters */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Vertical Reliability */
+ uint8_t vertReliability_valid; /**< Must be set to true if vertReliability is being passed */
+ qmiLocReliabilityEnumT_v02 vertReliability;
+ /**< Specifies the reliability of the vertical position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Vertical Speed */
+ uint8_t speedVertical_valid; /**< Must be set to true if speedVertical is being passed */
+ float speedVertical;
+ /**< Units -- Meters per second. */
+
+ /* Optional */
+ /* Heading */
+ uint8_t heading_valid; /**< Must be set to true if heading is being passed */
+ float heading;
+ /**< - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ /* Optional */
+ /* Heading Uncertainty */
+ uint8_t headingUnc_valid; /**< Must be set to true if headingUnc is being passed */
+ float headingUnc;
+ /**< - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ /* Optional */
+ /* Magnetic Deviation */
+ uint8_t magneticDeviation_valid; /**< Must be set to true if magneticDeviation is being passed */
+ float magneticDeviation;
+ /**< Difference between the bearing to true north and the bearing shown
+ on a magnetic compass. The deviation is positive when the magnetic
+ north is east of true north. */
+
+ /* Optional */
+ /* Technology Used */
+ uint8_t technologyMask_valid; /**< Must be set to true if technologyMask is being passed */
+ qmiLocPosTechMaskT_v02 technologyMask;
+ /**< Technology used in computing this fix.
+ Valid bitmasks: \n
+ - QMI_LOC_POS_TECH_MASK_SATELLITE (0x00000001) -- Satellites were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_CELLID (0x00000002) -- Cell towers were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_WIFI (0x00000004) -- Wi-Fi access points were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_SENSORS (0x00000008) -- Sensors were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_REFERENCE_LOCATION (0x00000010) -- Reference location was used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION (0x00000020) -- Coarse position injected into the location engine was used to
+ generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_AFLT (0x00000040) -- AFLT was used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_HYBRID (0x00000080) -- GNSS and network-provided measurements were used to
+ generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_DRE (0x00000100) -- Dead reckoning engine (DRE) was used to generate the fix.
+ */
+
+ /* Optional */
+ /* Dilution of Precision */
+ uint8_t DOP_valid; /**< Must be set to true if DOP is being passed */
+ qmiLocDOPStructT_v02 DOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* UTC Timestamp */
+ uint8_t timestampUtc_valid; /**< Must be set to true if timestampUtc is being passed */
+ uint64_t timestampUtc;
+ /**< Units -- Milliseconds since Jan. 1, 1970. */
+
+ /* Optional */
+ /* Leap Seconds */
+ uint8_t leapSeconds_valid; /**< Must be set to true if leapSeconds is being passed */
+ uint8_t leapSeconds;
+ /**< Leap second information. If leapSeconds is not available,
+ timestampUtc is calculated based on a hard-coded value
+ for leap seconds. \n
+ - Units -- Seconds */
+
+ /* Optional */
+ /* GPS Time */
+ uint8_t gpsTime_valid; /**< Must be set to true if gpsTime is being passed */
+ qmiLocGPSTimeStructT_v02 gpsTime;
+ /**< \vspace{0.06in} \n The number of weeks since Jan. 6, 1980, and
+ milliseconds into the current week. */
+
+ /* Optional */
+ /* Time Uncertainty */
+ uint8_t timeUnc_valid; /**< Must be set to true if timeUnc is being passed */
+ float timeUnc;
+ /**< Units -- Milliseconds. */
+
+ /* Optional */
+ /* Time Source */
+ uint8_t timeSrc_valid; /**< Must be set to true if timeSrc is being passed */
+ qmiLocTimeSourceEnumT_v02 timeSrc;
+ /**< Values: \n
+ - eQMI_LOC_TIME_SRC_INVALID (0) -- Invalid time \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TRANSFER (1) -- Time is set by the 1X system \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TAGGING (2) -- Time is set by WCDMA/GSM time tagging (that is,
+ associating network time with GPS time) \n
+ - eQMI_LOC_TIME_SRC_EXTERNAL_INPUT (3) -- Time is set by an external injection \n
+ - eQMI_LOC_TIME_SRC_TOW_DECODE (4) -- Time is set after decoding over-the-air GPS navigation data
+ from one GPS satellite \n
+ - eQMI_LOC_TIME_SRC_TOW_CONFIRMED (5) -- Time is set after decoding over-the-air GPS navigation data
+ from multiple satellites \n
+ - eQMI_LOC_TIME_SRC_TOW_AND_WEEK_CONFIRMED (6) -- Both time of the week and the GPS week number are known \n
+ - eQMI_LOC_TIME_SRC_NAV_SOLUTION (7) -- Time is set by the position engine after the fix is obtained \n
+ - eQMI_LOC_TIME_SRC_SOLVE_FOR_TIME (8) -- Time is set by the position engine after performing SFT;
+ this is done when the clock time uncertainty is large \n
+ - eQMI_LOC_TIME_SRC_GLO_TOW_DECODE (9) -- Time is set after decoding GLO satellites \n
+ - eQMI_LOC_TIME_SRC_TIME_TRANSFORM (10) -- Time is set after transforming the GPS to GLO time \n
+ - eQMI_LOC_TIME_SRC_WCDMA_SLEEP_TIME_TAGGING (11) -- Time is set by the sleep time tag provided by the WCDMA network \n
+ - eQMI_LOC_TIME_SRC_GSM_SLEEP_TIME_TAGGING (12) -- Time is set by the sleep time tag provided by the GSM network \n
+ - eQMI_LOC_TIME_SRC_UNKNOWN (13) -- Source of the time is unknown \n
+ - eQMI_LOC_TIME_SRC_SYSTEM_TIMETICK (14) -- Time is derived from the system clock (better known as the slow clock);
+ GNSS time is maintained irrespective of the GNSS receiver state \n
+ - eQMI_LOC_TIME_SRC_QZSS_TOW_DECODE (15) -- Time is set after decoding QZSS satellites \n
+ - eQMI_LOC_TIME_SRC_BDS_TOW_DECODE (16) -- Time is set after decoding BDS satellites \n
+ - eQMI_LOC_TIME_SRC_GAL_TOW_DECODE (17) -- Time is set after decoding Galileo satellites \n
+ - eQMI_LOC_TIME_SRC_NAVIC_TOW_DECODE (18) -- Time is set after decoding NavIC satellites */
+
+ /* Optional */
+ /* Sensor Data Usage */
+ uint8_t sensorDataUsage_valid; /**< Must be set to true if sensorDataUsage is being passed */
+ qmiLocSensorUsageIndicatorStructT_v02 sensorDataUsage;
+ /**< \vspace{0.06in} \n Indicates whether sensor data was used in computing the position in this
+ position report. */
+
+ /* Optional */
+ /* Fix Count for This Session */
+ uint8_t fixId_valid; /**< Must be set to true if fixId is being passed */
+ uint32_t fixId;
+ /**< Fix count for the session; starts with 0 and increments by one
+ for each successive position report for a particular session. */
+
+ /* Optional */
+ /* SVs Used to Calculate the Fix */
+ uint8_t gnssSvUsedList_valid; /**< Must be set to true if gnssSvUsedList is being passed */
+ uint32_t gnssSvUsedList_len; /**< Must be set to # of elements in gnssSvUsedList */
+ uint16_t gnssSvUsedList[QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02];
+ /**< Each entry in the list contains the SV ID of a satellite
+ used for calculating this position report. The following
+ information is associated with each SV ID: \n
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Altitude Assumed */
+ uint8_t altitudeAssumed_valid; /**< Must be set to true if altitudeAssumed is being passed */
+ uint8_t altitudeAssumed;
+ /**< Indicates whether altitude is assumed or calculated: \n
+ - 0x00 (FALSE) -- Calculated \n
+ - 0x01 (TRUE) -- Assumed; there might not be enough
+ satellites to determine the precise altitude
+ */
+
+ /* Optional */
+ /* Velocity ENU (East, North, Up) */
+ uint8_t velEnu_valid; /**< Must be set to true if velEnu is being passed */
+ float velEnu[QMI_LOC_ENU_ARRAY_LENGTH_V02];
+ /**< East, North, up velocity. \n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Velocity Uncertainty ENU */
+ uint8_t velUncEnu_valid; /**< Must be set to true if velUncEnu is being passed */
+ float velUncEnu[QMI_LOC_ENU_ARRAY_LENGTH_V02];
+ /**< East, North, up velocity uncertainty. \n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Navigation solution */
+ uint8_t navSolutionMask_valid; /**< Must be set to true if navSolutionMask is being passed */
+ qmiLocNavSolutionMaskT_v02 navSolutionMask;
+ /**< Navigation solutions that are used to calculate
+ the GNSS position report.
+ Valid bitmasks specifying whether the following is used: \n
+ - QMI_LOC_NAV_MASK_SBAS_CORRECTION_IONO (0x00000001) -- Indicates SBAS ionospheric correction \n
+ - QMI_LOC_NAV_MASK_SBAS_CORRECTION_FAST (0x00000002) -- Indicates SBAS fast correction \n
+ - QMI_LOC_NAV_MASK_SBAS_CORRECTION_LONG (0x00000004) -- Indicates long-tem correction \n
+ - QMI_LOC_NAV_MASK_SBAS_INTEGRITY (0x00000008) -- Indicates SBAS integrity information \n
+ - QMI_LOC_NAV_MASK_CORRECTION_DGNSS (0x00000010) -- Indicates DGNSS information is used \n
+ - QMI_LOC_NAV_MASK_ONLY_SBAS_CORRECTED_SV_USED (0x00000020) -- Only SBAS corrected SVs are used for the fix; \n
+ if mask is not set, all-in-view SVs are used for fix
+ */
+
+ /* Optional */
+ /* Sensor Subtechnology Information */
+ uint8_t sensorSubTechnologyMask_valid; /**< Must be set to true if sensorSubTechnologyMask is being passed */
+ qmiLocSensorSubTechnologyMaskT_v02 sensorSubTechnologyMask;
+ /**< Valid bitmasks: \n
+ - QMI_LOC_SENSOR_SUB_MASK_PDR_ENABLED (0x00000001) -- Indicates whether PDR is enabled \n
+ - QMI_LOC_SENSOR_SUB_MASK_PEDOMETER_ENABLED (0x00000002) -- Indicates whether a pedometer was used \n
+ - QMI_LOC_SENSOR_SUB_MASK_VEHICULAR_ENABLED (0x00000004) -- Indicates whether vehicular sensor assistance is enabled
+ */
+
+ /* Optional */
+ /* GNSS Only Position Report */
+ uint8_t gnssOnlyPosition_valid; /**< Must be set to true if gnssOnlyPosition is being passed */
+ uint8_t gnssOnlyPosition;
+ /**< Indicates whether this position report is generated from GNSS only technology.
+ Values: \n
+ - 0x00 (FALSE) -- Generated with other technologies (default) \n
+ - 0x01 (TRUE) -- Generated from GNSS technology only
+ */
+
+ /* Optional */
+ /* Extended Dilution of Precision */
+ uint8_t extDOP_valid; /**< Must be set to true if extDOP is being passed */
+ qmiLocExtDOPStructT_v02 extDOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* Differential correction source ID */
+ uint8_t dgnssStationId_valid; /**< Must be set to true if dgnssStationId is being passed */
+ uint32_t dgnssStationId_len; /**< Must be set to # of elements in dgnssStationId */
+ uint16_t dgnssStationId[QMI_LOC_DGNSS_STATION_ID_ARRAY_LENGTH_V02];
+ /**< List of DGNSS station IDs providing corrections. \n
+ Range: \n
+ - SBAS -- 120 to 158 and 183 to 191. \n
+ - Monitoring station -- 1000-2023 (Station ID biased by 1000). \n
+ - Other values reserved.
+ */
+
+ /* Optional */
+ /* Spoof Report */
+ uint8_t spoofReportMask_valid; /**< Must be set to true if spoofReportMask is being passed */
+ qmiLocSpoofMaskT_v02 spoofReportMask;
+ /**< The set bit indicates the domain that is suspected to be spoofed.
+ Valid bitmasks: \n
+ - QMI_LOC_POSITION_SPOOFED (0x00000001) -- Position \n
+ - QMI_LOC_TIME_SPOOFED (0x00000002) -- Time \n
+ - QMI_LOC_NAVIGATION_DATA_SPOOFED (0x00000004) -- Navigation data
+ */
+
+ /* Optional */
+ /* Expanded SVs Used to Calculate the Fix */
+ uint8_t expandedGnssSvUsedList_valid; /**< Must be set to true if expandedGnssSvUsedList is being passed */
+ uint32_t expandedGnssSvUsedList_len; /**< Must be set to # of elements in expandedGnssSvUsedList */
+ uint16_t expandedGnssSvUsedList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< If the service reports expandedGnssSvUsedList, gnssSvUsedList is
+ not reported. Each entry in the list contains the SV ID of a satellite
+ used to calculate this position report. The following
+ information is associated with each SV ID. \n
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* SVs Signal Types in the SVs Used list */
+ uint8_t gnssSvUsedSignalTypeList_valid; /**< Must be set to true if gnssSvUsedSignalTypeList is being passed */
+ uint32_t gnssSvUsedSignalTypeList_len; /**< Must be set to # of elements in gnssSvUsedSignalTypeList */
+ qmiLocGnssSignalTypeMaskT_v02 gnssSvUsedSignalTypeList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the signal type of each satellite in expandedGnssSvUsedList. The
+ signal type list is aligned with the SVs in expandedGnssSvUsedList. Value of 0
+ means invalid.
+ Valid bitmasks: \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band
+ */
+
+ /* Optional */
+ /* Jammer Indicator of each GNSS Signal */
+ uint8_t jammerIndicatorList_valid; /**< Must be set to true if jammerIndicatorList is being passed */
+ uint32_t jammerIndicatorList_len; /**< Must be set to # of elements in jammerIndicatorList */
+ qmiLocJammerIndicatorStructT_v02 jammerIndicatorList[QMI_LOC_MAX_GNSS_SIGNAL_TYPE_V02];
+ /**< Indicates the jammer indicator of each signal.
+ */
+
+ /* Optional */
+ /* DGNSS Correction Source */
+ uint8_t dgnssCorrectionSource_valid; /**< Must be set to true if dgnssCorrectionSource is being passed */
+ qmiLocDgnssCorrectionSourceTypeEnumT_v02 dgnssCorrectionSource;
+ /**< DGNSS correction source for position report.\n
+ - eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_INVALID (0) -- Invalid DGNSS correction source type \n
+ - eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_RTCM (1) -- DGNSS correction source type RTCM \n
+ - eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_3GPP (2) -- DGNSS correction source type 3GPP
+ */
+
+ /* Optional */
+ /* DGNSS Correction Source ID */
+ uint8_t dgnssCorrectionSourceID_valid; /**< Must be set to true if dgnssCorrectionSourceID is being passed */
+ uint32_t dgnssCorrectionSourceID;
+ /**< SourceID is a 32-bit number identifying the DGNSS source ID for position report.
+ */
+
+ /* Optional */
+ /* DGNSS Constellation Usage */
+ uint8_t dgnssConstellationUsage_valid; /**< Must be set to true if dgnssConstellationUsage is being passed */
+ qmiLocGNSSConstellEnumT_v02 dgnssConstellationUsage;
+ /**< Constellation mask providing the constellations used
+ along with DGNSS to produce the position report.
+ */
+
+ /* Optional */
+ /* DGNSS Reference Station ID */
+ uint8_t dgnssRefStationId_valid; /**< Must be set to true if dgnssRefStationId is being passed */
+ uint16_t dgnssRefStationId;
+ /**< Reference station ID used to produce the position report.
+ Range: \n
+ - 0 -- 4095
+ */
+
+ /* Optional */
+ /* DGNSS Data Age */
+ uint8_t dgnssDataAgeMsec_valid; /**< Must be set to true if dgnssDataAgeMsec is being passed */
+ uint32_t dgnssDataAgeMsec;
+ /**< Age of differential data in milliseconds with reference to the fix time.
+ */
+
+ /* Optional */
+ /* Conformity Index */
+ uint8_t conformityIndex_valid; /**< Must be set to true if conformityIndex is being passed */
+ float conformityIndex;
+ /**< Indicates how well the various input data considered for navigation solution conforms to expectations. \n
+ - Range -- 0 (least conforming) to 1 (most conforming)
+ */
+
+ /* Optional */
+ /* System Tick at GPS Time */
+ uint8_t systemTick_valid; /**< Must be set to true if systemTick is being passed */
+ uint64_t systemTick;
+ /**< System tick at GPS time of week. */
+
+ /* Optional */
+ /* Uncertainty for System Tick at GPS Time */
+ uint8_t systemTickUnc_valid; /**< Must be set to true if systemTickUnc is being passed */
+ float systemTickUnc;
+ /**< Uncertainty for system tick at GPS time of week. \n
+ - Units -- milliseconds
+ */
+
+ /* Optional */
+ /* System Clock Time Bias */
+ uint8_t systemClkTimeBias_valid; /**< Must be set to true if systemClkTimeBias is being passed */
+ float systemClkTimeBias;
+ /**< System clock time bias (submilliseconds). \n
+ - Units -- Milliseconds
+ (system time = systemMsec - systemClkTimeBias)
+ */
+
+ /* Optional */
+ /* Uncertainty for System Clock Time Bias */
+ uint8_t systemClkTimeBiasUnc_valid; /**< Must be set to true if systemClkTimeBiasUnc is being passed */
+ float systemClkTimeBiasUnc;
+ /**< Single-sided maximum time bias uncertainty.\n
+ - Units -- Milliseconds
+ */
+}qmiLocEventPositionReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSVSYSTEMENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SV_SYSTEM_GPS_V02 = 1, /**< GPS satellite \n */
+ eQMI_LOC_SV_SYSTEM_GALILEO_V02 = 2, /**< Galileo satellite \n */
+ eQMI_LOC_SV_SYSTEM_SBAS_V02 = 3, /**< SBAS satellite \n */
+ eQMI_LOC_SV_SYSTEM_COMPASS_V02 = 4, /**< COMPASS satellite (Deprecated) \n */
+ eQMI_LOC_SV_SYSTEM_GLONASS_V02 = 5, /**< GLONASS satellite \n */
+ eQMI_LOC_SV_SYSTEM_BDS_V02 = 6, /**< BDS satellite \n */
+ eQMI_LOC_SV_SYSTEM_QZSS_V02 = 7, /**< QZSS satellite \n */
+ eQMI_LOC_SV_SYSTEM_NAVIC_V02 = 8, /**< NavIC satellite */
+ QMILOCSVSYSTEMENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSvSystemEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSVSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SV_STATUS_IDLE_V02 = 1, /**< SV is not being actively processed \n */
+ eQMI_LOC_SV_STATUS_SEARCH_V02 = 2, /**< The system is searching for this SV \n */
+ eQMI_LOC_SV_STATUS_TRACK_V02 = 3, /**< SV is being tracked */
+ QMILOCSVSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSvStatusEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocSvInfoValidMaskT_v02;
+#define QMI_LOC_SV_INFO_MASK_VALID_SYSTEM_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000001) /**< System field is valid in SV information */
+#define QMI_LOC_SV_INFO_MASK_VALID_GNSS_SVID_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000002) /**< gnssSvId field is valid in SV information */
+#define QMI_LOC_SV_INFO_MASK_VALID_HEALTH_STATUS_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000004) /**< healthStatus field is valid in SV information */
+#define QMI_LOC_SV_INFO_MASK_VALID_PROCESS_STATUS_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000008) /**< processStatus field is valid in SV information */
+#define QMI_LOC_SV_INFO_MASK_VALID_SVINFO_MASK_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000010) /**< svInfoMask field is valid in SV information */
+#define QMI_LOC_SV_INFO_MASK_VALID_ELEVATION_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000020) /**< Elevation field is valid in SV information */
+#define QMI_LOC_SV_INFO_MASK_VALID_AZIMUTH_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000040) /**< Azimuth field is valid in SV information */
+#define QMI_LOC_SV_INFO_MASK_VALID_SNR_V02 ((qmiLocSvInfoValidMaskT_v02)0x00000080) /**< SNR field is valid in SV information */
+typedef uint8_t qmiLocSvInfoMaskT_v02;
+#define QMI_LOC_SVINFO_MASK_HAS_EPHEMERIS_V02 ((qmiLocSvInfoMaskT_v02)0x01) /**< Ephemeris is available for this SV */
+#define QMI_LOC_SVINFO_MASK_HAS_ALMANAC_V02 ((qmiLocSvInfoMaskT_v02)0x02) /**< Almanac is available for this SV */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSvInfoValidMaskT_v02 validMask;
+ /**< Bitmask indicating which of the fields in this TLV are valid.\n
+ Valid bitmasks:
+ - QMI_LOC_SV_INFO_MASK_VALID_SYSTEM (0x00000001) -- System field is valid in SV information
+ - QMI_LOC_SV_INFO_MASK_VALID_GNSS_SVID (0x00000002) -- gnssSvId field is valid in SV information
+ - QMI_LOC_SV_INFO_MASK_VALID_HEALTH_STATUS (0x00000004) -- healthStatus field is valid in SV information
+ - QMI_LOC_SV_INFO_MASK_VALID_PROCESS_STATUS (0x00000008) -- processStatus field is valid in SV information
+ - QMI_LOC_SV_INFO_MASK_VALID_SVINFO_MASK (0x00000010) -- svInfoMask field is valid in SV information
+ - QMI_LOC_SV_INFO_MASK_VALID_ELEVATION (0x00000020) -- Elevation field is valid in SV information
+ - QMI_LOC_SV_INFO_MASK_VALID_AZIMUTH (0x00000040) -- Azimuth field is valid in SV information
+ - QMI_LOC_SV_INFO_MASK_VALID_SNR (0x00000080) -- SNR field is valid in SV information */
+
+ qmiLocSvSystemEnumT_v02 system;
+ /**< Indicates to which constellation this SV belongs.\n
+ Values: \n
+ - eQMI_LOC_SV_SYSTEM_GPS (1) -- GPS satellite \n
+ - eQMI_LOC_SV_SYSTEM_GALILEO (2) -- Galileo satellite \n
+ - eQMI_LOC_SV_SYSTEM_SBAS (3) -- SBAS satellite \n
+ - eQMI_LOC_SV_SYSTEM_COMPASS (4) -- COMPASS satellite (Deprecated) \n
+ - eQMI_LOC_SV_SYSTEM_GLONASS (5) -- GLONASS satellite \n
+ - eQMI_LOC_SV_SYSTEM_BDS (6) -- BDS satellite \n
+ - eQMI_LOC_SV_SYSTEM_QZSS (7) -- QZSS satellite \n
+ - eQMI_LOC_SV_SYSTEM_NAVIC (8) -- NavIC satellite
+ */
+
+ uint16_t gnssSvId;
+ /**< GNSS SV ID.
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 1 to 32 \n
+ - SBAS -- 120 to 158 and 183 to 191 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414 \n
+
+ The GPS and GLONASS SVs can be disambiguated using the system field. */
+
+ uint8_t healthStatus;
+ /**< Health status.
+ Range -- 0 to 1 \n
+ - 0 -- Unhealthy \n
+ - 1 -- Healthy
+ */
+
+ qmiLocSvStatusEnumT_v02 svStatus;
+ /**< SV processing status.
+ Values: \n
+ - eQMI_LOC_SV_STATUS_IDLE (1) -- SV is not being actively processed \n
+ - eQMI_LOC_SV_STATUS_SEARCH (2) -- The system is searching for this SV \n
+ - eQMI_LOC_SV_STATUS_TRACK (3) -- SV is being tracked
+ */
+
+ qmiLocSvInfoMaskT_v02 svInfoMask;
+ /**< Indicates whether almanac and ephemeris information is available. \n
+ Valid bitmasks:\n
+ - 0x01 -- SVINFO_HAS_EPHEMERIS \n
+ - 0x02 -- SVINFO_HAS_ALMANAC
+ */
+
+ float elevation;
+ /**< SV elevation angle.\n
+ - Units -- Degrees \n
+ - Range -- 0 to 90 */
+
+ float azimuth;
+ /**< SV azimuth angle.\n
+ - Units -- Degrees \n
+ - Range -- 0 to 360 */
+
+ float snr;
+ /**< SV signal-to-noise ratio at antenna. \n
+ - Units -- dB-Hz */
+}qmiLocSvInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSvInfoStructT_v02 svInfo;
+ /**< SV information. */
+
+ uint8_t gloFrequency;
+ /**< GLONASS frequency number + 8.
+ Valid only for GLONASS systems and
+ must be ignored for all other systems. \n
+ - Range -- 1 to 14
+ */
+}qmiLocExpandedSvInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a satellite report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Altitude Assumed */
+ uint8_t altitudeAssumed;
+ /**< Indicates whether altitude is assumed or calculated: \n
+ - 0x00 (FALSE) -- Valid altitude is calculated \n
+ - 0x01 (TRUE) -- Valid altitude is assumed; there might not be
+ enough satellites to determine precise altitude
+ */
+
+ /* Optional */
+ /* Satellite Information */
+ uint8_t svList_valid; /**< Must be set to true if svList is being passed */
+ uint32_t svList_len; /**< Must be set to # of elements in svList */
+ qmiLocSvInfoStructT_v02 svList[QMI_LOC_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< \vspace{0.06in} \n SV information list. */
+
+ /* Optional */
+ /* Expanded Satellite Information */
+ uint8_t expandedSvList_valid; /**< Must be set to true if expandedSvList is being passed */
+ uint32_t expandedSvList_len; /**< Must be set to # of elements in expandedSvList */
+ qmiLocExpandedSvInfoStructT_v02 expandedSvList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< \vspace{0.06in} \n Expanded SV information list. If the service reports
+ expandedSvList, svList is not reported.*/
+
+ /* Optional */
+ /* Satellite Signal Type */
+ uint8_t gnssSignalTypeList_valid; /**< Must be set to true if gnssSignalTypeList is being passed */
+ uint32_t gnssSignalTypeList_len; /**< Must be set to # of elements in gnssSignalTypeList */
+ qmiLocGnssSignalTypeMaskT_v02 gnssSignalTypeList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the signal type of each satellite in expandedSvList. The
+ signal type list is aligned with the SVs in svList. Value of 0 means
+ invalid.
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band */
+
+ /* Optional */
+ /* RF Loss from Antenna to Baseband */
+ uint8_t rfLoss_valid; /**< Must be set to true if rfLoss is being passed */
+ uint32_t rfLoss_len; /**< Must be set to # of elements in rfLoss */
+ float rfLoss[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the RF loss from antenna to baseband of each satellite in expandedSvList.
+ rfLoss is aligned with the SVs in expandedSvList.\n
+ - Units -- dB-Hz \n
+ */
+}qmiLocEventGnssSvInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends NMEA sentences to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* NMEA String */
+ char nmea[QMI_LOC_NMEA_STRING_MAX_LENGTH_V02 + 1];
+ /**< NMEA string. \n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL-terminator) -- 201
+ */
+
+ /* Optional */
+ /* Expanded NMEA String */
+ uint8_t expandedNmea_valid; /**< Must be set to true if expandedNmea is being passed */
+ char expandedNmea[QMI_LOC_EXPANDED_NMEA_STRING_MAX_LENGTH_V02 + 1];
+ /**< Expanded NMEA string; when the service reports expandedNmea, the
+ mandatory NMEA string is empty. \n
+ - Type -- NULL-terminated string \n
+ - Expanded maximum string length (including NULL-terminator) -- 4096
+ */
+}qmiLocEventNmeaIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNINOTIFYVERIFYENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_USER_NO_NOTIFY_NO_VERIFY_V02 = 1, /**< No notification and no verification required \n */
+ eQMI_LOC_NI_USER_NOTIFY_ONLY_V02 = 2, /**< Notify only; no verification required \n */
+ eQMI_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP_V02 = 3, /**< Notify and verify, but no response required. \n */
+ eQMI_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP_V02 = 4, /**< Notify and verify, and require a response \n */
+ eQMI_LOC_NI_USER_NOTIFY_VERIFY_PRIVACY_OVERRIDE_V02 = 5, /**< Notify and verify; privacy override */
+ QMILOCNINOTIFYVERIFYENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiNotifyVerifyEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNIVXPOSMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_VX_MS_ASSISTED_ONLY_V02 = 1, /**< MS-assisted only allowed \n */
+ eQMI_LOC_NI_VX_MS_BASED_ONLY_V02 = 2, /**< MS-based only allowed \n */
+ eQMI_LOC_NI_VX_MS_ASSISTED_PREFERRED_MS_BASED_ALLOWED_V02 = 3, /**< MS-assisted preferred, but MS-based allowed \n */
+ eQMI_LOC_NI_VX_MS_BASED_PREFERRED_MS_ASSISTED_ALLOWED_V02 = 4, /**< MS-based preferred, but MS-assisted allowed */
+ QMILOCNIVXPOSMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiVxPosModeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNIVXREQUESTORIDENCODINGSCHEMEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_VX_OCTET_V02 = 0, /**< Encoding is Octet \n */
+ eQMI_LOC_NI_VX_EXN_PROTOCOL_MSG_V02 = 1, /**< Encoding is EXN protocol message \n */
+ eQMI_LOC_NI_VX_ASCII_V02 = 2, /**< Encoding is ASCII \n */
+ eQMI_LOC_NI_VX_IA5_V02 = 3, /**< Encoding is IA5 \n */
+ eQMI_LOC_NI_VX_UNICODE_V02 = 4, /**< Encoding is Unicode \n */
+ eQMI_LOC_NI_VX_SHIFT_JIS_V02 = 5, /**< Encoding is Shift JIS \n */
+ eQMI_LOC_NI_VX_KOREAN_V02 = 6, /**< Encoding is Korean \n */
+ eQMI_LOC_NI_VX_LATIN_HEBREW_V02 = 7, /**< Encoding is Latin Hebrew \n */
+ eQMI_LOC_NI_VX_LATIN_V02 = 8, /**< Encoding is Latin \n */
+ eQMI_LOC_NI_VX_GSM_V02 = 9, /**< Encoding is GSM */
+ QMILOCNIVXREQUESTORIDENCODINGSCHEMEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiVxRequestorIdEncodingSchemeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t posQosIncl;
+ /**< Indicates whether quality of service is included:\n
+ - 0x01 (TRUE) -- QoS is included \n
+ - 0x00 (FALSE) -- QoS is not included */
+
+ uint8_t posQos;
+ /**< Position QoS timeout. \n
+ - Units -- Seconds \n
+ - Range-- 0 to 255 */
+
+ uint32_t numFixes;
+ /**< Number of fixes allowed. */
+
+ uint32_t timeBetweenFixes;
+ /**< Time between fixes. \n
+ - Units -- Seconds */
+
+ qmiLocNiVxPosModeEnumT_v02 posMode;
+ /**< Position mode.
+ Values: \n
+ - eQMI_LOC_NI_VX_MS_ASSISTED_ONLY (1) -- MS-assisted only allowed \n
+ - eQMI_LOC_NI_VX_MS_BASED_ONLY (2) -- MS-based only allowed \n
+ - eQMI_LOC_NI_VX_MS_ASSISTED_PREFERRED_MS_BASED_ALLOWED (3) -- MS-assisted preferred, but MS-based allowed \n
+ - eQMI_LOC_NI_VX_MS_BASED_PREFERRED_MS_ASSISTED_ALLOWED (4) -- MS-based preferred, but MS-assisted allowed
+ */
+
+ qmiLocNiVxRequestorIdEncodingSchemeEnumT_v02 encodingScheme;
+ /**< VX encoding scheme.
+ Values:\n
+ - eQMI_LOC_NI_VX_OCTET (0) -- Encoding is Octet \n
+ - eQMI_LOC_NI_VX_EXN_PROTOCOL_MSG (1) -- Encoding is EXN protocol message \n
+ - eQMI_LOC_NI_VX_ASCII (2) -- Encoding is ASCII \n
+ - eQMI_LOC_NI_VX_IA5 (3) -- Encoding is IA5 \n
+ - eQMI_LOC_NI_VX_UNICODE (4) -- Encoding is Unicode \n
+ - eQMI_LOC_NI_VX_SHIFT_JIS (5) -- Encoding is Shift JIS \n
+ - eQMI_LOC_NI_VX_KOREAN (6) -- Encoding is Korean \n
+ - eQMI_LOC_NI_VX_LATIN_HEBREW (7) -- Encoding is Latin Hebrew \n
+ - eQMI_LOC_NI_VX_LATIN (8) -- Encoding is Latin \n
+ - eQMI_LOC_NI_VX_GSM (9) -- Encoding is GSM
+ */
+
+ uint32_t requestorId_len; /**< Must be set to # of elements in requestorId */
+ uint8_t requestorId[QMI_LOC_NI_MAX_REQUESTOR_ID_LENGTH_V02];
+ /**< Requestor ID. \n
+ - Type: Array of bytes \n
+ - Maximum array length: 200
+ */
+
+ uint16_t userRespTimerInSeconds;
+ /**< Time to wait for the user to respond. \n
+ - Units -- Seconds */
+}qmiLocNiVxNotifyVerifyStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNISUPLPOSMETHODENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETASSISTED_V02 = 1, /**< Set assisted \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETBASED_V02 = 2, /**< Set based \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETASSISTED_PREF_V02 = 3, /**< Set assisted preferred \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETBASED_PREF_V02 = 4, /**< Set based preferred \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_AUTONOMOUS_GPS_V02 = 5, /**< Standalone GPS \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_AFLT_V02 = 6, /**< Advanced forward link trilateration \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_ECID_V02 = 7, /**< Exclusive chip ID \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_EOTD_V02 = 8, /**< Enhanced observed time difference \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_OTDOA_V02 = 9, /**< Observed time delay of arrival \n */
+ eQMI_LOC_NI_SUPL_POSMETHOD_NO_POSITION_V02 = 10, /**< No position */
+ QMILOCNISUPLPOSMETHODENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiSuplPosMethodEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNIDATACODINGSCHEMEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_SS_GERMAN_V02 = 12, /**< Language is German \n */
+ eQMI_LOC_NI_SS_ENGLISH_V02 = 13, /**< Language is English \n */
+ eQMI_LOC_NI_SS_ITALIAN_V02 = 14, /**< Language is Italian \n */
+ eQMI_LOC_NI_SS_FRENCH_V02 = 15, /**< Language is French \n */
+ eQMI_LOC_NI_SS_SPANISH_V02 = 16, /**< Language is Spanish \n */
+ eQMI_LOC_NI_SS_DUTCH_V02 = 17, /**< Language is Dutch \n */
+ eQMI_LOC_NI_SS_SWEDISH_V02 = 18, /**< Language is Swedish \n */
+ eQMI_LOC_NI_SS_DANISH_V02 = 19, /**< Language is Danish \n */
+ eQMI_LOC_NI_SS_PORTUGUESE_V02 = 20, /**< Language is Portuguese \n */
+ eQMI_LOC_NI_SS_FINNISH_V02 = 21, /**< Language is Finnish \n */
+ eQMI_LOC_NI_SS_NORWEGIAN_V02 = 22, /**< Language is Norwegian \n */
+ eQMI_LOC_NI_SS_GREEK_V02 = 23, /**< Language is Greek \n */
+ eQMI_LOC_NI_SS_TURKISH_V02 = 24, /**< Language is Turkish \n */
+ eQMI_LOC_NI_SS_HUNGARIAN_V02 = 25, /**< Language is Hungarian \n */
+ eQMI_LOC_NI_SS_POLISH_V02 = 26, /**< Language is Polish \n */
+ eQMI_LOC_NI_SS_LANGUAGE_UNSPEC_V02 = 27, /**< Language is unspecified \n */
+ eQMI_LOC_NI_SUPL_UTF8_V02 = 28, /**< Encoding is UTF 8 \n */
+ eQMI_LOC_NI_SUPL_UCS2_V02 = 29, /**< Encoding is UCS 2 \n */
+ eQMI_LOC_NI_SUPL_GSM_DEFAULT_V02 = 30, /**< Encoding is GSM default */
+ QMILOCNIDATACODINGSCHEMEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiDataCodingSchemeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNISUPLFORMATENUMTYPE_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_SUPL_FORMAT_LOGICAL_NAME_V02 = 0, /**< SUPL logical name format \n */
+ eQMI_LOC_NI_SUPL_FORMAT_EMAIL_ADDRESS_V02 = 1, /**< SUPL email address format \n */
+ eQMI_LOC_NI_SUPL_FORMAT_MSISDN_V02 = 2, /**< SUPL MS-ISDN format \n */
+ eQMI_LOC_NI_SUPL_FORMAT_URL_V02 = 3, /**< SUPL URL format \n */
+ eQMI_LOC_NI_SUPL_FORMAT_SIP_URL_V02 = 4, /**< SUPL SIP URL format \n */
+ eQMI_LOC_NI_SUPL_FORMAT_MIN_V02 = 5, /**< SUPL MIN format \n */
+ eQMI_LOC_NI_SUPL_FORMAT_MDN_V02 = 6, /**< SUPL MDN format \n */
+ eQMI_LOC_NI_SUPL_FORMAT_IMSPUBLIC_IDENTITY_V02 = 7, /**< SUPL IMS public identity \n */
+ eQMI_LOC_NI_SUPL_FORMAT_OSS_UNKNOWN_V02 = 2147483647, /**< SUPL unknown format */
+ QMILOCNISUPLFORMATENUMTYPE_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiSuplFormatEnumType_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocNiSuplFormatEnumType_v02 formatType;
+ /**< Format of the formatted string.
+ Values: \n
+ - eQMI_LOC_NI_SUPL_FORMAT_LOGICAL_NAME (0) -- SUPL logical name format \n
+ - eQMI_LOC_NI_SUPL_FORMAT_EMAIL_ADDRESS (1) -- SUPL email address format \n
+ - eQMI_LOC_NI_SUPL_FORMAT_MSISDN (2) -- SUPL MS-ISDN format \n
+ - eQMI_LOC_NI_SUPL_FORMAT_URL (3) -- SUPL URL format \n
+ - eQMI_LOC_NI_SUPL_FORMAT_SIP_URL (4) -- SUPL SIP URL format \n
+ - eQMI_LOC_NI_SUPL_FORMAT_MIN (5) -- SUPL MIN format \n
+ - eQMI_LOC_NI_SUPL_FORMAT_MDN (6) -- SUPL MDN format \n
+ - eQMI_LOC_NI_SUPL_FORMAT_IMSPUBLIC_IDENTITY (7) -- SUPL IMS public identity \n
+ - eQMI_LOC_NI_SUPL_FORMAT_OSS_UNKNOWN (2147483647) -- SUPL unknown format
+ */
+
+ uint32_t formattedString_len; /**< Must be set to # of elements in formattedString */
+ uint8_t formattedString[QMI_LOC_NI_MAX_CLIENT_NAME_LENGTH_V02];
+ /**< Formatted string. \n
+ - Type -- Byte array \n
+ - Maximum string length -- 64
+ */
+}qmiLocNiSuplFormattedStringStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocSuplQopValidMaskT_v02;
+#define QMI_LOC_NI_SUPL_MASK_QOP_HORZ_ACC_VALID_V02 ((qmiLocSuplQopValidMaskT_v02)0x01) /**< Horizontal accuracy is valid in the Quality of Position (QoP) \n */
+#define QMI_LOC_NI_SUPL_MASK_QOP_VER_ACC_VALID_V02 ((qmiLocSuplQopValidMaskT_v02)0x02) /**< Vertical accuracy is valid in the QoP \n */
+#define QMI_LOC_NI_SUPL_MASK_QOP_MAXAGE_VALID_V02 ((qmiLocSuplQopValidMaskT_v02)0x04) /**< Vertical accuracy is valid in the QoP \n */
+#define QMI_LOC_NI_SUPL_MASK_QOP_DELAY_VALID_V02 ((qmiLocSuplQopValidMaskT_v02)0x08) /**< Vertical accuracy is valid in the QoP */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSuplQopValidMaskT_v02 validMask;
+ /**< Bit field indicating which fields are valid in this value.
+ Valid bitmasks: \n
+ - 0x01 -- QOP_HORZ_ACC_VALID \n
+ - 0x02 -- QOP_VER_ACC_VALID \n
+ - 0x04 -- QOP_MAXAGE_VALID \n
+ - 0x08 -- QOP_DELAY_VALID*/
+
+ uint8_t horizontalAccuracy;
+ /**< Horizontal accuracy. \n
+ - Units -- Meters */
+
+ uint8_t verticalAccuracy;
+ /**< Vertical accuracy. \n
+ - Units -- Meters */
+
+ uint16_t maxLocAge;
+ /**< Maximum age of the location if the engine sends a previously
+ computed position. \n
+ - Units -- Seconds */
+
+ uint8_t delay;
+ /**< Delay the server is willing to tolerate for the fix. \n
+ - Units -- Seconds */
+}qmiLocNiSuplQopStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocServerAddrTypeMaskT_v02;
+#define QMI_LOC_SERVER_ADDR_TYPE_IPV4_MASK_V02 ((qmiLocServerAddrTypeMaskT_v02)0x01) /**< IPv4 \n */
+#define QMI_LOC_SERVER_ADDR_TYPE_IPV6_MASK_V02 ((qmiLocServerAddrTypeMaskT_v02)0x02) /**< IPv6 \n */
+#define QMI_LOC_SERVER_ADDR_TYPE_URL_MASK_V02 ((qmiLocServerAddrTypeMaskT_v02)0x04) /**< URL */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t addr;
+ /**< IPv4 address. */
+
+ uint16_t port;
+ /**< IPv4 port. */
+}qmiLocIpV4AddrStructType_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t addr[QMI_LOC_IPV6_ADDR_LENGTH_V02];
+ /**< IPv6 address. \n
+ - Type -- Array of unsigned integers \n
+ - Maximum length of the array -- 8 */
+
+ uint32_t port;
+ /**< IPv6 port. */
+}qmiLocIpV6AddrStructType_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocServerAddrTypeMaskT_v02 suplServerAddrTypeMask;
+ /**< Mask specifying the valid fields in this value.
+ Valid bitmasks: \n
+ - QMI_LOC_SERVER_ADDR_TYPE_IPV4_MASK (0x01) -- IPv4 \n
+ - QMI_LOC_SERVER_ADDR_TYPE_IPV6_MASK (0x02) -- IPv6 \n
+ - QMI_LOC_SERVER_ADDR_TYPE_URL_MASK (0x04) -- URL
+ */
+
+ qmiLocIpV4AddrStructType_v02 ipv4Addr;
+ /**< IPv4 address and port. */
+
+ qmiLocIpV6AddrStructType_v02 ipv6Addr;
+ /**< IPv6 address and port. */
+
+ char urlAddr[QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02 + 1];
+ /**< URL.\n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 256
+ */
+}qmiLocNiSuplServerInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocNiSuplNotifyVerifyValidMaskT_v02;
+#define QMI_LOC_SUPL_SERVER_INFO_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000001) /**< Indicates presence of the server information
+ in an NI SUPL Notify/Verify request event. This mask is set in
+ the valid_flags field of a Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_SESSION_ID_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000002) /**< Indicates presence of the SUPL session ID
+ in an NI SUPL Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_HASH_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000004) /**< Indicates presence of the SUPL hash
+ in an NI Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_POS_METHOD_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000008) /**< Indicates presence of the position method
+ in an NI SUPL Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_DATA_CODING_SCHEME_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000010) /**< Indicates presence of the data coding scheme
+ in an NI SUPL Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_REQUESTOR_ID_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000020) /**< Indicates presence of the requestor ID
+ in an NI Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_CLIENT_NAME_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000040) /**< Indicates presence of the requestor ID
+ in an NI Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_QOP_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000080) /**< Indicates presence of the quality of position
+ in an NI Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_SUPL_USER_RESP_TIMER_MASK_V02 ((qmiLocNiSuplNotifyVerifyValidMaskT_v02)0x00000100) /**< Mask indicating that the user response timer
+ is present in an NI Notify/Verify request event.
+ This mask is set in the valid_flags field of a
+ Notify/Verify structure. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocNiSuplNotifyVerifyValidMaskT_v02 valid_flags;
+ /**< Indicates which of the following fields are present in this value.
+ Valid bitmasks: \n
+ - 0x00000001 -- SUPL_SERVER_INFO \n
+ - 0x00000002 -- SUPL_SESSION_ID \n
+ - 0x00000004 -- SUPL_HASH \n
+ - 0x00000008 -- SUPL_POS_METHOD \n
+ - 0x00000010 -- SUPL_DATA_ CODING_SCHEME \n
+ - 0x00000020 -- SUPL_REQUESTOR_ ID \n
+ - 0x00000040 -- SUPL_CLIENT_ NAME \n
+ - 0x00000080 -- SUPL_QOP \n
+ - 0x00000100 -- SUPL_USER_RESP_ TIMER
+ */
+
+ qmiLocNiSuplServerInfoStructT_v02 suplServerInfo;
+ /**< SUPL server information. */
+
+ uint8_t suplSessionId[QMI_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH_V02];
+ /**< SUPL session ID. \n
+ - Type -- Array of unsigned integers \n
+ - Maximum length of the array -- 4 */
+
+ uint8_t suplHash[QMI_LOC_NI_SUPL_HASH_LENGTH_V02];
+ /**< Hash for SUPL_INIT; validates that the message is not
+ corrupt. \n
+ - Type -- Array of unsigned integers \n
+ - Length of the array -- 8 */
+
+ qmiLocNiSuplPosMethodEnumT_v02 posMethod;
+ /**< GPS mode to use for the fix.
+ Values: \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETASSISTED (1) -- Set assisted \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETBASED (2) -- Set based \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETASSISTED_PREF (3) -- Set assisted preferred \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_AGPS_SETBASED_PREF (4) -- Set based preferred \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_AUTONOMOUS_GPS (5) -- Standalone GPS \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_AFLT (6) -- Advanced forward link trilateration \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_ECID (7) -- Exclusive chip ID \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_EOTD (8) -- Enhanced observed time difference \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_OTDOA (9) -- Observed time delay of arrival \n
+ - eQMI_LOC_NI_SUPL_POSMETHOD_NO_POSITION (10) -- No position
+ */
+
+ qmiLocNiDataCodingSchemeEnumT_v02 dataCodingScheme;
+ /**< Data coding scheme applies to both the requestor ID and the client
+ name.
+ Values: \n
+ - eQMI_LOC_NI_SS_GERMAN (12) -- Language is German \n
+ - eQMI_LOC_NI_SS_ENGLISH (13) -- Language is English \n
+ - eQMI_LOC_NI_SS_ITALIAN (14) -- Language is Italian \n
+ - eQMI_LOC_NI_SS_FRENCH (15) -- Language is French \n
+ - eQMI_LOC_NI_SS_SPANISH (16) -- Language is Spanish \n
+ - eQMI_LOC_NI_SS_DUTCH (17) -- Language is Dutch \n
+ - eQMI_LOC_NI_SS_SWEDISH (18) -- Language is Swedish \n
+ - eQMI_LOC_NI_SS_DANISH (19) -- Language is Danish \n
+ - eQMI_LOC_NI_SS_PORTUGUESE (20) -- Language is Portuguese \n
+ - eQMI_LOC_NI_SS_FINNISH (21) -- Language is Finnish \n
+ - eQMI_LOC_NI_SS_NORWEGIAN (22) -- Language is Norwegian \n
+ - eQMI_LOC_NI_SS_GREEK (23) -- Language is Greek \n
+ - eQMI_LOC_NI_SS_TURKISH (24) -- Language is Turkish \n
+ - eQMI_LOC_NI_SS_HUNGARIAN (25) -- Language is Hungarian \n
+ - eQMI_LOC_NI_SS_POLISH (26) -- Language is Polish \n
+ - eQMI_LOC_NI_SS_LANGUAGE_UNSPEC (27) -- Language is unspecified \n
+ - eQMI_LOC_NI_SUPL_UTF8 (28) -- Encoding is UTF 8 \n
+ - eQMI_LOC_NI_SUPL_UCS2 (29) -- Encoding is UCS 2 \n
+ - eQMI_LOC_NI_SUPL_GSM_DEFAULT (30) -- Encoding is GSM default
+ */
+
+ qmiLocNiSuplFormattedStringStructT_v02 requestorId;
+ /**< Requestor ID; the encoding scheme for requestor_id is specified in
+ the dataCodingScheme field. */
+
+ qmiLocNiSuplFormattedStringStructT_v02 clientName;
+ /**< Client name; the encoding scheme for client_name is specified in
+ the dataCodingScheme field. */
+
+ qmiLocNiSuplQopStructT_v02 suplQop;
+ /**< SUPL QoP. */
+
+ uint16_t userResponseTimer;
+ /**< Time to wait for the user to respond. \n
+ - Units -- Seconds*/
+}qmiLocNiSuplNotifyVerifyStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNILOCATIONTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION_V02 = 1, /**< Current location \n */
+ eQMI_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION_V02 = 2, /**< Last known location; might be the current location \n */
+ eQMI_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION_V02 = 3, /**< Initial location */
+ QMILOCNILOCATIONTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiLocationTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocNiDataCodingSchemeEnumT_v02 dataCodingScheme;
+ /**< Identifies the coding scheme of the coded string.
+ Values: \n
+ - eQMI_LOC_NI_SS_GERMAN (12) -- Language is German \n
+ - eQMI_LOC_NI_SS_ENGLISH (13) -- Language is English \n
+ - eQMI_LOC_NI_SS_ITALIAN (14) -- Language is Italian \n
+ - eQMI_LOC_NI_SS_FRENCH (15) -- Language is French \n
+ - eQMI_LOC_NI_SS_SPANISH (16) -- Language is Spanish \n
+ - eQMI_LOC_NI_SS_DUTCH (17) -- Language is Dutch \n
+ - eQMI_LOC_NI_SS_SWEDISH (18) -- Language is Swedish \n
+ - eQMI_LOC_NI_SS_DANISH (19) -- Language is Danish \n
+ - eQMI_LOC_NI_SS_PORTUGUESE (20) -- Language is Portuguese \n
+ - eQMI_LOC_NI_SS_FINNISH (21) -- Language is Finnish \n
+ - eQMI_LOC_NI_SS_NORWEGIAN (22) -- Language is Norwegian \n
+ - eQMI_LOC_NI_SS_GREEK (23) -- Language is Greek \n
+ - eQMI_LOC_NI_SS_TURKISH (24) -- Language is Turkish \n
+ - eQMI_LOC_NI_SS_HUNGARIAN (25) -- Language is Hungarian \n
+ - eQMI_LOC_NI_SS_POLISH (26) -- Language is Polish \n
+ - eQMI_LOC_NI_SS_LANGUAGE_UNSPEC (27) -- Language is unspecified \n
+ - eQMI_LOC_NI_SUPL_UTF8 (28) -- Encoding is UTF 8 \n
+ - eQMI_LOC_NI_SUPL_UCS2 (29) -- Encoding is UCS 2 \n
+ - eQMI_LOC_NI_SUPL_GSM_DEFAULT (30) -- Encoding is GSM default
+ */
+
+ uint32_t codedString_len; /**< Must be set to # of elements in codedString */
+ uint8_t codedString[QMI_LOC_NI_CODEWORD_MAX_LENGTH_V02];
+ /**< Coded string. \n
+ - Type: Array of bytes \n
+ - Maximum string length: 20 */
+}qmiLocNiUmtsCpCodedStringStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint16_t qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02;
+#define QMI_LOC_UMTS_CP_INVOKE_ID_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0001) /**< Indicates presence of the invoke ID
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_UMTS_CP_DATA_CODING_SCHEME_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0002) /**< Indicates presence of the data coding scheme
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_UMTS_CP_NOTIFICATION_TEXT_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0004) /**< Indicates presence of the notification text
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_UMTS_CP_CLIENT_ADDRESS_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0008) /**< Indicates presence of the client address
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_UMTS_CP_LOCATION_TYPE_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0010) /**< Indicates presence of the location type
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_UMTS_CP_REQUESTOR_ID_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0020) /**< Indicates presence of the requestor ID
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_UMTS_CP_CODEWORD_STRING_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0040) /**< Indicates presence of the code word string
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. */
+#define QMI_LOC_UMTS_CP_SERVICE_TYPE_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0080) /**< Indicates presence of the service type
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. \n */
+#define QMI_LOC_UMTS_CP_USER_RESP_TIMER_MASK_V02 ((qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02)0x0100) /**< Indicates presence of the user response timer
+ in an NI Notify/Verify request event.
+ This mask is set in the valid flags field of a
+ Notify/Verify structure. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocNiUmtsCpNotifyVerifyValidMaskT_v02 valid_flags;
+ /**< Valid bitmasks: \n
+ - 0x0001 -- INVOKE_ID_MASK \n
+ - 0x0002 -- DATA_CODING_ SCHEME_MASK \n
+ - 0x0004 -- NOTIFICATION_TEXT_ MASK \n
+ - 0x0008 -- CLIENT_ADDRESS_ MASK \n
+ - 0x0010 -- LOCATION_TYPE_ MASK \n
+ - 0x0020 -- REQUESTOR_ID_MASK \n
+ - 0x0040 -- CODEWORD_STRING_ MASK \n
+ - 0x0080 -- SERVICE_TYPE_MASK \n
+ - 0x0100 -- USER_RESP_TIMER_ MASK
+ */
+
+ uint8_t invokeId;
+ /**< Supplementary services invoke ID. */
+
+ qmiLocNiDataCodingSchemeEnumT_v02 dataCodingScheme;
+ /**< Type of data encoding scheme for the text.
+ Applies to both the notification text and the client address.
+ Values: \n
+ - eQMI_LOC_NI_SS_GERMAN (12) -- Language is German \n
+ - eQMI_LOC_NI_SS_ENGLISH (13) -- Language is English \n
+ - eQMI_LOC_NI_SS_ITALIAN (14) -- Language is Italian \n
+ - eQMI_LOC_NI_SS_FRENCH (15) -- Language is French \n
+ - eQMI_LOC_NI_SS_SPANISH (16) -- Language is Spanish \n
+ - eQMI_LOC_NI_SS_DUTCH (17) -- Language is Dutch \n
+ - eQMI_LOC_NI_SS_SWEDISH (18) -- Language is Swedish \n
+ - eQMI_LOC_NI_SS_DANISH (19) -- Language is Danish \n
+ - eQMI_LOC_NI_SS_PORTUGUESE (20) -- Language is Portuguese \n
+ - eQMI_LOC_NI_SS_FINNISH (21) -- Language is Finnish \n
+ - eQMI_LOC_NI_SS_NORWEGIAN (22) -- Language is Norwegian \n
+ - eQMI_LOC_NI_SS_GREEK (23) -- Language is Greek \n
+ - eQMI_LOC_NI_SS_TURKISH (24) -- Language is Turkish \n
+ - eQMI_LOC_NI_SS_HUNGARIAN (25) -- Language is Hungarian \n
+ - eQMI_LOC_NI_SS_POLISH (26) -- Language is Polish \n
+ - eQMI_LOC_NI_SS_LANGUAGE_UNSPEC (27) -- Language is unspecified \n
+ - eQMI_LOC_NI_SUPL_UTF8 (28) -- Encoding is UTF 8 \n
+ - eQMI_LOC_NI_SUPL_UCS2 (29) -- Encoding is UCS 2 \n
+ - eQMI_LOC_NI_SUPL_GSM_DEFAULT (30) -- Encoding is GSM default
+ */
+
+ uint32_t notificationText_len; /**< Must be set to # of elements in notificationText */
+ uint8_t notificationText[QMI_LOC_NI_MAX_CLIENT_NAME_LENGTH_V02];
+ /**< Notification text; the encoding method is specified in
+ dataCodingScheme. \n
+ - Type -- Array of bytes \n
+ - Maximum array length -- 64 */
+
+ uint32_t clientAddress_len; /**< Must be set to # of elements in clientAddress */
+ uint8_t clientAddress[QMI_LOC_NI_MAX_EXT_CLIENT_ADDRESS_V02];
+ /**< Client address; the encoding method is specified in
+ dataCodingScheme. \n
+ - Maximum array length -- 20 */
+
+ qmiLocNiLocationTypeEnumT_v02 locationType;
+ /**< Location type.
+ Values: \n
+ - eQMI_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION (1) -- Current location \n
+ - eQMI_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION (2) -- Last known location; might be the current location \n
+ - eQMI_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION (3) -- Initial location
+ */
+
+ qmiLocNiUmtsCpCodedStringStructT_v02 requestorId;
+ /**< Requestor ID; the encoding method is specified in the
+ qmiLocNiUmtsCpCodedStringStructT.dataCodingScheme field. */
+
+ qmiLocNiUmtsCpCodedStringStructT_v02 codewordString;
+ /**< Codeword string; the encoding method is specified in the
+ qmiLocNiUmtsCpCodedStringStructT.dataCodingScheme field. */
+
+ uint8_t lcsServiceTypeId;
+ /**< Service type ID. */
+
+ uint16_t userResponseTimer;
+ /**< Time to wait for the user to respond. \n
+ - Units -- Seconds */
+}qmiLocNiUmtsCpNotifyVerifyStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNISERVICEINTERACTIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO_V02 = 1, /**< Service interaction between ongoing NI and incoming MO sessions. */
+ QMILOCNISERVICEINTERACTIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiServiceInteractionEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocNiVxNotifyVerifyStructT_v02 niVxReq;
+ /**< Ongoing NI session request; this information is not filled. */
+
+ qmiLocNiServiceInteractionEnumT_v02 serviceInteractionType;
+ /**< Service interaction type specified in qmiLocNiServiceInteractionEnumT.
+ Values: \n
+ - eQMI_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO (1) -- Service interaction between ongoing NI and incoming MO sessions.
+ */
+}qmiLocNiVxServiceInteractionStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint16_t qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02;
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_WLAN_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0001) /**< WLAN measurements are allowed as part of location ID
+ and multiple location IDs in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_GSM_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0002) /**< GSM measurements are allowed as part of location ID
+ and multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_WCDMA_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0004) /**< WCDMA measurements are allowed as part of location ID
+ and multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_CDMA_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0008) /**< CDMA measurements are allowed as part of location ID
+ and multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_HRDP_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0010) /**< HRDP measurements are allowed as part of location ID
+ and multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_UMB_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0020) /**< UMB measurements are allowed as part of location ID
+ and multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_LTE_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0040) /**< LTE measurements are allowed as part of location ID
+ and multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_WIMAX_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0080) /**< WIMAX measurements are allowed as part of location ID
+ and multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_HISTORIC_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0100) /**< Historical information is allowed as part of
+ multiple location ID in the SUPL_POS_INIT message. */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_SUPPORTED_NETWORK_NONSVRV_V02 ((qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02)0x0200) /**< Information about nonserving cells is allowed
+ as part of multiple location ID in the SUPL_POS_INIT message. */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNISUPLVER2EXTTRIGGERTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SUPL_VER_2_EXT_TRIGGER_TYPE_SINGLE_SHOT_V02 = -1, /**< SUPL INIT message indicates a request for a single shot
+ triggered session \n */
+ eQMI_LOC_SUPL_VER_2_EXT_TRIGGER_TYPE_PERIODIC_V02 = 0, /**< SUPL INIT message indicates a request for a periodic
+ triggered session \n */
+ eQMI_LOC_SUPL_VER_2_EXT_TRIGGER_TYPE_AREA_EVENT_V02 = 1, /**< SUPL INIT message indicates a request for an area event
+ triggered session */
+ QMILOCNISUPLVER2EXTTRIGGERTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiSuplVer2ExtTriggerTypeEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint16_t qmiLocNiSuplVer2ExtGnssTypeMaskT_v02;
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_GPS_V02 ((qmiLocNiSuplVer2ExtGnssTypeMaskT_v02)0x0001) /**< GPS \n */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_GLONASS_V02 ((qmiLocNiSuplVer2ExtGnssTypeMaskT_v02)0x0002) /**< GLONASS \n */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_GALILEO_V02 ((qmiLocNiSuplVer2ExtGnssTypeMaskT_v02)0x0004) /**< Galileo \n */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_SBAS_V02 ((qmiLocNiSuplVer2ExtGnssTypeMaskT_v02)0x0008) /**< SBAS \n */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_QZSS_V02 ((qmiLocNiSuplVer2ExtGnssTypeMaskT_v02)0x0010) /**< QZSS \n */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_MODERN_GPS_V02 ((qmiLocNiSuplVer2ExtGnssTypeMaskT_v02)0x0020) /**< Modern GPS \n */
+#define QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_BDS_V02 ((qmiLocNiSuplVer2ExtGnssTypeMaskT_v02)0x0040) /**< BDS */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocNiSuplVer2ExtSupportedNetworksMaskT_v02 supportedNetworksMask;
+ /**< Specifies the type of network measurements allowed to be sent as
+ part of the location ID or multiple location IDs parameter in the
+ SUPL_POS_INIT message (refer to 3GPP \hyperref[TS 03.32]{TS 03.32}). \n
+ Valid bitmasks: \n
+ - 0x0001 -- SUPPORTED_NETWORK_ WLAN \n
+ - 0x0002 -- SUPPORTED_NETWORK_ GSM \n
+ - 0x0004 -- SUPPORTED_NETWORK_ WCDMA \n
+ - 0x0008 -- SUPPORTED_NETWORK_ CDMA \n
+ - 0x0010 -- SUPPORTED_NETWORK_ HRDP \n
+ - 0x0020 -- SUPPORTED_NETWORK_ UMB \n
+ - 0x0040 -- SUPPORTED_NETWORK_ LTE \n
+ - 0x0080 -- SUPPORTED_NETWORK_ WIMAX \n
+ - 0x0100 -- SUPPORTED_NETWORK_ HISTORIC \n
+ - 0x0200 -- SUPPORTED_NETWORK_ NONSVRV
+ */
+
+ qmiLocNiSuplVer2ExtTriggerTypeEnumT_v02 triggerType;
+ /**< Specifies the type of session trigger requested in the
+ SUPL_POS_INIT message (refer to 3GPP \hyperref[TS 03.32]{TS 03.32}).
+ Values: \n
+ - eQMI_LOC_SUPL_VER_2_EXT_TRIGGER_TYPE_SINGLE_SHOT (-1) -- SUPL INIT message indicates a request for a single shot
+ triggered session \n
+ - eQMI_LOC_SUPL_VER_2_EXT_TRIGGER_TYPE_PERIODIC (0) -- SUPL INIT message indicates a request for a periodic
+ triggered session \n
+ - eQMI_LOC_SUPL_VER_2_EXT_TRIGGER_TYPE_AREA_EVENT (1) -- SUPL INIT message indicates a request for an area event
+ triggered session
+ */
+
+ qmiLocNiSuplVer2ExtGnssTypeMaskT_v02 gnssType;
+ /**< Specifies which GNSS technologies are allowed as positioning
+ technologies.
+ Valid bitmasks: \n
+ - QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_GPS (0x0001) -- GPS \n
+ - QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_GLONASS (0x0002) -- GLONASS \n
+ - QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_GALILEO (0x0004) -- Galileo \n
+ - QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_SBAS (0x0008) -- SBAS \n
+ - QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_QZSS (0x0010) -- QZSS \n
+ - QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_MODERN_GPS (0x0020) -- Modern GPS \n
+ - QMI_LOC_SUPL_VER_2_EXT_MASK_GNSS_BDS (0x0040) -- BDS
+ */
+}qmiLocNiSuplVer2ExtStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ char eslpUrl[QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02 + 1];
+ /**< ESLP URL. \n
+ - Maximum length -- 255 bytes */
+}qmiLocEmergencyNotificationStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Indicates an NI notify/verify request to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Notification Type */
+ qmiLocNiNotifyVerifyEnumT_v02 notificationType;
+ /**< Type of notification/verification performed.
+ Values: \n
+ - eQMI_LOC_NI_USER_NO_NOTIFY_NO_VERIFY (1) -- No notification and no verification required \n
+ - eQMI_LOC_NI_USER_NOTIFY_ONLY (2) -- Notify only; no verification required \n
+ - eQMI_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP (3) -- Notify and verify, but no response required. \n
+ - eQMI_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP (4) -- Notify and verify, and require a response \n
+ - eQMI_LOC_NI_USER_NOTIFY_VERIFY_PRIVACY_OVERRIDE (5) -- Notify and verify; privacy override
+ */
+
+ /* Optional */
+ /* Network Initiated Vx Request */
+ uint8_t NiVxInd_valid; /**< Must be set to true if NiVxInd is being passed */
+ qmiLocNiVxNotifyVerifyStructT_v02 NiVxInd;
+ /**< \vspace{0.06in} \n Optional NI Vx request payload. */
+
+ /* Optional */
+ /* Network Initiated SUPL Request */
+ uint8_t NiSuplInd_valid; /**< Must be set to true if NiSuplInd is being passed */
+ qmiLocNiSuplNotifyVerifyStructT_v02 NiSuplInd;
+ /**< \vspace{0.06in} \n Optional NI SUPL request payload. */
+
+ /* Optional */
+ /* Network Initiated UMTS Control Plane Request */
+ uint8_t NiUmtsCpInd_valid; /**< Must be set to true if NiUmtsCpInd is being passed */
+ qmiLocNiUmtsCpNotifyVerifyStructT_v02 NiUmtsCpInd;
+ /**< \vspace{0.06in} \n Optional NI UMTS-CP request payload. */
+
+ /* Optional */
+ /* Network Initiated Service Interaction Request */
+ uint8_t NiVxServiceInteractionInd_valid; /**< Must be set to true if NiVxServiceInteractionInd is being passed */
+ qmiLocNiVxServiceInteractionStructT_v02 NiVxServiceInteractionInd;
+ /**< \vspace{0.06in} \n Optional NI service interaction payload. */
+
+ /* Optional */
+ /* Network Initiated SUPL Version 2 Extension */
+ uint8_t NiSuplVer2ExtInd_valid; /**< Must be set to true if NiSuplVer2ExtInd is being passed */
+ qmiLocNiSuplVer2ExtStructT_v02 NiSuplVer2ExtInd;
+ /**< \vspace{0.06in} \n Optional NI SUPL Version 2 Extension payload. When present,
+ this payload is used in conjunction with the SUPL
+ indication payload. */
+
+ /* Optional */
+ /* SUPL Emergency Notification */
+ uint8_t suplEmergencyNotification_valid; /**< Must be set to true if suplEmergencyNotification is being passed */
+ qmiLocEmergencyNotificationStructT_v02 suplEmergencyNotification;
+ /**< \vspace{0.06in} \n This specifies that the corresponding NI notification is an
+ emergency notification. Emergency notification
+ can be provided even without an Emergency SUPL Location Platform (ESLP)
+ address. */
+
+ /* Optional */
+ /* In Emergency Session */
+ uint8_t isInEmergencySession_valid; /**< Must be set to true if isInEmergencySession is being passed */
+ uint8_t isInEmergencySession;
+ /**< Reported as TRUE when the device is
+ in an emergency session or emergencyCallbackWindow. */
+}qmiLocEventNiNotifyVerifyReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ char serverUrl[QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02 + 1];
+ /**< Assistance server URL.\n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 256
+ */
+}qmiLocAssistanceServerUrlStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t delayThreshold;
+ /**< Skip the time server if a one-way delay to the server
+ exceeds this threshold. \n
+ - Units -- Milliseconds */
+
+ uint32_t timeServerList_len; /**< Must be set to # of elements in timeServerList */
+ qmiLocAssistanceServerUrlStructT_v02 timeServerList[QMI_LOC_MAX_NTP_SERVERS_V02];
+ /**< List of time server URLs recommended by the service for time
+ information. The list is ordered; the client uses the first
+ server specified in the list as the primary URL to fetch NTP time,
+ the second server as secondary, and so on. \n
+ - Maximum server list items -- 3 */
+}qmiLocTimeServerListStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to inject time information. */
+typedef struct {
+
+ /* Optional */
+ /* Time Server Info */
+ uint8_t timeServerInfo_valid; /**< Must be set to true if timeServerInfo is being passed */
+ qmiLocTimeServerListStructT_v02 timeServerInfo;
+ /**< \vspace{0.06in} \n Contains information about the time servers recommended by the
+ location service for NTP time. */
+}qmiLocEventInjectTimeReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocServerParamUpdateMaskT_v02;
+#define QMI_LOC_PREDICTED_ORBITS_INJECT_REQUEST_V02 ((qmiLocServerParamUpdateMaskT_v02)0x00000001ull) /**< Request for injection of predicted orbits \n */
+#define QMI_LOC_PREDICTED_ORBITS_SERVER_UPDATE_V02 ((qmiLocServerParamUpdateMaskT_v02)0x00000002ull) /**< Update server list \n */
+#define QMI_LOC_PREDICTED_ORBITS_REFRESH_UPDATE_RATE_V02 ((qmiLocServerParamUpdateMaskT_v02)0x00000004ull) /**< Refresh periodicity of injection */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCINJECTEDORBITUPDATETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_INJECTED_ORBIT_RATE_UPDATE_V02 = 1, /**< Injected orbit rate update \n */
+ eQMI_LOC_INTEGRITY_RATE_UPDATE_V02 = 2, /**< Integrity rate update */
+ QMILOCINJECTEDORBITUPDATETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocInjectedOrbitUpdateTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t maxFileSizeInBytes;
+ /**< Maximum allowable predicted orbits file size (in bytes). */
+
+ uint32_t maxPartSize;
+ /**< Maximum allowable predicted orbits file chunk size (in bytes). */
+}qmiLocPredictedOrbitsAllowedSizesStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t serverList_len; /**< Must be set to # of elements in serverList */
+ qmiLocAssistanceServerUrlStructT_v02 serverList[QMI_LOC_MAX_PREDICTED_ORBITS_SERVERS_V02];
+ /**< List of predicted orbits URLs. The list is ordered, so the client
+ must use the first server specified in the list as the primary URL
+ from which to download predicted orbits data, the second one as
+ secondary, and so on. \n
+ A maximum number of three servers can be specified. */
+}qmiLocPredictedOrbitsServerListStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to inject predicted orbits data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Allowed Sizes */
+ qmiLocPredictedOrbitsAllowedSizesStructT_v02 allowedSizes;
+ /**< \vspace{0.06in} \n Maximum part and file size allowed to inject in the engine. */
+
+ /* Optional */
+ /* Server List */
+ uint8_t serverList_valid; /**< Must be set to true if serverList is being passed */
+ qmiLocPredictedOrbitsServerListStructT_v02 serverList;
+ /**< \vspace{0.06in} \n List of servers that the client can use to download
+ predicted orbits data. */
+
+ /* Optional */
+ /* Server Request Update Mask */
+ uint8_t serverUpdateMask_valid; /**< Must be set to true if serverUpdateMask is being passed */
+ qmiLocServerParamUpdateMaskT_v02 serverUpdateMask;
+ /**< Mask indicating parameters updated in server request
+ of predicted orbits data.
+ - QMI_LOC_PREDICTED_ORBITS_INJECT_REQUEST (0x00000001) -- Request for injection of predicted orbits \n
+ - QMI_LOC_PREDICTED_ORBITS_SERVER_UPDATE (0x00000002) -- Update server list \n
+ - QMI_LOC_PREDICTED_ORBITS_REFRESH_UPDATE_RATE (0x00000004) -- Refresh periodicity of injection */
+
+ /* Optional */
+ /* Update Rate Type */
+ uint8_t updateType_valid; /**< Must be set to true if updateType is being passed */
+ qmiLocInjectedOrbitUpdateTypeEnumT_v02 updateType;
+ /**< Data type for which rate is being updated.
+ - eQMI_LOC_INJECTED_ORBIT_RATE_UPDATE (1) -- Injected orbit rate update \n
+ - eQMI_LOC_INTEGRITY_RATE_UPDATE (2) -- Integrity rate update */
+
+ /* Optional */
+ /* Update Rate */
+ uint8_t updateRate_valid; /**< Must be set to true if updateRate is being passed */
+ uint32_t updateRate;
+ /**< Update rate for the data type indicated. \n
+ - Units -- Seconds */
+}qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to inject a position. */
+typedef struct {
+
+ /* Mandatory */
+ /* Latitude */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum).\n
+ - Type -- Floating point\n
+ - Units -- Degrees\n
+ - Range -- -90.0 to 90.0\n
+ - Positive values indicate northern latitude\n
+ - Negative values indicate southern latitude
+ */
+
+ /* Mandatory */
+ /* Longitude */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ /* Mandatory */
+ /* Circular Horizontal Uncertainty */
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular). \n
+ - Units -- Meters */
+
+ /* Mandatory */
+ /* UTC Timestamp */
+ uint64_t timestampUtc;
+ /**< Units -- Milliseconds since Jan. 1, 1970
+ */
+}qmiLocEventInjectPositionReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCENGINESTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_ENGINE_STATE_ON_V02 = 1, /**< Location engine is on \n */
+ eQMI_LOC_ENGINE_STATE_OFF_V02 = 2, /**< Location engine is off */
+ QMILOCENGINESTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocEngineStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the engine state to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Engine State */
+ qmiLocEngineStateEnumT_v02 engineState;
+ /**< Location engine state.
+ Values: \n
+ - eQMI_LOC_ENGINE_STATE_ON (1) -- Location engine is on \n
+ - eQMI_LOC_ENGINE_STATE_OFF (2) -- Location engine is off
+ */
+}qmiLocEventEngineStateIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCFIXSESSIONSTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_FIX_SESSION_STARTED_V02 = 1, /**< Location fix session has started \n */
+ eQMI_LOC_FIX_SESSION_FINISHED_V02 = 2, /**< Location fix session has ended */
+ QMILOCFIXSESSIONSTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocFixSessionStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the fix session state to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Session State */
+ qmiLocFixSessionStateEnumT_v02 sessionState;
+ /**< LOC fix session state.
+ Values: \n
+ - eQMI_LOC_FIX_SESSION_STARTED (1) -- Location fix session has started \n
+ - eQMI_LOC_FIX_SESSION_FINISHED (2) -- Location fix session has ended
+ */
+
+ /* Optional */
+ /* Session ID */
+ uint8_t sessionId_valid; /**< Must be set to true if sessionId is being passed */
+ uint8_t sessionId;
+ /**< ID of the session specified in the Start request.
+ This might not be specified for a fix session corresponding to
+ a network-initiated request. \n
+ - Range: 0 to 255 */
+}qmiLocEventFixSessionStateIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWIFIREQUESTENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WIFI_START_PERIODIC_HI_FREQ_FIXES_V02 = 0, /**< Start periodic fixes with high frequency \n */
+ eQMI_LOC_WIFI_START_PERIODIC_KEEP_WARM_V02 = 1, /**< Keep warm for low frequency fixes without data downloads \n */
+ eQMI_LOC_WIFI_STOP_PERIODIC_FIXES_V02 = 2, /**< Stop periodic fixes request */
+ QMILOCWIFIREQUESTENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWifiRequestEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a Wi-Fi request to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Request Type */
+ qmiLocWifiRequestEnumT_v02 requestType;
+ /**< Request type.
+ Values: \n
+ - eQMI_LOC_WIFI_START_PERIODIC_HI_FREQ_FIXES (0) -- Start periodic fixes with high frequency \n
+ - eQMI_LOC_WIFI_START_PERIODIC_KEEP_WARM (1) -- Keep warm for low frequency fixes without data downloads \n
+ - eQMI_LOC_WIFI_STOP_PERIODIC_FIXES (2) -- Stop periodic fixes request
+ */
+
+ /* Optional */
+ /* Time Between Fixes */
+ uint8_t tbfInMs_valid; /**< Must be set to true if tbfInMs is being passed */
+ uint16_t tbfInMs;
+ /**< Time between fixes for a periodic request.\n
+ - Units -- Milliseconds */
+
+ /* Optional */
+ /* E911 Mode */
+ uint8_t e911Mode_valid; /**< Must be set to true if e911Mode is being passed */
+ uint8_t e911Mode;
+ /**< Specifies whether the GPS engine is in E911 mode when this
+ indication is sent to the client.
+ Values: \n
+ - 0x00 (FALSE) -- GPS engine is not in E911 mode \n
+ - 0x01 (TRUE) -- GPS engine is in E911 mode
+ */
+}qmiLocEventWifiReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t samplesPerBatch;
+ /**< Specifies the number of samples per batch the GNSS location engine is to
+ receive. Compute the sensor sampling frequency as follows: \vspace{-0.06in} \n
+
+ samplingFrequency = samplesPerBatch * batchesPerSecond \vspace{-0.06in} \n
+
+ samplesPerBatch must be a nonzero positive value.
+ */
+
+ uint16_t batchesPerSecond;
+ /**< Number of sensor-data batches the GNSS location engine is to receive
+ per second. The rate is specified in an integral number of batches per
+ second (Hz). \vspace{-0.06in} \n
+
+ batchesPerSecond must be a nonzero positive value.
+ */
+}qmiLocSensorControlConfigSamplingSpecStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t injectEnable;
+ /**< Indicates whether the GNSS location engine is ready to accept data from this
+ sensor.
+ Values: \n
+ - 0x01 (TRUE) -- GNSS location engine is ready to accept sensor
+ data \n
+ - 0x00 (FALSE) -- GNSS location engine is not ready to accept
+ sensor data
+ */
+
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 dataFrequency;
+ /**< Rate at which the GNSS engine would like tp sample the sensor. \n
+ The rate is specified in integral number of samples per second (Hz)\n
+ and batches per second.
+ */
+}qmiLocSensorReadyStatusStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point if the GNSS location engine is
+ ready to accept sensor data. */
+typedef struct {
+
+ /* Optional */
+ /* Accelerometer Accept Ready */
+ uint8_t accelReady_valid; /**< Must be set to true if accelReady is being passed */
+ qmiLocSensorReadyStatusStructT_v02 accelReady;
+ /**< \vspace{0.06in} \n Indicates whether the GNSS location engine is ready
+ to accept accelerometer sensor data.
+ */
+
+ /* Optional */
+ /* Gyroscope Accept Ready */
+ uint8_t gyroReady_valid; /**< Must be set to true if gyroReady is being passed */
+ qmiLocSensorReadyStatusStructT_v02 gyroReady;
+ /**< \vspace{0.06in} \n Indicates whether the GNSS location engine is ready
+ to accept gyroscope sensor data.
+ */
+
+ /* Optional */
+ /* Accelerometer Temperature Accept Ready */
+ uint8_t accelTemperatureReady_valid; /**< Must be set to true if accelTemperatureReady is being passed */
+ qmiLocSensorReadyStatusStructT_v02 accelTemperatureReady;
+ /**< \vspace{0.06in} \n Indicates whether the GNSS location engine is ready
+ to accept accelerometer temperature data.
+ */
+
+ /* Optional */
+ /* Gyroscope Temperature Accept Ready */
+ uint8_t gyroTemperatureReady_valid; /**< Must be set to true if gyroTemperatureReady is being passed */
+ qmiLocSensorReadyStatusStructT_v02 gyroTemperatureReady;
+ /**< \vspace{0.06in} \n Indicates whether the GNSS location engine is ready
+ to accept gyroscope temperature data.
+ */
+
+ /* Optional */
+ /* Calibrated Magnetometer Accept Ready */
+ uint8_t calibratedMagReady_valid; /**< Must be set to true if calibratedMagReady is being passed */
+ qmiLocSensorReadyStatusStructT_v02 calibratedMagReady;
+ /**< \vspace{0.06in} \n Indicates whether the GNSS location engine is ready
+ to accept calibrated magnetometer data.
+ */
+
+ /* Optional */
+ /* Uncalibrated Magnetometer Accept Ready */
+ uint8_t uncalibratedMagReady_valid; /**< Must be set to true if uncalibratedMagReady is being passed */
+ qmiLocSensorReadyStatusStructT_v02 uncalibratedMagReady;
+ /**< \vspace{0.06in} \n Indicates whether the GNSS location engine is ready
+ to accept uncalibrated magnetometer data.
+ */
+}qmiLocEventSensorStreamingReadyStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point to inject time synchronization
+ data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Opaque Time Sync Reference Counter */
+ uint32_t refCounter;
+ /**< This TLV is sent to registered control points. It is sent by
+ the location engine when it must synchronize the location engine and
+ control point (sensor processor) times.
+ This TLV must be echoed back in the Time Sync Inject request. */
+}qmiLocEventTimeSyncReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to enable Stationary Position
+ Indicator (SPI) streaming reports. */
+typedef struct {
+
+ /* Mandatory */
+ /* Enable/Disable SPI Requests */
+ uint8_t enable;
+ /**< Indicates whether the client is to start or stop sending an SPI status stream. \n
+ - 0x01 (TRUE) -- Client is to start sending an SPI status stream \n
+ - 0x00 (FALSE) -- Client is to stop sending an SPI status stream
+ */
+}qmiLocEventSetSpiStreamingReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWWANTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WWAN_TYPE_INTERNET_V02 = 0, /**< Bring up the WWAN type used for an Internet connection \n */
+ eQMI_LOC_WWAN_TYPE_AGNSS_V02 = 1, /**< Bring up the WWAN type used for AGNSS connections \n */
+ eQMI_LOC_WWAN_TYPE_AGNSS_EMERGENCY_V02 = 2, /**< Bring up the WWAN type used for AGNSS emergency connections */
+ QMILOCWWANTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWWANTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSERVERREQUESTENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SERVER_REQUEST_OPEN_V02 = 1, /**< Open a connection to the location server \n */
+ eQMI_LOC_SERVER_REQUEST_CLOSE_V02 = 2, /**< Close a connection to the location server */
+ QMILOCSERVERREQUESTENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocServerRequestEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCBEARERTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_BEARER_TYPE_WWAN_V02 = 1, /**< Request if for WWAN based connection \n */
+ eQMI_LOC_BEARER_TYPE_WLAN_V02 = 2, /**< Request if for WLAN based connection \n */
+ eQMI_LOC_BEARER_TYPE_ANY_V02 = 3, /**< Request for any available bearer WLAN/WWAN based connection */
+ QMILOCBEARERTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocBearerTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSYSMODEMASIDTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SYS_MODEM_AS_ID_1_V02 = 0, /**< Subscription ID 1 \n */
+ eQMI_LOC_SYS_MODEM_AS_ID_2_V02 = 1, /**< Subscription ID 2 \n */
+ eQMI_LOC_SYS_MODEM_AS_ID_3_V02 = 2, /**< Subscription ID 3 */
+ QMILOCSYSMODEMASIDTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSysModemAsIdTypeEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocApnTypeMaskT_v02;
+#define QMI_LOC_APN_TYPE_MASK_DEFAULT_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000001ull) /**< APN type for default/Internet traffic\n */
+#define QMI_LOC_APN_TYPE_MASK_IMS_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000002ull) /**< APN type for IP Multimedia Subsystem \n */
+#define QMI_LOC_APN_TYPE_MASK_MMS_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000004ull) /**< APN type for multimedia messaging service \n */
+#define QMI_LOC_APN_TYPE_MASK_DUN_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000008ull) /**< APN type for dial up network */
+#define QMI_LOC_APN_TYPE_MASK_SUPL_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000010ull) /**< APN type for secure user plane location \n */
+#define QMI_LOC_APN_TYPE_MASK_HIPRI_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000020ull) /**< APN type for high priority mobile data \n */
+#define QMI_LOC_APN_TYPE_MASK_FOTA_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000040ull) /**< APN type for over the air administration \n */
+#define QMI_LOC_APN_TYPE_MASK_CBS_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000080ull) /**< APN type for carrier branded services \n */
+#define QMI_LOC_APN_TYPE_MASK_IA_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000100ull) /**< APN type for initial attach \n */
+#define QMI_LOC_APN_TYPE_MASK_EMERGENCY_V02 ((qmiLocApnTypeMaskT_v02)0x0000000000000200ull) /**< APN type for emergency */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the client to open or close a connection
+ to the assisted GPS location server. */
+typedef struct {
+
+ /* Mandatory */
+ /* Connection Handle */
+ uint32_t connHandle;
+ /**< Identifies a connection across Open and Close request events. */
+
+ /* Mandatory */
+ /* Request Type */
+ qmiLocServerRequestEnumT_v02 requestType;
+ /**< Open or close a connection to the location server.
+ Values: \n
+ - eQMI_LOC_SERVER_REQUEST_OPEN (1) -- Open a connection to the location server \n
+ - eQMI_LOC_SERVER_REQUEST_CLOSE (2) -- Close a connection to the location server
+ */
+
+ /* Mandatory */
+ /* WWAN Type */
+ qmiLocWWANTypeEnumT_v02 wwanType;
+ /**< Identifies the WWAN type for this request.
+ Values: \n
+ - eQMI_LOC_WWAN_TYPE_INTERNET (0) -- Bring up the WWAN type used for an Internet connection \n
+ - eQMI_LOC_WWAN_TYPE_AGNSS (1) -- Bring up the WWAN type used for AGNSS connections \n
+ - eQMI_LOC_WWAN_TYPE_AGNSS_EMERGENCY (2) -- Bring up the WWAN type used for AGNSS emergency connections
+ */
+
+ /* Optional */
+ /* Bearer Type */
+ uint8_t bearerType_valid; /**< Must be set to true if bearerType is being passed */
+ qmiLocBearerTypeEnumT_v02 bearerType;
+ /**< Identifies the bearer type for this WWAN/WLAN request.
+ Used in a situation where the data connection for GPS
+ functionality over both WLAN and WWAN is supported. This field helps the modem GPS stack inform the AP
+ GPS stack to bring up the data connection on a particular bearer type.
+ This is helpful when both the WWAN and WLAN are available and use of one specific bearer is requested.
+ In the process, the bearer type field is omitted and the AP GPS stack relies on the WWAN type field
+ to bring up the data connection. \n
+ Values: \n
+ - eQMI_LOC_BEARER_TYPE_WWAN (1) -- Request if for WWAN based connection \n
+ - eQMI_LOC_BEARER_TYPE_WLAN (2) -- Request if for WLAN based connection \n
+ - eQMI_LOC_BEARER_TYPE_ANY (3) -- Request for any available bearer WLAN/WWAN based connection
+ */
+
+ /* Optional */
+ /* APN Type Mask */
+ uint8_t apnTypeMask_valid; /**< Must be set to true if apnTypeMask is being passed */
+ qmiLocApnTypeMaskT_v02 apnTypeMask;
+ /**< Bitmask specifies the APN type for the requested connection.
+ This bitmask uniquely identifies a data connection which the AP brought up
+ for the data connection request of the modem GPS stack. This mask is
+ provided to the data services as part of the policy to identify the correct
+ data connection AP. In case of emergency connections, this bitmask is provided by the data services to help the clients
+ latch on to the correct data call. The client (GPS) provides this mask to the AP to
+ bring up the correct emergency call, identified by this mask.
+ In the process, the APN type mask field is omitted and the AP GPS stack falls back to the legacy behavior
+ to request the data connection based on the WWAN type provided.\n
+ Valid bitmask: \n
+ - QMI_LOC_APN_TYPE_MASK_DEFAULT (0x0000000000000001) -- APN type for default/Internet traffic\n
+ - QMI_LOC_APN_TYPE_MASK_IMS (0x0000000000000002) -- APN type for IP Multimedia Subsystem \n
+ - QMI_LOC_APN_TYPE_MASK_MMS (0x0000000000000004) -- APN type for multimedia messaging service \n
+ - QMI_LOC_APN_TYPE_MASK_DUN (0x0000000000000008) -- APN type for dial up network
+ - QMI_LOC_APN_TYPE_MASK_SUPL (0x0000000000000010) -- APN type for secure user plane location \n
+ - QMI_LOC_APN_TYPE_MASK_HIPRI (0x0000000000000020) -- APN type for high priority mobile data \n
+ - QMI_LOC_APN_TYPE_MASK_FOTA (0x0000000000000040) -- APN type for over the air administration \n
+ - QMI_LOC_APN_TYPE_MASK_CBS (0x0000000000000080) -- APN type for carrier branded services \n
+ - QMI_LOC_APN_TYPE_MASK_IA (0x0000000000000100) -- APN type for initial attach \n
+ - QMI_LOC_APN_TYPE_MASK_EMERGENCY (0x0000000000000200) -- APN type for emergency
+ */
+
+ /* Optional */
+ /* Subscription ID */
+ uint8_t subId_valid; /**< Must be set to true if subId is being passed */
+ qmiLocSysModemAsIdTypeEnumT_v02 subId;
+ /**< Subscription ID on which to bring up the connection. Values: \n
+ - eQMI_LOC_SYS_MODEM_AS_ID_1 (0) -- Subscription ID 1 \n
+ - eQMI_LOC_SYS_MODEM_AS_ID_2 (1) -- Subscription ID 2 \n
+ - eQMI_LOC_SYS_MODEM_AS_ID_3 (2) -- Subscription ID 3
+ */
+}qmiLocEventLocationServerConnectionReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNIGEOFENCEOPERATIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_GEOFENCE_ADDED_V02 = 1, /**< A network-initated Geofence was added \n */
+ eQMI_LOC_NI_GEOFENCE_DELETED_V02 = 2, /**< A network-initated Geofence was deleted \n */
+ eQMI_LOC_NI_GEOFENCE_EDITED_V02 = 3, /**< A network-initated Geofence was edited; the control point can query the
+ Geofence to find the its current state */
+ QMILOCNIGEOFENCEOPERATIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiGeofenceOperationEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Informs the control point about
+ network-initiated Geofences. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence ID */
+ uint32_t geofenceId;
+ /**< ID of the Geofence for which this
+ notification was generated. */
+
+ /* Mandatory */
+ /* Operation Type */
+ qmiLocNiGeofenceOperationEnumT_v02 operationType;
+ /**< Operation for which this notification was generated.
+ Values: \n
+ - eQMI_LOC_NI_GEOFENCE_ADDED (1) -- A network-initated Geofence was added \n
+ - eQMI_LOC_NI_GEOFENCE_DELETED (2) -- A network-initated Geofence was deleted \n
+ - eQMI_LOC_NI_GEOFENCE_EDITED (3) -- A network-initated Geofence was edited; the control point can query the
+ Geofence to find the its current state
+ */
+}qmiLocEventNiGeofenceNotificationIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCEGENALERTENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_GEN_ALERT_GNSS_UNAVAILABLE_V02 = 1, /**< GNSS is unavailable and GNSS position fixes
+ cannot be used to monitor Geofences \n */
+ eQMI_LOC_GEOFENCE_GEN_ALERT_GNSS_AVAILABLE_V02 = 2, /**< GNSS is now available and GNSS postion fixes can
+ be used to monitor Geofences \n */
+ eQMI_LOC_GEOFENCE_GEN_ALERT_OOS_V02 = 3, /**< The engine is out of service and no cell ID coverage
+ information is available \n */
+ eQMI_LOC_GEOFENCE_GEN_ALERT_TIME_INVALID_V02 = 4, /**< The engine has an invalid time */
+ QMILOCGEOFENCEGENALERTENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceGenAlertEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of the
+ Geofence status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence General Alert */
+ qmiLocGeofenceGenAlertEnumT_v02 geofenceAlert;
+ /**< Specifies the Geofence general alert type.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_GEN_ALERT_GNSS_UNAVAILABLE (1) -- GNSS is unavailable and GNSS position fixes
+ cannot be used to monitor Geofences \n
+ - eQMI_LOC_GEOFENCE_GEN_ALERT_GNSS_AVAILABLE (2) -- GNSS is now available and GNSS postion fixes can
+ be used to monitor Geofences \n
+ - eQMI_LOC_GEOFENCE_GEN_ALERT_OOS (3) -- The engine is out of service and no cell ID coverage
+ information is available \n
+ - eQMI_LOC_GEOFENCE_GEN_ALERT_TIME_INVALID (4) -- The engine has an invalid time
+ */
+}qmiLocEventGeofenceGenAlertIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCEBREACHTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_BREACH_TYPE_ENTERING_V02 = 1, /**< Indicates that a client entered the Geofence \n */
+ eQMI_LOC_GEOFENCE_BREACH_TYPE_LEAVING_V02 = 2, /**< Indicates that a client left the Geofence */
+ QMILOCGEOFENCEBREACHTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceBreachTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ /* UTC timestamp */
+ uint64_t timestampUtc;
+ /**< - Units -- Milliseconds since Jan. 1, 1970
+ */
+
+ /* Latitude */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ /* Longitude */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ /* Horizontal elliptical uncertainty (semi-minor axis) */
+ float horUncEllipseSemiMinor;
+ /**< Semi-minor axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Horizontal elliptical uncertainty (semi-major axis) */
+ float horUncEllipseSemiMajor;
+ /**< Semi-major axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Elliptical horizontal uncertainty azimuth */
+ float horUncEllipseOrientAzimuth;
+ /**< Elliptical horizontal uncertainty azimuth of orientation.\n
+ - Units -- Decimal degrees \n
+ - Range -- 0 to 180 */
+
+ /* Horizontal speed validity bit */
+ uint8_t speedHorizontal_valid;
+ /**< Indicates whether the horizontal speed field contains valid
+ information.
+ Values: \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Horizontal speed */
+ float speedHorizontal;
+ /**< - Units -- Meters per second */
+
+ /* Altitude validity bit */
+ uint8_t altitudeWrtEllipsoid_valid;
+ /**< Indicates whether the altitude field contains valid
+ information. Values: \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Altitude with respect to ellipsoid */
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid. \n
+ - Units -- Meters \n
+ - Range -- -500 to 15883 */
+
+ /* Vertical uncertainty validity bit */
+ uint8_t vertUnc_valid;
+ /**< Indicates whether the vertical uncertainty field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Vertical uncertainty */
+ float vertUnc;
+ /**< - Units -- Meters */
+
+ /* Vertical speed validity bit */
+ uint8_t speedVertical_valid;
+ /**< Indicates whether the vertical speed field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Vertical speed */
+ float speedVertical;
+ /**< - Units -- Meters per second */
+
+ /* Heading validity bit */
+ uint8_t heading_valid;
+ /**< Indicates whether the heading field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Heading */
+ float heading;
+ /**< - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+}qmiLocGeofencePositionStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCECONFIDENCEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_CONFIDENCE_LOW_V02 = 0x01, /**< Geofence engine indicates a breach with
+ low confidence; this setting results in lower
+ power usage, and it can impact the yield because
+ incorrect breach events can be sent \n */
+ eQMI_LOC_GEOFENCE_CONFIDENCE_MED_V02 = 0x02, /**< (Default) Geofence engine indicates a breach with
+ medium confidence \n */
+ eQMI_LOC_GEOFENCE_CONFIDENCE_HIGH_V02 = 0x03, /**< Geofence engine indicates a breach with
+ high confidence; this setting results in higher
+ power usage */
+ QMILOCGEOFENCECONFIDENCEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceConfidenceEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of
+ a Geofence breach event. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence ID */
+ uint32_t geofenceId;
+ /**< ID of the Geofence for which this
+ notification was generated. */
+
+ /* Mandatory */
+ /* Geofence Breach Type */
+ qmiLocGeofenceBreachTypeEnumT_v02 breachType;
+ /**< The type of breach that generated this event.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_BREACH_TYPE_ENTERING (1) -- Indicates that a client entered the Geofence \n
+ - eQMI_LOC_GEOFENCE_BREACH_TYPE_LEAVING (2) -- Indicates that a client left the Geofence
+ */
+
+ /* Optional */
+ /* Geofence Position */
+ uint8_t geofencePosition_valid; /**< Must be set to true if geofencePosition is being passed */
+ qmiLocGeofencePositionStructT_v02 geofencePosition;
+ /**< \vspace{0.06in} \n Position of the client when it breached the Geofence.
+ This TLV is included if the client configures the
+ Geofence to report position. The position is reported
+ at the same confidence level that was specified in the
+ Add Circular Geofence request. */
+
+ /* Optional */
+ /* Geofence Breach Confidence */
+ uint8_t breachConfidence_valid; /**< Must be set to true if breachConfidence is being passed */
+ qmiLocGeofenceConfidenceEnumT_v02 breachConfidence;
+ /**< Given a breach event, the confidence determines the probability
+ that the breach happened at the Geofence boundary.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_LOW (0x01) -- Geofence engine indicates a breach with
+ low confidence; this setting results in lower
+ power usage, and it can impact the yield because
+ incorrect breach events can be sent \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_MED (0x02) -- (Default) Geofence engine indicates a breach with
+ medium confidence \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_HIGH (0x03) -- Geofence engine indicates a breach with
+ high confidence; this setting results in higher
+ power usage
+ */
+}qmiLocEventGeofenceBreachIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Recommends how to send pedometer reports to the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Request Pedometer Data */
+ uint8_t requestPedometerData;
+ /**< Indicates whether the GNSS location engine is requesting the client to
+ send pedometer data. \n
+ - 0x01 (TRUE) -- GNSS location engine is requesting
+ pedometer data \n
+ - 0x00 (FALSE) -- GNSS location engine is not requesting
+ pedometer data
+ */
+
+ /* Optional */
+ /* Reset Step Count */
+ uint8_t resetStepCount_valid; /**< Must be set to true if resetStepCount is being passed */
+ uint8_t resetStepCount;
+ /**< Indicates whether the location engine is to reset the step count. \n
+ - 0x01 (TRUE) -- Reset pedometer step count \n
+ - 0x00 (FALSE) -- Do not reset pedometer step count
+ */
+
+ /* Optional */
+ /* Step Count Threshold */
+ uint8_t stepCountThreshold_valid; /**< Must be set to true if stepCountThreshold is being passed */
+ uint32_t stepCountThreshold;
+ /**< Specifies the number of steps to sample in a pedometer report,
+ as recommended by the location engine. If the threshold is set to 0,
+ the location engine wants a pedometer report at every step event.
+ */
+}qmiLocEventPedometerControlIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Recommends how to send motion data reports to the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Request Motion Data */
+ uint8_t requestMotionData;
+ /**< Indicates whether the GNSS location engine is requesting
+ the client to send motion data.\n
+ - 0x01 (TRUE) -- GNSS location engine is requesting
+ motion data \n
+ - 0x00 (FALSE) -- GNSS location engine is not requesting
+ motion data
+ */
+}qmiLocEventMotionDataControlIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ /* Low Geofence ID */
+ uint32_t idLow;
+ /**< Contains the starting ID of the Geofence in the range of the continuous
+ range of Geofences that were breached at the same position. */
+
+ /* High Geofence ID */
+ uint32_t idHigh;
+ /**< Contains the ending ID of the Geofence in the range of the continuous
+ range of Geofences that were breached at the same position. */
+}qmiLocGeofenceIdContinuousStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of a Geofence breach event by
+ batching all the Geofences that were breached. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence Breach Type */
+ qmiLocGeofenceBreachTypeEnumT_v02 breachType;
+ /**< Type of breach that generated this event.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_BREACH_TYPE_ENTERING (1) -- Indicates that a client entered the Geofence \n
+ - eQMI_LOC_GEOFENCE_BREACH_TYPE_LEAVING (2) -- Indicates that a client left the Geofence
+ */
+
+ /* Optional */
+ /* Geofence ID Continuous */
+ uint8_t geofenceIdContinuousList_valid; /**< Must be set to true if geofenceIdContinuousList is being passed */
+ uint32_t geofenceIdContinuousList_len; /**< Must be set to # of elements in geofenceIdContinuousList */
+ qmiLocGeofenceIdContinuousStructT_v02 geofenceIdContinuousList[QMI_LOC_MAX_GEOFENCE_ID_CONTINUOUS_LIST_LENGTH_V02];
+ /**< \vspace{0.06in} \n Each entry in the list contains the continuous range of Geofence IDs that were breached
+ at the same position. This list does not overlap with the discrete Geofence ID list. */
+
+ /* Optional */
+ /* Geofence ID Discrete */
+ uint8_t geofenceIdDiscreteList_valid; /**< Must be set to true if geofenceIdDiscreteList is being passed */
+ uint32_t geofenceIdDiscreteList_len; /**< Must be set to # of elements in geofenceIdDiscreteList */
+ uint32_t geofenceIdDiscreteList[QMI_LOC_MAX_GEOFENCE_ID_DISCRETE_LIST_LENGTH_V02];
+ /**< This list contains the Geofence IDs that were breached at the same position.
+ This list does not overlap with the continuous Geofence ID list. */
+
+ /* Optional */
+ /* Geofence Position */
+ uint8_t geofencePosition_valid; /**< Must be set to true if geofencePosition is being passed */
+ qmiLocGeofencePositionStructT_v02 geofencePosition;
+ /**< \vspace{0.06in} \n Position of the client when it breached the Geofence.
+ This TLV is included if the client configures the
+ Geofence to report its position. The position is reported
+ at the same confidence level that was specified in the
+ Add Circular Geofence request. */
+
+ /* Optional */
+ /* Geofence Breach Confidence */
+ uint8_t breachConfidence_valid; /**< Must be set to true if breachConfidence is being passed */
+ qmiLocGeofenceConfidenceEnumT_v02 breachConfidence;
+ /**< Given a breach event, the confidence determines the probability
+ that the breach happened at the Geofence boundary.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_LOW (0x01) -- Geofence engine indicates a breach with
+ low confidence; this setting results in lower
+ power usage, and it can impact the yield because
+ incorrect breach events can be sent \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_MED (0x02) -- (Default) Geofence engine indicates a breach with
+ medium confidence \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_HIGH (0x03) -- Geofence engine indicates a breach with
+ high confidence; this setting results in higher
+ power usage
+ */
+
+ /* Optional */
+ /* Heading Uncertainty */
+ uint8_t headingUnc_valid; /**< Must be set to true if headingUnc is being passed */
+ float headingUnc;
+ /**< - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ /* Optional */
+ /* Vertical Uncertainty */
+ uint8_t vertUnc_valid; /**< Must be set to true if vertUnc is being passed */
+ float vertUnc;
+ /**< - Units -- Meters */
+
+ /* Optional */
+ /* Speed Uncertainty */
+ uint8_t speedUnc_valid; /**< Must be set to true if speedUnc is being passed */
+ float speedUnc;
+ /**< 3D speed uncertainty. \n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Horizontal Confidence */
+ uint8_t horConfidence_valid; /**< Must be set to true if horConfidence is being passed */
+ uint8_t horConfidence;
+ /**< Horizontal uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Dilution of Precision */
+ uint8_t DOP_valid; /**< Must be set to true if DOP is being passed */
+ qmiLocDOPStructT_v02 DOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* SVs Used to Calculate the Fix */
+ uint8_t gnssSvUsedList_valid; /**< Must be set to true if gnssSvUsedList is being passed */
+ uint32_t gnssSvUsedList_len; /**< Must be set to # of elements in gnssSvUsedList */
+ uint16_t gnssSvUsedList[QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02];
+ /**< Each entry in the list contains the SV ID of a satellite
+ used for calculating this position report. The following
+ information is associated with each SV ID.
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - SBAS -- 120 to 158 and 183 to 191 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Extended Dilution of Precision */
+ uint8_t extDOP_valid; /**< Must be set to true if extDOP is being passed */
+ qmiLocExtDOPStructT_v02 extDOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* Expanded SVs Used to Calculate the Fix */
+ uint8_t expandedGnssSvUsedList_valid; /**< Must be set to true if expandedGnssSvUsedList is being passed */
+ uint32_t expandedGnssSvUsedList_len; /**< Must be set to # of elements in expandedGnssSvUsedList */
+ uint16_t expandedGnssSvUsedList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< If the service reports expandedGnssSvUsedList, gnssSvUsedList is
+ not reported. Each entry in the list contains the SV ID of a satellite
+ used to calculate this position report. The following
+ information is associated with each SV ID.
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Satellite Signal Types in the SVs Used list */
+ uint8_t gnssSvUsedSignalTypeList_valid; /**< Must be set to true if gnssSvUsedSignalTypeList is being passed */
+ uint32_t gnssSvUsedSignalTypeList_len; /**< Must be set to # of elements in gnssSvUsedSignalTypeList */
+ qmiLocGnssSignalTypeMaskT_v02 gnssSvUsedSignalTypeList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the signal type of each satellite in expandedGnssSvUsedList. The
+ signal type list is aligned with the SVs in expandedGnssSvUsedList. Value of 0
+ means invalid.\n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band */
+}qmiLocEventGeofenceBatchedBreachIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCEPROXIMITYTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_PROXIMITY_TYPE_IN_V02 = 1, /**< Indicates that a client is in proximity of the Geofence \n */
+ eQMI_LOC_GEOFENCE_PROXIMITY_TYPE_OUT_V02 = 2, /**< Indicates that a client is out of proximity of the Geofence */
+ QMILOCGEOFENCEPROXIMITYTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceProximityTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of a Geofence proximity event. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence Breach Type */
+ qmiLocGeofenceProximityTypeEnumT_v02 proximityType;
+ /**< Values: \n
+ - eQMI_LOC_GEOFENCE_PROXIMITY_TYPE_IN (1) -- Indicates that a client is in proximity of the Geofence \n
+ - eQMI_LOC_GEOFENCE_PROXIMITY_TYPE_OUT (2) -- Indicates that a client is out of proximity of the Geofence
+ */
+
+ /* Mandatory */
+ /* Geofence ID */
+ uint32_t geofenceId;
+ /**< Identifier of the Geofence that is in proximity to the handset.
+ */
+
+ /* Optional */
+ /* Geofence Context ID */
+ uint8_t contextId_valid; /**< Must be set to true if contextId is being passed */
+ uint32_t contextId;
+ /**< Identifier for the context of the Geofence to which the handset is in proximity.
+ A single Geofence might be associated with different contexts.
+ */
+}qmiLocEventGeofenceProximityIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCEDWELLTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_DWELL_TYPE_INSIDE_V02 = 1, /**< Indicates that a client dwelled inside the Geofence \n */
+ eQMI_LOC_GEOFENCE_DWELL_TYPE_OUTSIDE_V02 = 2, /**< Indicates that a client dwelled outside the Geofence */
+ QMILOCGEOFENCEDWELLTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceDwellTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of a Geofence dwell event by
+ batching all the Geofences that were dwelled in. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence Dwell Type */
+ qmiLocGeofenceDwellTypeEnumT_v02 dwellType;
+ /**< Type of dwell event generated.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_DWELL_TYPE_INSIDE (1) -- Indicates that a client dwelled inside the Geofence \n
+ - eQMI_LOC_GEOFENCE_DWELL_TYPE_OUTSIDE (2) -- Indicates that a client dwelled outside the Geofence
+ */
+
+ /* Optional */
+ /* Geofence ID Continuous */
+ uint8_t geofenceIdContinuousList_valid; /**< Must be set to true if geofenceIdContinuousList is being passed */
+ uint32_t geofenceIdContinuousList_len; /**< Must be set to # of elements in geofenceIdContinuousList */
+ qmiLocGeofenceIdContinuousStructT_v02 geofenceIdContinuousList[QMI_LOC_MAX_GEOFENCE_ID_CONTINUOUS_LIST_LENGTH_V02];
+ /**< Each entry in the list contains the continuous range of Geofence IDs in which a client dwelled.
+ This list does not overlap with the discrete Geofence ID list. */
+
+ /* Optional */
+ /* Geofence ID Discrete */
+ uint8_t geofenceIdDiscreteList_valid; /**< Must be set to true if geofenceIdDiscreteList is being passed */
+ uint32_t geofenceIdDiscreteList_len; /**< Must be set to # of elements in geofenceIdDiscreteList */
+ uint32_t geofenceIdDiscreteList[QMI_LOC_MAX_GEOFENCE_ID_DISCRETE_LIST_LENGTH_V02];
+ /**< This list contains the Geofence IDs in which a client dwelled.
+ This list does not overlap with the continuous Geofence ID list. */
+
+ /* Optional */
+ /* Geofence Position */
+ uint8_t geofencePosition_valid; /**< Must be set to true if geofencePosition is being passed */
+ qmiLocGeofencePositionStructT_v02 geofencePosition;
+ /**< \n The latest position calculated by the Geofence engine when
+ the dwell notification is sent. */
+
+ /* Optional */
+ /* Heading Uncertainty */
+ uint8_t headingUnc_valid; /**< Must be set to true if headingUnc is being passed */
+ float headingUnc;
+ /**< Heading uncertainty.\n
+ - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ /* Optional */
+ /* Vertical Uncertainty */
+ uint8_t vertUnc_valid; /**< Must be set to true if vertUnc is being passed */
+ float vertUnc;
+ /**< Vertical uncertainty.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Speed Uncertainty */
+ uint8_t speedUnc_valid; /**< Must be set to true if speedUnc is being passed */
+ float speedUnc;
+ /**< 3D speed uncertainty.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Horizontal Confidence */
+ uint8_t horConfidence_valid; /**< Must be set to true if horConfidence is being passed */
+ uint8_t horConfidence;
+ /**< Horizontal uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Dilution of Precision */
+ uint8_t DOP_valid; /**< Must be set to true if DOP is being passed */
+ qmiLocDOPStructT_v02 DOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* SVs Used to Calculate the Fix */
+ uint8_t gnssSvUsedList_valid; /**< Must be set to true if gnssSvUsedList is being passed */
+ uint32_t gnssSvUsedList_len; /**< Must be set to # of elements in gnssSvUsedList */
+ uint16_t gnssSvUsedList[QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02];
+ /**< Each entry in the list contains the SV ID of a satellite
+ used for calculating this position report. The following
+ information is associated with each SV ID.
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - SBAS -- 120 to 158 and 183 to 191 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Extended Dilution of Precision */
+ uint8_t extDOP_valid; /**< Must be set to true if extDOP is being passed */
+ qmiLocExtDOPStructT_v02 extDOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* Expanded SVs Used to Calculate the Fix */
+ uint8_t expandedGnssSvUsedList_valid; /**< Must be set to true if expandedGnssSvUsedList is being passed */
+ uint32_t expandedGnssSvUsedList_len; /**< Must be set to # of elements in expandedGnssSvUsedList */
+ uint16_t expandedGnssSvUsedList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< If the service reports expandedGnssSvUsedList, gnssSvUsedList is
+ not reported. Each entry in the list contains the SV ID of a satellite
+ used to calculate this position report. The following
+ information is associated with each SV ID.
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Satellite Signal Types in the SVs Used list */
+ uint8_t gnssSvUsedSignalTypeList_valid; /**< Must be set to true if gnssSvUsedSignalTypeList is being passed */
+ uint32_t gnssSvUsedSignalTypeList_len; /**< Must be set to # of elements in gnssSvUsedSignalTypeList */
+ qmiLocGnssSignalTypeMaskT_v02 gnssSvUsedSignalTypeList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the signal type of each satellite in expandedGnssSvUsedList. The
+ signal type list is aligned with the SVs in expandedGnssSvUsedList. Value 0
+ means invalid.
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band */
+}qmiLocEventGeofenceBatchedDwellIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGDTSERVICEIDENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GDT_SERVICE_WWAN_V02 = 1, /**< GDT service for WWAN UL \n */
+ eQMI_LOC_GDT_SERVICE_WWAN_DL_V02 = 2, /**< GDT service for WWAN DL \n */
+ eQMI_LOC_GDT_SERVICE_CSM_UL_V02 = 3, /**< GDT service for Crowdsource Manager UL */
+ QMILOCGDTSERVICEIDENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGdtServiceIdEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGDTACCESSSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GDT_ACCESS_ALLOWED_V02 = 1, /**< GDT access to the service is allowed \n */
+ eQMI_LOC_GDT_ACCESS_FAILED_V02 = 2, /**< Any type of GDT access error \n */
+ eQMI_LOC_GDT_ACCESS_NOT_ALLOWED_V02 = 3, /**< GDT access to the service is not allowed */
+ QMILOCGDTACCESSSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGdtAccessStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to transfer data. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* Data */
+ uint32_t filePath_len; /**< Must be set to # of elements in filePath */
+ char filePath[QMI_LOC_MAX_GDT_PATH_LEN_V02];
+ /**< File path to the data. \n
+ - Type: Array of bytes \n
+ - Maximum length of the array: 255
+ */
+}qmiLocEventGdtUploadBeginStatusReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGDTENDSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GDT_SUCCESS_V02 = 1, /**< The sent data was accepted \n */
+ eQMI_LOC_GDT_FAILED_V02 = 2, /**< The sent data was not accepted \n */
+ eQMI_LOC_GDT_INVALID_V02 = 3, /**< General error in the received data */
+ QMILOCGDTENDSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGdtEndStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to report the status of the
+ transferred data. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+
+ /* Mandatory */
+ /* GDT End Status */
+ qmiLocGdtEndStatusEnumT_v02 endStatus;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SUCCESS (1) -- The sent data was accepted \n
+ - eQMI_LOC_GDT_FAILED (2) -- The sent data was not accepted \n
+ - eQMI_LOC_GDT_INVALID (3) -- General error in the received data */
+}qmiLocEventGdtUploadEndReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocGdtDownloadReqMaskT_v02;
+#define QMI_LOC_GDT_DOWNLOAD_REQ_MASK_DBH_V02 ((qmiLocGdtDownloadReqMaskT_v02)0x00000001) /**< Bitmask specifying whether DBH is on for the request. */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to transfer data. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* Interval After Which AP Must Respond to MP */
+ uint32_t respTimeoutInterval;
+ /**< Interval after which the AP must respond to the MP, in seconds. */
+
+ /* Mandatory */
+ /* Encoded GTP Client Information */
+ uint32_t clientInfo_len; /**< Must be set to # of elements in clientInfo */
+ uint8_t clientInfo[QMI_LOC_MAX_GTP_CL_INFO_LEN_V02];
+ /**< GTP client information encoded in asn.1 format. \n
+ - Type: Array of bytes \n
+ - Maximum length of the array: 1500
+ */
+
+ /* Mandatory */
+ /* Encoded Mobile Status Data */
+ uint32_t mobileStatusData_len; /**< Must be set to # of elements in mobileStatusData */
+ uint8_t mobileStatusData[QMI_LOC_MAX_GTP_MSD_LEN_V02];
+ /**< Mobile status data encoded in asn.1 format. \n
+ - Type: Array of bytes \n
+ - Maximum length of the array: 4000
+ */
+
+ /* Mandatory */
+ /* Data Filepath (NULL-Terminated) */
+ uint32_t filePath_len; /**< Must be set to # of elements in filePath */
+ char filePath[QMI_LOC_MAX_GDT_PATH_LEN_V02];
+ /**< File path to the GTP response data that is applicable to the MP. \n
+ - Type: Array of bytes \n
+ - Maximum length of the array: 255
+ */
+
+ /* Optional */
+ /* Power Budget Info */
+ uint8_t powerBudgetInfo_valid; /**< Must be set to true if powerBudgetInfo is being passed */
+ uint32_t powerBudgetInfo;
+ /**< Power budget information. */
+
+ /* Optional */
+ /* Power Budget Allowance */
+ uint8_t powerBudgetAllowance_valid; /**< Must be set to true if powerBudgetAllowance is being passed */
+ uint32_t powerBudgetAllowance;
+ /**< Power budget allowance. */
+
+ /* Optional */
+ /* Download Request Mask */
+ uint8_t downloadRequestMask_valid; /**< Must be set to true if downloadRequestMask is being passed */
+ qmiLocGdtDownloadReqMaskT_v02 downloadRequestMask;
+ /**< Download request mask. */
+}qmiLocEventGdtDownloadBeginReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGDTRECEIVESTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GTP_RCV_STATUS_CONTINUE_V02 = 1, /**< Indicates that the AP is to continue sending more partitions to the MP \n */
+ eQMI_LOC_GTP_RCV_STATUS_DONE_V02 = 2, /**< Indicates that the AP is to stop sending partitions to the MP */
+ QMILOCGDTRECEIVESTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGdtReceiveStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point after consuming the current data transfer. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* GDT Receive Status */
+ qmiLocGdtReceiveStatusEnumT_v02 status;
+ /**< Status indicating the continuation or termination of sending to the AP.
+ Values: \n
+ - eQMI_LOC_GTP_RCV_STATUS_CONTINUE (1) -- Indicates that the AP is to continue sending more partitions to the MP \n
+ - eQMI_LOC_GTP_RCV_STATUS_DONE (2) -- Indicates that the AP is to stop sending partitions to the MP
+ */
+}qmiLocEventGdtReceiveDoneIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of the end of a download session. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* GDT Download End Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the download session.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocEventGdtDownloadEndReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the client to query the service revision. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetServiceRevisionReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the client to query the service revision. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Revision Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Revision request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Interface Definition Minor Revision */
+ uint32_t revision;
+ /**< Revision of the service. This is the minor revision of the interface that
+ the service implements. Minor revision updates of the service are always
+ backward compatible. */
+
+ /* Optional */
+ /* GNSS Measurement Engine Firmware Version String */
+ uint8_t gnssMeFWVerString_valid; /**< Must be set to true if gnssMeFWVerString is being passed */
+ char gnssMeFWVerString[QMI_LOC_GNSS_ME_VERSION_STRING_MAX_LENGTH_V02 + 1];
+ /**< Version of the GNSS measurement engine software running under the LOC API. \n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 128 \n
+ \textbf{Note:} This string is only provided on platforms that have
+ a measurement engine that supports this version string. On all other
+ platforms, this optional TLV is not provided. */
+
+ /* Optional */
+ /* GNSS Hosted Software Version String */
+ uint8_t gnssHostSWVerString_valid; /**< Must be set to true if gnssHostSWVerString is being passed */
+ char gnssHostSWVerString[QMI_LOC_GNSS_HOSTED_SW_VERSION_STRING_MAX_LENGTH_V02 + 1];
+ /**< Version of the GNSS hosted software running under the LOC API.\n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 128 \n
+ \textbf{Note:} This string is only provided on hosted architectures
+ (measurement and position engine running on different processors) that
+ support this version string. All other platforms do not provide this optional TLV. */
+
+ /* Optional */
+ /* GNSS Software Version String */
+ uint8_t gnssSWVerString_valid; /**< Must be set to true if gnssSWVerString is being passed */
+ char gnssSWVerString[QMI_LOC_GNSS_SW_VERSION_STRING_MAX_LENGTH_V02 + 1];
+ /**< Aggregate version of the GNSS software. \n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 256
+ */
+}qmiLocGetServiceRevisionIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the fix criteria from the location engine. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetFixCriteriaReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the fix criteria from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Fix Criteria Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_FIX_CRITERIA_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Horizontal Accuracy */
+ uint8_t horizontalAccuracyLevel_valid; /**< Must be set to true if horizontalAccuracyLevel is being passed */
+ qmiLocAccuracyLevelEnumT_v02 horizontalAccuracyLevel;
+ /**< Horizontal accuracy level.
+ Values: \n
+ - eQMI_LOC_ACCURACY_LOW (1) -- Low accuracy \n
+ - eQMI_LOC_ACCURACY_MED (2) -- Medium accuracy \n
+ - eQMI_LOC_ACCURACY_HIGH (3) -- High accuracy
+ */
+
+ /* Optional */
+ /* Enable/Disable Intermediate Fixes */
+ uint8_t intermediateReportState_valid; /**< Must be set to true if intermediateReportState is being passed */
+ qmiLocIntermediateReportStateEnumT_v02 intermediateReportState;
+ /**< Intermediate report state (ON, OFF).\n
+ The client must explicitly set this field to OFF to stop receiving
+ intermediate position reports. Intermediate position reports are
+ generated at 1 Hz and are ON by default. If intermediate reports
+ are turned ON, the client receives position reports even if the
+ accuracy criteria is not met. The status in the position report is
+ set to IN_PROGRESS for intermediate reports.
+ Values: \n
+ - eQMI_LOC_INTERMEDIATE_REPORTS_ON (1) -- Intermediate reports are turned on \n
+ - eQMI_LOC_INTERMEDIATE_REPORTS_OFF (2) -- Intermediate reports are turned off
+ */
+
+ /* Optional */
+ /* Minimum Interval Between Fixes */
+ uint8_t minInterval_valid; /**< Must be set to true if minInterval is being passed */
+ uint32_t minInterval;
+ /**< Time that must elapse before alerting the client. \n
+ - Units -- Milliseconds */
+
+ /* Optional */
+ /* ID of the Application that Sent the Position Request */
+ uint8_t applicationId_valid; /**< Must be set to true if applicationId is being passed */
+ qmiLocApplicationIdStructT_v02 applicationId;
+ /**< \vspace{0.06in} \n Application provider, name, and version.*/
+
+ /* Optional */
+ /* Configuration for Altitude Assumed Info in GNSS SV Info Event */
+ uint8_t configAltitudeAssumed_valid; /**< Must be set to true if configAltitudeAssumed is being passed */
+ qmiLocConfigIncludeAltitudeAssumedInGnssSvInfoEnumT_v02 configAltitudeAssumed;
+ /**< Specifies the configuration to include Altitude Assumed information in the GNSS SV Info Event.
+ When enabled, an additional GNSS SV Info event indication is sent to the control
+ point that also includes the Altitude Sssumed information.
+ If not specified, the configuration defaults to ENABLED.
+ Values: \n
+ - eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_ENABLED (1) -- Enable altitude assumed information in GNSS SV Info Event.\n
+ - eQMI_LOC_ALTITUDE_ASSUMED_IN_GNSS_SV_INFO_DISABLED (2) -- Disable altitude assumed information in GNSS SV Info Event.
+ */
+
+ /* Optional */
+ /* Minimum Interval Between Intermediate Position Reports */
+ uint8_t minIntermediatePositionReportInterval_valid; /**< Must be set to true if minIntermediatePositionReportInterval is being passed */
+ uint32_t minIntermediatePositionReportInterval;
+ /**< Minimum time interval for intermediate position reports, specified by the control point,
+ that, between the position reports elapsed time, must be longer than the interval time.
+ If this optional value is not set or set to the default value (0), the intermediate position
+ is reported when it is ready. \n
+ - Units -- Milliseconds \n
+ - Default: 0 ms
+ */
+
+ /* Optional */
+ /* Maximum Wait Time to Get a Position Report */
+ uint8_t positionReportTimeout_valid; /**< Must be set to true if positionReportTimeout is being passed */
+ uint32_t positionReportTimeout;
+ /**< Maximum time to work on each fix, specified by the control point.
+ The GPS engine returns QMI_ERR_INTERNAL if a position cannot be obtained
+ within the positionReportTimeout value. \n
+ - Units -- Milliseconds \n
+ - Default: 255*1000 ms \n
+ - Range: 1000 - 255*1000 ms
+ */
+
+ /* Optional */
+ /* Share Position Report with Other Clients */
+ uint8_t sharePosition_valid; /**< Must be set to true if sharePosition is being passed */
+ uint8_t sharePosition;
+ /**< Share the position report with the other QMI_LOC clients. \n
+ - 0x00 (FALSE) -- Do not share the position report \n
+ - 0x01 (TRUE) -- Share the position report
+ */
+
+ /* Optional */
+ /* GNSS Power Mode */
+ uint8_t powerMode_valid; /**< Must be set to true if powerMode is being passed */
+ qmiLocPowerModeStructT_v02 powerMode;
+ /**< The power mode requested by the client.
+ */
+}qmiLocGetFixCriteriaIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCNIUSERRESPENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT_V02 = 1, /**< User accepted the Notify/Verify request \n */
+ eQMI_LOC_NI_LCS_NOTIFY_VERIFY_DENY_V02 = 2, /**< User denied the Notify/Verify request \n */
+ eQMI_LOC_NI_LCS_NOTIFY_VERIFY_NORESP_V02 = 3, /**< User did not respond to the Notify/Verify request */
+ QMILOCNIUSERRESPENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocNiUserRespEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sends the NI user response back to the engine; success or
+ failure is reported in a separate indication. */
+typedef struct {
+
+ /* Mandatory */
+ /* User Response */
+ qmiLocNiUserRespEnumT_v02 userResp;
+ /**< User accepted or denied.
+ Values: \n
+ - eQMI_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT (1) -- User accepted the Notify/Verify request \n
+ - eQMI_LOC_NI_LCS_NOTIFY_VERIFY_DENY (2) -- User denied the Notify/Verify request \n
+ - eQMI_LOC_NI_LCS_NOTIFY_VERIFY_NORESP (3) -- User did not respond to the Notify/Verify request
+ */
+
+ /* Mandatory */
+ /* Notification Type */
+ qmiLocNiNotifyVerifyEnumT_v02 notificationType;
+ /**< Type of notification/verification performed.
+ Values: \n
+ - eQMI_LOC_NI_USER_NO_NOTIFY_NO_VERIFY (1) -- No notification and no verification required \n
+ - eQMI_LOC_NI_USER_NOTIFY_ONLY (2) -- Notify only; no verification required \n
+ - eQMI_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP (3) -- Notify and verify, but no response required. \n
+ - eQMI_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP (4) -- Notify and verify, and require a response \n
+ - eQMI_LOC_NI_USER_NOTIFY_VERIFY_PRIVACY_OVERRIDE (5) -- Notify and verify; privacy override
+ */
+
+ /* Optional */
+ /* Network Initiated Vx Request */
+ uint8_t NiVxPayload_valid; /**< Must be set to true if NiVxPayload is being passed */
+ qmiLocNiVxNotifyVerifyStructT_v02 NiVxPayload;
+ /**< \vspace{0.06in} \n Optional NI VX request payload. */
+
+ /* Optional */
+ /* Network Initiated SUPL Request */
+ uint8_t NiSuplPayload_valid; /**< Must be set to true if NiSuplPayload is being passed */
+ qmiLocNiSuplNotifyVerifyStructT_v02 NiSuplPayload;
+ /**< \vspace{0.06in} \n Optional NI SUPL request payload. */
+
+ /* Optional */
+ /* Network Initiated UMTS Control Plane Request */
+ uint8_t NiUmtsCpPayload_valid; /**< Must be set to true if NiUmtsCpPayload is being passed */
+ qmiLocNiUmtsCpNotifyVerifyStructT_v02 NiUmtsCpPayload;
+ /**< \vspace{0.06in} \n Optional NI UMTS-CP request payload. */
+
+ /* Optional */
+ /* Network Initiated Service Interaction Request */
+ uint8_t NiVxServiceInteractionPayload_valid; /**< Must be set to true if NiVxServiceInteractionPayload is being passed */
+ qmiLocNiVxServiceInteractionStructT_v02 NiVxServiceInteractionPayload;
+ /**< \vspace{0.06in} \n Optional NI service interaction payload. */
+
+ /* Optional */
+ /* Network Initiated SUPL Version 2 Extension */
+ uint8_t NiSuplVer2ExtPayload_valid; /**< Must be set to true if NiSuplVer2ExtPayload is being passed */
+ qmiLocNiSuplVer2ExtStructT_v02 NiSuplVer2ExtPayload;
+ /**< \vspace{0.06in} \n Optional SUPL Version 2 Extension payload. */
+
+ /* Optional */
+ /* SUPL Emergency Notification */
+ uint8_t suplEmergencyNotification_valid; /**< Must be set to true if suplEmergencyNotification is being passed */
+ qmiLocEmergencyNotificationStructT_v02 suplEmergencyNotification;
+ /**< \vspace{0.06in} \n SUPL emergency notification payload. Emergency notification
+ can be provided even without an ESLP address */
+}qmiLocNiUserRespReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the NI user response back to the engine; success or
+ failure is reported in a separate indication. */
+typedef struct {
+
+ /* Mandatory */
+ /* NI User Response Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the NI User Response request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocNiUserRespIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPREDICTEDORBITSDATAFORMATENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_PREDICTED_ORBITS_XTRA_V02 = 0, /**< Default is XTRA format. */
+ QMILOCPREDICTEDORBITSDATAFORMATENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPredictedOrbitsDataFormatEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects predicted orbits data. (Deprecated) */
+typedef struct {
+
+ /* Mandatory */
+ /* Total Size */
+ uint32_t totalSize;
+ /**< Total size of the predicted orbits data to inject. \n
+ - Units -- Bytes */
+
+ /* Mandatory */
+ /* Total Parts */
+ uint16_t totalParts;
+ /**< Total number of parts to divide the predicted orbits data into. */
+
+ /* Mandatory */
+ /* Part Number */
+ uint16_t partNum;
+ /**< Number of the current predicted orbits data part; starts at 1. */
+
+ /* Mandatory */
+ /* Data */
+ uint32_t partData_len; /**< Must be set to # of elements in partData */
+ char partData[QMI_LOC_MAX_PREDICTED_ORBITS_PART_LEN_V02];
+ /**< Predicted orbits data. \n
+ - Type -- Array of bytes \n
+ - Maximum length of the array -- 1024
+ */
+
+ /* Optional */
+ /* Format Type */
+ uint8_t formatType_valid; /**< Must be set to true if formatType is being passed */
+ qmiLocPredictedOrbitsDataFormatEnumT_v02 formatType;
+ /**< Predicted orbits data format. \n
+ Values: \n
+ - eQMI_LOC_PREDICTED_ORBITS_XTRA (0) -- Default is XTRA format.
+ */
+}qmiLocInjectPredictedOrbitsDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects predicted orbits data. (Deprecated) */
+typedef struct {
+
+ /* Mandatory */
+ /* Data Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Data Injection request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Part Number */
+ uint8_t partNum_valid; /**< Must be set to true if partNum is being passed */
+ uint16_t partNum;
+ /**< Number of the predicted orbits data part for which this indication
+ is sent; starts at 1. */
+}qmiLocInjectPredictedOrbitsDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the predicted orbits data source. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetPredictedOrbitsDataSourceReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the predicted orbits data source. */
+typedef struct {
+
+ /* Mandatory */
+ /* Predicted Orbits Data Source Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the query request for a predicted orbits data source.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Allowed Sizes */
+ uint8_t allowedSizes_valid; /**< Must be set to true if allowedSizes is being passed */
+ qmiLocPredictedOrbitsAllowedSizesStructT_v02 allowedSizes;
+ /**< \n Maximum part and file size to inject in the engine. */
+
+ /* Optional */
+ /* Server List */
+ uint8_t serverList_valid; /**< Must be set to true if serverList is being passed */
+ qmiLocPredictedOrbitsServerListStructT_v02 serverList;
+ /**< \n List of servers that the client can use to download
+ predicted orbits data. */
+}qmiLocGetPredictedOrbitsDataSourceIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the predicted orbits data validity. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetPredictedOrbitsDataValidityReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint64_t startTimeInUTC;
+ /**< Predicted orbits data is valid starting from this time. \n
+ - Units -- Seconds (since Jan. 1, 1970)
+ */
+
+ uint16_t durationHours;
+ /**< Duration from the start time for which the data is valid.\n
+ - Units -- Hours
+ */
+}qmiLocPredictedOrbitsDataValidityStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the predicted orbits data validity. */
+typedef struct {
+
+ /* Mandatory */
+ /* Predicted Orbits Data Validity Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the query request for predicted orbits data validity.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Validity Info */
+ uint8_t validityInfo_valid; /**< Must be set to true if validityInfo is being passed */
+ qmiLocPredictedOrbitsDataValidityStructT_v02 validityInfo;
+}qmiLocGetPredictedOrbitsDataValidityIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCCOARSETIMEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_COARSE_TIME_UNKNOWN_V02 = 0, /**< Origin unknown, default setting, cross check \n */
+ eQMI_LOC_COARSE_TIME_AP_V02 = 1, /**< AP-based time injection, origin unknown \n */
+ eQMI_LOC_COARSE_TIME_NTP_XTRA_V02 = 2, /**< NTP-based injection \n */
+ eQMI_LOC_COARSE_TIME_NTS_XTRA_V02 = 3, /**< Network time security */
+ QMILOCCOARSETIMEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocCoarseTimeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects UTC time in the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* UTC Time */
+ uint64_t timeUtc;
+ /**< UTC time since Jan. 1, 1970.\n
+ - Units: Milliseconds */
+
+ /* Mandatory */
+ /* Time Uncertainty */
+ uint32_t timeUnc;
+ /**< - Units: Milliseconds */
+
+ /* Optional */
+ /* Time Source */
+ uint8_t timeSrc_valid; /**< Must be set to true if timeSrc is being passed */
+ qmiLocCoarseTimeEnumT_v02 timeSrc;
+ /**< Specifies the source of the coarse time.
+ Values: \n
+ - eQMI_LOC_COARSE_TIME_UNKNOWN (0) -- Origin unknown, default setting, cross check \n
+ - eQMI_LOC_COARSE_TIME_AP (1) -- AP-based time injection, origin unknown \n
+ - eQMI_LOC_COARSE_TIME_NTP_XTRA (2) -- NTP-based injection \n
+ - eQMI_LOC_COARSE_TIME_NTS_XTRA (3) -- Network time security
+ */
+}qmiLocInjectUtcTimeReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects UTC time in the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* UTC Time Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the UTC Time Injection request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectUtcTimeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCALTSRCENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_ALT_SRC_UNKNOWN_V02 = 0, /**< Source is unknown \n */
+ eQMI_LOC_ALT_SRC_GPS_V02 = 1, /**< GPS is the source \n */
+ eQMI_LOC_ALT_SRC_CELL_ID_V02 = 2, /**< Cell ID provided the source \n */
+ eQMI_LOC_ALT_SRC_ENHANCED_CELL_ID_V02 = 3, /**< Source is enhanced cell ID \n */
+ eQMI_LOC_ALT_SRC_WIFI_V02 = 4, /**< Wi-Fi is the source \n */
+ eQMI_LOC_ALT_SRC_TERRESTRIAL_V02 = 5, /**< Terrestrial source \n */
+ eQMI_LOC_ALT_SRC_TERRESTRIAL_HYBRID_V02 = 6, /**< Hybrid terrestrial source \n */
+ eQMI_LOC_ALT_SRC_ALTITUDE_DATABASE_V02 = 7, /**< Altitude database is the source \n */
+ eQMI_LOC_ALT_SRC_BAROMETRIC_ALTIMETER_V02 = 8, /**< Barometric altimeter is the source \n */
+ eQMI_LOC_ALT_SRC_OTHER_V02 = 9, /**< Other sources */
+ QMILOCALTSRCENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocAltSrcEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCALTSRCLINKAGEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_ALT_SRC_LINKAGE_NOT_SPECIFIED_V02 = 0, /**< Not specified \n */
+ eQMI_LOC_ALT_SRC_LINKAGE_FULLY_INTERDEPENDENT_V02 = 1, /**< Fully interdependent \n */
+ eQMI_LOC_ALT_SRC_LINKAGE_DEPENDS_ON_LAT_LONG_V02 = 2, /**< Depends on latitude and longitude \n */
+ eQMI_LOC_ALT_SRC_LINKAGE_FULLY_INDEPENDENT_V02 = 3, /**< Fully independent */
+ QMILOCALTSRCLINKAGEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocAltSrcLinkageEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCALTSRCUNCERTAINTYCOVERAGEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_ALT_UNCERTAINTY_NOT_SPECIFIED_V02 = 0, /**< Not specified \n */
+ eQMI_LOC_ALT_UNCERTAINTY_POINT_V02 = 1, /**< Altitude uncertainty is valid at the injected horizontal
+ position coordinates only \n */
+ eQMI_LOC_ALT_UNCERTAINTY_FULL_V02 = 2, /**< Altitude uncertainty applies to the position of the device
+ regardless of horizontal position (within the horizontal
+ uncertainty region, if provided) */
+ QMILOCALTSRCUNCERTAINTYCOVERAGEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocAltSrcUncertaintyCoverageEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocAltSrcEnumT_v02 source;
+ /**< Specifies the source of the altitude.
+ Values: \n
+ - eQMI_LOC_ALT_SRC_UNKNOWN (0) -- Source is unknown \n
+ - eQMI_LOC_ALT_SRC_GPS (1) -- GPS is the source \n
+ - eQMI_LOC_ALT_SRC_CELL_ID (2) -- Cell ID provided the source \n
+ - eQMI_LOC_ALT_SRC_ENHANCED_CELL_ID (3) -- Source is enhanced cell ID \n
+ - eQMI_LOC_ALT_SRC_WIFI (4) -- Wi-Fi is the source \n
+ - eQMI_LOC_ALT_SRC_TERRESTRIAL (5) -- Terrestrial source \n
+ - eQMI_LOC_ALT_SRC_TERRESTRIAL_HYBRID (6) -- Hybrid terrestrial source \n
+ - eQMI_LOC_ALT_SRC_ALTITUDE_DATABASE (7) -- Altitude database is the source \n
+ - eQMI_LOC_ALT_SRC_BAROMETRIC_ALTIMETER (8) -- Barometric altimeter is the source \n
+ - eQMI_LOC_ALT_SRC_OTHER (9) -- Other sources
+ */
+
+ qmiLocAltSrcLinkageEnumT_v02 linkage;
+ /**< Specifies the dependency between the horizontal and
+ altitude position components.
+ Values: \n
+ - eQMI_LOC_ALT_SRC_LINKAGE_NOT_SPECIFIED (0) -- Not specified \n
+ - eQMI_LOC_ALT_SRC_LINKAGE_FULLY_INTERDEPENDENT (1) -- Fully interdependent \n
+ - eQMI_LOC_ALT_SRC_LINKAGE_DEPENDS_ON_LAT_LONG (2) -- Depends on latitude and longitude \n
+ - eQMI_LOC_ALT_SRC_LINKAGE_FULLY_INDEPENDENT (3) -- Fully independent
+ */
+
+ qmiLocAltSrcUncertaintyCoverageEnumT_v02 coverage;
+ /**< Specifies the region of uncertainty.
+ Values: \n
+ - eQMI_LOC_ALT_UNCERTAINTY_NOT_SPECIFIED (0) -- Not specified \n
+ - eQMI_LOC_ALT_UNCERTAINTY_POINT (1) -- Altitude uncertainty is valid at the injected horizontal
+ position coordinates only \n
+ - eQMI_LOC_ALT_UNCERTAINTY_FULL (2) -- Altitude uncertainty applies to the position of the device
+ regardless of horizontal position (within the horizontal
+ uncertainty region, if provided)
+ */
+}qmiLocAltitudeSrcInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPOSITIONSRCENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_POSITION_SRC_GNSS_V02 = 0, /**< Position source is GNSS \n */
+ eQMI_LOC_POSITION_SRC_CELLID_V02 = 1, /**< Position source is Cell ID \n */
+ eQMI_LOC_POSITION_SRC_ENH_CELLID_V02 = 2, /**< Position source is Enhanced Cell ID \n */
+ eQMI_LOC_POSITION_SRC_WIFI_V02 = 3, /**< Position source is Wi-Fi \n */
+ eQMI_LOC_POSITION_SRC_TERRESTRIAL_V02 = 4, /**< Position source is Terrestrial \n */
+ eQMI_LOC_POSITION_SRC_GNSS_TERRESTRIAL_HYBRID_V02 = 5, /**< Position source is GNSS Terrestrial Hybrid \n */
+ eQMI_LOC_POSITION_SRC_OTHER_V02 = 6, /**< Other sources \n */
+ eQMI_LOC_POSITION_SRC_DRE_V02 = 7, /**< Position source is the dead reckoning engine */
+ QMILOCPOSITIONSRCENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPositionSrcEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPOSITIONSRCPROVIDERENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_POSITION_SRC_PROVIDER_EXTERNAL_V02 = 0, /**< Position is sourced from an external module \n */
+ eQMI_LOC_POSITION_SRC_PROVIDER_INTERNAL_V02 = 1, /**< Position is sourced from an internal module */
+ QMILOCPOSITIONSRCPROVIDERENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPositionSrcProviderEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects a position to the location engine. */
+typedef struct {
+
+ /* Optional */
+ /* Latitude */
+ uint8_t latitude_valid; /**< Must be set to true if latitude is being passed */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+
+ */
+
+ /* Optional */
+ /* Longitude */
+ uint8_t longitude_valid; /**< Must be set to true if longitude is being passed */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum).\n
+ - Type -- Floating point\n
+ - Units -- Degrees\n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude\n
+ - Negative values indicate western longitude
+ */
+
+ /* Optional */
+ /* Circular Horizontal Uncertainty */
+ uint8_t horUncCircular_valid; /**< Must be set to true if horUncCircular is being passed */
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular).\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Confidence */
+ uint8_t horConfidence_valid; /**< Must be set to true if horConfidence is being passed */
+ uint8_t horConfidence;
+ /**< Horizontal confidence, as defined by ETSI TS 101 109 (3GPP \hyperref[TS 03.32]{TS 03.32}).\n
+ - Units -- Percent (1 to 99)\n
+ - 0, 101 to 255 -- invalid value\n
+ - If 100 is received, reinterpret to 99 \n
+ This field must be specified together with horizontal uncertainty.
+ If not specified when horUncCircular is set, the default value is 50. */
+
+ /* Optional */
+ /* Horizontal Reliability */
+ uint8_t horReliability_valid; /**< Must be set to true if horReliability is being passed */
+ qmiLocReliabilityEnumT_v02 horReliability;
+ /**< Specifies the reliability of the horizontal position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Altitude With Respect to Ellipsoid */
+ uint8_t altitudeWrtEllipsoid_valid; /**< Must be set to true if altitudeWrtEllipsoid is being passed */
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid. \n
+ - Units -- Meters \n
+ - Positive = height
+ - Negative = depth
+ */
+
+ /* Optional */
+ /* Altitude With Respect to Sea Level */
+ uint8_t altitudeWrtMeanSeaLevel_valid; /**< Must be set to true if altitudeWrtMeanSeaLevel is being passed */
+ float altitudeWrtMeanSeaLevel;
+ /**< Altitude with respect to mean sea level.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Vertical Uncertainty */
+ uint8_t vertUnc_valid; /**< Must be set to true if vertUnc is being passed */
+ float vertUnc;
+ /**< Vertical uncertainty; mandatory when either altitudeWrtEllipsoid
+ or altitudeWrtMeanSeaLevel is specified.
+ - Units -- Meters */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical confidence, as defined by ETSI TS 101 109 (3GPP \hyperref[TS 03.32]{TS 03.32}).\n
+ - Units -- Percent (0-99)\n
+ - 0 -- invalid value \n
+ - 100 to 256 -- not used \n
+ - If 100 is received, reinterpret to 99 \n
+ This field must be specified together with the vertical uncertainty.
+ If not specified, the default value is 50. */
+
+ /* Optional */
+ /* Vertical Reliability */
+ uint8_t vertReliability_valid; /**< Must be set to true if vertReliability is being passed */
+ qmiLocReliabilityEnumT_v02 vertReliability;
+ /**< Specifies the reliability of the vertical position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Altitude Source Info */
+ uint8_t altSourceInfo_valid; /**< Must be set to true if altSourceInfo is being passed */
+ qmiLocAltitudeSrcInfoStructT_v02 altSourceInfo;
+ /**< \vspace{0.06in} \n Specifies information regarding the altitude source. */
+
+ /* Optional */
+ /* UTC Timestamp */
+ uint8_t timestampUtc_valid; /**< Must be set to true if timestampUtc is being passed */
+ uint64_t timestampUtc;
+ /**< UTC timestamp. \n
+ - Units -- Milliseconds (since Jan. 1, 1970) */
+
+ /* Optional */
+ /* Position Age */
+ uint8_t timestampAge_valid; /**< Must be set to true if timestampAge is being passed */
+ int32_t timestampAge;
+ /**< Position age, which is an estimate of how long ago this fix was made. \n
+ - Units -- Milliseconds */
+
+ /* Optional */
+ /* Position Source */
+ uint8_t positionSrc_valid; /**< Must be set to true if positionSrc is being passed */
+ qmiLocPositionSrcEnumT_v02 positionSrc;
+ /**< Source from which this position was obtained.
+ Values: \n
+ - eQMI_LOC_POSITION_SRC_GNSS (0) -- Position source is GNSS \n
+ - eQMI_LOC_POSITION_SRC_CELLID (1) -- Position source is Cell ID \n
+ - eQMI_LOC_POSITION_SRC_ENH_CELLID (2) -- Position source is Enhanced Cell ID \n
+ - eQMI_LOC_POSITION_SRC_WIFI (3) -- Position source is Wi-Fi \n
+ - eQMI_LOC_POSITION_SRC_TERRESTRIAL (4) -- Position source is Terrestrial \n
+ - eQMI_LOC_POSITION_SRC_GNSS_TERRESTRIAL_HYBRID (5) -- Position source is GNSS Terrestrial Hybrid \n
+ - eQMI_LOC_POSITION_SRC_OTHER (6) -- Other sources \n
+ - eQMI_LOC_POSITION_SRC_DRE (7) -- Position source is the dead reckoning engine \n
+ If altitude is specified and the altitude source is not specified, the engine
+ assumes that the altitude was obtained using the specified position source. \n
+ If both altitude and altitude source are specified, the engine assumes
+ that only latitude and longitude were obtained using the specified position
+ source.
+ */
+
+ /* Optional */
+ /* Raw Circular Horizontal Uncertainty */
+ uint8_t rawHorUncCircular_valid; /**< Must be set to true if rawHorUncCircular is being passed */
+ float rawHorUncCircular;
+ /**< Horizontal position uncertainty (circular) without any optimization.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Raw Horizontal Confidence */
+ uint8_t rawHorConfidence_valid; /**< Must be set to true if rawHorConfidence is being passed */
+ uint8_t rawHorConfidence;
+ /**< Horizontal confidence associated with raw horizontal uncertainty,
+ as defined by ETSI TS 101 109 (3GPP \hyperref[TS 03.32]{TS 03.32}).\n
+ - Units -- Percent (1 to 99) \n
+ - 0, 101 to 255 -- invalid value \n
+ - If 100 is received, reinterpret to 99 \n
+ This field must be specified together with raw horizontal uncertainty.
+ If not specified when rawHorUncCircular is set, the default value is 50. */
+
+ /* Optional */
+ /* Free CPI or On-Demand CPI */
+ uint8_t onDemandCpi_valid; /**< Must be set to true if onDemandCpi is being passed */
+ uint8_t onDemandCpi;
+ /**< Indicates whether the modem has requested this position injection.
+ Values: \n
+ - 0x00 (FALSE) -- The position injection was not requested by the modem (free CPI) \n
+ - 0x01 (TRUE) -- The position injection was requested by the modem (on-demand CPI) */
+
+ /* Optional */
+ /* Position Source Provider */
+ uint8_t positionSrcProvider_valid; /**< Must be set to true if positionSrcProvider is being passed */
+ qmiLocPositionSrcProviderEnumT_v02 positionSrcProvider;
+ /**< The source provider from which this position was obtained.
+ Values: \n
+ - eQMI_LOC_POSITION_SRC_PROVIDER_EXTERNAL (0) -- Position is sourced from an external module \n
+ - eQMI_LOC_POSITION_SRC_PROVIDER_INTERNAL (1) -- Position is sourced from an internal module
+ */
+
+ /* Optional */
+ /* GPS Time */
+ uint8_t gpsTime_valid; /**< Must be set to true if gpsTime is being passed */
+ qmiLocGPSTimeStructT_v02 gpsTime;
+ /**< \n The number of weeks since Jan. 6, 1980, and
+ milliseconds into the current week. This is the GPS time stamp
+ for this injected position. */
+
+ /* Optional */
+ /* Time Uncertainty */
+ uint8_t timeUnc_valid; /**< Must be set to true if timeUnc is being passed */
+ float timeUnc;
+ /**< Time uncertainty associated with this injected position. \n
+ - Units -- Milliseconds */
+
+ /* Optional */
+ /* Velocity ENU (East, North, Up) */
+ uint8_t velEnu_valid; /**< Must be set to true if velEnu is being passed */
+ float velEnu[QMI_LOC_ENU_ARRAY_LENGTH_V02];
+ /**< East, north, up velocity.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Velocity Uncertainty ENU */
+ uint8_t velUncEnu_valid; /**< Must be set to true if velUncEnu is being passed */
+ float velUncEnu[QMI_LOC_ENU_ARRAY_LENGTH_V02];
+ /**< East, North, up velocity uncertainty.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Expanded SVs Used to Calculate the Fix */
+ uint8_t expandedGnssSvUsedList_valid; /**< Must be set to true if expandedGnssSvUsedList is being passed */
+ uint32_t expandedGnssSvUsedList_len; /**< Must be set to # of elements in expandedGnssSvUsedList */
+ uint16_t expandedGnssSvUsedList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Each entry in the list contains the SV ID of a satellite
+ used for calculating this position report. The following
+ information is associated with each SV ID range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Number of SVs Used to Calculate the Fix */
+ uint8_t numSvInFix_valid; /**< Must be set to true if numSvInFix is being passed */
+ uint8_t numSvInFix;
+ /**< Number of SVs used to calculate the fix.
+ */
+}qmiLocInjectPositionReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects a position to the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* UTC Position Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the UTC Position Injection request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectPositionIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCLOCKENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_LOCK_NONE_V02 = 1, /**< Do not lock any position sessions \n */
+ eQMI_LOC_LOCK_MI_V02 = 2, /**< Lock application framework/AFW position sessions\n */
+ eQMI_LOC_LOCK_MT_V02 = 3, /**< Lock non-AFW/NFW position sessions\n */
+ eQMI_LOC_LOCK_ALL_V02 = 4, /**< Lock all position sessions */
+ QMILOCLOCKENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocLockEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCLOCKSUBINFOENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_LOCK_DV_SUB_V02 = 1, /**< Lock Dedicated Voice subscription (DV sub) \n */
+ eQMI_LOC_LOCK_DD_SUB_V02 = 2, /**< Lock Dedicated Data subscription (DD sub) \n */
+ eQMI_LOC_LOCK_ALL_SUB_V02 = 3, /**< Lock all subscriptions */
+ QMILOCLOCKSUBINFOENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocLockSubInfoEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocLockClientMaskT_v02;
+#define QMI_LOC_LOCK_CLIENT_MASK_AFW_V02 ((qmiLocLockClientMaskT_v02)0x00000001ull) /**< Lock AFW client \n */
+#define QMI_LOC_LOCK_CLIENT_MASK_NFW_V02 ((qmiLocLockClientMaskT_v02)0x00000002ull) /**< Lock NFW client \n */
+#define QMI_LOC_LOCK_CLIENT_MASK_PRIVILEGED_V02 ((qmiLocLockClientMaskT_v02)0x00000004ull) /**< Lock privileged client */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sets the location engine lock. */
+typedef struct {
+
+ /* Mandatory */
+ /* Lock Type */
+ qmiLocLockEnumT_v02 lockType;
+ /**< Type of lock.
+ Values: \n
+ - eQMI_LOC_LOCK_NONE (1) -- Do not lock any position sessions \n
+ - eQMI_LOC_LOCK_MI (2) -- Lock application framework/AFW position sessions\n
+ - eQMI_LOC_LOCK_MT (3) -- Lock non-AFW/NFW position sessions\n
+ - eQMI_LOC_LOCK_ALL (4) -- Lock all position sessions
+ */
+
+ /* Optional */
+ /* Subscription Type */
+ uint8_t subType_valid; /**< Must be set to true if subType is being passed */
+ qmiLocLockSubInfoEnumT_v02 subType;
+ /**< Subscription to which Lock Type must be applied.
+ If not specified, the default value is eQMI_LOC_LOCK_DD_SUB.
+ Values: \n
+ - eQMI_LOC_LOCK_DV_SUB (1) -- Lock Dedicated Voice subscription (DV sub) \n
+ - eQMI_LOC_LOCK_DD_SUB (2) -- Lock Dedicated Data subscription (DD sub) \n
+ - eQMI_LOC_LOCK_ALL_SUB (3) -- Lock all subscriptions
+ */
+
+ /* Optional */
+ /* Lock Client */
+ uint8_t lockClient_valid; /**< Must be set to true if lockClient is being passed */
+ qmiLocLockClientMaskT_v02 lockClient;
+ /**< If specified by the control point, the client(s) are
+ blocked to request position.
+ Note: lockClient overwrites lockType
+ Values: \n
+ - QMI_LOC_LOCK_CLIENT_MASK_AFW (0x00000001) -- Lock AFW client \n
+ - QMI_LOC_LOCK_CLIENT_MASK_NFW (0x00000002) -- Lock NFW client \n
+ - QMI_LOC_LOCK_CLIENT_MASK_PRIVILEGED (0x00000004) -- Lock privileged client
+ */
+}qmiLocSetEngineLockReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sets the location engine lock. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Engine Lock Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Engine Lock request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetEngineLockIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the location engine lock. */
+typedef struct {
+
+ /* Optional */
+ /* Subscription Type */
+ uint8_t subType_valid; /**< Must be set to true if subType is being passed */
+ qmiLocLockSubInfoEnumT_v02 subType;
+ /**< Subscription associated with the requested engine lock state.
+ Only a subset of the enum is valid -- eQMI_LOC_LOCK_ALL_SUB is invalid.
+ If not specified, the default value is eQMI_LOC_LOCK_DD_SUB.
+ Values: \n
+ - eQMI_LOC_LOCK_DV_SUB (1) -- Lock Dedicated Voice subscription (DV sub) \n
+ - eQMI_LOC_LOCK_DD_SUB (2) -- Lock Dedicated Data subscription (DD sub) \n
+ - eQMI_LOC_LOCK_ALL_SUB (3) -- Lock all subscriptions
+ */
+}qmiLocGetEngineLockReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the location engine lock. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Engine Lock Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Engine Lock request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Lock Type */
+ uint8_t lockType_valid; /**< Must be set to true if lockType is being passed */
+ qmiLocLockEnumT_v02 lockType;
+ /**< Type of lock.
+ Values: \n
+ - eQMI_LOC_LOCK_NONE (1) -- Do not lock any position sessions \n
+ - eQMI_LOC_LOCK_MI (2) -- Lock application framework/AFW position sessions\n
+ - eQMI_LOC_LOCK_MT (3) -- Lock non-AFW/NFW position sessions\n
+ - eQMI_LOC_LOCK_ALL (4) -- Lock all position sessions
+ */
+
+ /* Optional */
+ /* Subscription Type */
+ uint8_t subType_valid; /**< Must be set to true if subType is being passed */
+ qmiLocLockSubInfoEnumT_v02 subType;
+ /**< Subscription to which the above Lock Type is associated with.
+ Values: \n
+ - eQMI_LOC_LOCK_DV_SUB (1) -- Lock Dedicated Voice subscription (DV sub) \n
+ - eQMI_LOC_LOCK_DD_SUB (2) -- Lock Dedicated Data subscription (DD sub) \n
+ - eQMI_LOC_LOCK_ALL_SUB (3) -- Lock all subscriptions
+ */
+
+ /* Optional */
+ /* Lock Client */
+ uint8_t lockClient_valid; /**< Must be set to true if lockClient is being passed */
+ qmiLocLockClientMaskT_v02 lockClient;
+ /**< The client(s) who have been locked to request position.
+ Values: \n
+ - QMI_LOC_LOCK_CLIENT_MASK_AFW (0x00000001) -- Lock AFW client \n
+ - QMI_LOC_LOCK_CLIENT_MASK_NFW (0x00000002) -- Lock NFW client \n
+ - QMI_LOC_LOCK_CLIENT_MASK_PRIVILEGED (0x00000004) -- Lock privileged client
+ */
+}qmiLocGetEngineLockIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sets the SBAS configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* SBAS Config */
+ uint8_t sbasConfig;
+ /**< Indicates whether SBAS configuration is enabled.\n
+ - 0x01 (TRUE) -- Enabled \n
+ - 0x00 (FALSE) -- Disabled
+ */
+
+ /* Optional */
+ /* QZSS-L1S Config */
+ uint8_t qzssL1sConfig_valid; /**< Must be set to true if qzssL1sConfig is being passed */
+ uint8_t qzssL1sConfig;
+ /**< Indicates whether QZSS-L1S configuration is enabled.\n
+ - 0x01 (TRUE) -- Enabled \n
+ - 0x00 (FALSE) -- Disabled
+ */
+}qmiLocSetSbasConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sets the SBAS configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set SBAS Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set SBAS Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetSbasConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the SBAS configuration from the location engine. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetSbasConfigReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the SBAS configuration from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get SBAS Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get SBAS Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* SBAS Config */
+ uint8_t sbasConfig_valid; /**< Must be set to true if sbasConfig is being passed */
+ uint8_t sbasConfig;
+ /**< Indicates whether SBAS configuration is enabled.\n
+ - 0x01 (TRUE) -- SBAS configuration is enabled \n
+ - 0x00 (FALSE) -- SBAS configuration is disabled
+ */
+}qmiLocGetSbasConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocNmeaSentenceMaskT_v02;
+#define QMI_LOC_NMEA_MASK_GGA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000001) /**< Enable GGA type \n */
+#define QMI_LOC_NMEA_MASK_RMC_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000002) /**< Enable RMC type \n */
+#define QMI_LOC_NMEA_MASK_GSV_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000004) /**< Enable GSV type \n */
+#define QMI_LOC_NMEA_MASK_GSA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000008) /**< Enable GSA type \n */
+#define QMI_LOC_NMEA_MASK_VTG_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000010) /**< Enable VTG type \n */
+#define QMI_LOC_NMEA_MASK_PQXFI_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000020) /**< Enable PQXFI type \n */
+#define QMI_LOC_NMEA_MASK_PSTIS_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000040) /**< Enable PSTIS type \n */
+#define QMI_LOC_NMEA_MASK_GLGSV_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000080) /**< Enable GLGSV type \n */
+#define QMI_LOC_NMEA_MASK_GNGSA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000100) /**< Enable GNGSA type \n */
+#define QMI_LOC_NMEA_MASK_GNGNS_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000200) /**< Enable GNGNS type \n */
+#define QMI_LOC_NMEA_MASK_GARMC_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000400) /**< Enable GARMC type \n */
+#define QMI_LOC_NMEA_MASK_GAGSV_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00000800) /**< Enable GAGSV type \n */
+#define QMI_LOC_NMEA_MASK_GAGSA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00001000) /**< Enable GAGSA type \n */
+#define QMI_LOC_NMEA_MASK_GAVTG_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00002000) /**< Enable GAVTG type \n */
+#define QMI_LOC_NMEA_MASK_GAGGA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00004000) /**< Enable GAGGA type \n */
+#define QMI_LOC_NMEA_MASK_PQGSA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00008000) /**< Deprecated \n */
+#define QMI_LOC_NMEA_MASK_PQGSV_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00010000) /**< Deprecated \n */
+#define QMI_LOC_NMEA_MASK_DEBUG_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00020000) /**< Enable DEBUG NMEA type \n */
+#define QMI_LOC_NMEA_MASK_GPDTM_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00040000) /**< Enable GPDTM type \n */
+#define QMI_LOC_NMEA_MASK_GNGGA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00080000) /**< Enable GNGGA type \n */
+#define QMI_LOC_NMEA_MASK_GNRMC_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00100000) /**< Enable GNRMC type \n */
+#define QMI_LOC_NMEA_MASK_GNVTG_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00200000) /**< Enable GNVTG type \n */
+#define QMI_LOC_NMEA_MASK_GAGNS_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00400000) /**< Enable GAGNS type \n */
+#define QMI_LOC_NMEA_MASK_GBGGA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x00800000) /**< Enable GBGGA type \n */
+#define QMI_LOC_NMEA_MASK_GBGSA_V02 ((qmiLocNmeaSentenceMaskT_v02)0x01000000) /**< Enable GBGSA type \n */
+#define QMI_LOC_NMEA_MASK_GBGSV_V02 ((qmiLocNmeaSentenceMaskT_v02)0x02000000) /**< Enable GBGSV type \n */
+#define QMI_LOC_NMEA_MASK_GBRMC_V02 ((qmiLocNmeaSentenceMaskT_v02)0x04000000) /**< Enable GBRMC type \n */
+#define QMI_LOC_NMEA_MASK_GBVTG_V02 ((qmiLocNmeaSentenceMaskT_v02)0x08000000) /**< Enable GBVTG type \n */
+#define QMI_LOC_NMEA_MASK_GQGSV_V02 ((qmiLocNmeaSentenceMaskT_v02)0x10000000) /**< Enable GQGSV type \n */
+#define QMI_LOC_NMEA_MASK_GIGSV_V02 ((qmiLocNmeaSentenceMaskT_v02)0x20000000) /**< Enable GIGSV type \n */
+#define QMI_LOC_NMEA_MASK_GNDTM_V02 ((qmiLocNmeaSentenceMaskT_v02)0x40000000) /**< Enable GNDTM type \n */
+#define QMI_LOC_NMEA_MASK_GSA_TAGBLOCK_ENABLE_V02 ((qmiLocNmeaSentenceMaskT_v02)0x80000000) /**< Enable TAG block for GSA sentence */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sets the NMEA types. */
+typedef struct {
+
+ /* Mandatory */
+ /* NMEA Sentence Types */
+ qmiLocNmeaSentenceMaskT_v02 nmeaSentenceType;
+ /**< Bitmasks of NMEA types to enable.\n
+ Valid bitmasks: \n
+ - QMI_LOC_NMEA_MASK_GGA (0x00000001) -- Enable GGA type \n
+ - QMI_LOC_NMEA_MASK_RMC (0x00000002) -- Enable RMC type \n
+ - QMI_LOC_NMEA_MASK_GSV (0x00000004) -- Enable GSV type \n
+ - QMI_LOC_NMEA_MASK_GSA (0x00000008) -- Enable GSA type \n
+ - QMI_LOC_NMEA_MASK_VTG (0x00000010) -- Enable VTG type \n
+ - QMI_LOC_NMEA_MASK_PQXFI (0x00000020) -- Enable PQXFI type \n
+ - QMI_LOC_NMEA_MASK_PSTIS (0x00000040) -- Enable PSTIS type \n
+ - QMI_LOC_NMEA_MASK_GLGSV (0x00000080) -- Enable GLGSV type \n
+ - QMI_LOC_NMEA_MASK_GNGSA (0x00000100) -- Enable GNGSA type \n
+ - QMI_LOC_NMEA_MASK_GNGNS (0x00000200) -- Enable GNGNS type \n
+ - QMI_LOC_NMEA_MASK_GARMC (0x00000400) -- Enable GARMC type \n
+ - QMI_LOC_NMEA_MASK_GAGSV (0x00000800) -- Enable GAGSV type \n
+ - QMI_LOC_NMEA_MASK_GAGSA (0x00001000) -- Enable GAGSA type \n
+ - QMI_LOC_NMEA_MASK_GAVTG (0x00002000) -- Enable GAVTG type \n
+ - QMI_LOC_NMEA_MASK_GAGGA (0x00004000) -- Enable GAGGA type \n
+ - QMI_LOC_NMEA_MASK_PQGSA (0x00008000) -- Deprecated \n
+ - QMI_LOC_NMEA_MASK_PQGSV (0x00010000) -- Deprecated \n
+ - QMI_LOC_NMEA_MASK_DEBUG (0x00020000) -- Enable DEBUG NMEA type \n
+ - QMI_LOC_NMEA_MASK_GPDTM (0x00040000) -- Enable GPDTM type \n
+ - QMI_LOC_NMEA_MASK_GNGGA (0x00080000) -- Enable GNGGA type \n
+ - QMI_LOC_NMEA_MASK_GNRMC (0x00100000) -- Enable GNRMC type \n
+ - QMI_LOC_NMEA_MASK_GNVTG (0x00200000) -- Enable GNVTG type \n
+ - QMI_LOC_NMEA_MASK_GAGNS (0x00400000) -- Enable GAGNS type \n
+ - QMI_LOC_NMEA_MASK_GBGGA (0x00800000) -- Enable GBGGA type \n
+ - QMI_LOC_NMEA_MASK_GBGSA (0x01000000) -- Enable GBGSA type \n
+ - QMI_LOC_NMEA_MASK_GBGSV (0x02000000) -- Enable GBGSV type \n
+ - QMI_LOC_NMEA_MASK_GBRMC (0x04000000) -- Enable GBRMC type \n
+ - QMI_LOC_NMEA_MASK_GBVTG (0x08000000) -- Enable GBVTG type \n
+ - QMI_LOC_NMEA_MASK_GQGSV (0x10000000) -- Enable GQGSV type \n
+ - QMI_LOC_NMEA_MASK_GIGSV (0x20000000) -- Enable GIGSV type \n
+ - QMI_LOC_NMEA_MASK_GNDTM (0x40000000) -- Enable GNDTM type \n
+ - QMI_LOC_NMEA_MASK_GSA_TAGBLOCK_ENABLE (0x80000000) -- Enable TAG block for GSA sentence \n
+ The following NMEA sentences are deprecated, if any of these bits are
+ set, they are ignored: \n
+ - QMI_LOC_NMEA_MASK_PQGSA \n
+ - QMI_LOC_NMEA_MASK_PQGSV
+
+ */
+}qmiLocSetNmeaTypesReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sets the NMEA types. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set NMEA Types Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of QMI_LOC_SET_NMEA_TYPES_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetNmeaTypesIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the NMEA types from the location engine. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetNmeaTypesReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the NMEA types from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get NMEA Types Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get NMEA Types request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* NMEA Sentence Types */
+ uint8_t nmeaSentenceType_valid; /**< Must be set to true if nmeaSentenceType is being passed */
+ qmiLocNmeaSentenceMaskT_v02 nmeaSentenceType;
+ /**< NMEA types to enable. \n
+ Valid bitmasks: \n
+ - QMI_LOC_NMEA_MASK_GGA (0x00000001) -- Enable GGA type \n
+ - QMI_LOC_NMEA_MASK_RMC (0x00000002) -- Enable RMC type \n
+ - QMI_LOC_NMEA_MASK_GSV (0x00000004) -- Enable GSV type \n
+ - QMI_LOC_NMEA_MASK_GSA (0x00000008) -- Enable GSA type \n
+ - QMI_LOC_NMEA_MASK_VTG (0x00000010) -- Enable VTG type \n
+ - QMI_LOC_NMEA_MASK_PQXFI (0x00000020) -- Enable PQXFI type \n
+ - QMI_LOC_NMEA_MASK_PSTIS (0x00000040) -- Enable PSTIS type \n
+ - QMI_LOC_NMEA_MASK_GLGSV (0x00000080) -- Enable GLGSV type \n
+ - QMI_LOC_NMEA_MASK_GNGSA (0x00000100) -- Enable GNGSA type \n
+ - QMI_LOC_NMEA_MASK_GNGNS (0x00000200) -- Enable GNGNS type \n
+ - QMI_LOC_NMEA_MASK_GARMC (0x00000400) -- Enable GARMC type \n
+ - QMI_LOC_NMEA_MASK_GAGSV (0x00000800) -- Enable GAGSV type \n
+ - QMI_LOC_NMEA_MASK_GAGSA (0x00001000) -- Enable GAGSA type \n
+ - QMI_LOC_NMEA_MASK_GAVTG (0x00002000) -- Enable GAVTG type \n
+ - QMI_LOC_NMEA_MASK_GAGGA (0x00004000) -- Enable GAGGA type \n
+ - QMI_LOC_NMEA_MASK_PQGSA (0x00008000) -- Deprecated \n
+ - QMI_LOC_NMEA_MASK_PQGSV (0x00010000) -- Deprecated \n
+ - QMI_LOC_NMEA_MASK_DEBUG (0x00020000) -- Enable DEBUG NMEA type \n
+ - QMI_LOC_NMEA_MASK_GPDTM (0x00040000) -- Enable GPDTM type \n
+ - QMI_LOC_NMEA_MASK_GNGGA (0x00080000) -- Enable GNGGA type \n
+ - QMI_LOC_NMEA_MASK_GNRMC (0x00100000) -- Enable GNRMC type \n
+ - QMI_LOC_NMEA_MASK_GNVTG (0x00200000) -- Enable GNVTG type \n
+ - QMI_LOC_NMEA_MASK_GAGNS (0x00400000) -- Enable GAGNS type \n
+ - QMI_LOC_NMEA_MASK_GBGGA (0x00800000) -- Enable GBGGA type \n
+ - QMI_LOC_NMEA_MASK_GBGSA (0x01000000) -- Enable GBGSA type \n
+ - QMI_LOC_NMEA_MASK_GBGSV (0x02000000) -- Enable GBGSV type \n
+ - QMI_LOC_NMEA_MASK_GBRMC (0x04000000) -- Enable GBRMC type \n
+ - QMI_LOC_NMEA_MASK_GBVTG (0x08000000) -- Enable GBVTG type \n
+ - QMI_LOC_NMEA_MASK_GQGSV (0x10000000) -- Enable GQGSV type \n
+ - QMI_LOC_NMEA_MASK_GIGSV (0x20000000) -- Enable GIGSV type \n
+ - QMI_LOC_NMEA_MASK_GNDTM (0x40000000) -- Enable GNDTM type \n
+ - QMI_LOC_NMEA_MASK_GSA_TAGBLOCK_ENABLE (0x80000000) -- Enable TAG block for GSA sentence \n
+ The following NMEA sentences are deprecated, if any of these bits are
+ set, they are ignored: \n
+ - QMI_LOC_NMEA_MASK_PQGSA \n
+ - QMI_LOC_NMEA_MASK_PQGSV
+ */
+}qmiLocGetNmeaTypesIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Enables/disables Low Power Mode (LPM) configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Enable Low Power Mode */
+ uint8_t lowPowerMode;
+ /**< Indicates whether to enable Low Power mode:\n
+ - 0x01 (TRUE) -- Enable LPM \n
+ - 0x00 (FALSE) -- Disable LPM */
+}qmiLocSetLowPowerModeReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Enables/disables Low Power Mode (LPM) configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set LPM Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_SET_LOW_POWER_MODE_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetLowPowerModeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the LPM status from the location engine. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetLowPowerModeReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the LPM status from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get LPM Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get LPM request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Enable/Disable LPM */
+ uint8_t lowPowerMode_valid; /**< Must be set to true if lowPowerMode is being passed */
+ uint8_t lowPowerMode;
+ /**< Indicates whether to enable Low Power mode:\n
+ - 0x01 (TRUE) -- Enable LPM \n
+ - 0x00 (FALSE) -- Disable LPM */
+}qmiLocGetLowPowerModeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSERVERTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SERVER_TYPE_CDMA_PDE_V02 = 1, /**< CDMA PDE \n */
+ eQMI_LOC_SERVER_TYPE_CDMA_MPC_V02 = 2, /**< CDMA MPC \n */
+ eQMI_LOC_SERVER_TYPE_UMTS_SLP_V02 = 3, /**< UMTS SLP \n */
+ eQMI_LOC_SERVER_TYPE_CUSTOM_PDE_V02 = 4, /**< Custom PDE \n */
+ eQMI_LOC_SERVER_TYPE_CUSTOM_SLP_V02 = 5, /**< Custom SUPL SLP */
+ QMILOCSERVERTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocServerTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Specifies the A-GPS server type and address. */
+typedef struct {
+
+ /* Mandatory */
+ /* Server Type */
+ qmiLocServerTypeEnumT_v02 serverType;
+ /**< Type of server.
+ Values: \n
+ - eQMI_LOC_SERVER_TYPE_CDMA_PDE (1) -- CDMA PDE \n
+ - eQMI_LOC_SERVER_TYPE_CDMA_MPC (2) -- CDMA MPC \n
+ - eQMI_LOC_SERVER_TYPE_UMTS_SLP (3) -- UMTS SLP \n
+ - eQMI_LOC_SERVER_TYPE_CUSTOM_PDE (4) -- Custom PDE \n
+ - eQMI_LOC_SERVER_TYPE_CUSTOM_SLP (5) -- Custom SUPL SLP
+ */
+
+ /* Optional */
+ /* IPv4 Address */
+ uint8_t ipv4Addr_valid; /**< Must be set to true if ipv4Addr is being passed */
+ qmiLocIpV4AddrStructType_v02 ipv4Addr;
+ /**< \vspace{0.06in} \n IPv4 address and port. */
+
+ /* Optional */
+ /* IPv6 Address */
+ uint8_t ipv6Addr_valid; /**< Must be set to true if ipv6Addr is being passed */
+ qmiLocIpV6AddrStructType_v02 ipv6Addr;
+ /**< \vspace{0.06in} \n IPv6 address and port. */
+
+ /* Optional */
+ /* Uniform Resource Locator */
+ uint8_t urlAddr_valid; /**< Must be set to true if urlAddr is being passed */
+ char urlAddr[QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02 + 1];
+ /**< URL. \n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 256
+ */
+}qmiLocSetServerReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Specifies the A-GPS server type and address. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Server Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_SET_SERVER_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetServerIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the location server from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Server Type */
+ qmiLocServerTypeEnumT_v02 serverType;
+ /**< Type of server.
+ Values: \n
+ - eQMI_LOC_SERVER_TYPE_CDMA_PDE (1) -- CDMA PDE \n
+ - eQMI_LOC_SERVER_TYPE_CDMA_MPC (2) -- CDMA MPC \n
+ - eQMI_LOC_SERVER_TYPE_UMTS_SLP (3) -- UMTS SLP \n
+ - eQMI_LOC_SERVER_TYPE_CUSTOM_PDE (4) -- Custom PDE \n
+ - eQMI_LOC_SERVER_TYPE_CUSTOM_SLP (5) -- Custom SUPL SLP
+ */
+
+ /* Optional */
+ /* Server Address Type */
+ uint8_t serverAddrTypeMask_valid; /**< Must be set to true if serverAddrTypeMask is being passed */
+ qmiLocServerAddrTypeMaskT_v02 serverAddrTypeMask;
+ /**< Type of server address the client wants. If unspecified, the
+ indication contains all the types of addresses
+ it has for the specified server type.\n
+ Valid bitmasks: \n
+ - QMI_LOC_SERVER_ADDR_TYPE_IPV4_MASK (0x01) -- IPv4 \n
+ - QMI_LOC_SERVER_ADDR_TYPE_IPV6_MASK (0x02) -- IPv6 \n
+ - QMI_LOC_SERVER_ADDR_TYPE_URL_MASK (0x04) -- URL
+ */
+}qmiLocGetServerReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the location server from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Server Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Server request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Server Type */
+ qmiLocServerTypeEnumT_v02 serverType;
+ /**< Type of server.
+ Values: \n
+ - eQMI_LOC_SERVER_TYPE_CDMA_PDE (1) -- CDMA PDE \n
+ - eQMI_LOC_SERVER_TYPE_CDMA_MPC (2) -- CDMA MPC \n
+ - eQMI_LOC_SERVER_TYPE_UMTS_SLP (3) -- UMTS SLP \n
+ - eQMI_LOC_SERVER_TYPE_CUSTOM_PDE (4) -- Custom PDE \n
+ - eQMI_LOC_SERVER_TYPE_CUSTOM_SLP (5) -- Custom SUPL SLP
+ */
+
+ /* Optional */
+ /* IPv4 Address */
+ uint8_t ipv4Addr_valid; /**< Must be set to true if ipv4Addr is being passed */
+ qmiLocIpV4AddrStructType_v02 ipv4Addr;
+ /**< \vspace{0.06in} \n IPv4 address and port. */
+
+ /* Optional */
+ /* IPv6 Address */
+ uint8_t ipv6Addr_valid; /**< Must be set to true if ipv6Addr is being passed */
+ qmiLocIpV6AddrStructType_v02 ipv6Addr;
+ /**< \vspace{0.06in} \n IPv6 address and port. */
+
+ /* Optional */
+ /* Uniform Resource Locator */
+ uint8_t urlAddr_valid; /**< Must be set to true if urlAddr is being passed */
+ char urlAddr[QMI_LOC_MAX_SERVER_ADDR_LENGTH_V02 + 1];
+ /**< URL. \n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator)-- 256
+ */
+}qmiLocGetServerIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocDeleteGnssDataMaskT_v02;
+#define QMI_LOC_MASK_DELETE_GPS_SVDIR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000001ull) /**< Mask to delete GPS SVDIR */
+#define QMI_LOC_MASK_DELETE_GPS_SVSTEER_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000002ull) /**< Mask to delete GPS SVSTEER */
+#define QMI_LOC_MASK_DELETE_GPS_TIME_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000004ull) /**< Mask to delete GPS time */
+#define QMI_LOC_MASK_DELETE_GPS_ALM_CORR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000008ull) /**< Mask to delete almanac correlation */
+#define QMI_LOC_MASK_DELETE_GLO_SVDIR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000010ull) /**< Mask to delete GLONASS SVDIR */
+#define QMI_LOC_MASK_DELETE_GLO_SVSTEER_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000020ull) /**< Mask to delete GLONASS SVSTEER */
+#define QMI_LOC_MASK_DELETE_GLO_TIME_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000040ull) /**< Mask to delete GLONASS time */
+#define QMI_LOC_MASK_DELETE_GLO_ALM_CORR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000080ull) /**< Mask to delete GLONASS almanac correlation */
+#define QMI_LOC_MASK_DELETE_SBAS_SVDIR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000100ull) /**< Mask to delete SBAS SVDIR */
+#define QMI_LOC_MASK_DELETE_SBAS_SVSTEER_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000200ull) /**< Mask to delete SBAS SVSTEER */
+#define QMI_LOC_MASK_DELETE_POSITION_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000400ull) /**< Mask to delete position estimate */
+#define QMI_LOC_MASK_DELETE_TIME_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00000800ull) /**< Mask to delete time estimate */
+#define QMI_LOC_MASK_DELETE_IONO_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00001000ull) /**< Mask to delete IONO */
+#define QMI_LOC_MASK_DELETE_UTC_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00002000ull) /**< Mask to delete UTC estimate */
+#define QMI_LOC_MASK_DELETE_HEALTH_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00004000ull) /**< Mask to delete SV health record */
+#define QMI_LOC_MASK_DELETE_SADATA_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00008000ull) /**< Mask to delete SADATA */
+#define QMI_LOC_MASK_DELETE_RTI_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00010000ull) /**< Mask to delete RTI */
+#define QMI_LOC_MASK_DELETE_SV_NO_EXIST_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00020000ull) /**< Mask to delete SV_NO_EXIST */
+#define QMI_LOC_MASK_DELETE_FREQ_BIAS_EST_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00040000ull) /**< Mask to delete frequency bias estimate */
+#define QMI_LOC_MASK_DELETE_BDS_SVDIR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00080000ull) /**< Mask to delete BDS SVDIR */
+#define QMI_LOC_MASK_DELETE_BDS_SVSTEER_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00100000ull) /**< Mask to delete BDS SVSTEER */
+#define QMI_LOC_MASK_DELETE_BDS_TIME_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00200000ull) /**< Mask to delete BDS time */
+#define QMI_LOC_MASK_DELETE_BDS_ALM_CORR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00400000ull) /**< Mask to delete BDS almanac correlation */
+#define QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_GPS_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x00800000ull) /**< Mask to delete GNSS SV blacklist GPS */
+#define QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_GLO_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x01000000ull) /**< Mask to delete GNSS SV blacklist GLONASS */
+#define QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_BDS_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x02000000ull) /**< Mask to delete GNSS SV blacklist BDS */
+#define QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_GAL_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x04000000ull) /**< Mask to delete GNSS SV blacklist Galileo */
+#define QMI_LOC_MASK_DELETE_GAL_SVDIR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x08000000ull) /**< Mask to delete Galileo SVDIR */
+#define QMI_LOC_MASK_DELETE_GAL_SVSTEER_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x10000000ull) /**< Mask to delete Galileo SVSTEER */
+#define QMI_LOC_MASK_DELETE_GAL_TIME_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x20000000ull) /**< Mask to delete Galileo time */
+#define QMI_LOC_MASK_DELETE_GAL_ALM_CORR_V02 ((qmiLocDeleteGnssDataMaskT_v02)0x40000000ull) /**< Mask to delete Galileo almanac correlation */
+typedef uint32_t qmiLocDeleteCelldbDataMaskT_v02;
+#define QMI_LOC_MASK_DELETE_CELLDB_POS_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000001) /**< Delete cell database position */
+#define QMI_LOC_MASK_DELETE_CELLDB_LATEST_GPS_POS_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000002) /**< Delete cell database latest GPS position */
+#define QMI_LOC_MASK_DELETE_CELLDB_OTA_POS_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000004) /**< Delete cell database OTA position */
+#define QMI_LOC_MASK_DELETE_CELLDB_EXT_REF_POS_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000008) /**< Delete cell database external reference position */
+#define QMI_LOC_MASK_DELETE_CELLDB_TIMETAG_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000010) /**< Delete cell database time tag */
+#define QMI_LOC_MASK_DELETE_CELLDB_CELLID_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000020) /**< Delete cell database cell ID */
+#define QMI_LOC_MASK_DELETE_CELLDB_CACHED_CELLID_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000040) /**< Delete cell database cached cell ID */
+#define QMI_LOC_MASK_DELETE_CELLDB_LAST_SRV_CELL_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000080) /**< Delete cell database last service cell */
+#define QMI_LOC_MASK_DELETE_CELLDB_CUR_SRV_CELL_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000100) /**< Delete cell database current service cell */
+#define QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO_V02 ((qmiLocDeleteCelldbDataMaskT_v02)0x00000200) /**< Delete cell database neighbor information */
+typedef uint32_t qmiLocDeleteClockInfoMaskT_v02;
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_TIME_EST_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000001) /**< Delete time estimate */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_FREQ_EST_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000002) /**< Delete frequency estimate */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_WEEK_NUMBER_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000004) /**< Delete week number */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_RTC_TIME_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000008) /**< Delete RTC time */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_TIME_TRANSFER_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000010) /**< Delete time transfer */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GPSTIME_EST_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000020) /**< Delete GPS time estimate */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GLOTIME_EST_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000040) /**< Delete GLONASS time estimate */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GLODAY_NUMBER_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000080) /**< Delete GLONASS day number */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GLO4YEAR_NUMBER_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000100) /**< Delete GLONASS four year number */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GLO_RF_GRP_DELAY_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000200) /**< Delete GLONASS RF GRP delay */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_DISABLE_TT_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000400) /**< Delete disable TT */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GG_LEAPSEC_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00000800) /**< Delete GG leap second */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GG_GGTB_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00001000) /**< Delete GG GGTB */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_BDSTIME_EST_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00002000) /**< Delete a BDS time estimate */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GB_GBTB_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00004000) /**< Delete GLONASS-to-BDS time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_BG_BGTB_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00008000) /**< Delete BDS-to-GLONASS time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_BDSWEEK_NUMBER_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00010000) /**< Delete the BDS week number */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_BDS_RF_GRP_DELAY_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00020000) /**< Delete the BDS RF GRP delay */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTIME_EST_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00040000) /**< Delete a Galileo time estimate */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOGPS_TB_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00080000) /**< Delete Galileo-to-GPS time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOGLO_TB_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00100000) /**< Delete Galileo-to-GLO time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOBDS_TB_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00200000) /**< Delete Galileo-to-BDS time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GALWEEK_NUMBER_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x00800000) /**< Delete the Galileo week number */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_GAL_RF_GRP_DELAY_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x01000000) /**< Delete the Galileo RF GRP delay */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TIME_EST_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x02000000) /**< Delete a NavIC time estimate */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_WEEK_NUMBER_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x04000000) /**< Delete the NavIC week number */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_RF_GRP_DELAY_V02 ((qmiLocDeleteClockInfoMaskT_v02)0x08000000) /**< Delete the NavIC RF GRP delay */
+typedef uint64_t qmiLocExtDeleteClockInfoMaskT_v02;
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_GPS_TB_V02 ((qmiLocExtDeleteClockInfoMaskT_v02)0x000001ull) /**< Delete NavIC-to-GPS time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_GLO_TB_V02 ((qmiLocExtDeleteClockInfoMaskT_v02)0x000002ull) /**< Delete NavIC-to-GLO time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_BDS_TB_V02 ((qmiLocExtDeleteClockInfoMaskT_v02)0x000004ull) /**< Delete NavIC-to-BDS time bias-related information */
+#define QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_GAL_TB_V02 ((qmiLocExtDeleteClockInfoMaskT_v02)0x000008ull) /**< Delete NavIC-to-GAL time bias-related information */
+typedef uint8_t qmiLocDeleteSvInfoMaskT_v02;
+#define QMI_LOC_MASK_DELETE_EPHEMERIS_V02 ((qmiLocDeleteSvInfoMaskT_v02)0x01) /**< Delete ephemeris for the satellite */
+#define QMI_LOC_MASK_DELETE_ALMANAC_V02 ((qmiLocDeleteSvInfoMaskT_v02)0x02) /**< Delete almanac for the satellite */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t gnssSvId;
+ /**< SV ID of the satellite to delete data from.
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - SBAS -- 33 to 64 \n
+ - GLONASS -- 65 to 96
+ */
+
+ qmiLocSvSystemEnumT_v02 system;
+ /**< Indicates to which constellation this SV belongs.
+ Values: \n
+ - eQMI_LOC_SV_SYSTEM_GPS (1) -- GPS satellite \n
+ - eQMI_LOC_SV_SYSTEM_GALILEO (2) -- Galileo satellite \n
+ - eQMI_LOC_SV_SYSTEM_SBAS (3) -- SBAS satellite \n
+ - eQMI_LOC_SV_SYSTEM_COMPASS (4) -- COMPASS satellite (Deprecated) \n
+ - eQMI_LOC_SV_SYSTEM_GLONASS (5) -- GLONASS satellite \n
+ - eQMI_LOC_SV_SYSTEM_BDS (6) -- BDS satellite \n
+ - eQMI_LOC_SV_SYSTEM_QZSS (7) -- QZSS satellite \n
+ - eQMI_LOC_SV_SYSTEM_NAVIC (8) -- NavIC satellite
+ */
+
+ qmiLocDeleteSvInfoMaskT_v02 deleteSvInfoMask;
+ /**< Indicates whether to delete the ephemeris or almanac for a satellite. \n
+ Values: \n
+ - QMI_LOC_MASK_DELETE_EPHEMERIS (0x01) -- Delete ephemeris for the satellite
+ - QMI_LOC_MASK_DELETE_ALMANAC (0x02) -- Delete almanac for the satellite
+ */
+}qmiLocDeleteSvInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t gnssSvId;
+ /**< SV ID of the satellite from which to delete data. \n
+ Range for BDS -- 201 to 263 */
+
+ qmiLocDeleteSvInfoMaskT_v02 deleteSvInfoMask;
+ /**< Indicates whether to delete the ephemeris or almanac for a satellite. \n
+ Values: \n
+ - QMI_LOC_MASK_DELETE_EPHEMERIS (0x01) -- Delete ephemeris for the satellite
+ - QMI_LOC_MASK_DELETE_ALMANAC (0x02) -- Delete almanac for the satellite
+ */
+}qmiLocDeleteBDSSvInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t gnssSvId;
+ /**< SV ID of the satellite from which to delete data. \n
+ Range for Galileo -- 301 to 336 */
+
+ qmiLocDeleteSvInfoMaskT_v02 deleteSvInfoMask;
+ /**< Indicates whether to delete the ephemeris or almanac for a satellite. \n
+ Values: \n
+ - QMI_LOC_MASK_DELETE_EPHEMERIS (0x01) -- Delete ephemeris for the satellite
+ - QMI_LOC_MASK_DELETE_ALMANAC (0x02) -- Delete almanac for the satellite
+ */
+}qmiLocDeleteGALSvInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Deletes the location engine
+ assistance data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Delete All */
+ uint8_t deleteAllFlag;
+ /**< Indicates whether to delete all assistance data.\n
+ - 0x01 (TRUE) -- Delete all assistance data; if
+ this flag is set, ignore all the other information
+ contained in the optional fields for this
+ message \n
+ - 0x00 (FALSE) -- Use the optional fields in the message
+ to determine which data to delete
+ */
+
+ /* Optional */
+ /* Delete SV Information */
+ uint8_t deleteSvInfoList_valid; /**< Must be set to true if deleteSvInfoList is being passed */
+ uint32_t deleteSvInfoList_len; /**< Must be set to # of elements in deleteSvInfoList */
+ qmiLocDeleteSvInfoStructT_v02 deleteSvInfoList[QMI_LOC_DELETE_MAX_SV_INFO_LENGTH_V02];
+ /**< \vspace{0.06in} \n List of satellites for which to delete the assistance data.
+ */
+
+ /* Optional */
+ /* Delete GNSS Data */
+ uint8_t deleteGnssDataMask_valid; /**< Must be set to true if deleteGnssDataMask is being passed */
+ qmiLocDeleteGnssDataMaskT_v02 deleteGnssDataMask;
+ /**< Mask for the GNSS data to delete.
+ Values: \n
+ - QMI_LOC_MASK_DELETE_GPS_SVDIR (0x00000001) -- Mask to delete GPS SVDIR
+ - QMI_LOC_MASK_DELETE_GPS_SVSTEER (0x00000002) -- Mask to delete GPS SVSTEER
+ - QMI_LOC_MASK_DELETE_GPS_TIME (0x00000004) -- Mask to delete GPS time
+ - QMI_LOC_MASK_DELETE_GPS_ALM_CORR (0x00000008) -- Mask to delete almanac correlation
+ - QMI_LOC_MASK_DELETE_GLO_SVDIR (0x00000010) -- Mask to delete GLONASS SVDIR
+ - QMI_LOC_MASK_DELETE_GLO_SVSTEER (0x00000020) -- Mask to delete GLONASS SVSTEER
+ - QMI_LOC_MASK_DELETE_GLO_TIME (0x00000040) -- Mask to delete GLONASS time
+ - QMI_LOC_MASK_DELETE_GLO_ALM_CORR (0x00000080) -- Mask to delete GLONASS almanac correlation
+ - QMI_LOC_MASK_DELETE_SBAS_SVDIR (0x00000100) -- Mask to delete SBAS SVDIR
+ - QMI_LOC_MASK_DELETE_SBAS_SVSTEER (0x00000200) -- Mask to delete SBAS SVSTEER
+ - QMI_LOC_MASK_DELETE_POSITION (0x00000400) -- Mask to delete position estimate
+ - QMI_LOC_MASK_DELETE_TIME (0x00000800) -- Mask to delete time estimate
+ - QMI_LOC_MASK_DELETE_IONO (0x00001000) -- Mask to delete IONO
+ - QMI_LOC_MASK_DELETE_UTC (0x00002000) -- Mask to delete UTC estimate
+ - QMI_LOC_MASK_DELETE_HEALTH (0x00004000) -- Mask to delete SV health record
+ - QMI_LOC_MASK_DELETE_SADATA (0x00008000) -- Mask to delete SADATA
+ - QMI_LOC_MASK_DELETE_RTI (0x00010000) -- Mask to delete RTI
+ - QMI_LOC_MASK_DELETE_SV_NO_EXIST (0x00020000) -- Mask to delete SV_NO_EXIST
+ - QMI_LOC_MASK_DELETE_FREQ_BIAS_EST (0x00040000) -- Mask to delete frequency bias estimate
+ - QMI_LOC_MASK_DELETE_BDS_SVDIR (0x00080000) -- Mask to delete BDS SVDIR
+ - QMI_LOC_MASK_DELETE_BDS_SVSTEER (0x00100000) -- Mask to delete BDS SVSTEER
+ - QMI_LOC_MASK_DELETE_BDS_TIME (0x00200000) -- Mask to delete BDS time
+ - QMI_LOC_MASK_DELETE_BDS_ALM_CORR (0x00400000) -- Mask to delete BDS almanac correlation
+ - QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_GPS (0x00800000) -- Mask to delete GNSS SV blacklist GPS
+ - QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_GLO (0x01000000) -- Mask to delete GNSS SV blacklist GLONASS
+ - QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_BDS (0x02000000) -- Mask to delete GNSS SV blacklist BDS
+ - QMI_LOC_MASK_DELETE_GNSS_SV_BLACKLIST_GAL (0x04000000) -- Mask to delete GNSS SV blacklist Galileo
+ - QMI_LOC_MASK_DELETE_GAL_SVDIR (0x08000000) -- Mask to delete Galileo SVDIR
+ - QMI_LOC_MASK_DELETE_GAL_SVSTEER (0x10000000) -- Mask to delete Galileo SVSTEER
+ - QMI_LOC_MASK_DELETE_GAL_TIME (0x20000000) -- Mask to delete Galileo time
+ - QMI_LOC_MASK_DELETE_GAL_ALM_CORR (0x40000000) -- Mask to delete Galileo almanac correlation
+ */
+
+ /* Optional */
+ /* Delete Cell Database */
+ uint8_t deleteCellDbDataMask_valid; /**< Must be set to true if deleteCellDbDataMask is being passed */
+ qmiLocDeleteCelldbDataMaskT_v02 deleteCellDbDataMask;
+ /**< Mask for the cell database assistance data to delete.
+ Values: \n
+ - QMI_LOC_MASK_DELETE_CELLDB_POS (0x00000001) -- Delete cell database position
+ - QMI_LOC_MASK_DELETE_CELLDB_LATEST_GPS_POS (0x00000002) -- Delete cell database latest GPS position
+ - QMI_LOC_MASK_DELETE_CELLDB_OTA_POS (0x00000004) -- Delete cell database OTA position
+ - QMI_LOC_MASK_DELETE_CELLDB_EXT_REF_POS (0x00000008) -- Delete cell database external reference position
+ - QMI_LOC_MASK_DELETE_CELLDB_TIMETAG (0x00000010) -- Delete cell database time tag
+ - QMI_LOC_MASK_DELETE_CELLDB_CELLID (0x00000020) -- Delete cell database cell ID
+ - QMI_LOC_MASK_DELETE_CELLDB_CACHED_CELLID (0x00000040) -- Delete cell database cached cell ID
+ - QMI_LOC_MASK_DELETE_CELLDB_LAST_SRV_CELL (0x00000080) -- Delete cell database last service cell
+ - QMI_LOC_MASK_DELETE_CELLDB_CUR_SRV_CELL (0x00000100) -- Delete cell database current service cell
+ - QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO (0x00000200) -- Delete cell database neighbor information
+ */
+
+ /* Optional */
+ /* Delete Clock Info */
+ uint8_t deleteClockInfoMask_valid; /**< Must be set to true if deleteClockInfoMask is being passed */
+ qmiLocDeleteClockInfoMaskT_v02 deleteClockInfoMask;
+ /**< Mask for the clock information assistance data to delete.
+ Valid bitmasks: \n
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_TIME_EST (0x00000001) -- Delete time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_FREQ_EST (0x00000002) -- Delete frequency estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_WEEK_NUMBER (0x00000004) -- Delete week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_RTC_TIME (0x00000008) -- Delete RTC time
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_TIME_TRANSFER (0x00000010) -- Delete time transfer
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GPSTIME_EST (0x00000020) -- Delete GPS time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLOTIME_EST (0x00000040) -- Delete GLONASS time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLODAY_NUMBER (0x00000080) -- Delete GLONASS day number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLO4YEAR_NUMBER (0x00000100) -- Delete GLONASS four year number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLO_RF_GRP_DELAY (0x00000200) -- Delete GLONASS RF GRP delay
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_DISABLE_TT (0x00000400) -- Delete disable TT
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GG_LEAPSEC (0x00000800) -- Delete GG leap second
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GG_GGTB (0x00001000) -- Delete GG GGTB
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BDSTIME_EST (0x00002000) -- Delete a BDS time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GB_GBTB (0x00004000) -- Delete GLONASS-to-BDS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BG_BGTB (0x00008000) -- Delete BDS-to-GLONASS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BDSWEEK_NUMBER (0x00010000) -- Delete the BDS week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BDS_RF_GRP_DELAY (0x00020000) -- Delete the BDS RF GRP delay
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTIME_EST (0x00040000) -- Delete a Galileo time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOGPS_TB (0x00080000) -- Delete Galileo-to-GPS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOGLO_TB (0x00100000) -- Delete Galileo-to-GLO time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOBDS_TB (0x00200000) -- Delete Galileo-to-BDS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALWEEK_NUMBER (0x00800000) -- Delete the Galileo week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GAL_RF_GRP_DELAY (0x01000000) -- Delete the Galileo RF GRP delay
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TIME_EST (0x02000000) -- Delete a NavIC time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_WEEK_NUMBER (0x04000000) -- Delete the NavIC week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_RF_GRP_DELAY (0x08000000) -- Delete the NavIC RF GRP delay
+ */
+
+ /* Optional */
+ /* Delete BDS SV Info */
+ uint8_t deleteBdsSvInfoList_valid; /**< Must be set to true if deleteBdsSvInfoList is being passed */
+ uint32_t deleteBdsSvInfoList_len; /**< Must be set to # of elements in deleteBdsSvInfoList */
+ qmiLocDeleteBDSSvInfoStructT_v02 deleteBdsSvInfoList[QMI_LOC_DELETE_MAX_BDS_SV_INFO_LENGTH_V02];
+ /**< \vspace{0.06in} \n List of BDS satellites to delete the assistance data from.
+ */
+
+ /* Optional */
+ /* Delete GAL SV Info */
+ uint8_t deleteGalSvInfoList_valid; /**< Must be set to true if deleteGalSvInfoList is being passed */
+ uint32_t deleteGalSvInfoList_len; /**< Must be set to # of elements in deleteGalSvInfoList */
+ qmiLocDeleteGALSvInfoStructT_v02 deleteGalSvInfoList[QMI_LOC_DELETE_MAX_GAL_SV_INFO_LENGTH_V02];
+ /**< \vspace{0.06in} \n List of Galileo satellites to delete the assistance data from.
+ */
+
+ /* Optional */
+ /* Delete QZSS-L1S Data */
+ uint8_t deleteQzssL1sDataFlag_valid; /**< Must be set to true if deleteQzssL1sDataFlag is being passed */
+ uint8_t deleteQzssL1sDataFlag;
+ /**< Indicates whether to delete QZSS-L1S data;
+ if the flag is set, delete data from all QZSS-L1S satellites.
+ */
+}qmiLocDeleteAssistDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Deletes the location engine
+ assistance data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Delete Assist Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_DELETE_ASSIST_DATA_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocDeleteAssistDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Enables/disables XTRA-T session control. */
+typedef struct {
+
+ /* Mandatory */
+ /* Enable XTRA-T */
+ uint8_t xtraTSessionControl;
+ /**< Indicates whether to enable XTRA-T:\n
+ - 0x01 (TRUE) -- Enable XTRA-T \n
+ - 0x00 (FALSE) -- Disable XTRA-T */
+}qmiLocSetXtraTSessionControlReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Enables/disables XTRA-T session control. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set XTRA-T Session Control Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetXtraTSessionControlIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the XTRA-T session control value from the location
+ engine. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetXtraTSessionControlReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the XTRA-T session control value from the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get XTRA-T Session Control Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Enable/Disable XTRA-T */
+ uint8_t xtraTSessionControl_valid; /**< Must be set to true if xtraTSessionControl is being passed */
+ uint8_t xtraTSessionControl;
+ /**< Indicates whether to enable XTRA-T:\n
+ - 0x01 (TRUE) -- Enable XTRA-T \n
+ - 0x00 (FALSE) -- Disable XTRA-T */
+}qmiLocGetXtraTSessionControlIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t wifiPositionTime;
+ /**< Common counter (typically, the number of milliseconds since bootup).
+ This field is only provided when the modem and host processors are
+ synchronized. */
+}qmiLocWifiFixTimeStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWIFIFIXERRORCODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WIFI_FIX_ERROR_SUCCESS_V02 = 0, /**< Wi-Fi fix is successful. \n */
+ eQMI_LOC_WIFI_FIX_ERROR_WIFI_NOT_AVAILABLE_V02 = 1, /**< Wi-Fi fix failed because Wi-Fi is not available on the device.\n */
+ eQMI_LOC_WIFI_FIX_ERROR_NO_AP_FOUND_V02 = 2, /**< Wi-Fi fix failed because no access points are found. \n */
+ eQMI_LOC_WIFI_FIX_ERROR_UNAUTHORIZED_V02 = 3, /**< Wi-Fi fix failed because the server denied access due to bad authorization
+ code. \n */
+ eQMI_LOC_WIFI_FIX_ERROR_SERVER_UNAVAILABLE_V02 = 4, /**< Wi-Fi fix failed because the Wi-Fi server is unavailable.\n */
+ eQMI_LOC_WIFI_FIX_ERROR_LOCATION_CANNOT_BE_DETERMINED_V02 = 5, /**< Wi-Fi fix failed even though APs were found and the server can be reached.
+ This might be because the APs found are not in the database. \n */
+ eQMI_LOC_WIFI_FIX_ERROR_UNKNOWN_V02 = 6, /**< Wi-Fi fix failed, but the cause cannot be determined. */
+ QMILOCWIFIFIXERRORCODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWifiFixErrorCodeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ double lat;
+ /**< Wi-Fi position latitude. \n
+ - Type -- Floating point \n
+ - Units -- Degrees */
+
+ double lon;
+ /**< Wi-Fi position longitude. \n
+ - Type -- Floating point \n
+ - Units -- Degrees */
+
+ uint16_t hepe;
+ /**< Wi-Fi position HEPE.\n
+ - Units -- Meters */
+
+ uint8_t numApsUsed;
+ /**< Number of Access Points (AP) used to generate a fix. */
+
+ qmiLocWifiFixErrorCodeEnumT_v02 fixErrorCode;
+ /**< Wi-Fi position error code; set to 0 if the fix succeeds. This position
+ is only used by a module if the value is 0. If there was a failure,
+ the error code provided by the Wi-Fi positioning system can be provided
+ here.
+ Values: \n
+ - eQMI_LOC_WIFI_FIX_ERROR_SUCCESS (0) -- Wi-Fi fix is successful. \n
+ - eQMI_LOC_WIFI_FIX_ERROR_WIFI_NOT_AVAILABLE (1) -- Wi-Fi fix failed because Wi-Fi is not available on the device.\n
+ - eQMI_LOC_WIFI_FIX_ERROR_NO_AP_FOUND (2) -- Wi-Fi fix failed because no access points are found. \n
+ - eQMI_LOC_WIFI_FIX_ERROR_UNAUTHORIZED (3) -- Wi-Fi fix failed because the server denied access due to bad authorization
+ code. \n
+ - eQMI_LOC_WIFI_FIX_ERROR_SERVER_UNAVAILABLE (4) -- Wi-Fi fix failed because the Wi-Fi server is unavailable.\n
+ - eQMI_LOC_WIFI_FIX_ERROR_LOCATION_CANNOT_BE_DETERMINED (5) -- Wi-Fi fix failed even though APs were found and the server can be reached.
+ This might be because the APs found are not in the database. \n
+ - eQMI_LOC_WIFI_FIX_ERROR_UNKNOWN (6) -- Wi-Fi fix failed, but the cause cannot be determined.
+ */
+}qmiLocWifiFixPosStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocWifiApQualifierMaskT_v02;
+#define QMI_LOC_WIFI_AP_QUALIFIER_BEING_USED_V02 ((qmiLocWifiApQualifierMaskT_v02)0x01) /**< Access point is in use by the WPS. */
+#define QMI_LOC_WIFI_AP_QUALIFIER_HIDDEN_SSID_V02 ((qmiLocWifiApQualifierMaskT_v02)0x02) /**< AP does not broadcast SSID. */
+#define QMI_LOC_WIFI_AP_QUALIFIER_PRIVATE_V02 ((qmiLocWifiApQualifierMaskT_v02)0x04) /**< AP has encryption turned on. */
+#define QMI_LOC_WIFI_AP_QUALIFIER_INFRASTRUCTURE_MODE_V02 ((qmiLocWifiApQualifierMaskT_v02)0x08) /**< AP is in infrastructure mode and not in ad-hoc/unknown mode. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t macAddr[QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02];
+ /**< Associated MAC address of the AP. \n
+ - Type -- Array of unsigned integers \n
+ - Address length -- 6
+ */
+
+ int32_t rssi;
+ /**< Receive signal strength indicator.\n
+ - Units -- dBm (offset with +100 dB) */
+
+ uint16_t channel;
+ /**< Wi-Fi channel on which a beacon was received. */
+
+ qmiLocWifiApQualifierMaskT_v02 apQualifier;
+ /**< A bitmask of Boolean qualifiers for APs.
+ All unused bits in this mask must be set to 0.
+ Values: \n
+ - 0x01 -- BEING_USED \n
+ - 0x02 -- HIDDEN_SSID \n
+ - 0x04 -- PRIVATE \n
+ - 0x08 -- INFRASTRUCTURE_MODE
+ */
+}qmiLocWifiApInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ char ssid[QMI_LOC_MAX_WIFI_AP_SSID_STR_LENGTH_V02 + 1];
+ /**< NULL-terminated SSID string of the Wi-Fi AP. Its maximum length according to the ASCII standard is 32 octets. */
+}qmiLocWifiApSsidStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects the Wi-Fi position. */
+typedef struct {
+
+ /* Optional */
+ /* Wi-Fi Fix Time */
+ uint8_t wifiFixTime_valid; /**< Must be set to true if wifiFixTime is being passed */
+ qmiLocWifiFixTimeStructT_v02 wifiFixTime;
+ /**< \vspace{0.06in} \n Time of Wi-Fi position fix. */
+
+ /* Optional */
+ /* Wi-Fi Position */
+ uint8_t wifiFixPosition_valid; /**< Must be set to true if wifiFixPosition is being passed */
+ qmiLocWifiFixPosStructT_v02 wifiFixPosition;
+ /**< \vspace{0.06in} \n Wi-Fi position fix. */
+
+ /* Optional */
+ /* Wi-Fi Access Point Information */
+ uint8_t apInfo_valid; /**< Must be set to true if apInfo is being passed */
+ uint32_t apInfo_len; /**< Must be set to # of elements in apInfo */
+ qmiLocWifiApInfoStructT_v02 apInfo[QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02];
+ /**< \vspace{0.06in} \n AP scan list.
+ SSID of the Wi-Fi AP.
+ The ordering of the Wi-Fi AP SSID list must match the Wi-Fi AP MAC address list if both are provided,
+ that is, the first element of the Wi-Fi AP SSID list must be the SSID of the AP whose MAC
+ address is in the first element in the Wi-Fi AP Info MAC Address, and so on. */
+
+ /* Optional */
+ /* Horizontal Reliability */
+ uint8_t horizontalReliability_valid; /**< Must be set to true if horizontalReliability is being passed */
+ qmiLocReliabilityEnumT_v02 horizontalReliability;
+ /**< Specifies the reliability of the horizontal position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Raw HEPE */
+ uint8_t rawHepe_valid; /**< Must be set to true if rawHepe is being passed */
+ uint16_t rawHepe;
+ /**< Wi-Fi position raw HEPE, which has no optimization.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Wi-Fi AP SSID String */
+ uint8_t wifiApSsidInfo_valid; /**< Must be set to true if wifiApSsidInfo is being passed */
+ uint32_t wifiApSsidInfo_len; /**< Must be set to # of elements in wifiApSsidInfo */
+ qmiLocWifiApSsidStructT_v02 wifiApSsidInfo[QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02];
+ /**< \vspace{0.04in} \n
+ The ordering of the Wi-Fi AP SSID list must match the Wi-Fi AP MAC address list if both are provided,
+ that is, the first element of the Wi-Fi AP SSID list must be the SSID of the AP whose MAC
+ address is in the first element in the Wi-Fi AP Info MAC address, and so on.*/
+}qmiLocInjectWifiPositionReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects the Wi-Fi position. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Wi-Fi Position Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Wi-Fi Position request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectWifiPositionIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWIFISTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WIFI_STATUS_AVAILABLE_V02 = 1, /**< Wi-Fi is available \n */
+ eQMI_LOC_WIFI_STATUS_UNAVAILABLE_V02 = 2, /**< Wi-Fi is not available */
+ QMILOCWIFISTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWifiStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Notifies the location engine of the Wi-Fi status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Availablility of Wi-Fi */
+ qmiLocWifiStatusEnumT_v02 wifiStatus;
+ /**< Wi-Fi status information.
+ Values: \n
+ - eQMI_LOC_WIFI_STATUS_AVAILABLE (1) -- Wi-Fi is available \n
+ - eQMI_LOC_WIFI_STATUS_UNAVAILABLE (2) -- Wi-Fi is not available
+ */
+}qmiLocNotifyWifiStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the location engine of the Wi-Fi status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of Notify Wi-Fi Status Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Notify Wi-Fi Status request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocNotifyWifiStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the mask of the events for which a client has
+ registered. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetRegisteredEventsReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the mask of the events for which a client has
+ registered. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Registered Events Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Registered Events request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Event Registration Mask */
+ uint8_t eventRegMask_valid; /**< Must be set to true if eventRegMask is being passed */
+ qmiLocEventRegMaskT_v02 eventRegMask;
+ /**< Event registration mask.
+ The control point must enable the following masks to receive the events:\n
+ - QMI_LOC_EVENT_MASK_POSITION_REPORT (0x00000001) -- Position report event indications. \n
+ - QMI_LOC_EVENT_MASK_GNSS_SV_INFO (0x00000002) -- Satellite report event indications. These reports are sent at a 1 Hz rate. \n
+ - QMI_LOC_EVENT_MASK_NMEA (0x00000004) -- NMEA reports for
+ position and satellites in view. The report is at a 1 Hz rate. \n
+ - QMI_LOC_EVENT_MASK_NI_NOTIFY_VERIFY_REQ (0x00000008) -- NI Notify/Verify request event indications. \n
+ - QMI_LOC_EVENT_MASK_INJECT_TIME_REQ (0x00000010) -- Time injection request event indications. \n
+ - QMI_LOC_EVENT_MASK_INJECT_PREDICTED_ORBITS_REQ (0x00000020) -- Predicted orbits request
+ event indications. \n
+ - QMI_LOC_EVENT_MASK_INJECT_POSITION_REQ (0x00000040) -- Position injection request event indications. \n
+ - QMI_LOC_EVENT_MASK_ENGINE_STATE (0x00000080) -- Engine state report
+ event indications. \n
+ - QMI_LOC_EVENT_MASK_FIX_SESSION_STATE (0x00000100) -- Fix session status report event indications. \n
+ - QMI_LOC_EVENT_MASK_WIFI_REQ (0x00000200) -- Wi-Fi position request event indications. \n
+ - QMI_LOC_EVENT_MASK_SENSOR_STREAMING_READY_STATUS (0x00000400) -- Notifications from the location engine indicating its readiness to accept data from the
+ sensors (accelerometer, gyroscope, and so on). \n
+ - QMI_LOC_EVENT_MASK_TIME_SYNC_REQ (0x00000800) -- Time sync requests
+ from the GPS engine. Time sync enables the GPS engine to synchronize
+ its clock with the sensor processor's clock. \n
+ - QMI_LOC_EVENT_MASK_SET_SPI_STREAMING_REPORT (0x00001000) -- Stationary Position Indicator (SPI) streaming report indications. \n
+ - QMI_LOC_EVENT_MASK_LOCATION_SERVER_CONNECTION_REQ (0x00002000) -- Location server requests; generated when the service wishes to
+ establish a connection with a location server. \n
+ - QMI_LOC_EVENT_MASK_NI_GEOFENCE_NOTIFICATION (0x00004000) -- Notifications related to network-initiated Geofences. These events notify the client
+ when a network-initiated Geofence is added, deleted, or edited. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_GEN_ALERT (0x00008000) -- Geofence alerts; generated to inform the client of the changes that can
+ affect a Geofence, for example, if GPS is turned off or if the network is
+ unavailable. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION (0x00010000) -- Geofence breach; when a UE enters or leaves the perimeter of a Geofence.
+ This breach report is for a single Geofence. \n
+ - QMI_LOC_EVENT_MASK_PEDOMETER_CONTROL (0x00020000) -- Pedometer control requests from the location engine. The location engine sends
+ this event to control the injection of pedometer reports. \n
+ - QMI_LOC_EVENT_MASK_MOTION_DATA_CONTROL (0x00040000) -- Motion data control requests from the location engine. The location engine sends
+ this event to control the injection of motion data. \n
+ - QMI_LOC_EVENT_MASK_BATCH_FULL_NOTIFICATION (0x00080000) -- Notification when a batch is full. The location engine sends this event to
+ notify of batch full for ongoing batching session. \n
+ - QMI_LOC_EVENT_MASK_LIVE_BATCHED_POSITION_REPORT (0x00100000) -- Position report indications along with an ongoing batching session.
+ The location engine sends this event to notify the batched position
+ report while a batching session is ongoing. \n
+ - QMI_LOC_EVENT_MASK_INJECT_WIFI_AP_DATA_REQ (0x00200000) -- Wi-Fi AP data inject request event indications. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_BREACH_NOTIFICATION (0x00400000) -- Notifications when a Geofence is breached. These events are generated when a UE enters
+ or leaves the perimeter of a Geofence. This breach notification is for
+ multiple Geofences. Breaches from multiple Geofences are all batched and
+ sent in the same notification. \n
+ - QMI_LOC_EVENT_MASK_VEHICLE_DATA_READY_STATUS (0x00800000) -- Notifications from the
+ location engine indicating its readiness to accept vehicle data (vehicle
+ accelerometer, vehicle angular rate, vehicle odometry, and so on).\n
+ - QMI_LOC_EVENT_MASK_GNSS_MEASUREMENT_REPORT (0x01000000) -- System clock and satellite measurement report events (system clock, SV time,
+ Doppler, and so on). Reports are generated only for the GNSS satellite constellations
+ that are enabled using QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n
+ - QMI_LOC_EVENT_MASK_GNSS_SV_POLYNOMIAL_REPORT (0x02000000) -- Satellite position reports as polynomials. Reports are generated only for the GNSS satellite
+ constellations that are enabled using QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_PROXIMITY_NOTIFICATION (0x04000000) -- Notifications when a Geofence proximity is entered and exited. The proximity of
+ a Geofence might be due to different contexts. These contexts are identified
+ using the context ID in this indication. The context of a Geofence can contain Wi-Fi area
+ ID lists, IBeacon lists, Cell-ID list, and so forth. \n
+ - QMI_LOC_EVENT_MASK_GDT_UPLOAD_BEGIN_REQ (0x08000000) -- Generic Data Transport (GDT) upload session begin request event indications. \n
+ - QMI_LOC_EVENT_MASK_GDT_UPLOAD_END_REQ (0x10000000) -- GDT upload session end request event indications. \n
+ - QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_DWELL_NOTIFICATION (0x20000000) -- Notifications when a Geofence is dwelled. These events are generated when a UE enters
+ or leaves the perimeter of a Geofence and dwells inside or outside for a specified time.
+ This dwell notification is for multiple Geofences. Dwells from multiple Geofences are all batched and
+ sent in the same notification. \n
+ - QMI_LOC_EVENT_MASK_GET_TIME_ZONE_REQ (0x40000000) -- Requests for time zone information from the service.
+ These events are generated when there is a need for time zone information in the
+ service. \n
+ - QMI_LOC_EVENT_MASK_BATCHING_STATUS (0x80000000) -- Asynchronous events related to batching. n
+ - QMI_LOC_EVENT_MASK_INTERNAL_STATUS_REPORT (0x100000000) -- The location service internal status report mask. \n
+ - QMI_LOC_EVENT_MASK_INJECT_SRN_AP_DATA_REQ (0x200000000) -- Asynchronous events for
+ short range node (SRN) RSSI scans, for example, BT, BTLE, NFC, and so on. \n
+ - QMI_LOC_EVENT_MASK_GNSS_ONLY_POSITION_REPORT (0x400000000) -- Position report event indications that contain a GNSS only position. \n
+ - QMI_LOC_EVENT_MASK_FDCL_SERVICE_REQ (0x800000000) -- FDCL service request. \n
+ - QMI_LOC_EVENT_MASK_DC_REPORT (0x1000000000) -- DC report event indications that contains disaster and crisis reports. \n
+ - QMI_LOC_EVENT_MASK_ENGINE_LOCK_STATE (0x2000000000) -- Asynchronous events related to the engine lock state. \n
+ - QMI_LOC_EVENT_MASK_UNPROPAGATED_POSITION_REPORT (0x4000000000) -- Unpropagated fix. \n
+ - QMI_LOC_EVENT_MASK_BS_OBS_DATA_SERVICE_REQ (0x8000000000) -- Base station observed data service request. \n
+ - QMI_LOC_EVENT_MASK_EPHEMERIS_REPORT (0x10000000000) -- Ephemeris data for all GNSS constellations. \n
+ - QMI_LOC_EVENT_MASK_NEXT_LS_INFO_REPORT (0x20000000000) -- Upcoming leap second information from the service. \n
+ - QMI_LOC_EVENT_MASK_GET_BAND_MEASUREMENT_METRICS (0x40000000000) -- The band measurement metrics from the ME. \n
+ - QMI_LOC_EVENT_MASK_GNSS_NHZ_MEASUREMENT_REPORT (0x80000000000) -- System clock and satellite
+ measurement report events (system clock, SV time, Doppler, and so on) at a rate greater
+ than 1 Hz.
+ Reports are generated only for the GNSS satellite constellations that are enabled using
+ QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG. \n
+ - QMI_LOC_EVENT_MASK_GNSS_EVENT_REPORT (0x100000000000) -- The QMI_LOC_EVENT_REPORT indication. \n
+ - QMI_LOC_EVENT_MASK_QUERY_XTRA_INFO (0x200000000000) -- Event indication to trigger XTRA config query from the control point. \n
+ - QMI_LOC_EVENT_MASK_SAP_INS_PARAMETERS_REPORT (0x400000000000) -- QMI_LOC_EVENT_SAP_INS_PARAMETERS indication. \n
+ - QMI_LOC_EVENT_MASK_LATENCY_INFORMATION_REPORT (0x800000000000) -- QMI_LOC_LATENCY_INFORMATION indication.
+ */
+}qmiLocGetRegisteredEventsIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCOPERATIONMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_OPER_MODE_DEFAULT_V02 = 1, /**< Use the default engine mode \n */
+ eQMI_LOC_OPER_MODE_MSB_V02 = 2, /**< Use the MS-based mode \n */
+ eQMI_LOC_OPER_MODE_MSA_V02 = 3, /**< Use the MS-assisted mode \n */
+ eQMI_LOC_OPER_MODE_STANDALONE_V02 = 4, /**< Use Standalone mode \n */
+ eQMI_LOC_OPER_MODE_CELL_ID_V02 = 5, /**< Use cell ID; this mode is only valid for GSM/UMTS networks \n */
+ eQMI_LOC_OPER_MODE_WWAN_V02 = 6, /**< Use WWAN measurements to calculate the position; if this mode is
+ set, AFLT is used for 1X networks and OTDOA is used
+ for LTE networks */
+ QMILOCOPERATIONMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocOperationModeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Tells the engine to use the specified operation mode while
+ making the position fixes. */
+typedef struct {
+
+ /* Mandatory */
+ /* Operation Mode */
+ qmiLocOperationModeEnumT_v02 operationMode;
+ /**< Preferred operation mode.
+ Values: \n
+ - eQMI_LOC_OPER_MODE_DEFAULT (1) -- Use the default engine mode \n
+ - eQMI_LOC_OPER_MODE_MSB (2) -- Use the MS-based mode \n
+ - eQMI_LOC_OPER_MODE_MSA (3) -- Use the MS-assisted mode \n
+ - eQMI_LOC_OPER_MODE_STANDALONE (4) -- Use Standalone mode \n
+ - eQMI_LOC_OPER_MODE_CELL_ID (5) -- Use cell ID; this mode is only valid for GSM/UMTS networks \n
+ - eQMI_LOC_OPER_MODE_WWAN (6) -- Use WWAN measurements to calculate the position; if this mode is
+ set, AFLT is used for 1X networks and OTDOA is used
+ for LTE networks
+ */
+
+ /* Optional */
+ /* Minimum Interval Between Position Reports */
+ uint8_t minInterval_valid; /**< Must be set to true if minInterval is being passed */
+ uint32_t minInterval;
+ /**< Minimum time interval, specified by the control point, that must elapse between
+ position reports. \n
+ - Units -- milliseconds \n
+ - Default -- 1000 ms
+ */
+}qmiLocSetOperationModeReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Tells the engine to use the specified operation mode while
+ making the position fixes. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Operation Mode Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Operation Mode request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetOperationModeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Gets the current operation mode from the engine. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetOperationModeReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Gets the current operation mode from the engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Operation Mode Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Operation Mode request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Operation Mode */
+ uint8_t operationMode_valid; /**< Must be set to true if operationMode is being passed */
+ qmiLocOperationModeEnumT_v02 operationMode;
+ /**< Current operation mode.
+ Values: \n
+ - eQMI_LOC_OPER_MODE_DEFAULT (1) -- Use the default engine mode \n
+ - eQMI_LOC_OPER_MODE_MSB (2) -- Use the MS-based mode \n
+ - eQMI_LOC_OPER_MODE_MSA (3) -- Use the MS-assisted mode \n
+ - eQMI_LOC_OPER_MODE_STANDALONE (4) -- Use Standalone mode \n
+ - eQMI_LOC_OPER_MODE_CELL_ID (5) -- Use cell ID; this mode is only valid for GSM/UMTS networks \n
+ - eQMI_LOC_OPER_MODE_WWAN (6) -- Use WWAN measurements to calculate the position; if this mode is
+ set, AFLT is used for 1X networks and OTDOA is used
+ for LTE networks
+ */
+}qmiLocGetOperationModeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to set the SPI status, which
+ indicates whether the device is stationary. */
+typedef struct {
+
+ /* Mandatory */
+ /* Stationary Status */
+ uint8_t stationary;
+ /**< Indicates whether the device is stationary: \n
+ - 0x00 (FALSE) -- Device is not stationary \n
+ - 0x01 (TRUE) -- Device is stationary
+ */
+
+ /* Optional */
+ /* Confidence */
+ uint8_t confidenceStationary_valid; /**< Must be set to true if confidenceStationary is being passed */
+ uint8_t confidenceStationary;
+ /**< Confidence in the Stationary state expressed as a percentage.\n
+ - Range -- 0 to 100 */
+}qmiLocSetSpiStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to set the SPI status, which
+ indicates whether the device is stationary. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of SPI Status Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the SPI status request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetSpiStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocSensorDataFlagMaskT_v02;
+#define QMI_LOC_SENSOR_DATA_FLAG_SIGN_REVERSAL_V02 ((qmiLocSensorDataFlagMaskT_v02)0x01) /**< Bitmask specifying that a sign reversal is required while interpreting
+ the sensor data; only applies to the accelerometer samples */
+#define QMI_LOC_SENSOR_DATA_FLAG_SENSOR_TIME_IS_MODEM_TIME_V02 ((qmiLocSensorDataFlagMaskT_v02)0x02) /**< Bitmask specifying that the sensor time stamp is the same as the modem
+ time stamp */
+#define QMI_LOC_SENSOR_DATA_FLAG_CALIBRATED_DATA_V02 ((qmiLocSensorDataFlagMaskT_v02)0x04) /**< Bitmask specifying that the injected sensor data is calibrated */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSENSORDATATIMESOURCEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SENSOR_TIME_SOURCE_UNSPECIFIED_V02 = 0, /**< Sensor time source is unspecified \n */
+ eQMI_LOC_SENSOR_TIME_SOURCE_COMMON_V02 = 1, /**< Time source is common between the sensors and
+ the location engine */
+ QMILOCSENSORDATATIMESOURCEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSensorDataTimeSourceEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t timeOffset;
+ /**< Sample time offset. This time offset must be
+ relative to the timestamp of the first sensor data sample.\n
+ - Units -- Milliseconds */
+
+ float xAxis;
+ /**< Sensor x-axis sample. \n
+ - Units accelerometer -- Meters per second^2 \n
+ - Units gyroscope -- Radians per second \n
+ - Units magnetometer -- microTesla */
+
+ float yAxis;
+ /**< Sensor y-axis sample. \n
+ - Units accelerometer -- Meters per second^2 \n
+ - Units gyroscope -- Radians per second \n
+ - Units magnetometer -- microTesla */
+
+ float zAxis;
+ /**< Sensor z-axis sample. \n
+ - Units accelerometer -- Meters per second^2 ) \n
+ - Units gyroscope -- Radians per second \n
+ - Units magnetometer -- microTesla */
+}qmiLoc3AxisSensorSampleStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t timeOfFirstSample;
+ /**< Indicates a full 32-bit timestamp of the first (oldest) sample in this
+ message. The timestamp is in the time reference scale that is
+ used by the sensor time source.\n
+ - Units -- Milliseconds */
+
+ qmiLocSensorDataFlagMaskT_v02 flags;
+ /**< Flags to indicate any deviation from the default measurement
+ assumptions. Set all unused bits in this field to 0.
+ Valid bitmasks:
+ - QMI_LOC_SENSOR_DATA_FLAG_SIGN_REVERSAL (0x01) -- Bitmask specifying that a sign reversal is required while interpreting
+ the sensor data; only applies to the accelerometer samples
+ - QMI_LOC_SENSOR_DATA_FLAG_SENSOR_TIME_IS_MODEM_TIME (0x02) -- Bitmask specifying that the sensor time stamp is the same as the modem
+ time stamp
+ - QMI_LOC_SENSOR_DATA_FLAG_CALIBRATED_DATA (0x04) -- Bitmask specifying that the injected sensor data is calibrated */
+
+ uint32_t sensorData_len; /**< Must be set to # of elements in sensorData */
+ qmiLoc3AxisSensorSampleStructT_v02 sensorData[QMI_LOC_SENSOR_DATA_MAX_SAMPLES_V02];
+ /**< Variable length array specifying sensor samples. \n
+ - Maximum length of the array -- 50 */
+}qmiLoc3AxisSensorSampleListStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t timeOffset;
+ /**< Sample time offset. This time offset must be
+ relative to the timestamp of the first sensor sample.\n
+ - Units: Milliseconds */
+
+ float temperature;
+ /**< Sensor temperature. \n
+ - Type: Floating point \n
+ - Units: Degrees Celsius \n
+ - Range: -50 to +100.00 */
+}qmiLocSensorTemperatureSampleStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSensorDataTimeSourceEnumT_v02 timeSource;
+ /**< Indicates the time source of the sensor data. Location service uses
+ this field to identify the time reference used in the
+ sensor data timestamps.
+ Values: \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_UNSPECIFIED (0) -- Sensor time source is unspecified \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_COMMON (1) -- Time source is common between the sensors and
+ the location engine
+ */
+
+ uint32_t timeOfFirstSample;
+ /**< Indicates a full 32-bit timestamp of the first (oldest) sample in this
+ message. The timestamp is in the time reference scale that is
+ used by the sensor time source.\n
+ - Units -- Milliseconds */
+
+ uint32_t temperatureData_len; /**< Must be set to # of elements in temperatureData */
+ qmiLocSensorTemperatureSampleStructT_v02 temperatureData[QMI_LOC_SENSOR_DATA_MAX_SAMPLES_V02];
+ /**< Variable length array specifying sensor temperature samples. \n
+ - Maximum length of the array -- 50 */
+}qmiLocSensorTemperatureSampleListStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject sensor data into the
+ GNSS location engine. */
+typedef struct {
+
+ /* Optional */
+ /* Opaque Identifier */
+ uint8_t opaqueIdentifier_valid; /**< Must be set to true if opaqueIdentifier is being passed */
+ uint32_t opaqueIdentifier;
+ /**< An opaque identifier that is sent in by the client that is echoed
+ in the indication so the client can relate the indication to the
+ request. */
+
+ /* Optional */
+ /* 3-Axis Accelerometer Data */
+ uint8_t threeAxisAccelData_valid; /**< Must be set to true if threeAxisAccelData is being passed */
+ qmiLoc3AxisSensorSampleListStructT_v02 threeAxisAccelData;
+ /**< \vspace{0.06in} \n Accelerometer sensor samples. */
+
+ /* Optional */
+ /* 3-Axis Gyroscope Data */
+ uint8_t threeAxisGyroData_valid; /**< Must be set to true if threeAxisGyroData is being passed */
+ qmiLoc3AxisSensorSampleListStructT_v02 threeAxisGyroData;
+ /**< \vspace{0.06in} \n Gyroscope sensor samples. */
+
+ /* Optional */
+ /* 3-Axis Accelerometer Data Time Source */
+ uint8_t threeAxisAccelDataTimeSource_valid; /**< Must be set to true if threeAxisAccelDataTimeSource is being passed */
+ qmiLocSensorDataTimeSourceEnumT_v02 threeAxisAccelDataTimeSource;
+ /**< Time source for the 3-axis accelerometer data. The location service uses
+ this field to identify the time reference used in the accelerometer data
+ timestamps. If not specified, the location service assumes that the
+ time source for the accelereometer data is unknown. \n
+ Values: \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_UNSPECIFIED (0) -- Sensor time source is unspecified \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_COMMON (1) -- Time source is common between the sensors and
+ the location engine
+ */
+
+ /* Optional */
+ /* 3-Axis Gyroscope Data Time Source */
+ uint8_t threeAxisGyroDataTimeSource_valid; /**< Must be set to true if threeAxisGyroDataTimeSource is being passed */
+ qmiLocSensorDataTimeSourceEnumT_v02 threeAxisGyroDataTimeSource;
+ /**< Time source for the 3-axis gyroscope data. The location service uses
+ this field to identify the time reference used in the gyroscope data
+ timestamps. If not specified, the location service assumes that the
+ time source for the gyroscope data is unknown. \n
+ Values: \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_UNSPECIFIED (0) -- Sensor time source is unspecified \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_COMMON (1) -- Time source is common between the sensors and
+ the location engine
+ */
+
+ /* Optional */
+ /* Accelerometer Temperature Data */
+ uint8_t accelTemperatureData_valid; /**< Must be set to true if accelTemperatureData is being passed */
+ qmiLocSensorTemperatureSampleListStructT_v02 accelTemperatureData;
+ /**< \vspace{0.06in} \n Accelerometer temperature samples. This data is optional and does not
+ have to be included in the message along with accelerometer data. */
+
+ /* Optional */
+ /* Gyroscope Temperature Data */
+ uint8_t gyroTemperatureData_valid; /**< Must be set to true if gyroTemperatureData is being passed */
+ qmiLocSensorTemperatureSampleListStructT_v02 gyroTemperatureData;
+ /**< \vspace{0.06in} \n Gyroscope temperature samples. This data is optional and does not
+ have to be included in the message along with gyroscope data. */
+
+ /* Optional */
+ /* 3-Axis Magnetometer Data */
+ uint8_t threeAxisMagData_valid; /**< Must be set to true if threeAxisMagData is being passed */
+ qmiLoc3AxisSensorSampleListStructT_v02 threeAxisMagData;
+ /**< \vspace{0.06in} \n Magnetometer sensor samples. */
+
+ /* Optional */
+ /* 3-Axis Magnetometer Data Time Source */
+ uint8_t threeAxisMagDataTimeSource_valid; /**< Must be set to true if threeAxisMagDataTimeSource is being passed */
+ qmiLocSensorDataTimeSourceEnumT_v02 threeAxisMagDataTimeSource;
+ /**< Time source for the 3-axis magnetometer data. The location service uses
+ this field to identify the time reference used in the magnetometer data
+ timestamps. If not specified, the location service assumes that the
+ time source for the magnetometer data is unknown. \n
+ Values: \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_UNSPECIFIED (0) -- Sensor time source is unspecified \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_COMMON (1) -- Time source is common between the sensors and
+ the location engine
+ */
+}qmiLocInjectSensorDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject sensor data into the
+ GNSS location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Sensor Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Sensor Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Opaque Identifier */
+ uint8_t opaqueIdentifier_valid; /**< Must be set to true if opaqueIdentifier is being passed */
+ uint32_t opaqueIdentifier;
+ /**< Opaque identifier that was sent in by the client echoed
+ so the client can relate the indication to the request. */
+
+ /* Optional */
+ /* Accelerometer Samples Accepted */
+ uint8_t threeAxisAccelSamplesAccepted_valid; /**< Must be set to true if threeAxisAccelSamplesAccepted is being passed */
+ uint8_t threeAxisAccelSamplesAccepted;
+ /**< Lets the client know how many 3-axis accelerometer samples
+ were accepted. This field is present only if the accelerometer
+ samples were sent in the request. */
+
+ /* Optional */
+ /* Gyroscope Samples Accepted */
+ uint8_t threeAxisGyroSamplesAccepted_valid; /**< Must be set to true if threeAxisGyroSamplesAccepted is being passed */
+ uint8_t threeAxisGyroSamplesAccepted;
+ /**< Lets the client know how many 3-axis gyroscope samples were
+ accepted. This field is present only if the gyroscope
+ samples were sent in the request. */
+
+ /* Optional */
+ /* Accelerometer Temperature Samples Accepted */
+ uint8_t accelTemperatureSamplesAccepted_valid; /**< Must be set to true if accelTemperatureSamplesAccepted is being passed */
+ uint8_t accelTemperatureSamplesAccepted;
+ /**< Lets the client know how many accelerometer temperature
+ samples were accepted. This field is present only if the accelerometer
+ temperature samples were sent in the request. */
+
+ /* Optional */
+ /* Gyroscope Temperature Samples Accepted */
+ uint8_t gyroTemperatureSamplesAccepted_valid; /**< Must be set to true if gyroTemperatureSamplesAccepted is being passed */
+ uint8_t gyroTemperatureSamplesAccepted;
+ /**< Lets the client know how many gyroscope temperature samples
+ were accepted. This field is present only if the gyroscope
+ temperature samples were sent in the request. */
+
+ /* Optional */
+ /* Magnetometer Samples Accepted */
+ uint8_t threeAxisMagSamplesAccepted_valid; /**< Must be set to true if threeAxisMagSamplesAccepted is being passed */
+ uint8_t threeAxisMagSamplesAccepted;
+ /**< Lets the client know how many 3-axis magnetometer samples
+ were accepted. This field is present only if the magnetometer
+ samples were sent in the request. */
+}qmiLocInjectSensorDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject time synchronization data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Reference Time Sync Counter */
+ uint32_t refCounter;
+ /**< Set to the value that was sent to the control point when the
+ GNSS location engine requested time synchronization injection. */
+
+ /* Mandatory */
+ /* Sensor Receive Time */
+ uint32_t sensorProcRxTime;
+ /**< Value of the sensor time when the control point received the
+ Time Sync Inject request from the GNSS location engine.
+ Must be monotonically increasing, jitter @latexonly $\leq$ @endlatexonly 1
+ millisecond, never stopping until the process is rebooted.\n
+ - Units -- Milliseconds */
+
+ /* Mandatory */
+ /* Sensor Transmit Time */
+ uint32_t sensorProcTxTime;
+ /**< Value of the sensor time when the control point injects this message
+ for use by the GNSS location engine.
+ Must be monotonically increasing, jitter @latexonly $\leq$ @endlatexonly 1
+ millisecond, never stopping until the process is rebooted.\n
+ - Units -- Milliseconds */
+}qmiLocInjectTimeSyncDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject time synchronization data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Time Sync Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Time Synchronization Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectTimeSyncDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCCRADLEMOUNTSTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_CRADLE_STATE_NOT_MOUNTED_V02 = 0, /**< Device is mounted on the cradle \n */
+ eQMI_LOC_CRADLE_STATE_MOUNTED_V02 = 1, /**< Device is not mounted on the cradle \n */
+ eQMI_LOC_CRADLE_STATE_UNKNOWN_V02 = 2, /**< Unknown cradle mount state */
+ QMILOCCRADLEMOUNTSTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocCradleMountStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the current
+ cradle mount configuration. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetCradleMountConfigReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the current
+ cradle mount configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Cradle Mount Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Cradle Mount State */
+ uint8_t cradleMountState_valid; /**< Must be set to true if cradleMountState is being passed */
+ qmiLocCradleMountStateEnumT_v02 cradleMountState;
+ /**< Cradle Mount state set by the control point.
+ Values: \n
+ - eQMI_LOC_CRADLE_STATE_NOT_MOUNTED (0) -- Device is mounted on the cradle \n
+ - eQMI_LOC_CRADLE_STATE_MOUNTED (1) -- Device is not mounted on the cradle \n
+ - eQMI_LOC_CRADLE_STATE_UNKNOWN (2) -- Unknown cradle mount state
+ */
+
+ /* Optional */
+ /* Cradle Mount Confidence */
+ uint8_t confidenceCradleMountState_valid; /**< Must be set to true if confidenceCradleMountState is being passed */
+ uint8_t confidenceCradleMountState;
+ /**< Confidence of the Cradle Mount state expressed as a percentage.\n
+ - Range: 0 to 100 */
+}qmiLocGetCradleMountConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to set the current
+ cradle mount configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Cradle Mount State */
+ qmiLocCradleMountStateEnumT_v02 cradleMountState;
+ /**< Cradle Mount state set by the control point.
+ Values: \n
+ - eQMI_LOC_CRADLE_STATE_NOT_MOUNTED (0) -- Device is mounted on the cradle \n
+ - eQMI_LOC_CRADLE_STATE_MOUNTED (1) -- Device is not mounted on the cradle \n
+ - eQMI_LOC_CRADLE_STATE_UNKNOWN (2) -- Unknown cradle mount state
+ */
+
+ /* Optional */
+ /* Cradle Mount Confidence */
+ uint8_t confidenceCradleMountState_valid; /**< Must be set to true if confidenceCradleMountState is being passed */
+ uint8_t confidenceCradleMountState;
+ /**< Confidence in the Cradle Mount state expressed as a percentage.\n
+ - Range -- 0 to 100 */
+}qmiLocSetCradleMountConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to set the current
+ cradle mount configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Cradle Mount Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetCradleMountConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCEXTERNALPOWERCONFIGENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_EXTERNAL_POWER_NOT_CONNECTED_V02 = 0, /**< Device is not connected to an external power source \n */
+ eQMI_LOC_EXTERNAL_POWER_CONNECTED_V02 = 1, /**< Device is connected to an external power source \n */
+ eQMI_LOC_EXTERNAL_POWER_UNKNOWN_V02 = 2, /**< Unknown external power state */
+ QMILOCEXTERNALPOWERCONFIGENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocExternalPowerConfigEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the current
+ external power configuration. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetExternalPowerConfigReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the current
+ external power configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Ext Power Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* External Power State */
+ uint8_t externalPowerState_valid; /**< Must be set to true if externalPowerState is being passed */
+ qmiLocExternalPowerConfigEnumT_v02 externalPowerState;
+ /**< Power state injected by the control point.
+ Values: \n
+ - eQMI_LOC_EXTERNAL_POWER_NOT_CONNECTED (0) -- Device is not connected to an external power source \n
+ - eQMI_LOC_EXTERNAL_POWER_CONNECTED (1) -- Device is connected to an external power source \n
+ - eQMI_LOC_EXTERNAL_POWER_UNKNOWN (2) -- Unknown external power state
+ */
+}qmiLocGetExternalPowerConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCBATTERYLEVELENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_BATTERY_LEVEL_UNKNOWN_V02 = 0, /**< Device battery level is unknown \n */
+ eQMI_LOC_BATTERY_LEVEL_VERY_HIGH_V02 = 1, /**< Device battery level is >75% and <=100% \n */
+ eQMI_LOC_BATTERY_LEVEL_HIGH_V02 = 2, /**< Device battery level is >50% and <=75% \n */
+ eQMI_LOC_BATTERY_LEVEL_MEDIUM_V02 = 3, /**< Device battery level is >25% and <=50% \n */
+ eQMI_LOC_BATTERY_LEVEL_LOW_V02 = 4, /**< Device battery level is >0% and <= 25% */
+ QMILOCBATTERYLEVELENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocBatteryLevelEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to set the current
+ external power configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* External Power State */
+ qmiLocExternalPowerConfigEnumT_v02 externalPowerState;
+ /**< Power state injected by the control point.
+ Values: \n
+ - eQMI_LOC_EXTERNAL_POWER_NOT_CONNECTED (0) -- Device is not connected to an external power source \n
+ - eQMI_LOC_EXTERNAL_POWER_CONNECTED (1) -- Device is connected to an external power source \n
+ - eQMI_LOC_EXTERNAL_POWER_UNKNOWN (2) -- Unknown external power state
+ */
+
+ /* Optional */
+ /* Battery Level Percent */
+ uint8_t batteryLevel_valid; /**< Must be set to true if batteryLevel is being passed */
+ qmiLocBatteryLevelEnumT_v02 batteryLevel;
+ /**< Battery level as injected by the control point.
+ Values: \n
+ - eQMI_LOC_BATTERY_LEVEL_UNKNOWN (0) -- Device battery level is unknown \n
+ - eQMI_LOC_BATTERY_LEVEL_VERY_HIGH (1) -- Device battery level is >75% and <=100% \n
+ - eQMI_LOC_BATTERY_LEVEL_HIGH (2) -- Device battery level is >50% and <=75% \n
+ - eQMI_LOC_BATTERY_LEVEL_MEDIUM (3) -- Device battery level is >25% and <=50% \n
+ - eQMI_LOC_BATTERY_LEVEL_LOW (4) -- Device battery level is >0% and <= 25%
+ */
+}qmiLocSetExternalPowerConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to set the current
+ external power configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set External Power Configuration Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetExternalPowerConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSERVERPDNENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4_V02 = 0x01, /**< IPv4 PDN type \n */
+ eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV6_V02 = 0x02, /**< IPv6 PDN type \n */
+ eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4V6_V02 = 0x03, /**< IPv4v6 PDN type \n */
+ eQMI_LOC_APN_PROFILE_PDN_TYPE_PPP_V02 = 0x04, /**< PPP PDN type */
+ QMILOCSERVERPDNENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocServerPDNEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocServerPDNEnumT_v02 pdnType;
+ /**< PDN type of the APN profile.
+ Values: \n
+ - eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4 (0x01) -- IPv4 PDN type \n
+ - eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV6 (0x02) -- IPv6 PDN type \n
+ - eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4V6 (0x03) -- IPv4v6 PDN type \n
+ - eQMI_LOC_APN_PROFILE_PDN_TYPE_PPP (0x04) -- PPP PDN type
+ */
+
+ char apnName[QMI_LOC_MAX_APN_NAME_LENGTH_V02 + 1];
+ /**< APN name. \n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator)-- 101
+
+ */
+}qmiLocApnProfilesStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSERVERREQSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SERVER_REQ_STATUS_SUCCESS_V02 = 1, /**< Location server request was successful \n */
+ eQMI_LOC_SERVER_REQ_STATUS_FAILURE_V02 = 2, /**< Location server request failed */
+ QMILOCSERVERREQSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocServerReqStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inform the service about the
+ status of the location server connection request that the
+ service might have sent via the
+ QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND event. */
+typedef struct {
+
+ /* Mandatory */
+ /* Connection Handle */
+ uint32_t connHandle;
+ /**< Connection handle that the service specified in the
+ Location Server Connection request event. */
+
+ /* Mandatory */
+ /* Request Type */
+ qmiLocServerRequestEnumT_v02 requestType;
+ /**< Type of connection request service that was specified in the
+ Location Server Connection Request event.
+ Values: \n
+ - eQMI_LOC_SERVER_REQUEST_OPEN (1) -- Open a connection to the location server \n
+ - eQMI_LOC_SERVER_REQUEST_CLOSE (2) -- Close a connection to the location server
+ */
+
+ /* Mandatory */
+ /* Connection Status */
+ qmiLocServerReqStatusEnumT_v02 statusType;
+ /**< Status of the connection request.
+ Values: \n
+ - eQMI_LOC_SERVER_REQ_STATUS_SUCCESS (1) -- Location server request was successful \n
+ - eQMI_LOC_SERVER_REQ_STATUS_FAILURE (2) -- Location server request failed
+ */
+
+ /* Optional */
+ /* APN Profile */
+ uint8_t apnProfile_valid; /**< Must be set to true if apnProfile is being passed */
+ qmiLocApnProfilesStructT_v02 apnProfile;
+ /**< \vspace{0.06in} \n Access point name (APN) profile information is present only when
+ requestType is OPEN and statusType is SUCCESS. */
+
+ /* Optional */
+ /* APN Type Mask */
+ uint8_t apnTypeMask_valid; /**< Must be set to true if apnTypeMask is being passed */
+ qmiLocApnTypeMaskT_v02 apnTypeMask;
+ /**< Bitmask specifying the APN type for the requested connection.
+ This bitmask uniquely identifies a data connection which the AP brought up
+ for the data connection request of the modem GPS stack. This mask is
+ provided to the data services as part of the policy to identify the correct
+ data connection AP.
+ In the process, this field is not provided and the legacy behavior takes precedence.
+ The modem GPS stack uses an APN name to look up the correct data profile number
+ associated with the connection and use it in policy construction. \n
+ Valid bitmask: \n
+ - QMI_LOC_APN_TYPE_MASK_DEFAULT (0x0000000000000001) -- APN type for default/Internet traffic\n
+ - QMI_LOC_APN_TYPE_MASK_IMS (0x0000000000000002) -- APN type for IP Multimedia Subsystem \n
+ - QMI_LOC_APN_TYPE_MASK_MMS (0x0000000000000004) -- APN type for multimedia messaging service \n
+ - QMI_LOC_APN_TYPE_MASK_DUN (0x0000000000000008) -- APN type for dial up network
+ - QMI_LOC_APN_TYPE_MASK_SUPL (0x0000000000000010) -- APN type for secure user plane location \n
+ - QMI_LOC_APN_TYPE_MASK_HIPRI (0x0000000000000020) -- APN type for high priority mobile data \n
+ - QMI_LOC_APN_TYPE_MASK_FOTA (0x0000000000000040) -- APN type for over the air administration \n
+ - QMI_LOC_APN_TYPE_MASK_CBS (0x0000000000000080) -- APN type for carrier branded services \n
+ - QMI_LOC_APN_TYPE_MASK_IA (0x0000000000000100) -- APN type for initial attach \n
+ - QMI_LOC_APN_TYPE_MASK_EMERGENCY (0x0000000000000200) -- APN type for emergency
+ */
+}qmiLocInformLocationServerConnStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inform the service about the
+ status of the location server connection request that the
+ service might have sent via the
+ QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND event. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of Inform Loc Server Conn Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inform Location Server Connection Status request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInformLocationServerConnStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCVXVERSIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_VX_VERSION_V1_ONLY_V02 = 1, /**< V1 VX version \n */
+ eQMI_LOC_VX_VERSION_V2_ONLY_V02 = 2, /**< V2 VX version */
+ QMILOCVXVERSIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocVxVersionEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSUPLVERSIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SUPL_VERSION_1_0_V02 = 1, /**< SUPL version 1.0 \n */
+ eQMI_LOC_SUPL_VERSION_2_0_V02 = 2, /**< SUPL version 2.0 \n */
+ eQMI_LOC_SUPL_VERSION_2_0_2_V02 = 3, /**< SUPL version 2.0.2 \n */
+ eQMI_LOC_SUPL_VERSION_2_0_4_V02 = 4, /**< SUPL version 2.0.4 */
+ QMILOCSUPLVERSIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSuplVersionEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocLppConfigMaskT_v02;
+#define QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE_V02 ((qmiLocLppConfigMaskT_v02)0x00000001) /**< Enable user plane configuration for LTE Positioning Profile (LPP) \n */
+#define QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE_V02 ((qmiLocLppConfigMaskT_v02)0x00000002) /**< Enable control plane configuration for LPP \n */
+#define QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE_OVER_NR5G_SA_V02 ((qmiLocLppConfigMaskT_v02)0x00000004) /**< Enable user plane configuration for NR5G (LPP) \n */
+#define QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE_OVER_NR5G_SA_V02 ((qmiLocLppConfigMaskT_v02)0x00000008) /**< Enable control plane configuration for NR5G (LPP) */
+typedef uint32_t qmiLocAssistedGlonassProtocolMaskT_v02;
+#define QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRC_CP_V02 ((qmiLocAssistedGlonassProtocolMaskT_v02)0x00000001) /**< Assisted GLONASS is supported over RRC in the control plane \n */
+#define QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRLP_UP_V02 ((qmiLocAssistedGlonassProtocolMaskT_v02)0x00000002) /**< Assisted GLONASS is supported over RRLP in the user plane \n */
+#define QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_UP_V02 ((qmiLocAssistedGlonassProtocolMaskT_v02)0x00000004) /**< Assisted GLONASS is supported over LPP in the user plane;
+ QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE must be set
+ in the LPP configuration for this to take effect \n */
+#define QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_CP_V02 ((qmiLocAssistedGlonassProtocolMaskT_v02)0x00000008) /**< Assisted GLONASS is supported over LPP in the control plane;
+ QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE must be set
+ in the LPP configuration for this to take effect */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSUPLHASHALGOENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SUPL_HASH_ALGO_SHA1_V02 = 0, /**< SHA-1 hash algorithm for SUPL version 2.0 or later \n */
+ eQMI_LOC_SUPL_HASH_ALGO_SHA256_V02 = 1, /**< SHA-256 hash algorithm for SUPL version 2.0 or later */
+ QMILOCSUPLHASHALGOENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSuplHashAlgoEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSUPLTLSVERSIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SUPL_TLS_VERSION_1_0_V02 = 0, /**< SUPL TLS version 1.0 \n */
+ eQMI_LOC_SUPL_TLS_VERSION_1_1_V02 = 1, /**< SUPL TLS version 1.1 \n */
+ eQMI_LOC_SUPL_TLS_VERSION_1_2_V02 = 2, /**< SUPL TLS version 1.2 */
+ QMILOCSUPLTLSVERSIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSuplTlsVersionEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCEMERGENCYPROTOCOLENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_EMERGENCY_PROTOCOL_WCDMA_CP_V02 = 0, /**< Use Control Plane Protocol during an emergency while on WCDMA \n */
+ eQMI_LOC_EMERGENCY_PROTOCOL_WCDMA_UP_V02 = 1, /**< Use SUPL 2.0 emergency services during an emergency while on WCDMA */
+ QMILOCEMERGENCYPROTOCOLENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocEmergencyProtocolEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocLppeUpAuxTechMaskT_v02;
+#define QMI_LOC_LPPE_MASK_UP_DBH_V02 ((qmiLocLppeUpAuxTechMaskT_v02)0x00000001ull) /**< Enable Device-Based Hybrid (3D High Accuracy Position) mode on the LPPe user plane. \n */
+#define QMI_LOC_LPPE_MASK_UP_AP_WIFI_MEASUREMENT_V02 ((qmiLocLppeUpAuxTechMaskT_v02)0x00000002ull) /**< Enable WLAN AP Measurement mode on the LPPe user plane.\n */
+#define QMI_LOC_LPPE_MASK_UP_AP_SRN_BTLE_MEASUREMENT_V02 ((qmiLocLppeUpAuxTechMaskT_v02)0x00000004ull) /**< Enable SRN BTLE Measurement mode on the LPPe user plane.\n */
+#define QMI_LOC_LPPE_MASK_UP_UBP_V02 ((qmiLocLppeUpAuxTechMaskT_v02)0x00000008ull) /**< Enable the Uncompromised Barometer Pressure Measurement mode on the LPPe user plane. */
+typedef uint64_t qmiLocLppeCpAuxTechMaskT_v02;
+#define QMI_LOC_LPPE_MASK_CP_DBH_V02 ((qmiLocLppeCpAuxTechMaskT_v02)0x00000001ull) /**< Enable Device-Based Hybrid (3D High Accuracy Position) mode on the LPPe control plane.\n */
+#define QMI_LOC_LPPE_MASK_CP_AP_WIFI_MEASUREMENT_V02 ((qmiLocLppeCpAuxTechMaskT_v02)0x00000002ull) /**< Enable WLAN AP Measurement mode on the LPPe control plane. \n */
+#define QMI_LOC_LPPE_MASK_CP_AP_SRN_BTLE_MEASUREMENT_V02 ((qmiLocLppeCpAuxTechMaskT_v02)0x00000004ull) /**< Enable SRN BTLE Measurement mode on the LPPe user plane. \n */
+#define QMI_LOC_LPPE_MASK_CP_UBP_V02 ((qmiLocLppeCpAuxTechMaskT_v02)0x00000008ull) /**< Enable the Uncompromised Barometer Pressure Measurement mode on the LPPe user plane. */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to configure parameters stored
+ in the nonvolatile memory. */
+typedef struct {
+
+ /* Optional */
+ /* SUPL Security */
+ uint8_t suplSecurity_valid; /**< Must be set to true if suplSecurity is being passed */
+ uint8_t suplSecurity;
+ /**< Indicates whether SUPL security is enabled. \n
+ - 0x01 (TRUE) -- SUPL security is enabled \n
+ - 0x00 (FALSE) -- SUPL security is disabled
+ */
+
+ /* Optional */
+ /* VX Version */
+ uint8_t vxVersion_valid; /**< Must be set to true if vxVersion is being passed */
+ qmiLocVxVersionEnumT_v02 vxVersion;
+ /**< VX version.
+ Values: \n
+ - eQMI_LOC_VX_VERSION_V1_ONLY (1) -- V1 VX version \n
+ - eQMI_LOC_VX_VERSION_V2_ONLY (2) -- V2 VX version
+ */
+
+ /* Optional */
+ /* SUPL Version */
+ uint8_t suplVersion_valid; /**< Must be set to true if suplVersion is being passed */
+ qmiLocSuplVersionEnumT_v02 suplVersion;
+ /**< SUPL version.
+ Values: \n
+ - eQMI_LOC_SUPL_VERSION_1_0 (1) -- SUPL version 1.0 \n
+ - eQMI_LOC_SUPL_VERSION_2_0 (2) -- SUPL version 2.0 \n
+ - eQMI_LOC_SUPL_VERSION_2_0_2 (3) -- SUPL version 2.0.2 \n
+ - eQMI_LOC_SUPL_VERSION_2_0_4 (4) -- SUPL version 2.0.4
+ */
+
+ /* Optional */
+ /* LPP Configuration */
+ uint8_t lppConfig_valid; /**< Must be set to true if lppConfig is being passed */
+ qmiLocLppConfigMaskT_v02 lppConfig;
+ /**< LTE Positioning Protocol (LPP) configuration; allows use of LPP
+ as an assisted GNSS positioning (AGNSS) protocol over different communication layers
+ such as LTE and NR user plane and control plane.
+
+ If LPP is enabled on a LTE or NR, LPP is the preferred AGNSS protcol over
+ other AGNSS protocols such as RRLP on the respective communication layer.
+
+ To use other AGNSS protocols such as RRLP over LTE and NR, this configuration must be
+ turned off. In addition, the appropriate NV items to enable RRLP must be set.
+
+ Refer to \hyperref[80ND1841]{80-ND184-1}, \hyperref[80YA5181]{80-YA518-1} and \hyperref[80VU9051]{80-VU905-1} for more details.
+ Valid bitmasks: \n
+ - QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE (0x00000001) -- Enable user plane configuration for LTE Positioning Profile (LPP) \n
+ - QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE (0x00000002) -- Enable control plane configuration for LPP \n
+ - QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE_OVER_NR5G_SA (0x00000004) -- Enable user plane configuration for NR5G (LPP) \n
+ - QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE_OVER_NR5G_SA (0x00000008) -- Enable control plane configuration for NR5G (LPP)
+ */
+
+ /* Optional */
+ /* Assisted GLONASS Protocol Mask */
+ uint8_t assistedGlonassProtocolMask_valid; /**< Must be set to true if assistedGlonassProtocolMask is being passed */
+ qmiLocAssistedGlonassProtocolMaskT_v02 assistedGlonassProtocolMask;
+ /**< Configures the protocols that the location service supports
+ for assisted GLONASS.
+ Valid bitmasks: \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRC_CP (0x00000001) -- Assisted GLONASS is supported over RRC in the control plane \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRLP_UP (0x00000002) -- Assisted GLONASS is supported over RRLP in the user plane \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_UP (0x00000004) -- Assisted GLONASS is supported over LPP in the user plane;
+ QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE must be set
+ in the LPP configuration for this to take effect \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_CP (0x00000008) -- Assisted GLONASS is supported over LPP in the control plane;
+ QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE must be set
+ in the LPP configuration for this to take effect
+ */
+
+ /* Optional */
+ /* SUPL Hash Algorithm */
+ uint8_t suplHashAlgo_valid; /**< Must be set to true if suplHashAlgo is being passed */
+ qmiLocSuplHashAlgoEnumT_v02 suplHashAlgo;
+ /**< SUPL hash algorithm to use.
+ Values: \n
+ - eQMI_LOC_SUPL_HASH_ALGO_SHA1 (0) -- SHA-1 hash algorithm for SUPL version 2.0 or later \n
+ - eQMI_LOC_SUPL_HASH_ALGO_SHA256 (1) -- SHA-256 hash algorithm for SUPL version 2.0 or later
+ */
+
+ /* Optional */
+ /* SUPL TLS Version */
+ uint8_t suplTlsVersion_valid; /**< Must be set to true if suplTlsVersion is being passed */
+ qmiLocSuplTlsVersionEnumT_v02 suplTlsVersion;
+ /**< SUPL Transport Layer Security (TLS) version. This configuration is only
+ applicable to SUPL 2.0 or later, as SUPL 1.0 always uses TLS version 1.0.
+ Values: \n
+ - eQMI_LOC_SUPL_TLS_VERSION_1_0 (0) -- SUPL TLS version 1.0 \n
+ - eQMI_LOC_SUPL_TLS_VERSION_1_1 (1) -- SUPL TLS version 1.1 \n
+ - eQMI_LOC_SUPL_TLS_VERSION_1_2 (2) -- SUPL TLS version 1.2
+ */
+
+ /* Optional */
+ /* Emergency Protocol */
+ uint8_t emergencyProtocol_valid; /**< Must be set to true if emergencyProtocol is being passed */
+ qmiLocEmergencyProtocolEnumT_v02 emergencyProtocol;
+ /**< Configures the protocol use during an emergency. \n
+ Note: This can only be selected on WCDMA. For GSM
+ and 1X, the UE only allows a control plane NI trigger for positioning.
+ For LTE, the UE allows either a SUPL or a control plane NI trigger.
+ Values: \n
+ - eQMI_LOC_EMERGENCY_PROTOCOL_WCDMA_CP (0) -- Use Control Plane Protocol during an emergency while on WCDMA \n
+ - eQMI_LOC_EMERGENCY_PROTOCOL_WCDMA_UP (1) -- Use SUPL 2.0 emergency services during an emergency while on WCDMA
+ */
+
+ /* Optional */
+ /* Wi-Fi Scan Injection Timeout Period */
+ uint8_t wifiScanInjectTimeout_valid; /**< Must be set to true if wifiScanInjectTimeout is being passed */
+ uint8_t wifiScanInjectTimeout;
+ /**< Configures the timeout duration that the service waits for scan results
+ injection from the control point after the event notification is sent. \n
+ Values: 0 to 10 seconds
+
+ The minimum value (0 seconds) is the default. At this value, the service
+ disables sending the Wi-Fi scan injection notification and ignores any
+ scan results injection request.
+ */
+
+ /* Optional */
+ /* LPPe User Plane Configure */
+ uint8_t lppeUpConfig_valid; /**< Must be set to true if lppeUpConfig is being passed */
+ qmiLocLppeUpAuxTechMaskT_v02 lppeUpConfig;
+ /**< LPPe user plane auxiliary technology mask.
+ Valid bitmasks: \n
+ - QMI_LOC_LPPE_MASK_UP_DBH (0x00000001) -- Enable Device-Based Hybrid (3D High Accuracy Position) mode on the LPPe user plane. \n
+ - QMI_LOC_LPPE_MASK_UP_AP_WIFI_MEASUREMENT (0x00000002) -- Enable WLAN AP Measurement mode on the LPPe user plane.\n
+ - QMI_LOC_LPPE_MASK_UP_AP_SRN_BTLE_MEASUREMENT (0x00000004) -- Enable SRN BTLE Measurement mode on the LPPe user plane.\n
+ - QMI_LOC_LPPE_MASK_UP_UBP (0x00000008) -- Enable the Uncompromised Barometer Pressure Measurement mode on the LPPe user plane.
+ */
+
+ /* Optional */
+ /* LPPe Control Plane Configure */
+ uint8_t lppeCpConfig_valid; /**< Must be set to true if lppeCpConfig is being passed */
+ qmiLocLppeCpAuxTechMaskT_v02 lppeCpConfig;
+ /**< LPPe control plane auxiliary technology mask.
+ Valid bitmasks: \n
+ - QMI_LOC_LPPE_MASK_CP_DBH (0x00000001) -- Enable Device-Based Hybrid (3D High Accuracy Position) mode on the LPPe control plane.\n
+ - QMI_LOC_LPPE_MASK_CP_AP_WIFI_MEASUREMENT (0x00000002) -- Enable WLAN AP Measurement mode on the LPPe control plane. \n
+ - QMI_LOC_LPPE_MASK_CP_AP_SRN_BTLE_MEASUREMENT (0x00000004) -- Enable SRN BTLE Measurement mode on the LPPe user plane. \n
+ - QMI_LOC_LPPE_MASK_CP_UBP (0x00000008) -- Enable the Uncompromised Barometer Pressure Measurement mode on the LPPe user plane.
+ */
+
+ /* Optional */
+ /* Emergency Callback Window */
+ uint8_t emergencyCallbackWindow_valid; /**< Must be set to true if emergencyCallbackWindow is being passed */
+ uint32_t emergencyCallbackWindow;
+ /**< The emergency callback window extends the period of time
+ during which eQMI_LOC_LOCK_MT is ignored.\n
+ - Units -- Seconds \n
+ - Default -- 0 seconds
+ */
+}qmiLocSetProtocolConfigParametersReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocProtocolConfigParamMaskT_v02;
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_SECURITY_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000001ull) /**< Mask for the SUPL security configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_VX_VERSION_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000002ull) /**< Mask for the VX version configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_VERSION_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000004ull) /**< Mask for the SUPL version configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPP_CONFIG_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000008ull) /**< Mask for the LPP configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_ASSISTED_GLONASS_PROTOCOL_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000010ull) /**< Mask for the assisted GLONASS configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_HASH_ALGO_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000020ull) /**< Mask for the SUPL hash algorithm configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_TLS_VERSION_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000040ull) /**< Mask for the SUPL TLS version configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_EMERGENCY_PROTOCOL_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000080ull) /**< Mask for the emergency protocol configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_WIFI_SCAN_INJECT_TIMEOUT_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000100ull) /**< Mask for the Wi-Fi scan injection timeout configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPPE_UP_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000200ull) /**< Mask for the LPPe user plane configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPPE_CP_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000400ull) /**< Mask for the LPPe control plane configuration parameter \n */
+#define QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_EMERGENCY_CB_WINDOW_V02 ((qmiLocProtocolConfigParamMaskT_v02)0x0000000000000800ull) /**< Mask for the emergency callback window configuration parameter */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to configure parameters stored
+ in the nonvolatile memory. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Config Params Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Configuration Parameters request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Failed Parameters */
+ uint8_t failedProtocolConfigParamMask_valid; /**< Must be set to true if failedProtocolConfigParamMask is being passed */
+ qmiLocProtocolConfigParamMaskT_v02 failedProtocolConfigParamMask;
+ /**< Identifies parameters that were not set successfully. This field
+ is sent only if the status is not SUCCESS.
+ Valid bitmasks: \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_SECURITY (0x0000000000000001) -- Mask for the SUPL security configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_VX_VERSION (0x0000000000000002) -- Mask for the VX version configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_VERSION (0x0000000000000004) -- Mask for the SUPL version configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPP_CONFIG (0x0000000000000008) -- Mask for the LPP configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_ASSISTED_GLONASS_PROTOCOL (0x0000000000000010) -- Mask for the assisted GLONASS configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_HASH_ALGO (0x0000000000000020) -- Mask for the SUPL hash algorithm configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_TLS_VERSION (0x0000000000000040) -- Mask for the SUPL TLS version configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_EMERGENCY_PROTOCOL (0x0000000000000080) -- Mask for the emergency protocol configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_WIFI_SCAN_INJECT_TIMEOUT (0x0000000000000100) -- Mask for the Wi-Fi scan injection timeout configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPPE_UP (0x0000000000000200) -- Mask for the LPPe user plane configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPPE_CP (0x0000000000000400) -- Mask for the LPPe control plane configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_EMERGENCY_CB_WINDOW (0x0000000000000800) -- Mask for the emergency callback window configuration parameter
+ */
+}qmiLocSetProtocolConfigParametersIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the configuration
+ parameters stored in the nonvolatile memory. */
+typedef struct {
+
+ /* Mandatory */
+ /* Config Parameters */
+ qmiLocProtocolConfigParamMaskT_v02 getProtocolConfigParamMask;
+ /**< Mask denoting the configuration parameters to retrieve.
+ Valid bitmasks: \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_SECURITY (0x0000000000000001) -- Mask for the SUPL security configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_VX_VERSION (0x0000000000000002) -- Mask for the VX version configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_VERSION (0x0000000000000004) -- Mask for the SUPL version configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPP_CONFIG (0x0000000000000008) -- Mask for the LPP configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_ASSISTED_GLONASS_PROTOCOL (0x0000000000000010) -- Mask for the assisted GLONASS configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_HASH_ALGO (0x0000000000000020) -- Mask for the SUPL hash algorithm configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_SUPL_TLS_VERSION (0x0000000000000040) -- Mask for the SUPL TLS version configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_EMERGENCY_PROTOCOL (0x0000000000000080) -- Mask for the emergency protocol configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_WIFI_SCAN_INJECT_TIMEOUT (0x0000000000000100) -- Mask for the Wi-Fi scan injection timeout configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPPE_UP (0x0000000000000200) -- Mask for the LPPe user plane configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_LPPE_CP (0x0000000000000400) -- Mask for the LPPe control plane configuration parameter \n
+ - QMI_LOC_PROTOCOL_CONFIG_PARAM_MASK_EMERGENCY_CB_WINDOW (0x0000000000000800) -- Mask for the emergency callback window configuration parameter
+ */
+}qmiLocGetProtocolConfigParametersReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the configuration
+ parameters stored in the nonvolatile memory. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Config Params Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Configuration Parameters request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* SUPL Security */
+ uint8_t suplSecurity_valid; /**< Must be set to true if suplSecurity is being passed */
+ uint8_t suplSecurity;
+ /**< Indicates whether SUPL security is enabled.\n
+ - 0x01 (TRUE) -- Enabled
+ */
+
+ /* Optional */
+ /* VX Version */
+ uint8_t vxVersion_valid; /**< Must be set to true if vxVersion is being passed */
+ qmiLocVxVersionEnumT_v02 vxVersion;
+ /**< VX version.
+ Values: \n
+ - eQMI_LOC_VX_VERSION_V1_ONLY (1) -- V1 VX version \n
+ - eQMI_LOC_VX_VERSION_V2_ONLY (2) -- V2 VX version
+ */
+
+ /* Optional */
+ /* SUPL Version */
+ uint8_t suplVersion_valid; /**< Must be set to true if suplVersion is being passed */
+ qmiLocSuplVersionEnumT_v02 suplVersion;
+ /**< SUPL version.
+ Values: \n
+ - eQMI_LOC_SUPL_VERSION_1_0 (1) -- SUPL version 1.0 \n
+ - eQMI_LOC_SUPL_VERSION_2_0 (2) -- SUPL version 2.0 \n
+ - eQMI_LOC_SUPL_VERSION_2_0_2 (3) -- SUPL version 2.0.2 \n
+ - eQMI_LOC_SUPL_VERSION_2_0_4 (4) -- SUPL version 2.0.4
+ */
+
+ /* Optional */
+ /* LPP Configuration */
+ uint8_t lppConfig_valid; /**< Must be set to true if lppConfig is being passed */
+ qmiLocLppConfigMaskT_v02 lppConfig;
+ /**< LTE Positioning Profile (LPP) configuration. \n
+ - 0x00000001 -- LPP_CONFIG_ ENABLE_USER_PLANE \n
+ - 0x00000002 -- LPP_CONFIG_ ENABLE_CONTROL_PLANE
+ */
+
+ /* Optional */
+ /* Assisted GLONASS Protocol Mask */
+ uint8_t assistedGlonassProtocolMask_valid; /**< Must be set to true if assistedGlonassProtocolMask is being passed */
+ qmiLocAssistedGlonassProtocolMaskT_v02 assistedGlonassProtocolMask;
+ /**< Assisted GLONASS protocol mask.
+ Valid bitmasks: \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRC_CP (0x00000001) -- Assisted GLONASS is supported over RRC in the control plane \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_RRLP_UP (0x00000002) -- Assisted GLONASS is supported over RRLP in the user plane \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_UP (0x00000004) -- Assisted GLONASS is supported over LPP in the user plane;
+ QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE must be set
+ in the LPP configuration for this to take effect \n
+ - QMI_LOC_ASSISTED_GLONASS_PROTOCOL_MASK_LPP_CP (0x00000008) -- Assisted GLONASS is supported over LPP in the control plane;
+ QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE must be set
+ in the LPP configuration for this to take effect
+ */
+
+ /* Optional */
+ /* SUPL Hash Algorithm */
+ uint8_t suplHashAlgo_valid; /**< Must be set to true if suplHashAlgo is being passed */
+ qmiLocSuplHashAlgoEnumT_v02 suplHashAlgo;
+ /**< SUPL hash algorithm to use.
+ Values: \n
+ - eQMI_LOC_SUPL_HASH_ALGO_SHA1 (0) -- SHA-1 hash algorithm for SUPL version 2.0 or later \n
+ - eQMI_LOC_SUPL_HASH_ALGO_SHA256 (1) -- SHA-256 hash algorithm for SUPL version 2.0 or later
+ */
+
+ /* Optional */
+ /* SUPL TLS Version */
+ uint8_t suplTlsVersion_valid; /**< Must be set to true if suplTlsVersion is being passed */
+ qmiLocSuplTlsVersionEnumT_v02 suplTlsVersion;
+ /**< SUPL TLS version. This configuration is only
+ applicable to SUPL 2.0 or later, as SUPL 1.0 always uses TLS version 1.0.
+ Values: \n
+ - eQMI_LOC_SUPL_TLS_VERSION_1_0 (0) -- SUPL TLS version 1.0 \n
+ - eQMI_LOC_SUPL_TLS_VERSION_1_1 (1) -- SUPL TLS version 1.1 \n
+ - eQMI_LOC_SUPL_TLS_VERSION_1_2 (2) -- SUPL TLS version 1.2
+ */
+
+ /* Optional */
+ /* Emergency Protocol */
+ uint8_t emergencyProtocol_valid; /**< Must be set to true if emergencyProtocol is being passed */
+ qmiLocEmergencyProtocolEnumT_v02 emergencyProtocol;
+ /**< Protocol to use during emergency.
+ Values: \n
+ - eQMI_LOC_EMERGENCY_PROTOCOL_WCDMA_CP (0) -- Use Control Plane Protocol during an emergency while on WCDMA \n
+ - eQMI_LOC_EMERGENCY_PROTOCOL_WCDMA_UP (1) -- Use SUPL 2.0 emergency services during an emergency while on WCDMA
+ */
+
+ /* Optional */
+ /* Wi-Fi Scan Injection Timeout Period */
+ uint8_t wifiScanInjectTimeout_valid; /**< Must be set to true if wifiScanInjectTimeout is being passed */
+ uint8_t wifiScanInjectTimeout;
+ /**< Timeout duration that the service waits for a scan results
+ injection from the control point after the event notification is sent. \n
+ Values: \n
+ 0 to 10 seconds
+ */
+
+ /* Optional */
+ /* LPPe User Plane Configure */
+ uint8_t lppeUpConfig_valid; /**< Must be set to true if lppeUpConfig is being passed */
+ qmiLocLppeUpAuxTechMaskT_v02 lppeUpConfig;
+ /**< LPPe user plane auxiliary technology mask.
+ Valid bitmasks: \n
+ - QMI_LOC_LPPE_MASK_UP_DBH (0x00000001) -- Enable Device-Based Hybrid (3D High Accuracy Position) mode on the LPPe user plane. \n
+ - QMI_LOC_LPPE_MASK_UP_AP_WIFI_MEASUREMENT (0x00000002) -- Enable WLAN AP Measurement mode on the LPPe user plane.\n
+ - QMI_LOC_LPPE_MASK_UP_AP_SRN_BTLE_MEASUREMENT (0x00000004) -- Enable SRN BTLE Measurement mode on the LPPe user plane.\n
+ - QMI_LOC_LPPE_MASK_UP_UBP (0x00000008) -- Enable the Uncompromised Barometer Pressure Measurement mode on the LPPe user plane.
+ */
+
+ /* Optional */
+ /* LPPe Control Plane Configure */
+ uint8_t lppeCpConfig_valid; /**< Must be set to true if lppeCpConfig is being passed */
+ qmiLocLppeCpAuxTechMaskT_v02 lppeCpConfig;
+ /**< LPPe control plane auxiliary technology mask.
+ Valid bitmasks: \n
+ - QMI_LOC_LPPE_MASK_CP_DBH (0x00000001) -- Enable Device-Based Hybrid (3D High Accuracy Position) mode on the LPPe control plane.\n
+ - QMI_LOC_LPPE_MASK_CP_AP_WIFI_MEASUREMENT (0x00000002) -- Enable WLAN AP Measurement mode on the LPPe control plane. \n
+ - QMI_LOC_LPPE_MASK_CP_AP_SRN_BTLE_MEASUREMENT (0x00000004) -- Enable SRN BTLE Measurement mode on the LPPe user plane. \n
+ - QMI_LOC_LPPE_MASK_CP_UBP (0x00000008) -- Enable the Uncompromised Barometer Pressure Measurement mode on the LPPe user plane.
+ */
+
+ /* Optional */
+ /* Emergency Callback Window */
+ uint8_t emergencyCallbackWindow_valid; /**< Must be set to true if emergencyCallbackWindow is being passed */
+ uint32_t emergencyCallbackWindow;
+ /**< The emergency callback window extends the period of time
+ during which MT LOCK is ignored.
+ - Units -- Seconds
+ - Default -- 0 seconds
+ */
+}qmiLocGetProtocolConfigParametersIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSENSORSCONTROLCONFIGSENSORUSEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SENSOR_CONFIG_SENSOR_USE_ENABLE_V02 = 0, /**< Request sensors data whenever a position request is
+ received. If sensor data are injected, the positioning engine
+ attempts to improve the heading and positioning performance using sensors.
+ This is the default.\n
+ */
+ eQMI_LOC_SENSOR_CONFIG_SENSOR_USE_DISABLE_V02 = 1, /**< Do not use inertial sensors to aid heading and position
+ improvement. */
+ QMILOCSENSORSCONTROLCONFIGSENSORUSEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSensorsControlConfigSensorUseEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSENSORSCONTROLCONFIGSENSORPROVIDERENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SENSOR_CONFIG_USE_PROVIDER_SSC_V02 = 0, /**< Sensors data provider is Snapdragon Sensor Core (SSC) (default) \n
+ */
+ eQMI_LOC_SENSOR_CONFIG_USE_PROVIDER_NATIVE_V02 = 1, /**< Sensors data provider is on the host processor */
+ QMILOCSENSORSCONTROLCONFIGSENSORPROVIDERENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSensorsControlConfigSensorProviderEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sets the sensor control configuration. */
+typedef struct {
+
+ /* Optional */
+ /* Sensors Usage */
+ uint8_t sensorsUsage_valid; /**< Must be set to true if sensorsUsage is being passed */
+ qmiLocSensorsControlConfigSensorUseEnumT_v02 sensorsUsage;
+ /**< Controls how sensors are used to aid heading and positioning
+ performance.
+ Values: \n
+ - eQMI_LOC_SENSOR_CONFIG_SENSOR_USE_ENABLE (0) -- Request sensors data whenever a position request is
+ received. If sensor data are injected, the positioning engine
+ attempts to improve the heading and positioning performance using sensors.
+ This is the default.\n
+
+ - eQMI_LOC_SENSOR_CONFIG_SENSOR_USE_DISABLE (1) -- Do not use inertial sensors to aid heading and position
+ improvement.
+ */
+
+ /* Optional */
+ /* Sensors Provider */
+ uint8_t sensorProvider_valid; /**< Must be set to true if sensorProvider is being passed */
+ qmiLocSensorsControlConfigSensorProviderEnumT_v02 sensorProvider;
+ /**< Controls which sensors data provider to use.
+ Values: \n
+ - eQMI_LOC_SENSOR_CONFIG_USE_PROVIDER_SSC (0) -- Sensors data provider is Snapdragon Sensor Core (SSC) (default) \n
+
+ - eQMI_LOC_SENSOR_CONFIG_USE_PROVIDER_NATIVE (1) -- Sensors data provider is on the host processor
+ */
+}qmiLocSetSensorControlConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sets the sensor control configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Sensor Control Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Sensor Control Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetSensorControlConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Retrieves the current sensor control configuration. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetSensorControlConfigReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Retrieves the current sensor control configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Sensor Control Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Sensors Control Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Sensors Usage */
+ uint8_t sensorsUsage_valid; /**< Must be set to true if sensorsUsage is being passed */
+ qmiLocSensorsControlConfigSensorUseEnumT_v02 sensorsUsage;
+ /**< Controls how sensors are used to aid the heading and positioning
+ performance.
+ Values: \n
+ - eQMI_LOC_SENSOR_CONFIG_SENSOR_USE_ENABLE (0) -- Request sensors data whenever a position request is
+ received. If sensor data are injected, the positioning engine
+ attempts to improve the heading and positioning performance using sensors.
+ This is the default.\n
+
+ - eQMI_LOC_SENSOR_CONFIG_SENSOR_USE_DISABLE (1) -- Do not use inertial sensors to aid heading and position
+ improvement.
+ */
+
+ /* Optional */
+ /* Sensors Provider */
+ uint8_t sensorProvider_valid; /**< Must be set to true if sensorProvider is being passed */
+ qmiLocSensorsControlConfigSensorProviderEnumT_v02 sensorProvider;
+ /**< Controls which sensors data provider to use.
+ Values: \n
+ - eQMI_LOC_SENSOR_CONFIG_USE_PROVIDER_SSC (0) -- Sensors data provider is Snapdragon Sensor Core (SSC) (default) \n
+
+ - eQMI_LOC_SENSOR_CONFIG_USE_PROVIDER_NATIVE (1) -- Sensors data provider is on the host processor
+ */
+}qmiLocGetSensorControlConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocSensorPropertiesMaskT_v02;
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_GYRO_BIAS_VARIANCE_RANDOM_WALK_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000001) /**< Gyro bias variance random walk parameter \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000002) /**< Velocity random walk spectral density parameter \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_ACCELERATION_RANDOM_WALK_SPECTRAL_DENSITY_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000004) /**< Acceleration random walk spectral density parameter \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000008) /**< Angle random walk spectral density parameter \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_RATE_RANDOM_WALK_SPECTRAL_DENSITY_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000010) /**< Random walk spectral density parameter \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_DATA_USE_CONTROL_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000020) /**< Vehicle data use control parameter \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_VELOCITY_RWSD_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000040) /**< Vehicle velocity random walk spectral density \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ACCEL_RWSD_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000080) /**< Vehicle accelerometer random walk spectral density \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ANGLE_RWSD_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000100) /**< Vehicle angle random walk spectral density \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ANGULAR_RATE_RWSD_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000200) /**< Vehicle angular rate random walk spectral density \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ODOMETRY_SCALE_RWSD_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000400) /**< Vehicle odometry scale random walk spectral density \n */
+#define QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ODOMETRY_VARIANCE_V02 ((qmiLocSensorPropertiesMaskT_v02)0x00000800) /**< Vehicle odometry variance */
+typedef uint64_t qmiLocVehicleDataUseControlMaskT_v02;
+#define QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_X_AXIS_V02 ((qmiLocVehicleDataUseControlMaskT_v02)0x0000000000000001ull) /**< X-axis vehicle acceleration sensor data \n */
+#define QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_Y_AXIS_V02 ((qmiLocVehicleDataUseControlMaskT_v02)0x0000000000000002ull) /**< Y-axis vehicle acceleration sensor data \n */
+#define QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_Z_AXIS_V02 ((qmiLocVehicleDataUseControlMaskT_v02)0x0000000000000004ull) /**< Z-axis vehicle acceleration sensor data \n */
+#define QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_X_AXIS_V02 ((qmiLocVehicleDataUseControlMaskT_v02)0x0000000000000010ull) /**< X-axis vehicle gyroscope data \n */
+#define QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_Y_AXIS_V02 ((qmiLocVehicleDataUseControlMaskT_v02)0x0000000000000020ull) /**< Y-axis vehicle gyroscope data \n */
+#define QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_Z_AXIS_V02 ((qmiLocVehicleDataUseControlMaskT_v02)0x0000000000000040ull) /**< Z-axis vehicle gyroscope data \n */
+#define QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ODOMETRY_V02 ((qmiLocVehicleDataUseControlMaskT_v02)0x0000000000000100ull) /**< Odometry data */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sets the properties specific to the type of sensor used.
+ The control point must set sensor properties before using them
+ to aid in heading and positioning performance improvement.
+ */
+typedef struct {
+
+ /* Optional */
+ /* Gyro Bias Random Walk Variance */
+ uint8_t gyroBiasVarianceRandomWalk_valid; /**< Must be set to true if gyroBiasVarianceRandomWalk is being passed */
+ float gyroBiasVarianceRandomWalk;
+ /**< Specifies the gyro bias random walk variance parameter as a positive
+ floating-point value. This value has internal default value 1.0e-5 radian^2/second^4.
+ The gyro bias variance random walk parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Radians^2 per seconds^4
+ */
+
+ /* Optional */
+ /* Velocity Random Walk Spectral Density */
+ uint8_t velocityRandomWalkSpectralDensity_valid; /**< Must be set to true if velocityRandomWalkSpectralDensity is being passed */
+ float velocityRandomWalkSpectralDensity;
+ /**< Specifies the velocity random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The velocity random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Meters per seconds^2 per Hz^0.5
+ */
+
+ /* Optional */
+ /* Acceleration Random Walk Spectral Density */
+ uint8_t accelerationRandomWalkSpectralDensity_valid; /**< Must be set to true if accelerationRandomWalkSpectralDensity is being passed */
+ float accelerationRandomWalkSpectralDensity;
+ /**< Specifies the acceleration random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The acceleration random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Meters per seconds^3/Hz^0.5
+ */
+
+ /* Optional */
+ /* Angle Random Walk Spectral Density */
+ uint8_t angleRandomWalkSpectralDensity_valid; /**< Must be set to true if angleRandomWalkSpectralDensity is being passed */
+ float angleRandomWalkSpectralDensity;
+ /**< Specifies the angle random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The angle random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Radians per seconds/Hz^0.5
+ */
+
+ /* Optional */
+ /* Rate Random Walk Spectral Density */
+ uint8_t rateRandomWalkSpectralDensity_valid; /**< Must be set to true if rateRandomWalkSpectralDensity is being passed */
+ float rateRandomWalkSpectralDensity;
+ /**< Specifies the rate random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The rate random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Radians per seconds^2/Hz^0.5
+ */
+
+ /* Optional */
+ /* Vehicle Data Use Control */
+ uint8_t vehicleDataUse_valid; /**< Must be set to true if vehicleDataUse is being passed */
+ qmiLocVehicleDataUseControlMaskT_v02 vehicleDataUse;
+ /**< Identifies which portions of the vehicle data to use in location
+ estimation (information provided by the
+ QMI_LOC_INJECT_VEHICLE_SENSOR_DATA message). Valid bitmasks: \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_X_AXIS (0x0000000000000001) -- X-axis vehicle acceleration sensor data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_Y_AXIS (0x0000000000000002) -- Y-axis vehicle acceleration sensor data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_Z_AXIS (0x0000000000000004) -- Z-axis vehicle acceleration sensor data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_X_AXIS (0x0000000000000010) -- X-axis vehicle gyroscope data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_Y_AXIS (0x0000000000000020) -- Y-axis vehicle gyroscope data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_Z_AXIS (0x0000000000000040) -- Z-axis vehicle gyroscope data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ODOMETRY (0x0000000000000100) -- Odometry data
+ @note All other bits are reserved for future use and must be set to 0. */
+
+ /* Optional */
+ /* Vehicle Velocity Random Walk Spectral Density */
+ uint8_t vehicleVelocityRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleVelocityRandomWalkSpectralDensity is being passed */
+ float vehicleVelocityRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- Meters per second^2/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Acceleration Random Walk Spectral Density */
+ uint8_t vehicleAccelRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleAccelRandomWalkSpectralDensity is being passed */
+ float vehicleAccelRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- Meters per second^3/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Angle Random Walk Spectral Density */
+ uint8_t vehicleAngleRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleAngleRandomWalkSpectralDensity is being passed */
+ float vehicleAngleRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- Radians per second/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Angular Rate Random Walk Spectral Density */
+ uint8_t vehicleAngularRateRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleAngularRateRandomWalkSpectralDensity is being passed */
+ float vehicleAngularRateRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- Radians per second^2/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Odometry Scale Factor Random Walk Spectral Density */
+ uint8_t vehicleOdometryScaleFactorRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleOdometryScaleFactorRandomWalkSpectralDensity is being passed */
+ float vehicleOdometryScaleFactorRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- (1/second)/Hz^0.5 \n
+ - Range -- Approximately 0.0001 to 0.001 \n
+ - Default -- 0.001 (actual calibration recommended)
+ */
+
+ /* Optional */
+ /* Vehicle Odometry Variance */
+ uint8_t vehicleOdometryVariance_valid; /**< Must be set to true if vehicleOdometryVariance is being passed */
+ float vehicleOdometryVariance;
+ /**< Vehicle odometry variance of each odometry sample
+ (coarseness of measurement). \n
+ - Type -- 32-bit float \n
+ - Units -- Meters^2 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+}qmiLocSetSensorPropertiesReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sets the properties specific to the type of sensor used.
+ The control point must set sensor properties before using them
+ to aid in heading and positioning performance improvement.
+ */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Sensor Properties Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Sensor Properties request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+
+ /* Optional */
+ /* Failed Set Sensor Properties */
+ uint8_t failedSensorPropertiesMask_valid; /**< Must be set to true if failedSensorPropertiesMask is being passed */
+ qmiLocSensorPropertiesMaskT_v02 failedSensorPropertiesMask;
+ /**< This field is sent only if the status is not SUCCESS.
+ Identifies the parameters not set successfully.
+ Valid bitmasks:\n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_GYRO_BIAS_VARIANCE_RANDOM_WALK (0x00000001) -- Gyro bias variance random walk parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY (0x00000002) -- Velocity random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_ACCELERATION_RANDOM_WALK_SPECTRAL_DENSITY (0x00000004) -- Acceleration random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_ANGLE_RANDOM_WALK_SPECTRAL_DENSITY (0x00000008) -- Angle random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_RATE_RANDOM_WALK_SPECTRAL_DENSITY (0x00000010) -- Random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_DATA_USE_CONTROL (0x00000020) -- Vehicle data use control parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_VELOCITY_RWSD (0x00000040) -- Vehicle velocity random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ACCEL_RWSD (0x00000080) -- Vehicle accelerometer random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ANGLE_RWSD (0x00000100) -- Vehicle angle random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ANGULAR_RATE_RWSD (0x00000200) -- Vehicle angular rate random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ODOMETRY_SCALE_RWSD (0x00000400) -- Vehicle odometry scale random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ODOMETRY_VARIANCE (0x00000800) -- Vehicle odometry variance
+
+ */
+}qmiLocSetSensorPropertiesIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Retrieves the current sensor properties. */
+typedef struct {
+
+ /* Mandatory */
+ /* Sensor Properties Config Parameters */
+ qmiLocSensorPropertiesMaskT_v02 getSensorPropertiesMask;
+ /**< Mask indicating the sensor properties parameters to retrieve.
+ Valid bitmasks:
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_GYRO_BIAS_VARIANCE_RANDOM_WALK (0x00000001) -- Gyro bias variance random walk parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY (0x00000002) -- Velocity random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_ACCELERATION_RANDOM_WALK_SPECTRAL_DENSITY (0x00000004) -- Acceleration random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_ANGLE_RANDOM_WALK_SPECTRAL_DENSITY (0x00000008) -- Angle random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_RATE_RANDOM_WALK_SPECTRAL_DENSITY (0x00000010) -- Random walk spectral density parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_DATA_USE_CONTROL (0x00000020) -- Vehicle data use control parameter \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_VELOCITY_RWSD (0x00000040) -- Vehicle velocity random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ACCEL_RWSD (0x00000080) -- Vehicle accelerometer random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ANGLE_RWSD (0x00000100) -- Vehicle angle random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ANGULAR_RATE_RWSD (0x00000200) -- Vehicle angular rate random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ODOMETRY_SCALE_RWSD (0x00000400) -- Vehicle odometry scale random walk spectral density \n
+ - QMI_LOC_SENSOR_PROPERTIES_MASK_VEHICLE_ODOMETRY_VARIANCE (0x00000800) -- Vehicle odometry variance
+ */
+}qmiLocGetSensorPropertiesReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Retrieves the current sensor properties. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Sensor Properties Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Sensors Properties request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Gyro Bias Random Walk Variance */
+ uint8_t gyroBiasVarianceRandomWalk_valid; /**< Must be set to true if gyroBiasVarianceRandomWalk is being passed */
+ float gyroBiasVarianceRandomWalk;
+ /**< Specifies the gyro bias random walk variance parameter as a positive
+ floating-point value. This value has internal default value 1.0e-5 radian^2/second^4.
+ The gyro bias variance random walk parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Radians^2 per seconds^4
+ */
+
+ /* Optional */
+ /* Velocity Random Walk Spectral Density */
+ uint8_t velocityRandomWalkSpectralDensity_valid; /**< Must be set to true if velocityRandomWalkSpectralDensity is being passed */
+ float velocityRandomWalkSpectralDensity;
+ /**< Specifies the velocity random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The velocity random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Meters per seconds^2/Hz^0.5
+ */
+
+ /* Optional */
+ /* Acceleration Random Walk Spectral Density */
+ uint8_t accelerationRandomWalkSpectralDensity_valid; /**< Must be set to true if accelerationRandomWalkSpectralDensity is being passed */
+ float accelerationRandomWalkSpectralDensity;
+ /**< Specifies the acceleration random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The acceleration random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Meters per seconds^3/Hz^0.5
+ */
+
+ /* Optional */
+ /* Angle Random Walk Spectral Density */
+ uint8_t angleRandomWalkSpectralDensity_valid; /**< Must be set to true if angleRandomWalkSpectralDensity is being passed */
+ float angleRandomWalkSpectralDensity;
+ /**< Specifies the angle random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The angle random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Radians per seconds/Hz^0.5
+ */
+
+ /* Optional */
+ /* Rate Random Walk Spectral Density */
+ uint8_t rateRandomWalkSpectralDensity_valid; /**< Must be set to true if rateRandomWalkSpectralDensity is being passed */
+ float rateRandomWalkSpectralDensity;
+ /**< Specifies the rate random walk spectral density parameter as a positive
+ floating-point value. This value does not have any internal defaults.
+ The rate random walk spectral density parameter is derived from either the
+ sensors data sheet or a sensors conformance test. \n
+ - Units -- Radians per seconds^2/Hz^0.5
+ */
+
+ /* Optional */
+ /* Vehicle Data Use Control */
+ uint8_t vehicleDataUse_valid; /**< Must be set to true if vehicleDataUse is being passed */
+ qmiLocVehicleDataUseControlMaskT_v02 vehicleDataUse;
+ /**< Identifies which portions of the vehicle data to use in location
+ estimation (information provided by the
+ QMI_LOC_INJECT_VEHICLE_SENSOR_DATA message). Valid bitmasks: \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_X_AXIS (0x0000000000000001) -- X-axis vehicle acceleration sensor data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_Y_AXIS (0x0000000000000002) -- Y-axis vehicle acceleration sensor data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ACCEL_Z_AXIS (0x0000000000000004) -- Z-axis vehicle acceleration sensor data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_X_AXIS (0x0000000000000010) -- X-axis vehicle gyroscope data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_Y_AXIS (0x0000000000000020) -- Y-axis vehicle gyroscope data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_GYRO_Z_AXIS (0x0000000000000040) -- Z-axis vehicle gyroscope data \n
+ - QMI_LOC_VEHICLE_DATA_ENABLE_USE_MASK_ODOMETRY (0x0000000000000100) -- Odometry data
+ @note All other bits are reserved for future use and must be set to 0. */
+
+ /* Optional */
+ /* Vehicle Velocity Random Walk Spectral Density */
+ uint8_t vehicleVelocityRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleVelocityRandomWalkSpectralDensity is being passed */
+ float vehicleVelocityRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- Meters per seconds^2/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Acceleration Random Walk Spectral Density */
+ uint8_t vehicleAccelRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleAccelRandomWalkSpectralDensity is being passed */
+ float vehicleAccelRandomWalkSpectralDensity;
+ /**< - Type-- 32-bit float \n
+ - Units -- Meters per seconds^3/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Angle Random Walk Spectral Density */
+ uint8_t vehicleAngleRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleAngleRandomWalkSpectralDensity is being passed */
+ float vehicleAngleRandomWalkSpectralDensity;
+ /**< Vehicle angle random walk spectral density. \n
+ - Type -- 32-bit float \n
+ - Units -- Radians per seconds/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Angular Rate Random Walk Spectral Density */
+ uint8_t vehicleAngularRateRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleAngularRateRandomWalkSpectralDensity is being passed */
+ float vehicleAngularRateRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- Radians per seconds^2/Hz^0.5 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+
+ /* Optional */
+ /* Vehicle Odometry Scale Factor Random Walk Spectral Density */
+ uint8_t vehicleOdometryScaleFactorRandomWalkSpectralDensity_valid; /**< Must be set to true if vehicleOdometryScaleFactorRandomWalkSpectralDensity is being passed */
+ float vehicleOdometryScaleFactorRandomWalkSpectralDensity;
+ /**< - Type -- 32-bit float \n
+ - Units -- (1/seconds)/Hz^0.5 \n
+ - Range -- Approximately 0.0001 to 0.001 \n
+ - Default -- 0.001 (actual calibration recommended)
+ */
+
+ /* Optional */
+ /* Vehicle Odometry Variance */
+ uint8_t vehicleOdometryVariance_valid; /**< Must be set to true if vehicleOdometryVariance is being passed */
+ float vehicleOdometryVariance;
+ /**< Vehicle odometry variance of each odometry sample
+ (coarseness of measurement). \n
+ - Type -- 32-bit float \n
+ - Units -- Meters^2 \n
+ - Valid values -- Positive values \n
+ - Default -- None
+ */
+}qmiLocGetSensorPropertiesIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSENSORPERFORMANCECONTROLMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SENSOR_PERFORMANCE_CONTROL_MODE_AUTO_V02 = 0, /**< Sensors usage is determined by the GNSS location engine.
+ This mode can optimize power consumption and give a
+ power-balanced positioning and heading enhancement using
+ inertial sensors \n */
+ eQMI_LOC_SENSOR_PERFORMANCE_CONTROL_MODE_FORCED_V02 = 1, /**< Sensors usage is forced ON.
+ This mode can be requested by the control point when
+ power consumption is not a restriction to the use of
+ inertial sensors. */
+ QMILOCSENSORPERFORMANCECONTROLMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSensorPerformanceControlModeEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocSensorAlgorithmMaskT_v02;
+#define QMI_LOC_SENSOR_ALGORITHM_MASK_DISABLE_INS_POSITIONING_FILTER_V02 ((qmiLocSensorAlgorithmMaskT_v02)0x00000001) /**< Do not use inertial sensors in accelerometer-integrated fashion with
+ GNSS. They can still be used for aiding in heading improvements. */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Provides fine-grained control of sensor based positioning
+ performance. */
+typedef struct {
+
+ /* Optional */
+ /* Sensor Performance Control Mode */
+ uint8_t performanceControlMode_valid; /**< Must be set to true if performanceControlMode is being passed */
+ qmiLocSensorPerformanceControlModeEnumT_v02 performanceControlMode;
+ /**< Controls when sensors data is requested during GNSS fix processing.
+ This field is relevant only when sensors have been enabled using the
+ sensors control configuration.
+ Values: \n
+ - eQMI_LOC_SENSOR_PERFORMANCE_CONTROL_MODE_AUTO (0) -- Sensors usage is determined by the GNSS location engine.
+ This mode can optimize power consumption and give a
+ power-balanced positioning and heading enhancement using
+ inertial sensors \n
+ - eQMI_LOC_SENSOR_PERFORMANCE_CONTROL_MODE_FORCED (1) -- Sensors usage is forced ON.
+ This mode can be requested by the control point when
+ power consumption is not a restriction to the use of
+ inertial sensors.
+ */
+
+ /* Optional */
+ /* Accelerometer Sampling Specification */
+ uint8_t accelSamplingSpec_valid; /**< Must be set to true if accelSamplingSpec is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 accelSamplingSpec;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location
+ engine is to request acceleration data to use by the low data rate
+ filter. The sensor data rate is specified in terms of the nominal number
+ of samples per batch and the number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 10 Hz sampling rate and 2 Hz batching rate.
+ */
+
+ /* Optional */
+ /* Gyroscope Sampling Specification */
+ uint8_t gyroSamplingSpec_valid; /**< Must be set to true if gyroSamplingSpec is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 gyroSamplingSpec;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location
+ engine is to request gyro data to use by the high data rate filter.
+ The sensor data rate is specified in terms of the nominal number of
+ samples per batch and the number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 10 Hz sampling rate and 2 Hz batching rate.
+ */
+
+ /* Optional */
+ /* Algorithm Configuration */
+ uint8_t algorithmConfig_valid; /**< Must be set to true if algorithmConfig is being passed */
+ qmiLocSensorAlgorithmMaskT_v02 algorithmConfig;
+ /**< Sets which sensor algorithms to use when processing sensor data.
+ Valid bitmasks: \n
+ - 0x00000001 -- DISABLE_INS_ POSITIONING_FILTER
+ */
+
+ /* Optional */
+ /* High Data Rate Filter Accelerometer Sampling Specification */
+ uint8_t accelSamplingSpecHigh_valid; /**< Must be set to true if accelSamplingSpecHigh is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 accelSamplingSpecHigh;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location engine is to request
+ acceleration data to use by the high data rate filter. The sensor
+ data rate is specified in terms of the nominal number of samples per
+ batch and the number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 100 Hz sampling rate and 4 Hz batching rate.
+ */
+
+ /* Optional */
+ /* High Data Rate Filter Gyroscope Sampling Specification */
+ uint8_t gyroSamplingSpecHigh_valid; /**< Must be set to true if gyroSamplingSpecHigh is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 gyroSamplingSpecHigh;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location engine is to request
+ gyro data to use by the high data rate filter. The sensor data rate
+ is specified in terms of the nominal number of samples per batch and the
+ number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 100 Hz sampling rate and 4 Hz batching rate.
+ */
+}qmiLocSetSensorPerformanceControlConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocSensorPerformanceControlConfigFailureMaskT_v02;
+#define QMI_LOC_SENSOR_PERFORMANCE_CONTROL_CONFIG_PARAM_MASK_PERFORMANCE_MODE_V02 ((qmiLocSensorPerformanceControlConfigFailureMaskT_v02)0x00000001) /**< Failed to set the performance mode */
+#define QMI_LOC_SENSOR_PERFORMANCE_CONTROL_CONFIG_PARAM_MASK_ACCEL_SAMPLING_SPEC_V02 ((qmiLocSensorPerformanceControlConfigFailureMaskT_v02)0x00000002) /**< Failed to set the accelerometer sampling specification */
+#define QMI_LOC_SENSOR_PERFORMANCE_CONTROL_CONFIG_PARAM_MASK_GYRO_SAMPLING_SPEC_V02 ((qmiLocSensorPerformanceControlConfigFailureMaskT_v02)0x00000004) /**< Failed to set the gyroscope sampling specification */
+#define QMI_LOC_SENSOR_PERFORMANCE_CONTROL_CONFIG_PARAM_MASK_ALGORITHM_CONFIG_V02 ((qmiLocSensorPerformanceControlConfigFailureMaskT_v02)0x00000008) /**< Failed to set the algorithm configuration */
+#define QMI_LOC_SENSOR_PERFORMANCE_CONTROL_CONFIG_PARAM_MASK_ACCEL_SAMPLING_SPEC_HIGH_V02 ((qmiLocSensorPerformanceControlConfigFailureMaskT_v02)0x00000010) /**< Failed to set the accelerometer sampling specification */
+#define QMI_LOC_SENSOR_PERFORMANCE_CONTROL_CONFIG_PARAM_MASK_GYRO_SAMPLING_SPEC_HIGH_V02 ((qmiLocSensorPerformanceControlConfigFailureMaskT_v02)0x00000020) /**< Failed to set the gyroscope sampling specification */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Provides fine-grained control of sensor based positioning
+ performance. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Sensor Perf Control Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Sensor Performance Control Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Failed Configuration */
+ uint8_t failedConfiguration_valid; /**< Must be set to true if failedConfiguration is being passed */
+ qmiLocSensorPerformanceControlConfigFailureMaskT_v02 failedConfiguration;
+ /**< Identifies parameters that were not configured successfully. This field
+ is sent only when the status is not a success.
+ Valid bitmasks: \n
+ - 0x00000001 -- PERFORMANCE_ MODE \n
+ - 0x00000002 -- ACCEL_SAMPLING_ SPEC \n
+ - 0x00000004 -- GYRO_SAMPLING_ SPEC \n
+ - 0x00000008 -- ALGORITHM_ CONFIG \n
+ - 0x00000010 -- ACCEL_SAMPLING_ SPEC_HIGH \n
+ - 0x00000020 -- GYRO_SAMPLING_ SPEC_HIGH
+ */
+}qmiLocSetSensorPerformanceControlConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Retrieves the current sensor performance control
+ configuration. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetSensorPerformanceControlConfigReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Retrieves the current sensor performance control
+ configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Sensor Perf Control Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Sensor Performance Control Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Performance Control Mode */
+ uint8_t performanceControlMode_valid; /**< Must be set to true if performanceControlMode is being passed */
+ qmiLocSensorPerformanceControlModeEnumT_v02 performanceControlMode;
+ /**< Controls when sensor data is requested during GNSS fix processing.
+ This field is relevant only when sensors have been enabled using the
+ sensor control configuration.
+ Values: \n
+ - eQMI_LOC_SENSOR_PERFORMANCE_CONTROL_MODE_AUTO (0) -- Sensors usage is determined by the GNSS location engine.
+ This mode can optimize power consumption and give a
+ power-balanced positioning and heading enhancement using
+ inertial sensors \n
+ - eQMI_LOC_SENSOR_PERFORMANCE_CONTROL_MODE_FORCED (1) -- Sensors usage is forced ON.
+ This mode can be requested by the control point when
+ power consumption is not a restriction to the use of
+ inertial sensors.
+ */
+
+ /* Optional */
+ /* Accelerometer Sampling Specification */
+ uint8_t accelSamplingSpec_valid; /**< Must be set to true if accelSamplingSpec is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 accelSamplingSpec;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location engine is to request
+ acceleration data to use by the high data rate filter. The sensor
+ data rate is specified in terms of the nominal number of samples per
+ batch and the number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 10 Hz sampling rate and 2 Hz batching rate.
+ */
+
+ /* Optional */
+ /* Gyroscope Sampling Specification */
+ uint8_t gyroSamplingSpec_valid; /**< Must be set to true if gyroSamplingSpec is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 gyroSamplingSpec;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location engine is to request
+ gyro data to use by the high data rate filter. The sensor data
+ rate is specified in terms of the nominal number of samples per batch
+ and the number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 10 Hz sampling rate and 2 Hz batching rate.
+ */
+
+ /* Optional */
+ /* Algorithm Configuration */
+ uint8_t algorithmConfig_valid; /**< Must be set to true if algorithmConfig is being passed */
+ qmiLocSensorAlgorithmMaskT_v02 algorithmConfig;
+ /**< Informs which sensor algorithms are set.
+ Valid bitmasks: \n
+ - 0x00000001 -- DISABLE_INS_ POSITIONING_FILTER
+ */
+
+ /* Optional */
+ /* High Data Rate Filter Accelerometer Sampling Specification */
+ uint8_t accelSamplingSpecHigh_valid; /**< Must be set to true if accelSamplingSpecHigh is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 accelSamplingSpecHigh;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location engine requests
+ acceleration data to use by the high data rate filter. The sensor
+ data rate is specified in terms of the nominal number of samples per
+ batch and the number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 100 Hz sampling rate and 4 Hz batching rate.
+ */
+
+ /* Optional */
+ /* High Data Rate Filter Gyroscope Sampling Specification */
+ uint8_t gyroSamplingSpecHigh_valid; /**< Must be set to true if gyroSamplingSpecHigh is being passed */
+ qmiLocSensorControlConfigSamplingSpecStructT_v02 gyroSamplingSpecHigh;
+ /**< \vspace{0.06in} \n Sets the nominal rate at which the GNSS location engine is to request
+ gyro data to use by the high data rate filter. The sensor data rate
+ is specified in terms of the nominal number of samples per batch and the
+ number of batches per second.
+ However, the final control of the actual requested rate resides with
+ the Sensors Manager Module/GNSS location engine. \n
+ Default -- 100 Hz sampling rate and 4 Hz batching rate.
+ */
+}qmiLocGetSensorPerformanceControlConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects a SUPL certificate to use in AGNSS sessions. */
+typedef struct {
+
+ /* Mandatory */
+ /* SUPL Certificate ID */
+ uint8_t suplCertId;
+ /**< Certificate ID of the SUPL certificate. \n
+ - Units -- Bytes \n
+ - Range -- 0 to 9 */
+
+ /* Mandatory */
+ /* SUPL Certificate Data */
+ uint32_t suplCertData_len; /**< Must be set to # of elements in suplCertData */
+ uint8_t suplCertData[QMI_LOC_MAX_SUPL_CERT_LENGTH_V02];
+ /**< SUPL certificate contents. \n
+ - Type -- Array of bytes \n
+ - Maximum certificate size -- 2000 bytes */
+}qmiLocInjectSuplCertificateReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects a SUPL certificate to use in AGNSS sessions. */
+typedef struct {
+
+ /* Mandatory */
+ /* SUPL Certificate Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject SUPL Certificate request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectSuplCertificateIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Deletes a SUPL certificate. */
+typedef struct {
+
+ /* Optional */
+ /* SUPL Certificate ID */
+ uint8_t suplCertId_valid; /**< Must be set to true if suplCertId is being passed */
+ uint8_t suplCertId;
+ /**< Certificate ID of the SUPL certificate to delete. \n
+ - Units -- Bytes \n
+ - Range -- 0 to 9 \n
+ If suplCertId is not specified,
+ all SUPL certificates are deleted. */
+}qmiLocDeleteSuplCertificateReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Deletes a SUPL certificate. */
+typedef struct {
+
+ /* Mandatory */
+ /* SUPL Certificate Deletion Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Delete SUPL Certificate request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocDeleteSuplCertificateIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocPositionEngineConfigParamMaskT_v02;
+#define QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_INJECTED_POSITION_CONTROL_V02 ((qmiLocPositionEngineConfigParamMaskT_v02)0x00000001) /**< Indicates whether the position engine uses the
+ injected position in a direct position calculation. */
+#define QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_FILTER_SV_USAGE_V02 ((qmiLocPositionEngineConfigParamMaskT_v02)0x00000002) /**< Indicates whether the position engine filters the
+ SV usage in the fix. */
+#define QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_STORE_ASSIST_DATA_V02 ((qmiLocPositionEngineConfigParamMaskT_v02)0x00000004) /**< Indicates whether the position engine stores assistance data
+ in persistent memory. */
+#define QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_ENABLE_FASTER_TTFF_V02 ((qmiLocPositionEngineConfigParamMaskT_v02)0x00000008) /**< Indicates whether the position engine stays on to optimize
+ the TTFF for the subsequent position fix. */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to configure position engine
+ functionality. */
+typedef struct {
+
+ /* Optional */
+ /* Injected Position Control */
+ uint8_t injectedPositionControl_valid; /**< Must be set to true if injectedPositionControl is being passed */
+ uint8_t injectedPositionControl;
+ /**< Controls how the injected position is used in the position engine.\n
+ - 0x01 (TRUE) -- Use the injected position in a direct position
+ calculation (default) \n
+ - 0x00 (FALSE) -- Do not use the injected position in a direct
+ position calculation
+ */
+
+ /* Optional */
+ /* Filter SV Usage */
+ uint8_t filterSvUsage_valid; /**< Must be set to true if filterSvUsage is being passed */
+ uint8_t filterSvUsage;
+ /**< Controls whether SV usage is filtered in a position fix.
+ Values: \n
+ - 0x01 (TRUE) -- Filter the usage of SVs in the fix \n
+ - 0x00 (FALSE) -- Do not filter the usage of SVs in the fix (default)
+ */
+
+ /* Optional */
+ /* Store Assist Data */
+ uint8_t storeAssistData_valid; /**< Must be set to true if storeAssistData is being passed */
+ uint8_t storeAssistData;
+ /**< Controls whether assistance data is stored in
+ persistent memory.
+ Values: \n
+ - 0x01 (TRUE) -- Store assistance data in persistent memory (default) \n
+ - 0x00 (FALSE) -- Do not store assistance data in persistent memory
+
+ */
+
+ /* Optional */
+ /* Enable Faster TTFF */
+ uint8_t enableFasterTTFF_valid; /**< Must be set to true if enableFasterTTFF is being passed */
+ uint8_t enableFasterTTFF;
+ /**< Allows the receiver to stay on after a position session, to
+ collect information that helps reduce the Time To First Fix (TTFF)
+ when the next position request is made. The receiver stays
+ on only if the engine determines that it must collect some
+ information. The receiver stays on for the duration necessary to
+ collect the information.
+ If enabled, the clients can see a delay in receiving the Engine Off
+ event after the position session ends.
+ Values: \n
+ - 0x01 (TRUE) -- Allow the engine to stay on for reduced TTFF (default) \n
+ - 0x00 (FALSE) -- Do not allow the engine to stay on for reduced TTFF
+ */
+}qmiLocSetPositionEngineConfigParametersReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to configure position engine
+ functionality. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Position Engine Configuration Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Configuration Parameters request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Failed Parameters */
+ uint8_t failedPositionEngineConfigParamMask_valid; /**< Must be set to true if failedPositionEngineConfigParamMask is being passed */
+ qmiLocPositionEngineConfigParamMaskT_v02 failedPositionEngineConfigParamMask;
+ /**< Identifies the parameters that were not set successfully.
+ This field is sent only if the status is other than SUCCESS.
+ Valid bitmasks:\n
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_INJECTED_POSITION_CONTROL (0x00000001) -- Indicates whether the position engine uses the
+ injected position in a direct position calculation.
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_FILTER_SV_USAGE (0x00000002) -- Indicates whether the position engine filters the
+ SV usage in the fix.
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_STORE_ASSIST_DATA (0x00000004) -- Indicates whether the position engine stores assistance data
+ in persistent memory.
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_ENABLE_FASTER_TTFF (0x00000008) -- Indicates whether the position engine stays on to optimize
+ the TTFF for the subsequent position fix.
+ */
+}qmiLocSetPositionEngineConfigParametersIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the position engine
+ configuration parameters. */
+typedef struct {
+
+ /* Mandatory */
+ /* Config Parameters */
+ qmiLocPositionEngineConfigParamMaskT_v02 getPositionEngineConfigParamMask;
+ /**< Mask denoting the configuration parameters to retrieve.
+ Valid bitmasks:
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_INJECTED_POSITION_CONTROL (0x00000001) -- Indicates whether the position engine uses the
+ injected position in a direct position calculation.
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_FILTER_SV_USAGE (0x00000002) -- Indicates whether the position engine filters the
+ SV usage in the fix.
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_STORE_ASSIST_DATA (0x00000004) -- Indicates whether the position engine stores assistance data
+ in persistent memory.
+ - QMI_LOC_POSITION_ENGINE_CONFIG_PARAM_MASK_ENABLE_FASTER_TTFF (0x00000008) -- Indicates whether the position engine stays on to optimize
+ the TTFF for the subsequent position fix.
+ */
+}qmiLocGetPositionEngineConfigParametersReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the position engine
+ configuration parameters. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Position Engine Configuration Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Configuration Parameters request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Injected Position Control */
+ uint8_t injectedPositionControl_valid; /**< Must be set to true if injectedPositionControl is being passed */
+ uint8_t injectedPositionControl;
+ /**< Specifies whether the injected position is used for a direct calculation
+ in the position engine.
+ Values:\n
+ - 0x01 (TRUE) -- The injected position is used in a direct
+ position calculation (default) \n
+ - 0x00 (FALSE) -- The injected position is not used in a direct
+ position calculation
+ */
+
+ /* Optional */
+ /* Filter SV Usage */
+ uint8_t filterSvUsage_valid; /**< Must be set to true if filterSvUsage is being passed */
+ uint8_t filterSvUsage;
+ /**< Specifies whether SV usage is filtered in a position fix.
+ Values: \n
+ - 0x01 (TRUE) -- SV usage is filtered in the fix\n
+ - 0x00 (FALSE) -- SV usage is not filtered in the fix (default)
+ */
+
+ /* Optional */
+ /* Store Assist Data */
+ uint8_t storeAssistData_valid; /**< Must be set to true if storeAssistData is being passed */
+ uint8_t storeAssistData;
+ /**< Specifies whether assistance data is stored in persistent memory.
+ Values: \n
+ - 0x01 (TRUE) -- Assistance data is stored in persistent memory (default) \n
+ - 0x00 (FALSE) -- Assistance data is not stored in persistent
+ memory
+ */
+
+ /* Optional */
+ /* Enable Faster TTFF */
+ uint8_t enableFasterTTFF_valid; /**< Must be set to true if enableFasterTTFF is being passed */
+ uint8_t enableFasterTTFF;
+ /**< Allows the receiver to stay on after a position session, to
+ collect information that helps reduce the TTFF
+ when the next position request is made. The receiver stays
+ on only if the engine determines that it must collect some
+ information. The receiver stays on for the duration necessary to
+ collect the information.
+ If enabled, the clients can see a delay in receiving the Engine Off
+ event after the position session ends.
+ Values: \n
+ - 0x01 (TRUE) -- Allow the engine to stay on for reduced TTFF (default) \n
+ - 0x00 (FALSE) -- Do not allow the engine to stay on for reduced
+ TTFF
+ */
+}qmiLocGetPositionEngineConfigParametersIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocGeofenceBreachMaskT_v02;
+#define QMI_LOC_GEOFENCE_BREACH_ENTERING_MASK_V02 ((qmiLocGeofenceBreachMaskT_v02)0x01) /**< If this mask is set, a breach event is reported
+ when the Geofence is entered */
+#define QMI_LOC_GEOFENCE_BREACH_LEAVING_MASK_V02 ((qmiLocGeofenceBreachMaskT_v02)0x02) /**< If this mask is set, a breach event is reported
+ when the Geofence is exited */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCERESPONSIVENESSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_RESPONSIVENESS_LOW_V02 = 0x01, /**< The Geofence is monitored for a breach at a
+ low rate of 15 minutes. The gap between the actual breach and
+ the time it is reported is higher. This
+ setting results in lower power usage. \n */
+ eQMI_LOC_GEOFENCE_RESPONSIVENESS_MED_V02 = 0x02, /**< The Geofence is monitored for a breach at a
+ medium rate of 2 minutes. This is the default setting.\n */
+ eQMI_LOC_GEOFENCE_RESPONSIVENESS_HIGH_V02 = 0x03, /**< The Geofence is monitored for a breach at a
+ high rate of 10 seconds. The gap between the actual breach and
+ the time it is reported is low. This results
+ in higher power usage. \n */
+ eQMI_LOC_GEOFENCE_RESPONSIVENESS_ULTRA_HIGH_V02 = 0x04, /**< The Geofence is monitored for a breach at a
+ very high rate of 1 second. The gap between the actual breach and
+ the time it is reported is very low. This results
+ in very high power usage. This setting must be avoided whenever
+ possible because of the drastic power implications. \n */
+ eQMI_LOC_GEOFENCE_RESPONSIVENESS_CUSTOM_V02 = 0x05, /**< The Geofence is monitored for a breach at a
+ user defined rate. The gap between the actual breach and
+ the time it is reported depends on the user setting. The power implication
+ is inversely proportional to the responsiveness value set by the user.
+ The higher the responsiveness value, the lower the power implications, and vice-versa. */
+ QMILOCGEOFENCERESPONSIVENESSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceResponsivenessEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ double latitude;
+ /**< Latitude of the center of the Geofence.*/
+
+ double longitude;
+ /**< Longitude of the center of the Geofence.*/
+
+ uint32_t radius;
+ /**< Radius of the circular Geofence in meters. */
+}qmiLocCircularGeofenceArgsStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCEPOSITIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_POSITION_INSIDE_V02 = 0x01, /**< Position is inside a Geofence \n */
+ eQMI_LOC_GEOFENCE_POSITION_OUTSIDE_V02 = 0x02, /**< Position is outside a Geofence */
+ QMILOCGEOFENCEPOSITIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofencePositionEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocGeofenceDwellTypeMaskT_v02;
+#define QMI_LOC_GEOFENCE_DWELL_TYPE_INSIDE_MASK_V02 ((qmiLocGeofenceDwellTypeMaskT_v02)0x01) /**< If this mask is set, a dwell event is reported
+ when a user dwells inside the Geofence for a specified time \n */
+#define QMI_LOC_GEOFENCE_DWELL_TYPE_OUTSIDE_MASK_V02 ((qmiLocGeofenceDwellTypeMaskT_v02)0x02) /**< If this mask is set, a dwell event is reported
+ when a user dwells outside the Geofence for a specified time */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to add a circular Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The transaction ID
+ is returned in the QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND
+ indication. */
+
+ /* Mandatory */
+ /* Circular Geofence Arguments */
+ qmiLocCircularGeofenceArgsStructT_v02 circularGeofenceArgs;
+
+ /* Mandatory */
+ /* Breach Event Mask */
+ qmiLocGeofenceBreachMaskT_v02 breachMask;
+ /**< Specifies the breach events in which the client is interested.
+ Values: \n
+ - 0x01 -- GEOFENCE_BREACH_ ENTERING_MASK \n
+ - 0x02 -- GEOFENCE_BREACH_ LEAVING_MASK
+ */
+
+ /* Mandatory */
+ /* Include Position in Breach Event */
+ uint8_t includePosition;
+ /**< Specifies whether the Geofence engine includes the position
+ in a breach event.\n
+ Values: \n
+ - 0x01 (TRUE) -- Position is reported with the breach event \n
+ - 0x00 (FALSE) -- Position is not reported with the breach
+ event
+ */
+
+ /* Optional */
+ /* Responsiveness */
+ uint8_t responsiveness_valid; /**< Must be set to true if responsiveness is being passed */
+ qmiLocGeofenceResponsivenessEnumT_v02 responsiveness;
+ /**< Specifies the rate of detection for a Geofence breach.
+ This can impact the time lag between the actual breach event and
+ when it is reported. This parameter has power implications
+ and must be fine-tuned to optimize power savings.\n
+ Values: \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_LOW (0x01) -- The Geofence is monitored for a breach at a
+ low rate of 15 minutes. The gap between the actual breach and
+ the time it is reported is higher. This
+ setting results in lower power usage. \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_MED (0x02) -- The Geofence is monitored for a breach at a
+ medium rate of 2 minutes. This is the default setting.\n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_HIGH (0x03) -- The Geofence is monitored for a breach at a
+ high rate of 10 seconds. The gap between the actual breach and
+ the time it is reported is low. This results
+ in higher power usage. \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_ULTRA_HIGH (0x04) -- The Geofence is monitored for a breach at a
+ very high rate of 1 second. The gap between the actual breach and
+ the time it is reported is very low. This results
+ in very high power usage. This setting must be avoided whenever
+ possible because of the drastic power implications. \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_CUSTOM (0x05) -- The Geofence is monitored for a breach at a
+ user defined rate. The gap between the actual breach and
+ the time it is reported depends on the user setting. The power implication
+ is inversely proportional to the responsiveness value set by the user.
+ The higher the responsiveness value, the lower the power implications, and vice-versa.
+ */
+
+ /* Optional */
+ /* Confidence */
+ uint8_t confidence_valid; /**< Must be set to true if confidence is being passed */
+ qmiLocGeofenceConfidenceEnumT_v02 confidence;
+ /**< Given a breach event, the confidence determines the probability
+ that the breach happened at the Geofence boundary.
+ This parameter has power implications and
+ must be fine-tuned to optimize power savings.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_LOW (0x01) -- Geofence engine indicates a breach with
+ low confidence; this setting results in lower
+ power usage, and it can impact the yield because
+ incorrect breach events can be sent \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_MED (0x02) -- (Default) Geofence engine indicates a breach with
+ medium confidence \n
+ - eQMI_LOC_GEOFENCE_CONFIDENCE_HIGH (0x03) -- Geofence engine indicates a breach with
+ high confidence; this setting results in higher
+ power usage
+ */
+
+ /* Optional */
+ /* Custom Responsiveness Value */
+ uint8_t customResponsivenessValue_valid; /**< Must be set to true if customResponsivenessValue is being passed */
+ uint32_t customResponsivenessValue;
+ /**< Specifies in seconds the user-defined rate of detection for a Geofence breach.
+ This might impact the time lag between the actual breach event and
+ when it is reported. The gap between the actual breach and
+ the time it is reported depends on the user setting. The power implication
+ is inversely proportional to the responsiveness value set by the user.
+ The higher the responsiveness value, the lower the power implications, and vice-versa.
+ If this field is set, the responsiveness is always treated
+ as eQMI_LOC_GEOFENCE_ RESPONSIVENESS_CUSTOM.
+ The minimum value supported in this field is 1 second, and the maximum value is 65535 seconds.
+ An error is returned if an attempt is made to set this to an unsupported value.
+ If this field is set, the responsiveness is always treated
+ as eQMI_LOC_GEOFENCE_ RESPONSIVENESS_CUSTOM, which means that the other responsiveness
+ types, such as eQMI_LOC_GEOFENCE _RESPONSIVENESS_LOW, eQMI_LOC_GEOFENCE_ RESPONSIVENESS_MEDIUM,
+ eQMI_LOC_GEOFENCE_ RESPONSIVENESS_HIGH, and eQMI_LOC_GEOFENCE_ RESPONSIVENESS_ULTRA_HIGH are all
+ disregarded.
+ If this field is not set, the responsiveness is treated as
+ eQMI_LOC_GEOFENCE_ RESPONSIVENESS_LOW, eQMI_LOC_GEOFENCE_RESPONSIVENESS_MEDIUM,
+ eQMI_LOC_GEOFENCE_RESPONSIVENESS_HIGH, or eQMI_LOC_GEOFENCE_RESPONSIVENESS_ULTRA_HIGH.
+ */
+
+ /* Optional */
+ /* Dwell Time of Geofence */
+ uint8_t dwellTime_valid; /**< Must be set to true if dwellTime is being passed */
+ uint32_t dwellTime;
+ /**< Dwell time is the time in seconds a user spends in the Geofence before a dwell
+ event is sent.
+ */
+
+ /* Optional */
+ /* Geofence Dwell Type */
+ uint8_t dwellTypeMask_valid; /**< Must be set to true if dwellTypeMask is being passed */
+ qmiLocGeofenceDwellTypeMaskT_v02 dwellTypeMask;
+ /**< Type of dwell event in which the user is interested.
+ Values: \n
+ - QMI_LOC_GEOFENCE_DWELL_TYPE_INSIDE_MASK (0x01) -- If this mask is set, a dwell event is reported
+ when a user dwells inside the Geofence for a specified time \n
+ - QMI_LOC_GEOFENCE_DWELL_TYPE_OUTSIDE_MASK (0x02) -- If this mask is set, a dwell event is reported
+ when a user dwells outside the Geofence for a specified time
+ */
+}qmiLocAddCircularGeofenceReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to add a circular Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Add Circular Geofence Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Add Circular Geofence request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the Add Circular
+ Geofence request. This parameter is always present
+ when the status field is set to SUCCESS. */
+
+ /* Optional */
+ /* Geofence ID */
+ uint8_t geofenceId_valid; /**< Must be set to true if geofenceId is being passed */
+ uint32_t geofenceId;
+ /**< Geofence identifier allocated by the engine.
+ The client must include this identifier in all transactions
+ pertaining to this Geofence. */
+}qmiLocAddCircularGeofenceIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to delete a Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence ID */
+ uint32_t geofenceId;
+ /**< Identifier for the Geofence that is to delete. */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The QMI_LOC_DELETE_GEOFENCE_IND
+ indication returns the transaction ID. */
+}qmiLocDeleteGeofenceReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to delete a Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Delete Geofence Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_DELETE_GEOFENCE_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Geofence ID */
+ uint8_t geofenceId_valid; /**< Must be set to true if geofenceId is being passed */
+ uint32_t geofenceId;
+ /**< Identifier for the Geofence that was deleted. */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the Delete
+ Geofence request. This parameter is always present
+ when the status field is set to SUCCESS. */
+}qmiLocDeleteGeofenceIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCEORIGINENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_ORIGIN_NETWORK_V02 = 1, /**< Geofence was initiated by a network-initiated client \n */
+ eQMI_LOC_GEOFENCE_ORIGIN_DEVICE_V02 = 2, /**< Geofence was initiated by the device */
+ QMILOCGEOFENCEORIGINENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceOriginEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCESTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_STATE_ACTIVE_V02 = 1, /**< Geofence is being actively monitored \n */
+ eQMI_LOC_GEOFENCE_STATE_SUSPEND_V02 = 2, /**< Geofence monitoring is suspended */
+ QMILOCGEOFENCESTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to query a Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence ID */
+ uint32_t geofenceId;
+ /**< Identifier for the Geofence that to query. */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The QMI_LOC_QUERY_GEOFENCE_IND
+ indication returns the transaction ID. */
+}qmiLocQueryGeofenceReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query a Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Query Geofence Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Query Geofence request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Geofence ID */
+ uint8_t geofenceId_valid; /**< Must be set to true if geofenceId is being passed */
+ uint32_t geofenceId;
+ /**< Identifier for the Geofence that was queried. */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the Query
+ Geofence request. This parameter is always present
+ when the status field is set to SUCCESS. */
+
+ /* Optional */
+ /* Geofence Origin */
+ uint8_t geofenceOrigin_valid; /**< Must be set to true if geofenceOrigin is being passed */
+ qmiLocGeofenceOriginEnumT_v02 geofenceOrigin;
+ /**< Originator of the Geofence.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_ORIGIN_NETWORK (1) -- Geofence was initiated by a network-initiated client \n
+ - eQMI_LOC_GEOFENCE_ORIGIN_DEVICE (2) -- Geofence was initiated by the device
+ */
+
+ /* Optional */
+ /* Position with Respect to Geofence */
+ uint8_t posWrtGeofence_valid; /**< Must be set to true if posWrtGeofence is being passed */
+ qmiLocGeofencePositionEnumT_v02 posWrtGeofence;
+ /**< Indicates whether the client is inside or outside
+ the Geofence.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_POSITION_INSIDE (0x01) -- Position is inside a Geofence \n
+ - eQMI_LOC_GEOFENCE_POSITION_OUTSIDE (0x02) -- Position is outside a Geofence
+ */
+
+ /* Optional */
+ /* Circular Geofence Parameters */
+ uint8_t circularGeofenceArgs_valid; /**< Must be set to true if circularGeofenceArgs is being passed */
+ qmiLocCircularGeofenceArgsStructT_v02 circularGeofenceArgs;
+
+ /* Optional */
+ /* Geofence State */
+ uint8_t geofenceState_valid; /**< Must be set to true if geofenceState is being passed */
+ qmiLocGeofenceStateEnumT_v02 geofenceState;
+ /**< Specifies whether to actively monitor the Geofenced.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_STATE_ACTIVE (1) -- Geofence is being actively monitored \n
+ - eQMI_LOC_GEOFENCE_STATE_SUSPEND (2) -- Geofence monitoring is suspended
+ */
+}qmiLocQueryGeofenceIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocMotionDetectionSourceMaskT_v02;
+#define QMI_LOC_MOTION_DETECTION_SOURCE_SENSORS_V02 ((qmiLocMotionDetectionSourceMaskT_v02)0x00000001) /**< Sensors are used for motion detection\n */
+#define QMI_LOC_MOTION_DETECTION_SOURCE_WIFI_V02 ((qmiLocMotionDetectionSourceMaskT_v02)0x00000002) /**< Wi-Fi is used for motion detection \n */
+#define QMI_LOC_MOTION_DETECTION_SOURCE_WWAN_V02 ((qmiLocMotionDetectionSourceMaskT_v02)0x00000004) /**< Wireless WAN is used for motion detection */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGEOFENCEMOTIONSTATESENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GEOFENCE_MOTION_STATE_STATIONARY_V02 = 0, /**< Motion state Stationary -- Handset is completely stationary \n */
+ eQMI_LOC_GEOFENCE_MOTION_STATE_FIDDLE_V02 = 1, /**< Motion state Fiddle -- Handset is not in motion but is being "fiddled" with \n */
+ eQMI_LOC_GEOFENCE_MOTION_STATE_WALK_V02 = 2, /**< Motion state Walk -- User is walking with the handset \n */
+ eQMI_LOC_GEOFENCE_MOTION_STATE_RUN_V02 = 3, /**< Motion state Run -- User is running with the handset \n */
+ eQMI_LOC_GEOFENCE_MOTION_STATE_DRIVE_V02 = 4, /**< Motion state Drive -- User is driving with the handset */
+ QMILOCGEOFENCEMOTIONSTATESENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGeofenceMotionStatesEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocGeofenceMotionStatesEnumT_v02 motionState;
+ /**< Motion state for which information is being configured. */
+
+ float motionStateSpeed;
+ /**< Motion state speed in milliseconds; positive floating values.
+ The state speed must be configured carefully. Very low speed
+ configuration for a state might result in missing Geofence
+ breaches in some scenarios.
+
+ Typical motion state speeds: \n
+ - Stationary speed -- 0 meters per second
+ - Fiddle speed -- 0 meters per second \n
+ - Walk speed -- 3 meters per second \n
+ - Run speed -- 8 meters per second \n
+ - Drive speed -- 56 meters per second
+ */
+}qmiLocGeofenceMotionStateConfigStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to set the Geofence engine configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The transaction ID
+ is returned with the QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_IND
+ indication. */
+
+ /* Optional */
+ /* GNSS Unavailable Indication Timeout */
+ uint8_t gnssUnavailableIndicationTimeout_valid; /**< Must be set to true if gnssUnavailableIndicationTimeout is being passed */
+ uint32_t gnssUnavailableIndicationTimeout;
+ /**< In a bad GNSS environment, this is the timeout after which the Geofence
+ engine sends out a GNSS Unavailable alert. The GNSS Unavailable
+ alert is sent under the following conditions: \n
+ - If gnssUnavailableIndicationTimeout is less than
+ gnssPositionSessionTimeout, the GNSS
+ unavailable timeout indication is sent after
+ gnssPositionSessionTimeout expires \n
+ - If gnssPositionSessionTimeout is less than
+ gnssUnavailableIndicationTimeout, the
+ GNSS Unavailable timeout indication is sent after
+ gnssUnavailableIndicationTimeout expires
+ */
+
+ /* Optional */
+ /* Max Geofences */
+ uint8_t maxGeofences_valid; /**< Must be set to true if maxGeofences is being passed */
+ uint32_t maxGeofences;
+ /**< Identifies the maximum number of Geofences that the Geofence enginer can support.
+ If this number is less than the deployed
+ Geofences, this command fails.
+ If the command succeeds, the engine supports the maximum number of
+ Geofences requested, provided there is enough memory to support that
+ many Geofences. Increasing this value to a very large number in a
+ constrained memory environment might affect other modules negatively.
+ This value is determined by phone manufacturers. The default value
+ is 200. */
+
+ /* Optional */
+ /* Enable Motion Detection Sources */
+ uint8_t enableMotionDetectionSources_valid; /**< Must be set to true if enableMotionDetectionSources is being passed */
+ qmiLocMotionDetectionSourceMaskT_v02 enableMotionDetectionSources;
+ /**< Identifies the sources that the Geofence engine can enable for motion detection.
+ The sources of motion detection that the Geofence enginer enable are dependent on the platform.
+ These sources are only set once at boot time, they are not expected to change after that.
+ Any attempt to set the value of the motion detection sources at runtime results in an undefined behavior.
+ Values: \n
+ - QMI_LOC_MOTION_DETECTION_SOURCE_SENSORS (0x00000001) -- Sensors are used for motion detection\n
+ - QMI_LOC_MOTION_DETECTION_SOURCE_WIFI (0x00000002) -- Wi-Fi is used for motion detection \n
+ - QMI_LOC_MOTION_DETECTION_SOURCE_WWAN (0x00000004) -- Wireless WAN is used for motion detection */
+
+ /* Optional */
+ /* Enable Coarse Position Injection Usage */
+ uint8_t enableCpiUsage_valid; /**< Must be set to true if enableCpiUsage is being passed */
+ uint8_t enableCpiUsage;
+ /**< Indicates whether the Geofence engine uses external Coarse Position Injection (CPI).\n
+ - 0x01 (TRUE) -- CPI is enabled (default) \n
+ - 0x00 (FALSE) -- CPI is disabled
+ */
+
+ /* Optional */
+ /* GNSS Position QOS Session Timeout */
+ uint8_t gnssPositionSessionTimeout_valid; /**< Must be set to true if gnssPositionSessionTimeout is being passed */
+ uint32_t gnssPositionSessionTimeout;
+ /**< Identifies the session timeout value (in seconds) for requesting a
+ position in a bad GNSS environment.
+ Values: \n
+ - If the gnssUnavailableIndicationTimeout value is less than
+ gnssPositionSessionTimeout, in a bad GNSS environment, the GNSS
+ Unavailable timeout indication is sent after
+ gnssPositionSessionTimeout expires.\n
+ - If gnssPositionSessionTimeout is less than gnssUnavailableIndicationTimeout,
+ in a bad GNSS environment, the GNSS Unavailable timeout indication
+ is sent after gnssUnavailableIndicationTimeout expires.
+ */
+
+ /* Optional */
+ /* GNSS Position Maximum Position Uncertainity Acceptable */
+ uint8_t gnssPositionMaxPuncAcceptable_valid; /**< Must be set to true if gnssPositionMaxPuncAcceptable is being passed */
+ uint32_t gnssPositionMaxPuncAcceptable;
+ /**< GNSS maximum position uncertainity in meters acceptable by
+ the Geofence engine.
+ Values: \n
+ - All positive values
+ */
+
+ /* Optional */
+ /* Medium Responsiveness Value */
+ uint8_t mediumResponsivenessValue_valid; /**< Must be set to true if mediumResponsivenessValue is being passed */
+ uint32_t mediumResponsivenessValue;
+ /**< Medium responsiveness value in seconds that the Geofence engine
+ uses for all medium responsiveness Geofences in the Geofence engine.
+ Values: \n
+ - Positive values (in seconds) \n
+ - If the value is configured for less than 30 seconds, the value is
+ set at 30 seconds \n
+ - If the value is configured for more than 600 seconds, the value is
+ set at 600 seconds \n
+ - Default -- The Geofence engine uses 120 seconds as the medium
+ responsiveness value \n
+
+ If the medium responsiveness value is changed, the responsiveness
+ of the existing medium responsiveness Geofence does not change until the next
+ position fix, which is based on the previous medium responsiveness
+ setting.
+ */
+
+ /* Optional */
+ /* Challenging GNSS Environment Minimum CPI Wait Interval */
+ uint8_t chalGnssEnvMinCpiWaitInterval_valid; /**< Must be set to true if chalGnssEnvMinCpiWaitInterval is being passed */
+ uint32_t chalGnssEnvMinCpiWaitInterval;
+ /**< Number of seconds that the Geofence engine is to wait between
+ CPI requests in challenging a GNSS environment.
+ Values: \n
+ - Positive values (in seconds)
+ */
+
+ /* Optional */
+ /* Geofence Motion State Information */
+ uint8_t motionStateInfo_valid; /**< Must be set to true if motionStateInfo is being passed */
+ uint32_t motionStateInfo_len; /**< Must be set to # of elements in motionStateInfo */
+ qmiLocGeofenceMotionStateConfigStructT_v02 motionStateInfo[QMI_LOC_GEOFENCE_MAX_MOTION_STATES_V02];
+ /**< \vspace{4pt} \n Motion state information (for example, motion state speed) that the
+ Geofence engine is to use.
+ */
+}qmiLocSetGeofenceEngineConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to set the Geofence engine configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Geofence Engine Configuration Status. */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Geofence Engine Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the Set Geofence Configuration
+ request. This parameter is always present if the status
+ field is set to SUCCESS. */
+}qmiLocSetGeofenceEngineConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the Geofence engine configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The transaction ID
+ is returned with the QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_IND
+ indication. */
+}qmiLocGetGeofenceEngineConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the Geofence engine configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Geofence Engine Configuration Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_REQ
+ request. This parameter is always present
+ if the status field is set to SUCCESS. */
+
+ /* Optional */
+ /* GPS Unavailable Indication Timeout */
+ uint8_t gnssUnavailableIndicationTimeout_valid; /**< Must be set to true if gnssUnavailableIndicationTimeout is being passed */
+ uint32_t gnssUnavailableIndicationTimeout;
+ /**< In a bad GNSS environment, the timeout after which the Geofence engine
+ sends out a GNSS unavailable indication. */
+
+ /* Optional */
+ /* Max Geofences */
+ uint8_t maxGeofences_valid; /**< Must be set to true if maxGeofences is being passed */
+ uint32_t maxGeofences;
+ /**< Identifies the maximum number of supported Geofences
+ in the Geofence engine. */
+
+ /* Optional */
+ /* Enabled Motion Detection Sources */
+ uint8_t enabledMotionDetectionSources_valid; /**< Must be set to true if enabledMotionDetectionSources is being passed */
+ qmiLocMotionDetectionSourceMaskT_v02 enabledMotionDetectionSources;
+ /**< Identifies the enabled sources for motion detection
+ by the Geofence engine.
+ Values: \n
+ - QMI_LOC_MOTION_DETECTION_SOURCE_SENSORS (0x00000001) -- Sensors are used for motion detection\n
+ - QMI_LOC_MOTION_DETECTION_SOURCE_WIFI (0x00000002) -- Wi-Fi is used for motion detection \n
+ - QMI_LOC_MOTION_DETECTION_SOURCE_WWAN (0x00000004) -- Wireless WAN is used for motion detection */
+
+ /* Optional */
+ /* Enabled for CPI Position Injection Usage */
+ uint8_t enabledCpiUsage_valid; /**< Must be set to true if enabledCpiUsage is being passed */
+ uint8_t enabledCpiUsage;
+ /**< Indicates whether CPI usage is enabled. \n
+ - 0x01 (TRUE) -- enabled \n
+ - 0x00 (FALSE) -- disabled
+ */
+}qmiLocGetGeofenceEngineConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to edit a Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Geofence ID */
+ uint32_t geofenceId;
+ /**< Identifier for the Geofence to edit. */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Transaction ID specified in the Edit Geofence
+ request. This parameter is always present when the
+ status field is set to SUCCESS.
+ */
+
+ /* Optional */
+ /* Geofence State */
+ uint8_t geofenceState_valid; /**< Must be set to true if geofenceState is being passed */
+ qmiLocGeofenceStateEnumT_v02 geofenceState;
+ /**< Specifies whether to actively monitor the Geofence.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_STATE_ACTIVE (1) -- Geofence is being actively monitored \n
+ - eQMI_LOC_GEOFENCE_STATE_SUSPEND (2) -- Geofence monitoring is suspended
+ */
+
+ /* Optional */
+ /* Breach Event Mask */
+ uint8_t breachMask_valid; /**< Must be set to true if breachMask is being passed */
+ qmiLocGeofenceBreachMaskT_v02 breachMask;
+ /**< Specifies the breach events in which the client is interested.
+ Values: \n
+ - 0x01 -- GEOFENCE_BREACH_ ENTERING_MASK \n
+ - 0x02 -- GEOFENCE_BREACH_ LEAVING_MASK
+ */
+
+ /* Optional */
+ /* Responsiveness */
+ uint8_t responsiveness_valid; /**< Must be set to true if responsiveness is being passed */
+ qmiLocGeofenceResponsivenessEnumT_v02 responsiveness;
+ /**< Specifies the rate of detection for a Geofence breach.
+ This might impact the time lag between the actual breach event and
+ when it is reported. This parameter has power implications
+ and must be fine-tuned to optimize power savings.
+ Values: \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_LOW (0x01) -- The Geofence is monitored for a breach at a
+ low rate of 15 minutes. The gap between the actual breach and
+ the time it is reported is higher. This
+ setting results in lower power usage. \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_MED (0x02) -- The Geofence is monitored for a breach at a
+ medium rate of 2 minutes. This is the default setting.\n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_HIGH (0x03) -- The Geofence is monitored for a breach at a
+ high rate of 10 seconds. The gap between the actual breach and
+ the time it is reported is low. This results
+ in higher power usage. \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_ULTRA_HIGH (0x04) -- The Geofence is monitored for a breach at a
+ very high rate of 1 second. The gap between the actual breach and
+ the time it is reported is very low. This results
+ in very high power usage. This setting must be avoided whenever
+ possible because of the drastic power implications. \n
+ - eQMI_LOC_GEOFENCE_RESPONSIVENESS_CUSTOM (0x05) -- The Geofence is monitored for a breach at a
+ user defined rate. The gap between the actual breach and
+ the time it is reported depends on the user setting. The power implication
+ is inversely proportional to the responsiveness value set by the user.
+ The higher the responsiveness value, the lower the power implications, and vice-versa.
+ */
+}qmiLocEditGeofenceReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocGeofenceConfigParamMaskT_v02;
+#define QMI_LOC_GEOFENCE_PARAM_MASK_GEOFENCE_STATE_V02 ((qmiLocGeofenceConfigParamMaskT_v02)0x00000001) /**< Mask for the Geofence state parameter. \n */
+#define QMI_LOC_GEOFENCE_PARAM_MASK_BREACH_MASK_V02 ((qmiLocGeofenceConfigParamMaskT_v02)0x00000002) /**< Mask for Geofence breach mask parameter. */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to edit a Geofence. */
+typedef struct {
+
+ /* Mandatory */
+ /* Edit Geofence Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Edit Geofence request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+
+ /* Optional */
+ /* Geofence ID */
+ uint8_t geofenceId_valid; /**< Must be set to true if geofenceId is being passed */
+ uint32_t geofenceId;
+ /**< Identifier for the Geofence that was edited. */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The transaction ID
+ is specified in the Edit Geofence request. */
+
+ /* Optional */
+ /* Failed Parameters */
+ uint8_t failedParams_valid; /**< Must be set to true if failedParams is being passed */
+ qmiLocGeofenceConfigParamMaskT_v02 failedParams;
+ /**< Specified only when the status is not set to SUCCESS. A set mask corresponding to a field
+ indicates that the Geofence parameter cannot be edited.
+ Values:\n
+ - 0x00000001 -- GEOFENCE_PARAM_ MASK_GEOFENCE_STATE\n
+ - 0x00000002 -- GEOFENCE_PARAM_ MASK_BREACH_MASK
+ */
+}qmiLocEditGeofenceIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to get time zone information. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Time Zone Info Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get Time Zone Info request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocEventGetTimeZoneReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint64_t dstOffset;
+ /**< Offset for Daylight Savings Time in seconds. This is zero if the time zone is not in Daylight Savings
+ Time during the specified UTC timestamp. */
+
+ uint64_t rawOffset;
+ /**< Offset from UTC (in seconds) for the current location. This does not take daylight savings into account. */
+}qmiLocTimeZoneStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject time zone information. */
+typedef struct {
+
+ /* Mandatory */
+ /* UTC Time */
+ uint64_t timeUtc;
+ /**< UTC time since Jan. 1, 1970.\n
+ - Units -- Milliseconds */
+
+ /* Mandatory */
+ /* Time Zone Information */
+ qmiLocTimeZoneStructT_v02 timeZone;
+}qmiLocInjectTimeZoneInfoReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject time zone information. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Time Zone Info Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the inject time zone information.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectTimeZoneInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the best available
+ position estimate from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND
+ indication returns the transaction ID. */
+
+ /* Optional */
+ /* GNSS Special Request Type */
+ uint8_t specialReqType_valid; /**< Must be set to true if specialReqType is being passed */
+ qmiLocSpecialReqEnumT_v02 specialReqType;
+ /**< QMI_LOC client requests for best available location with special
+ service request types set, honor this request even when GPS and privacy NVs
+ do not allow fix requests for this client.
+ If not set, ignore the field and process the client request
+ according to GPS lock and privacy settings.
+ Values: \n
+ - eQMI_LOC_SPECIAL_REQUEST_SHORT_CODE (1) -- The QMI_LOC client requests for location fix with Special
+ Service type set with Short Code, allow even when GPS and privacy NVs
+ do not allow fix requests for this client.
+ */
+}qmiLocGetBestAvailablePositionReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the best available
+ position estimate from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Best Available Position Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the Get Best
+ Available Position request. This parameter is
+ always present when the status field is set to
+ SUCCESS. */
+
+ /* Optional */
+ /* Latitude */
+ uint8_t latitude_valid; /**< Must be set to true if latitude is being passed */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ /* Optional */
+ /* Longitude */
+ uint8_t longitude_valid; /**< Must be set to true if longitude is being passed */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ /* Optional */
+ /* Circular Horizontal Position Uncertainty */
+ uint8_t horUncCircular_valid; /**< Must be set to true if horUncCircular is being passed */
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular).\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Altitude With Respect to Ellipsoid */
+ uint8_t altitudeWrtEllipsoid_valid; /**< Must be set to true if altitudeWrtEllipsoid is being passed */
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid.\n
+ - Units -- Meters \n
+ - Range -- -500 to 15883 */
+
+ /* Optional */
+ /* Vertical Uncertainty */
+ uint8_t vertUnc_valid; /**< Must be set to true if vertUnc is being passed */
+ float vertUnc;
+ /**< - Units -- Meters */
+
+ /* Optional */
+ /* UTC Timestamp */
+ uint8_t timestampUtc_valid; /**< Must be set to true if timestampUtc is being passed */
+ uint64_t timestampUtc;
+ /**< - Units -- Milliseconds since Jan. 1, 1970
+ */
+
+ /* Optional */
+ /* Time Uncertainty */
+ uint8_t timeUnc_valid; /**< Must be set to true if timeUnc is being passed */
+ float timeUnc;
+ /**< - Units -- Milliseconds */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Semi-Minor Axis */
+ uint8_t horUncEllipseSemiMinor_valid; /**< Must be set to true if horUncEllipseSemiMinor is being passed */
+ float horUncEllipseSemiMinor;
+ /**< Semi-minor axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Semi-Major Axis */
+ uint8_t horUncEllipseSemiMajor_valid; /**< Must be set to true if horUncEllipseSemiMajor is being passed */
+ float horUncEllipseSemiMajor;
+ /**< Semi-major axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Azimuth */
+ uint8_t horUncEllipseOrientAzimuth_valid; /**< Must be set to true if horUncEllipseOrientAzimuth is being passed */
+ float horUncEllipseOrientAzimuth;
+ /**< Elliptical horizontal uncertainty azimuth of orientation. \n
+ - Units -- Decimal degrees\n
+ - Range -- 0 to 180 */
+
+ /* Optional */
+ /* Horizontal Circular Confidence */
+ uint8_t horCircularConfidence_valid; /**< Must be set to true if horCircularConfidence is being passed */
+ uint8_t horCircularConfidence;
+ /**< Horizontal circular uncertainty confidence. \n
+ - Units -- Percent\n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Horizontal Elliptical Confidence */
+ uint8_t horEllipticalConfidence_valid; /**< Must be set to true if horEllipticalConfidence is being passed */
+ uint8_t horEllipticalConfidence;
+ /**< Horizontal elliptical uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Horizontal Reliability */
+ uint8_t horReliability_valid; /**< Must be set to true if horReliability is being passed */
+ qmiLocReliabilityEnumT_v02 horReliability;
+ /**< Specifies the reliability of the horizontal position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Horizontal Speed */
+ uint8_t horSpeed_valid; /**< Must be set to true if horSpeed is being passed */
+ float horSpeed;
+ /**< Horizontal speed.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Horizontal Speed Uncertainty */
+ uint8_t horSpeedUnc_valid; /**< Must be set to true if horSpeedUnc is being passed */
+ float horSpeedUnc;
+ /**< Horizontal speed uncertainty. \n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Altitude With Respect to Sea Level */
+ uint8_t altitudeWrtMeanSeaLevel_valid; /**< Must be set to true if altitudeWrtMeanSeaLevel is being passed */
+ float altitudeWrtMeanSeaLevel;
+ /**< Altitude with respect to mean sea level. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical uncertainty confidence. \n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Vertical Reliability */
+ uint8_t vertReliability_valid; /**< Must be set to true if vertReliability is being passed */
+ qmiLocReliabilityEnumT_v02 vertReliability;
+ /**< Specifies the reliability of the vertical position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Vertical Speed */
+ uint8_t vertSpeed_valid; /**< Must be set to true if vertSpeed is being passed */
+ float vertSpeed;
+ /**< - Units -- Meters per second */
+
+ /* Optional */
+ /* Vertical Speed Uncertainty */
+ uint8_t vertSpeedUnc_valid; /**< Must be set to true if vertSpeedUnc is being passed */
+ float vertSpeedUnc;
+ /**< - Units -- Meters per second */
+
+ /* Optional */
+ /* Heading */
+ uint8_t heading_valid; /**< Must be set to true if heading is being passed */
+ float heading;
+ /**< - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ /* Optional */
+ /* Heading Uncertainty */
+ uint8_t headingUnc_valid; /**< Must be set to true if headingUnc is being passed */
+ float headingUnc;
+ /**< - Type -- Floating point \n
+ - Range -- 0 to 359.999 */
+
+ /* Optional */
+ /* Magnetic Deviation */
+ uint8_t magneticDeviation_valid; /**< Must be set to true if magneticDeviation is being passed */
+ float magneticDeviation;
+ /**< Difference between the bearing to true north and the bearing shown
+ on a magnetic compass. The deviation is positive when the magnetic
+ north is east of true north. */
+
+ /* Optional */
+ /* Technology Used Mask */
+ uint8_t technologyMask_valid; /**< Must be set to true if technologyMask is being passed */
+ qmiLocPosTechMaskT_v02 technologyMask;
+ /**< Technology used in computing this fix.
+ Valid bitmasks: \n
+ - QMI_LOC_POS_TECH_MASK_SATELLITE (0x00000001) -- Satellites were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_CELLID (0x00000002) -- Cell towers were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_WIFI (0x00000004) -- Wi-Fi access points were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_SENSORS (0x00000008) -- Sensors were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_REFERENCE_LOCATION (0x00000010) -- Reference location was used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION (0x00000020) -- Coarse position injected into the location engine was used to
+ generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_AFLT (0x00000040) -- AFLT was used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_HYBRID (0x00000080) -- GNSS and network-provided measurements were used to
+ generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_DRE (0x00000100) -- Dead reckoning engine (DRE) was used to generate the fix.
+ */
+
+ /* Optional */
+ /* Dilution of Precision */
+ uint8_t DOP_valid; /**< Must be set to true if DOP is being passed */
+ qmiLocDOPStructT_v02 DOP;
+
+ /* Optional */
+ /* GPS Time */
+ uint8_t gpsTime_valid; /**< Must be set to true if gpsTime is being passed */
+ qmiLocGPSTimeStructT_v02 gpsTime;
+
+ /* Optional */
+ /* Time Source */
+ uint8_t timeSrc_valid; /**< Must be set to true if timeSrc is being passed */
+ qmiLocTimeSourceEnumT_v02 timeSrc;
+ /**< Values: \n
+ - eQMI_LOC_TIME_SRC_INVALID (0) -- Invalid time \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TRANSFER (1) -- Time is set by the 1X system \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TAGGING (2) -- Time is set by WCDMA/GSM time tagging (that is,
+ associating network time with GPS time) \n
+ - eQMI_LOC_TIME_SRC_EXTERNAL_INPUT (3) -- Time is set by an external injection \n
+ - eQMI_LOC_TIME_SRC_TOW_DECODE (4) -- Time is set after decoding over-the-air GPS navigation data
+ from one GPS satellite \n
+ - eQMI_LOC_TIME_SRC_TOW_CONFIRMED (5) -- Time is set after decoding over-the-air GPS navigation data
+ from multiple satellites \n
+ - eQMI_LOC_TIME_SRC_TOW_AND_WEEK_CONFIRMED (6) -- Both time of the week and the GPS week number are known \n
+ - eQMI_LOC_TIME_SRC_NAV_SOLUTION (7) -- Time is set by the position engine after the fix is obtained \n
+ - eQMI_LOC_TIME_SRC_SOLVE_FOR_TIME (8) -- Time is set by the position engine after performing SFT;
+ this is done when the clock time uncertainty is large \n
+ - eQMI_LOC_TIME_SRC_GLO_TOW_DECODE (9) -- Time is set after decoding GLO satellites \n
+ - eQMI_LOC_TIME_SRC_TIME_TRANSFORM (10) -- Time is set after transforming the GPS to GLO time \n
+ - eQMI_LOC_TIME_SRC_WCDMA_SLEEP_TIME_TAGGING (11) -- Time is set by the sleep time tag provided by the WCDMA network \n
+ - eQMI_LOC_TIME_SRC_GSM_SLEEP_TIME_TAGGING (12) -- Time is set by the sleep time tag provided by the GSM network \n
+ - eQMI_LOC_TIME_SRC_UNKNOWN (13) -- Source of the time is unknown \n
+ - eQMI_LOC_TIME_SRC_SYSTEM_TIMETICK (14) -- Time is derived from the system clock (better known as the slow clock);
+ GNSS time is maintained irrespective of the GNSS receiver state \n
+ - eQMI_LOC_TIME_SRC_QZSS_TOW_DECODE (15) -- Time is set after decoding QZSS satellites \n
+ - eQMI_LOC_TIME_SRC_BDS_TOW_DECODE (16) -- Time is set after decoding BDS satellites \n
+ - eQMI_LOC_TIME_SRC_GAL_TOW_DECODE (17) -- Time is set after decoding Galileo satellites \n
+ - eQMI_LOC_TIME_SRC_NAVIC_TOW_DECODE (18) -- Time is set after decoding NavIC satellites
+ */
+
+ /* Optional */
+ /* Sensor Data Usage */
+ uint8_t sensorDataUsage_valid; /**< Must be set to true if sensorDataUsage is being passed */
+ qmiLocSensorUsageIndicatorStructT_v02 sensorDataUsage;
+
+ /* Optional */
+ /* SVs Used to Calculate the Fix */
+ uint8_t gnssSvUsedList_valid; /**< Must be set to true if gnssSvUsedList is being passed */
+ uint32_t gnssSvUsedList_len; /**< Must be set to # of elements in gnssSvUsedList */
+ uint16_t gnssSvUsedList[QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02];
+ /**< Each entry in the list contains the SV ID of a satellite
+ used for calculating this position report. The following
+ information is associated with each SV ID: \n
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - SBAS -- 120 to 158 and 183 to 191 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Extended Dilution of Precision */
+ uint8_t extDOP_valid; /**< Must be set to true if extDOP is being passed */
+ qmiLocExtDOPStructT_v02 extDOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* Spoof Report */
+ uint8_t spoofReportMask_valid; /**< Must be set to true if spoofReportMask is being passed */
+ qmiLocSpoofMaskT_v02 spoofReportMask;
+ /**< The set bit indicates the domain that is suspected to be spoofed. \n
+ - QMI_LOC_POSITION_SPOOFED (0x00000001) -- Position \n
+ - QMI_LOC_TIME_SPOOFED (0x00000002) -- Time \n
+ - QMI_LOC_NAVIGATION_DATA_SPOOFED (0x00000004) -- Navigation data
+ */
+
+ /* Optional */
+ /* Expanded SVs Used to Calculate the Fix */
+ uint8_t expandedGnssSvUsedList_valid; /**< Must be set to true if expandedGnssSvUsedList is being passed */
+ uint32_t expandedGnssSvUsedList_len; /**< Must be set to # of elements in expandedGnssSvUsedList */
+ uint16_t expandedGnssSvUsedList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< If the service reports expandedGnssSvUsedList, gnssSvUsedList is
+ not reported. Each entry in the list contains the SV ID of a satellite
+ used to calculate this position report. The following
+ information is associated with each SV ID. \n
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Satellite Signal Types in the SVs Used List */
+ uint8_t gnssSvUsedSignalTypeList_valid; /**< Must be set to true if gnssSvUsedSignalTypeList is being passed */
+ uint32_t gnssSvUsedSignalTypeList_len; /**< Must be set to # of elements in gnssSvUsedSignalTypeList */
+ qmiLocGnssSignalTypeMaskT_v02 gnssSvUsedSignalTypeList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the signal type of each satellite in expandedGnssSvUsedList. The
+ signal type list is aligned with the SVs in expandedGnssSvUsedList. Value 0
+ means invalid.\n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band */
+}qmiLocGetBestAvailablePositionIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCMOTIONSTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_MOTION_STATE_UNKNOWN_V02 = 0, /**< Device state is not known \n */
+ eQMI_LOC_MOTION_STATE_STATIONARY_V02 = 1, /**< Device state is Stationary \n */
+ eQMI_LOC_MOTION_STATE_IN_MOTION_V02 = 2, /**< Device state is In Motion */
+ QMILOCMOTIONSTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocMotionStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCMOTIONMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_MOTION_MODE_UNKNOWN_V02 = 0, /**< Device movement is not known */
+ eQMI_LOC_MOTION_MODE_STATIONARY_V02 = 1, /**< Device is not moving */
+ eQMI_LOC_MOTION_MODE_PEDESTRIAN_UNKNOWN_V02 = 200, /**< Device movement is in Pedestrian mode; nothing else is known about the movement */
+ eQMI_LOC_MOTION_MODE_PEDESTRIAN_WALKING_V02 = 201, /**< Device movement is in pedestrian Walking mode */
+ eQMI_LOC_MOTION_MODE_PEDESTRIAN_RUNNING_V02 = 202, /**< Device movement is in pedestrian Running mode */
+ eQMI_LOC_MOTION_MODE_VEHICLE_UNKNOWN_V02 = 300, /**< Device movement is in Vehicular mode; nothing else is known about the movement */
+ QMILOCMOTIONMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocMotionModeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocMotionStateEnumT_v02 motion_state;
+ /**< Current motion state of the user.
+ Values: \n
+ - eQMI_LOC_MOTION_STATE_UNKNOWN (0) -- Device state is not known \n
+ - eQMI_LOC_MOTION_STATE_STATIONARY (1) -- Device state is Stationary \n
+ - eQMI_LOC_MOTION_STATE_IN_MOTION (2) -- Device state is In Motion
+ */
+
+ qmiLocMotionModeEnumT_v02 motion_mode;
+ /**< Modes of user motion.
+ Values: \n
+ - eQMI_LOC_MOTION_MODE_UNKNOWN (0) -- Device movement is not known
+ - eQMI_LOC_MOTION_MODE_STATIONARY (1) -- Device is not moving
+ - eQMI_LOC_MOTION_MODE_PEDESTRIAN_UNKNOWN (200) -- Device movement is in Pedestrian mode; nothing else is known about the movement
+ - eQMI_LOC_MOTION_MODE_PEDESTRIAN_WALKING (201) -- Device movement is in pedestrian Walking mode
+ - eQMI_LOC_MOTION_MODE_PEDESTRIAN_RUNNING (202) -- Device movement is in pedestrian Running mode
+ - eQMI_LOC_MOTION_MODE_VEHICLE_UNKNOWN (300) -- Device movement is in Vehicular mode; nothing else is known about the movement
+ */
+
+ float probability_of_state;
+ /**< Probability that the device is actually undergoing the motion state
+ specified by the combination of the values of motion_state, motion_mode,
+ and motion_sub_mode. \vspace{0.1in}
+
+ This value is a floating point number in the range of 0 to 100, in
+ units of percent probability. Any value greater than 99.9999 is
+ applied as 99.9999. \vspace{0.1in}
+
+ It is recommended that if a particular combination of motion_state and
+ motion_mode cannot be determined with more than 50 percent confidence,
+ that a more general statement of user motion be made.
+ For example, if the mode of In-Motion + Pedestrian-Running can only be
+ determined with 50 percent probability, and the simpler statement of In-Motion
+ can be determined with 90 percent probability, it is recommended that this field
+ be used to simply state In-Motion with 90 percent probability. \vspace{0.1in}
+
+ If the motion_state is not known, the value in this field is not used.
+ */
+
+ uint16_t age;
+ /**< Age of the motion data in milliseconds at the time of injection.
+ */
+
+ uint16_t timeout;
+ /**< If the age of the motion data input exceeds the timeout value, the data
+ is no longer used. The timeout value is in units of milliseconds.
+ Values in the range of 0 to 10000 are accepted. If 65535 is provided,
+ the motion data input is applied until the next input is
+ received. \n
+
+ If the determination of motion data is an instantaneous observation
+ and no notice is guaranteed via the QMI on a change in the
+ state of the motion data, it is recommended to set this field to 0. \vspace{0.1in}
+
+ If the determination of motion data is continuously monitored
+ external to the QMI and an update is always applied to the QMI upon any
+ change in state, a value of 65535 is used for this field.
+ In this case, if a certain mode is set and is not later
+ unset (for example, by sending in the request message with a user motion
+ state of Unknown), the value is applied indefinitely.
+ */
+}qmiLocMotionDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects motion data for MSM GPS service use. */
+typedef struct {
+
+ /* Mandatory */
+ /* Motion Data */
+ qmiLocMotionDataStructT_v02 motion_data;
+}qmiLocInjectMotionDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects motion data for MSM GPS service use. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Motion Data Request Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Motion Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectMotionDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to retrieve the list of network
+ initiated Geofence IDs. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The same transaction ID
+ is returned in the QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND indication. */
+}qmiLocGetNiGeofenceIdListReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to retrieve the list of network
+ initiated Geofence IDs. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get NI Geofence ID List Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get NI Geofence ID List request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the Get NI
+ Geofence ID List request. */
+
+ /* Optional */
+ /* NI Geofence ID List */
+ uint8_t niGeofenceIdList_valid; /**< Must be set to true if niGeofenceIdList is being passed */
+ uint32_t niGeofenceIdList_len; /**< Must be set to # of elements in niGeofenceIdList */
+ uint32_t niGeofenceIdList[QMI_LOC_MAX_NI_GEOFENCE_ID_LIST_LENGTH_V02];
+ /**< List containing the NI Geofence IDs. \n
+ - Type -- Array of unsigned 32-bit integers \n
+ - Maximum NI Geofence ID list length -- 16 */
+}qmiLocGetNiGeofenceIdListIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t MCC;
+ /**< GSM mobile country code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+
+ uint32_t MNC;
+ /**< GSM mobile network code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+
+ uint32_t LAC;
+ /**< GSM location area code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+
+ uint32_t CID;
+ /**< GSM cell identification. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+}qmiLocGSMCellIdStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects GSM cell information into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* GSM Cell ID */
+ qmiLocGSMCellIdStructT_v02 gsmCellId;
+ /**< \vspace{0.06in} \n Identifies the GSM cell on which the device is camped. */
+
+ /* Mandatory */
+ /* Roaming Status */
+ uint8_t roamingStatus;
+ /**< Indicates whether the device is roaming.
+ - 0x01 (TRUE) -- Device is roaming
+ - 0x00 (FALSE) -- Device is not roaming
+ */
+
+ /* Optional */
+ /* Timing Advance */
+ uint8_t timingAdvance_valid; /**< Must be set to true if timingAdvance is being passed */
+ uint32_t timingAdvance;
+ /**< Round trip delay between the MS and the BS, in units of 3.69 microseconds.
+ Refer to 3GPP \hyperref[TS 05.10]{TS 05.10} and \hyperref[TS 45.010]{TS 45.010}. */
+}qmiLocInjectGSMCellInfoReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects GSM cell information into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject GSM Cell Info Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject GSM Cell Info request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectGSMCellInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCROAMINGSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_PHONE_NOT_ROAMING_V02 = 1, /**< Modem is camped on a home network \n */
+ eQMI_LOC_PHONE_ROAMING_V02 = 2, /**< Modem is camped on a roaming network */
+ QMILOCROAMINGSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocRoamingStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t mcc;
+ /**< WCDMA mobile country code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+
+ uint32_t mnc;
+ /**< WCDMA mobile network code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+
+ uint32_t cid;
+ /**< WCDMA cell identity. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+}qmiLocWCDMACellIdStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects WCDMA cell information into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* WCDMA Cell ID */
+ qmiLocWCDMACellIdStructT_v02 wcdmaCellId;
+ /**< \n Identifies the WCDMA cell on which the device is camped. */
+
+ /* Mandatory */
+ /* Roaming Status */
+ qmiLocRoamingStatusEnumT_v02 roamingStatus;
+ /**< Indicates whether the device is roaming.
+ Values: \n
+ - eQMI_LOC_PHONE_NOT_ROAMING (1) -- Modem is camped on a home network \n
+ - eQMI_LOC_PHONE_ROAMING (2) -- Modem is camped on a roaming network
+ */
+
+ /* Optional */
+ /* Cell Frequency */
+ uint8_t freq_valid; /**< Must be set to true if freq is being passed */
+ uint32_t freq;
+ /**< Frequency information of the serving cell. \n
+ - Valid range -- 0 to 16383 \n
+ Refer to 3GPP \hyperref[TS 25.331]{TS 25.331}. */
+
+ /* Optional */
+ /* Primary Scrambling Code */
+ uint8_t psc_valid; /**< Must be set to true if psc is being passed */
+ uint32_t psc;
+ /**< Primary scrambling code of the serving cell. \n
+ - Valid range -- 0 to 511 \n
+ Refer to 3GPP \hyperref[TS 25.331]{TS 25.331}. */
+}qmiLocInjectWCDMACellInfoReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects WCDMA cell information into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject WCDMA Cell Info Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject WCDMA Cell Info request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectWCDMACellInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t mcc;
+ /**< TDSCDMA mobile country code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+
+ uint32_t mnc;
+ /**< TDSCDMA mobile network code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+
+ uint32_t cid;
+ /**< TDSCDMA cell identity. Refer to 3GPP \hyperref[TS 25.331]{TS 25.331}. */
+
+ uint32_t lac;
+ /**< TDSCDMA location area code. Refer to \hyperref[ITU-T E.212]{ITU-T E.212}. */
+}qmiLocTDSCDMACellIdStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects TDSCDMA cell information into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* TDSCDMA Cell ID */
+ qmiLocTDSCDMACellIdStructT_v02 tdscdmaCellId;
+ /**< \n Identifies the TDSCDMA cell on which the device is camped. */
+
+ /* Mandatory */
+ /* Roaming Status */
+ qmiLocRoamingStatusEnumT_v02 roamingStatus;
+ /**< Indicates whether the device is roaming.
+ Values: \n
+ - eQMI_LOC_PHONE_NOT_ROAMING (1) -- Modem is camped on a home network \n
+ - eQMI_LOC_PHONE_ROAMING (2) -- Modem is camped on a roaming network
+ */
+
+ /* Optional */
+ /* Cell Frequency */
+ uint8_t freq_valid; /**< Must be set to true if freq is being passed */
+ uint32_t freq;
+ /**< Frequency information of the serving cell. \n
+ - Valid range -- 0 to 16383 \n
+ Refer to 3GPP \hyperref[TS 25.331]{TS 25.331}. */
+}qmiLocInjectTDSCDMACellInfoReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects TDSCDMA cell information into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject TDSCDMA Cell Info Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject TDSCDMA Cell Info request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectTDSCDMACellInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects the subscriber ID of the phone into the location engine. */
+typedef struct {
+
+ /* Optional */
+ /* Preferred IMSI */
+ uint8_t preferredIMSI_valid; /**< Must be set to true if preferredIMSI is being passed */
+ uint64_t preferredIMSI;
+ /**< IMSI number of the preferred RAT; refer to \hyperref[ITU-T E.212]{ITU-T E.212}.*/
+
+ /* Optional */
+ /* Preferred MSISDN */
+ uint8_t preferredMSISDN_valid; /**< Must be set to true if preferredMSISDN is being passed */
+ uint64_t preferredMSISDN;
+ /**< MSISDN number of the preferred RAT; refer to \hyperref[ITU-T E.212]{ITU-T E.212}.*/
+}qmiLocInjectSubscriberIDReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects the subscriber ID of the phone into the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Subscriber ID Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Subscriber ID request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectSubscriberIDIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCINJECTEDNETWORKINITIATEDMESSAGETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_INJECTED_NETWORK_INITIATED_MESSAGE_TYPE_SUPL_V02 = 0, /**< SUPL network-initiated message is being injected. */
+ QMILOCINJECTEDNETWORKINITIATEDMESSAGETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocInjectedNetworkInitiatedMessageTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects a network-initiated message into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Injected Network Initiated Message Type */
+ qmiLocInjectedNetworkInitiatedMessageTypeEnumT_v02 injectedNIMessageType;
+ /**< Type of the network-initiated message being injected.
+ Values: \n
+ - eQMI_LOC_INJECTED_NETWORK_INITIATED_MESSAGE_TYPE_SUPL (0) -- SUPL network-initiated message is being injected. */
+
+ /* Mandatory */
+ /* Injected Network Initiated Message */
+ uint32_t injectedNIMessage_len; /**< Must be set to # of elements in injectedNIMessage */
+ uint8_t injectedNIMessage[QMI_LOC_MAX_INJECTED_NETWORK_INITIATED_MESSAGE_LENGTH_V02];
+ /**< Network-initiated message body.
+ If the inject NI message type is TYPE_SUPL, the message contains
+ a SUPL INIT message as defined in OMA-TS-ULP-V2_\hyperref[020110527C]{0-20110527-C}. */
+}qmiLocInjectNetworkInitiatedMessageReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects a network-initiated message into the location
+ engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Network Initiated Message Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Network Initiated Message request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectNetworkInitiatedMessageIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Notifies the location engine that the device is out of
+ service. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocWWANOutOfServiceNotificationReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the location engine that the device is out of
+ service. */
+typedef struct {
+
+ /* Mandatory */
+ /* Notify WWAN Out of Service Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Notify WWAN Out of Service request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocWWANOutOfServiceNotificationIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject pedometer data
+ into the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Time Source */
+ qmiLocSensorDataTimeSourceEnumT_v02 timeSource;
+ /**< Time source for the pedometer. The location service uses
+ this field to identify the time reference used in the
+ pedometer data time stamp.
+ Values: \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_UNSPECIFIED (0) -- Sensor time source is unspecified \n
+ - eQMI_LOC_SENSOR_TIME_SOURCE_COMMON (1) -- Time source is common between the sensors and
+ the location engine
+ */
+
+ /* Mandatory */
+ /* Pedometer Report Timestamp */
+ uint32_t timestamp;
+ /**< Time stamp of the last step event in this report, that is, the time stamp
+ of the step event that caused this report to be generated.
+ The time stamp is in the time reference scale
+ used by the pedometer time source. \n
+ - Units -- Milliseconds */
+
+ /* Mandatory */
+ /* Time Interval */
+ uint32_t timeInterval;
+ /**< Time interval during which the step count was calculated. Subtracting
+ timeInterval from the timestamp field yields the time when
+ the step detection for the first step in this report started. \n
+ - Units -- Milliseconds */
+
+ /* Mandatory */
+ /* Step Count */
+ uint32_t stepCount;
+ /**< Number of steps counted during the time interval. */
+
+ /* Optional */
+ /* Step Confidence */
+ uint8_t stepConfidence_valid; /**< Must be set to true if stepConfidence is being passed */
+ uint8_t stepConfidence;
+ /**< Confidence associated with the step. This field is only applicable
+ for a single step report, that is, if the step count is one. \n
+ - Range -- 0 to 100 \n
+ \textbf{Note:} The report is ignored if confidence is 0. */
+
+ /* Optional */
+ /* Step Count Uncertainty */
+ uint8_t stepCountUncertainty_valid; /**< Must be set to true if stepCountUncertainty is being passed */
+ float stepCountUncertainty;
+ /**< Uncertainty (in steps) associated with the step count. */
+
+ /* Optional */
+ /* Step Rate */
+ uint8_t stepRate_valid; /**< Must be set to true if stepRate is being passed */
+ float stepRate;
+ /**< Current estimate for the rate of steps per second. \n
+ - Units -- steps per second \n
+ - Range -- >= 0.0 */
+}qmiLocPedometerReportReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject pedometer data
+ into the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of Pedometer Report Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Pedometer Report request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocPedometerReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCBATCHINGTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_LOCATION_BATCHING_V02 = 1, /**< Location batching (default) \n */
+ eQMI_LOC_OUTDOOR_TRIP_BATCHING_V02 = 2, /**< Outdoor trip batching */
+ QMILOCBATCHINGTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocBatchingTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the batching size. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction; the QMI_LOC_GET_BATCH_SIZE_IND
+ indication returns the transaction ID. */
+
+ /* Mandatory */
+ /* Requested Batch Size */
+ uint32_t batchSize;
+ /**< Request the service with the number of location fixes to batch. */
+
+ /* Optional */
+ /* Batching Type */
+ uint8_t batchType_valid; /**< Must be set to true if batchType is being passed */
+ qmiLocBatchingTypeEnumT_v02 batchType;
+ /**< Identifies the batching type.
+ Values: \n
+ - eQMI_LOC_LOCATION_BATCHING (1) -- Location batching (default) \n
+ - eQMI_LOC_OUTDOOR_TRIP_BATCHING (2) -- Outdoor trip batching
+ */
+}qmiLocGetBatchSizeReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the batching size. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Batch Size Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_BATCH_SIZE_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the QMI_LOC_GET_BATCH_SIZE_REQ request.
+ */
+
+ /* Mandatory */
+ /* Batch Size Supported */
+ uint32_t batchSize;
+ /**< Number of location fixes that the service is able to batch.
+ The batch size value is returned as 0 in the case of a failure status.
+ */
+}qmiLocGetBatchSizeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to initiate a location batching session. */
+typedef struct {
+
+ /* Optional */
+ /* Minimum Interval Between Position Reports */
+ uint8_t minInterval_valid; /**< Must be set to true if minInterval is being passed */
+ uint32_t minInterval;
+ /**< Minimum time interval, specified by the control point, that must elapse between
+ position reports. \n
+ - Units -- milliseconds \n
+ - Default -- 60000 ms
+ */
+
+ /* Optional */
+ /* Horizontal Accuracy Level */
+ uint8_t horizontalAccuracyLevel_valid; /**< Must be set to true if horizontalAccuracyLevel is being passed */
+ qmiLocAccuracyLevelEnumT_v02 horizontalAccuracyLevel;
+ /**< Specifies the horizontal accuracy level required by the control point.
+ If not specified, accuracy defaults to low.
+ Values: \n
+ - eQMI_LOC_ACCURACY_LOW (1) -- Low accuracy \n
+ - eQMI_LOC_ACCURACY_MED (2) -- Medium accuracy \n
+ - eQMI_LOC_ACCURACY_HIGH (3) -- High accuracy
+ */
+
+ /* Optional */
+ /* Fix Session Timeout Period */
+ uint8_t fixSessionTimeout_valid; /**< Must be set to true if fixSessionTimeout is being passed */
+ uint32_t fixSessionTimeout;
+ /**< Configures the fix session timeout duration. \n
+ - Units -- Milliseconds \n
+ - Default -- 20,000 ms
+ */
+
+ /* Optional */
+ /* Minimum Distance */
+ uint8_t minDistance_valid; /**< Must be set to true if minDistance is being passed */
+ uint32_t minDistance;
+ /**< Specifies the minimum distance to traverse before a
+ position is batched.
+ If no distance is specified, the positions are batched after
+ the minInterval period expires. If both minInterval and minDistance are
+ specified, the position are batched only after minInterval has
+ expired and minDistance has been traversed. \n
+ - Units -- Meters
+ */
+
+ /* Optional */
+ /* Batch All Positions */
+ uint8_t batchAllPos_valid; /**< Must be set to true if batchAllPos is being passed */
+ uint8_t batchAllPos;
+ /**< Values: \n
+ - TRUE -- All positions that are available must be batched. For example,
+ if any other type of positioning is active (such as 1 Hz tracking), all
+ positions computed for that use case are also batched. This can
+ result in the BATCH_FULL indication getting generated earlier. \n
+ - FALSE -- Only positions that meet the time and/or distance criteria are batched
+ (default).
+ */
+
+ /* Optional */
+ /* Request ID */
+ uint8_t requestId_valid; /**< Must be set to true if requestId is being passed */
+ uint32_t requestId;
+ /**< Identifies the request; a batching client can start multiple batching
+ requests with different batching parameters,
+ however, positions corresponding to all requests from the same client are
+ batched in the same buffer. A request ID value of 0 is considered invalid. \n
+ - Valid values -- 0x01 -- 0xFFFFFFFF
+ */
+}qmiLocStartBatchingReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to initiate a location batching session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Start Batching Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Start Batching request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Request ID */
+ uint8_t requestId_valid; /**< Must be set to true if requestId is being passed */
+ uint32_t requestId;
+ /**< Identifies the request. A batching client can start multiple batching
+ requests with different batching parameters, however, positions
+ corresponding to all requests from the same client are
+ batched in the same buffer. \n
+ - Valid values -- -0x01 - 0xFFFFFFFF
+ */
+}qmiLocStartBatchingIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used to notify the control point that the batched buffer is full. */
+typedef struct {
+
+ /* Mandatory */
+ /* Number of Entries in the Batch During Full Event */
+ uint32_t batchCount;
+ /**< Number of entries in the batch during a full event.
+ */
+
+ /* Optional */
+ /* Batching Type */
+ uint8_t batchType_valid; /**< Must be set to true if batchType is being passed */
+ qmiLocBatchingTypeEnumT_v02 batchType;
+ /**< Identifies the batching type.
+ Values: \n
+ - eQMI_LOC_LOCATION_BATCHING (1) -- Location batching (default) \n
+ - eQMI_LOC_OUTDOOR_TRIP_BATCHING (2) -- Outdoor trip batching
+ */
+
+ /* Optional */
+ /* Accumulated OTB Distance */
+ uint8_t accumulatedDistance_valid; /**< Must be set to true if accumulatedDistance is being passed */
+ uint32_t accumulatedDistance;
+ /**< The accumulated outdoor trip batching (OTB) distance if the batchType is Outdoor Trip. \n
+ - Units -- Meters
+ */
+
+ /* Optional */
+ /* Number of Batched Position Reports */
+ uint8_t batchedPosition_valid; /**< Must be set to true if batchedPosition is being passed */
+ uint32_t batchedPosition;
+ /**< The number of position reports that have been batched from the last
+ QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ.
+ */
+}qmiLocEventBatchFullIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocBatchedReportValidFieldsMaskT_v02;
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_LATITUDE_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000001ull) /**< Latitude field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_LONGITUDE_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000002ull) /**< Longitude field\n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_HOR_CIR_UNC_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000004ull) /**< Horizontal circular uncertainty field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_HOR_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000008ull) /**< Horizontal speed field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_UNC_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000010ull) /**< Speed uncertainty field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_ALT_WRT_ELP_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000020ull) /**< Altitude with respect to ellipsoid field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_VER_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000040ull) /**< Vertical speed field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_HEADING_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000080ull) /**< Heading field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_HEADING_UNC_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000100ull) /**< Heading uncertainty field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_TECH_MASK_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000200ull) /**< Technology source mask field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_TIMESTAMP_UTC_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000400ull) /**< UTC timestamp field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_TIME_UNC_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00000800ull) /**< Time uncertainty field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_MAGNETIC_DEV_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00001000ull) /**< Magnetic deviation field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_VERT_UNC_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00002000ull) /**< Vertical uncertainty field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_HOR_CONF_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00004000ull) /**< Horizontal confidence field \n */
+#define QMI_LOC_BATCHED_REPORT_MASK_VALID_TIMESTAMP_GPS_V02 ((qmiLocBatchedReportValidFieldsMaskT_v02)0x00008000ull) /**< GPS timestamp field */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t fixId;
+ /**< Fix count for the session. The count starts at 0 and increments by one for
+ each successive batched position report for a particular session. */
+
+ qmiLocBatchedReportValidFieldsMaskT_v02 validFields;
+ /**< Mask of valid fields for this fix.
+ Valid bitmasks: \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_LATITUDE (0x00000001) -- Latitude field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_LONGITUDE (0x00000002) -- Longitude field\n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_HOR_CIR_UNC (0x00000004) -- Horizontal circular uncertainty field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_HOR (0x00000008) -- Horizontal speed field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_UNC (0x00000010) -- Speed uncertainty field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_ALT_WRT_ELP (0x00000020) -- Altitude with respect to ellipsoid field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_SPEED_VER (0x00000040) -- Vertical speed field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_HEADING (0x00000080) -- Heading field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_HEADING_UNC (0x00000100) -- Heading uncertainty field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_TECH_MASK (0x00000200) -- Technology source mask field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_TIMESTAMP_UTC (0x00000400) -- UTC timestamp field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_TIME_UNC (0x00000800) -- Time uncertainty field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_MAGNETIC_DEV (0x00001000) -- Magnetic deviation field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_VERT_UNC (0x00002000) -- Vertical uncertainty field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_HOR_CONF (0x00004000) -- Horizontal confidence field \n
+ - QMI_LOC_BATCHED_REPORT_MASK_VALID_TIMESTAMP_GPS (0x00008000) -- GPS timestamp field
+ */
+
+ double latitude;
+ /**< Latitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ double longitude;
+ /**< Longitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude\n
+ - Negative values indicate western longitude
+ */
+
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular).\n
+ - Units -- Meters */
+
+ float speedHorizontal;
+ /**< Horizontal speed.\n
+ - Units -- Meters per second */
+
+ float speedUnc;
+ /**< 3D speed uncertainty.\n
+ - Units -- Meters per second */
+
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid.\n
+ - Units -- Meters \n
+ - Range -- -500 to 15883 */
+
+ float speedVertical;
+ /**< Vertical speed.\n
+ - Units -- Meters per second */
+
+ float heading;
+ /**< Heading.\n
+ - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ float headingUnc;
+ /**< Heading uncertainty.\n
+ - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ qmiLocPosTechMaskT_v02 technologyMask;
+ /**< Technology used in computing this fix.
+ Valid bitmasks: \n
+ - QMI_LOC_POS_TECH_MASK_SATELLITE (0x00000001) -- Satellites were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_CELLID (0x00000002) -- Cell towers were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_WIFI (0x00000004) -- Wi-Fi access points were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_SENSORS (0x00000008) -- Sensors were used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_REFERENCE_LOCATION (0x00000010) -- Reference location was used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION (0x00000020) -- Coarse position injected into the location engine was used to
+ generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_AFLT (0x00000040) -- AFLT was used to generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_HYBRID (0x00000080) -- GNSS and network-provided measurements were used to
+ generate the fix. \n
+ - QMI_LOC_POS_TECH_MASK_DRE (0x00000100) -- Dead reckoning engine (DRE) was used to generate the fix.
+ */
+
+ uint64_t timestampUtc;
+ /**< UTC timestamp. \n
+ - Units -- Milliseconds since Jan. 1, 1970 */
+
+ float timeUnc;
+ /**< - Units -- milliseconds */
+
+ float magneticDeviation;
+ /**< Difference between the bearing to true north and the bearing shown
+ on a magnetic compass. The deviation is positive when the magnetic
+ north is east of true north. */
+
+ float vertUnc;
+ /**< Vertical uncertainty.\n
+ - Units -- Meters */
+
+ uint8_t horConfidence;
+ /**< Horizontal confidence. \n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ qmiLocGPSTimeStructT_v02 gpsTime;
+ /**< Number of weeks since Jan. 5, 1980, and milliseconds into the current week. */
+}qmiLocBatchedReportStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used to notify the control point with the live batched
+ position report. */
+typedef struct {
+
+ /* Mandatory */
+ /* Batched Position Report */
+ qmiLocBatchedReportStructT_v02 liveBatchedReport;
+ /**< \n Live position report that is also batched. */
+}qmiLocEventLiveBatchedPositionReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to retrieve fixes from the batch. */
+typedef struct {
+
+ /* Mandatory */
+ /* Number of Fix Entries to Retrieve from the Batch */
+ uint32_t numberOfEntries;
+ /**< Number of fix entries to retrieve from the batch. \n
+ - Maximum limit -- QMI_LOC_READ_FROM_BATCH_MAX_SIZE.
+ */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The QMI_LOC_READ_FROM_BATCH_IND
+ indication returns the transaction ID. */
+
+ /* Optional */
+ /* Batching Type */
+ uint8_t batchType_valid; /**< Must be set to true if batchType is being passed */
+ qmiLocBatchingTypeEnumT_v02 batchType;
+ /**< Identifies the batching type.
+ Values: \n
+ - eQMI_LOC_LOCATION_BATCHING (1) -- Location batching (default) \n
+ - eQMI_LOC_OUTDOOR_TRIP_BATCHING (2) -- Outdoor trip batching
+ */
+}qmiLocReadFromBatchReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to retrieve fixes from the batch. */
+typedef struct {
+
+ /* Mandatory */
+ /* Read from Batch Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_READ_FROM_BATCH_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the QMI_LOC_READ_FROM_BATCH_REQ
+ request.
+ */
+
+ /* Optional */
+ /* Number of Fix Entries Returned from the Batch */
+ uint8_t numberOfEntries_valid; /**< Must be set to true if numberOfEntries is being passed */
+ uint32_t numberOfEntries;
+ /**< Number of fix entries returned from the batch. */
+
+ /* Optional */
+ /* List of Batched Position Reports Returned */
+ uint8_t batchedReportList_valid; /**< Must be set to true if batchedReportList is being passed */
+ uint32_t batchedReportList_len; /**< Must be set to # of elements in batchedReportList */
+ qmiLocBatchedReportStructT_v02 batchedReportList[QMI_LOC_READ_FROM_BATCH_MAX_SIZE_V02];
+ /**< \n List of fix reports returned from the batch. */
+}qmiLocReadFromBatchIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to stop an ongoing batching session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Transaction ID of the request. */
+
+ /* Optional */
+ /* Request ID */
+ uint8_t requestId_valid; /**< Must be set to true if requestId is being passed */
+ uint32_t requestId;
+ /**< Identifies the location batching request that must be stopped.
+ A location batching client can start multiple batching requests. \n
+ Values: \n
+ - 0x01 -- 0xFFFFFFFF
+ */
+
+ /* Optional */
+ /* Batching Type */
+ uint8_t batchType_valid; /**< Must be set to true if batchType is being passed */
+ qmiLocBatchingTypeEnumT_v02 batchType;
+ /**< Identifies the batching type.
+ Values: \n
+ - eQMI_LOC_LOCATION_BATCHING (1) -- Location batching (default) \n
+ - eQMI_LOC_OUTDOOR_TRIP_BATCHING (2) -- Outdoor trip batching
+ */
+}qmiLocStopBatchingReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to stop an ongoing batching session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Stop Batching Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_STOP_BATCHING_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the QMI_LOC_STOP_BATCHING_REQ request.
+ */
+
+ /* Optional */
+ /* Request ID */
+ uint8_t requestId_valid; /**< Must be set to true if requestId is being passed */
+ uint32_t requestId;
+ /**< Identifies the location batching request that was stopped.
+ A location batching client can start multiple batching requests. \n
+ Values: \n
+ - 0x01 -- 0xFFFFFFFF
+ */
+}qmiLocStopBatchingIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to release the batching buffer. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. */
+
+ /* Optional */
+ /* Batching Type */
+ uint8_t batchType_valid; /**< Must be set to true if batchType is being passed */
+ qmiLocBatchingTypeEnumT_v02 batchType;
+ /**< Identifies the batching type.
+ Values: \n
+ - eQMI_LOC_LOCATION_BATCHING (1) -- Location batching (default) \n
+ - eQMI_LOC_OUTDOOR_TRIP_BATCHING (2) -- Outdoor trip batching
+ */
+}qmiLocReleaseBatchReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to release the batching buffer. */
+typedef struct {
+
+ /* Mandatory */
+ /* Release Batch Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_RELEASE_BATCH_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Transaction ID specified in the QMI_LOC_RELEASE_BATCH_REQ request.
+ */
+}qmiLocReleaseBatchIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to inject Wi-Fi AP data. */
+typedef struct {
+
+ /* Optional */
+ /* E911 Mode */
+ uint8_t e911Mode_valid; /**< Must be set to true if e911Mode is being passed */
+ uint8_t e911Mode;
+ /**< Indicates whether the GPS engine is in E911 mode when this
+ indication is sent to the client.
+ Values: \n
+ - 0x01 (TRUE) -- GPS engine is in E911 mode \n
+ - 0x00 (FALSE) -- GPS engine is not in E911 mode
+ */
+}qmiLocEventInjectWifiApDataReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWIFIAPDATADEVICETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WIFI_AP_DATA_DEVICE_TYPE_WLAN_802_11_A_V02 = 0, /**< Wi-Fi AP device is 802.11a. \n */
+ eQMI_LOC_WIFI_AP_DATA_DEVICE_TYPE_WLAN_802_11_B_V02 = 1, /**< Wi-Fi AP device is 802.11b. \n */
+ eQMI_LOC_WIFI_AP_DATA_DEVICE_TYPE_WLAN_802_11_G_V02 = 2, /**< Wi-Fi AP device is 802.11g. */
+ QMILOCWIFIAPDATADEVICETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWifiApDataDeviceTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWIFIAPDATARTDUNITTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_MICROSEC_V02 = 0, /**< Wi-Fi AP data Round-trip Delay (RTD) is in microseconds. \n */
+ eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_HUNDREDS_OF_NANOSEC_V02 = 1, /**< Wi-Fi AP data RTD is in hundreds of nanoseconds. \n */
+ eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_TENS_OF_NANOSEC_V02 = 2, /**< Wi-Fi AP data RTD is in tens of nanoseconds. \n */
+ eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_NANOSEC_V02 = 3, /**< Wi-Fi AP data RTD is in nanoseconds. \n */
+ eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_TENTH_OF_NANOSEC_V02 = 4, /**< Wi-Fi AP data RTD is in tenths of nanoseconds. */
+ QMILOCWIFIAPDATARTDUNITTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWifiApDataRtdUnitTypeEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocWifiApDataMaskT_v02;
+#define QMI_LOC_WIFI_APDATA_MASK_AP_TRANSMIT_POWER_V02 ((qmiLocWifiApDataMaskT_v02)0x00000001) /**< AP transmit power is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_AP_ANTENNA_GAIN_V02 ((qmiLocWifiApDataMaskT_v02)0x00000002) /**< AP antenna gain is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_AP_SNR_V02 ((qmiLocWifiApDataMaskT_v02)0x00000004) /**< AP signal-to-noise ratio is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_AP_DEVICE_TYPE_V02 ((qmiLocWifiApDataMaskT_v02)0x00000008) /**< AP device type is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_AP_RSSI_V02 ((qmiLocWifiApDataMaskT_v02)0x00000010) /**< AP RSSI is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_AP_CHANNEL_V02 ((qmiLocWifiApDataMaskT_v02)0x00000020) /**< AP channel is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_AP_ROUNDTRIP_DELAY_V02 ((qmiLocWifiApDataMaskT_v02)0x00000040) /**< AP roundtrip delay is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_AP_ROUNDTRIP_DELAY_ACCURACY_V02 ((qmiLocWifiApDataMaskT_v02)0x00000080) /**< AP roundtrip delay accuracy is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_MOBILE_SNR_V02 ((qmiLocWifiApDataMaskT_v02)0x00000100) /**< Mobile signal-to-noise ratio is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_MOBILE_RSSI_V02 ((qmiLocWifiApDataMaskT_v02)0x00000200) /**< Mobile RSSI is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_RSSI_TIMESTAMP_V02 ((qmiLocWifiApDataMaskT_v02)0x00000400) /**< RSSI timestamp is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_MEASUREMENT_AGE_V02 ((qmiLocWifiApDataMaskT_v02)0x00000800) /**< Measurement age is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_SERVING_AP_V02 ((qmiLocWifiApDataMaskT_v02)0x00001000) /**< Serving access point is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_FREQUENCY_V02 ((qmiLocWifiApDataMaskT_v02)0x00002000) /**< Channel frequency is valid */
+#define QMI_LOC_WIFI_APDATA_MASK_SSID_V02 ((qmiLocWifiApDataMaskT_v02)0x00004000) /**< SSID is valid */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocWifiApDataMaskT_v02 wifiApDataMask;
+ /**< Specifies which Wi-Fi AP scan information types are in use.
+ Values: \n
+ - QMI_LOC_WIFI_APDATA_MASK_AP_TRANSMIT_POWER (0x00000001) -- AP transmit power is valid
+ - QMI_LOC_WIFI_APDATA_MASK_AP_ANTENNA_GAIN (0x00000002) -- AP antenna gain is valid
+ - QMI_LOC_WIFI_APDATA_MASK_AP_SNR (0x00000004) -- AP signal-to-noise ratio is valid
+ - QMI_LOC_WIFI_APDATA_MASK_AP_DEVICE_TYPE (0x00000008) -- AP device type is valid
+ - QMI_LOC_WIFI_APDATA_MASK_AP_RSSI (0x00000010) -- AP RSSI is valid
+ - QMI_LOC_WIFI_APDATA_MASK_AP_CHANNEL (0x00000020) -- AP channel is valid
+ - QMI_LOC_WIFI_APDATA_MASK_AP_ROUNDTRIP_DELAY (0x00000040) -- AP roundtrip delay is valid
+ - QMI_LOC_WIFI_APDATA_MASK_AP_ROUNDTRIP_DELAY_ACCURACY (0x00000080) -- AP roundtrip delay accuracy is valid
+ - QMI_LOC_WIFI_APDATA_MASK_MOBILE_SNR (0x00000100) -- Mobile signal-to-noise ratio is valid
+ - QMI_LOC_WIFI_APDATA_MASK_MOBILE_RSSI (0x00000200) -- Mobile RSSI is valid
+ - QMI_LOC_WIFI_APDATA_MASK_RSSI_TIMESTAMP (0x00000400) -- RSSI timestamp is valid
+ - QMI_LOC_WIFI_APDATA_MASK_MEASUREMENT_AGE (0x00000800) -- Measurement age is valid
+ - QMI_LOC_WIFI_APDATA_MASK_SERVING_AP (0x00001000) -- Serving access point is valid
+ - QMI_LOC_WIFI_APDATA_MASK_FREQUENCY (0x00002000) -- Channel frequency is valid
+ - QMI_LOC_WIFI_APDATA_MASK_SSID (0x00004000) -- SSID is valid */
+
+ uint8_t macAddress[QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02];
+ /**< MAC address. \n
+ Each address is of length QMI_LOC_WIFI_MAC_ADDR_LENGTH.
+ */
+
+ int32_t apTransmitPower;
+ /**< AP transmit power in dBm. */
+
+ int32_t apAntennaGain;
+ /**< AP antenna gain in dBI. */
+
+ int32_t apSignalToNoise;
+ /**< AP SNR received at the mobile device. */
+
+ qmiLocWifiApDataDeviceTypeEnumT_v02 apDeviceType;
+ /**< List of AP device types.\n - eQMI_LOC_WIFI_AP_DATA_DEVICE_TYPE_WLAN_802_11_A (0) -- Wi-Fi AP device is 802.11a. \n
+ - eQMI_LOC_WIFI_AP_DATA_DEVICE_TYPE_WLAN_802_11_B (1) -- Wi-Fi AP device is 802.11b. \n
+ - eQMI_LOC_WIFI_AP_DATA_DEVICE_TYPE_WLAN_802_11_G (2) -- Wi-Fi AP device is 802.11g. */
+
+ int32_t apRssi;
+ /**< AP signal strength indicator in dBm. */
+
+ uint16_t apChannel;
+ /**< AP Wi-Fi channel on which a beacon was received. */
+
+ uint32_t apRoundTripDelay;
+ /**< Round trip delay between the mobile device and the AP, in units of
+ apRoundTripDelayUnit. */
+
+ qmiLocWifiApDataRtdUnitTypeEnumT_v02 apRoundTripDelayUnit;
+ /**< Units of apRoundTripDelay and its accuracy; mandatory if apRoundTripDelay
+ is present. \n - eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_MICROSEC (0) -- Wi-Fi AP data Round-trip Delay (RTD) is in microseconds. \n
+ - eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_HUNDREDS_OF_NANOSEC (1) -- Wi-Fi AP data RTD is in hundreds of nanoseconds. \n
+ - eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_TENS_OF_NANOSEC (2) -- Wi-Fi AP data RTD is in tens of nanoseconds. \n
+ - eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_NANOSEC (3) -- Wi-Fi AP data RTD is in nanoseconds. \n
+ - eQMI_LOC_WIFI_AP_DATA_RTD_UNIT_TENTH_OF_NANOSEC (4) -- Wi-Fi AP data RTD is in tenths of nanoseconds. */
+
+ uint8_t apRoundTripDelayAccuracy;
+ /**< AP's accuracy of round trip delay apRoundTripDelay, in units of
+ apRoundTripDelayUnit. */
+
+ int32_t mobileSignalToNoise;
+ /**< Mobile SNR received at the AP. */
+
+ int32_t mobileRssi;
+ /**< Mobile signal strength at the AP. */
+}qmiLocWifiApDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ int64_t rssiTimestamp;
+ /**< Measurement time stamp corresponding to when the beacon was received. \n
+ Units -- Milliseconds*/
+
+ int32_t measAge;
+ /**< Measurements age; -1 means information is not available.\n
+ Units -- Milliseconds */
+
+ uint8_t servingAccessPoint;
+ /**< Indicates whether a set of WLAN-AP measurements
+ were obtained for a serving WLAN-AP (TRUE) or a nonserving WLAN-AP (FALSE).
+ A target device with multiple radio support can indicate more than
+ one type of serving access for the same time instant.*/
+
+ uint32_t channelFrequency;
+ /**< Primary channel frequency.\n
+ Units -- MHz */
+
+ char ssid[QMI_LOC_MAX_WIFI_AP_SSID_STR_LENGTH_V02 + 1];
+ /**< NULL-terminated SSID of the Wi-Fi AP.
+ Its maximum length according to the ASCII standard is 32 octets. */
+
+ int32_t apHighResolutionRssi;
+ /**< AP signal strength indicator in dBm.\n
+ Units -- 0.1 dBm */
+}qmiLocWifiApAdditionalDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWLANAPERRENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WLAN_AP_ERR_UNKNOWN_V02 = 0, /**< Error is unknown \n */
+ eQMI_LOC_WLAN_AP_ERR_NO_REQ_MEAS_AVAILABLE_V02 = 1, /**< None of the requested measurements could be provided \n */
+ eQMI_LOC_WLAN_AP_ERR_WIFI_OFF_V02 = 2, /**< Wi-Fi is off */
+ QMILOCWLANAPERRENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWlanApErrEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects Wi-Fi AP data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Wi-Fi AP Scan Data */
+ uint32_t wifiApInfo_len; /**< Must be set to # of elements in wifiApInfo */
+ qmiLocWifiApDataStructT_v02 wifiApInfo[QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02];
+ /**< \n List of Wi-Fi AP scan information entered by the control point. */
+
+ /* Optional */
+ /* Failure Reason for WLAN-AP Measurements Not Available */
+ uint8_t errorCause_valid; /**< Must be set to true if errorCause is being passed */
+ qmiLocWlanApErrEnumT_v02 errorCause;
+ /**< If WLAN-AP measurements are not available,
+ indicate the reason for the error/failure.
+ This field is not present when WLAN-AP measurements are available.
+ Values: \n
+ - eQMI_LOC_WLAN_AP_ERR_UNKNOWN (0) -- Error is unknown \n
+ - eQMI_LOC_WLAN_AP_ERR_NO_REQ_MEAS_AVAILABLE (1) -- None of the requested measurements could be provided \n
+ - eQMI_LOC_WLAN_AP_ERR_WIFI_OFF (2) -- Wi-Fi is off */
+
+ /* Optional */
+ /* Scan Request Timestamp */
+ uint8_t requestTimestamp_valid; /**< Must be set to true if requestTimestamp is being passed */
+ int64_t requestTimestamp;
+ /**< UTC timestamp at which the scan was requested. \n
+ - Units -- Milliseconds */
+
+ /* Optional */
+ /* Scan Receive Timestamp */
+ uint8_t receiveTimestamp_valid; /**< Must be set to true if receiveTimestamp is being passed */
+ int64_t receiveTimestamp;
+ /**< UTC timestamp at which the scan was received. \n
+ - Units -- Milliseconds */
+
+ /* Optional */
+ /* Free Scan or On-Demand Scan */
+ uint8_t onDemandScan_valid; /**< Must be set to true if onDemandScan is being passed */
+ uint8_t onDemandScan;
+ /**< Indicates whether the modem requested this scan.\n
+ - 0x00 (FALSE) -- The Wi-Fi AP data injection was not requested by the modem (free scan).\n
+ - 0x01 (TRUE) -- The Wi-Fi AP data injection was requested by the modem (0n-demand scan).
+ */
+
+ /* Optional */
+ /* Wi-Fi AP Additional Measurements Scan Data */
+ uint8_t wifiApInfoA_valid; /**< Must be set to true if wifiApInfoA is being passed */
+ uint32_t wifiApInfoA_len; /**< Must be set to # of elements in wifiApInfoA */
+ qmiLocWifiApAdditionalDataStructT_v02 wifiApInfoA[QMI_LOC_WIFI_MAX_REPORTED_APS_PER_MSG_V02];
+ /**< \n List of Wi-Fi AP additional measurements scan information entered by the control point.
+ The order and the number of additional measurements must be the same as wifiApInfo. */
+
+ /* Optional */
+ /* UE Wi-Fi Mac Address */
+ uint8_t ueMacAddress_valid; /**< Must be set to true if ueMacAddress is being passed */
+ uint8_t ueMacAddress[QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02];
+ /**< Wi-Fi MAC address of the UE. \n
+ Address is of length QMI_LOC_WIFI_MAC_ADDR_LENGTH.
+ */
+}qmiLocInjectWifiApDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects Wi-Fi AP data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Wi-Fi AP Scan Information Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Wi-Fi AP Scan Information request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectWifiApDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWIFIACCESSPOINTATTACHSTATESENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WIFI_ACCESS_POINT_ATTACHED_V02 = 0, /**< Attached to an access point \n */
+ eQMI_LOC_WIFI_ACCESS_POINT_DETACHED_V02 = 1, /**< Detached from an access point \n */
+ eQMI_LOC_WIFI_ACCESS_POINT_HANDOVER_V02 = 2, /**< Handed over to another access point */
+ QMILOCWIFIACCESSPOINTATTACHSTATESENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWifiAccessPointAttachStatesEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject the Wi-Fi attachment status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Attach State */
+ qmiLocWifiAccessPointAttachStatesEnumT_v02 attachState;
+ /**< Wi-Fi access point attach state.
+ Values: \n
+ - eQMI_LOC_WIFI_ACCESS_POINT_ATTACHED (0) -- Attached to an access point \n
+ - eQMI_LOC_WIFI_ACCESS_POINT_DETACHED (1) -- Detached from an access point \n
+ - eQMI_LOC_WIFI_ACCESS_POINT_HANDOVER (2) -- Handed over to another access point */
+
+ /* Optional */
+ /* Access Point MAC Address */
+ uint8_t accessPointMacAddress_valid; /**< Must be set to true if accessPointMacAddress is being passed */
+ uint8_t accessPointMacAddress[QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02];
+ /**< MAC address of the access point to which the Wi-Fi is attached.
+ This must always be specified if the attach state is Handover.
+ */
+
+ /* Optional */
+ /* Wi-Fi AP SSID String */
+ uint8_t wifiApSsid_valid; /**< Must be set to true if wifiApSsid is being passed */
+ char wifiApSsid[QMI_LOC_MAX_WIFI_AP_SSID_STR_LENGTH_V02 + 1];
+ /**< The NULL-terminated SSID of the Wi-Fi AP. Its maximum length according to the ASCII standard is 32 octets. */
+}qmiLocNotifyWifiAttachmentStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject the Wi-Fi attachment status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of Wi-Fi Attachment Status Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of Wi-Fi Attachment Status request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocNotifyWifiAttachmentStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCWIFIENABLEDSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_WIFI_ENABLED_FALSE_V02 = 0, /**< Wi-Fi is disabled on the device \n */
+ eQMI_LOC_WIFI_ENABLED_TRUE_V02 = 1, /**< Wi-Fi is enabled on the device */
+ QMILOCWIFIENABLEDSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocWifiEnabledStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject the Wi-Fi enabled status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Enabled Status */
+ qmiLocWifiEnabledStatusEnumT_v02 enabledStatus;
+ /**< Wi-Fi enabled status on the device.
+ Values: \n
+ - eQMI_LOC_WIFI_ENABLED_FALSE (0) -- Wi-Fi is disabled on the device \n
+ - eQMI_LOC_WIFI_ENABLED_TRUE (1) -- Wi-Fi is enabled on the device */
+}qmiLocNotifyWifiEnabledStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject the Wi-Fi enabled status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of Wi-Fi Enabled Status Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Wi-Fi Enabled Status request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocNotifyWifiEnabledStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point whether the GNSS location engine is
+ ready to accept vehicle data. */
+typedef struct {
+
+ /* Optional */
+ /* Vehicle Accelerometer Ready Status */
+ uint8_t vehicleAccelReadyStatus_valid; /**< Must be set to true if vehicleAccelReadyStatus is being passed */
+ uint8_t vehicleAccelReadyStatus;
+ /**< The location service uses this TLV to let a control point know when it is
+ ready to receive vehicle accelerometer data input.
+ Values: \n
+ - 0x00 -- Not ready \n
+ - 0x01 -- Ready */
+
+ /* Optional */
+ /* Vehicle Angular Rate Ready Status */
+ uint8_t vehicleAngularRateReadyStatus_valid; /**< Must be set to true if vehicleAngularRateReadyStatus is being passed */
+ uint8_t vehicleAngularRateReadyStatus;
+ /**< The location service uses this TLV to let a control point know when it is
+ ready to receive vehicle angular rate data input.
+ Values: \n
+ - 0x00 -- Not ready \n
+ - 0x01 -- Ready */
+
+ /* Optional */
+ /* Vehicle Odometry Ready Status */
+ uint8_t vehicleOdometryReadyStatus_valid; /**< Must be set to true if vehicleOdometryReadyStatus is being passed */
+ uint8_t vehicleOdometryReadyStatus;
+ /**< The location service uses this TLV to let a control point know when it is
+ ready to receive vehicle odometry data input.
+ Values: \n
+ - 0x00 -- Not ready \n
+ - 0x01 -- Ready*/
+}qmiLocEventVehicleDataReadyIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t timeOffset;
+ /**< Sample time offset. This time offset must be
+ relative to the vehicle sensor time of the first sample. \n
+ - Units -- Microseconds \n
+ - Range -- Up to over 4000 seconds */
+
+ uint32_t axisSample_len; /**< Must be set to # of elements in axisSample */
+ float axisSample[QMI_LOC_VEHICLE_SENSOR_DATA_MAX_AXES_V02];
+ /**< Sensor axis sample. \n
+ - Type -- Floating point \n
+ - Units accelerometer -- Meters per seconds^2 \n
+ - Units gyroscope -- Radians per seconds \n
+ Note: The axes samples must be in the following order: \n
+ 1. X-axis \n
+ 2. Y-axis \n
+ 3. Z-axis */
+}qmiLocVehicleSensorSampleStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocAxesMaskT_v02;
+#define QMI_LOC_MASK_X_AXIS_V02 ((qmiLocAxesMaskT_v02)0x01) /**< X-axis is valid \n */
+#define QMI_LOC_MASK_Y_AXIS_V02 ((qmiLocAxesMaskT_v02)0x02) /**< Y-axis is valid \n */
+#define QMI_LOC_MASK_Z_AXIS_V02 ((qmiLocAxesMaskT_v02)0x04) /**< Z-axis is valid */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t sampleTimeBase;
+ /**< 32-bit time tag of the reference time from which
+ all samples in this message are offset. This time must
+ be the same as or (slightly) earlier than the first (oldest)
+ sample in this message. \n
+ - Units -- Milliseconds \n
+ - Range -- Approx. 4 million seconds, or almost 50 days between rollovers */
+
+ qmiLocAxesMaskT_v02 axesValidity;
+ /**< Axes that are valid for all sensor samples.
+ Values: \n
+ - QMI_LOC_MASK_X_AXIS (0x01) -- X-axis is valid \n
+ - QMI_LOC_MASK_Y_AXIS (0x02) -- Y-axis is valid \n
+ - QMI_LOC_MASK_Z_AXIS (0x04) -- Z-axis is valid */
+
+ uint32_t sensorData_len; /**< Must be set to # of elements in sensorData */
+ qmiLocVehicleSensorSampleStructT_v02 sensorData[QMI_LOC_VEHICLE_SENSOR_DATA_MAX_SAMPLES_V02];
+ /**< Variable length array specifying the on-vehicle sensor samples;
+ maximum length of the array is 50 */
+}qmiLocVehicleSensorSampleListStructType_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocVehicleOdometryMeasDeviationMaskType_v02;
+#define QMI_LOC_MASK_VEHICLE_ODOMETRY_REVERSE_MOVEMENT_V02 ((qmiLocVehicleOdometryMeasDeviationMaskType_v02)0x00000001) /**< Odometry data in this message includes at least some data where
+ the vehicle might have been moving in the reverse direction; this
+ bit must be set if odometry data might be in reverse, and must
+ not be set if odometry data is all in the forward direction \n */
+#define QMI_LOC_MASK_VEHICLE_ODOMETRY_AFFECTED_BY_ERRORS_V02 ((qmiLocVehicleOdometryMeasDeviationMaskType_v02)0x00000002) /**< Odometry data in this message includes at least some data affected
+ by a major error source affecting distance-traveled accuracy,
+ such as wheel slippage due to skidding, gravel, snow, or ice, as
+ detected by the vehicle, for example, via an ABS or other system \n */
+#define QMI_LOC_MASK_VEHICLE_ODOMETRY_ABSOLUTE_MEASUREMENT_V02 ((qmiLocVehicleOdometryMeasDeviationMaskType_v02)0x00000004) /**< Odometry data in this message is an absolute amount since the vehicle
+ began service, and is the same vehicle that is regularly used with
+ this device (so that the offset of this value, since the last time
+ this measurement was used by the location engine, can safely be used
+ as a likely correct estimate of distance traveled since last
+ use) */
+typedef uint32_t qmiLocVehicleOdometryWheelFlagsMaskT_v02;
+#define QMI_LOC_MASK_VEHICLE_ODOMETRY_LEFT_AND_RIGHT_AVERAGE_V02 ((qmiLocVehicleOdometryWheelFlagsMaskT_v02)0x00000001) /**< Average of left and right non-turning wheels \n */
+#define QMI_LOC_MASK_VEHICLE_ODOMETRY_LEFT_V02 ((qmiLocVehicleOdometryWheelFlagsMaskT_v02)0x00000002) /**< Left side, non-turning wheel \n */
+#define QMI_LOC_MASK_VEHICLE_ODOMETRY_RIGHT_V02 ((qmiLocVehicleOdometryWheelFlagsMaskT_v02)0x00000004) /**< Right side, non-turning wheel */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t timeOffset;
+ /**< Sample time offset; must be
+ relative to the sensor time of the first sample. \n
+ - Units -- Microseconds \n
+ - Range -- Up to over 4000 seconds */
+
+ uint32_t distanceTravelled_len; /**< Must be set to # of elements in distanceTravelled */
+ uint32_t distanceTravelled[QMI_LOC_VEHICLE_ODOMETRY_MAX_MEASUREMENTS_V02];
+ /**< Distance traveled (odometry) sample offset. \n
+ - Units of accumulated distance -- Millimeters \n
+ - Range -- Over 4000 kilometers\n
+
+ This measurement (with units in millimeters) is added to
+ the distance_travelled_base measurement (in meters) to
+ get the total distance traveled sample value.
+
+ Note: The order of measurements must be as follows: \n
+ 1. Left and right average \n
+ 2. Left \n
+ 3. Right
+ */
+}qmiLocVehicleOdometrySampleStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t sampleTimeBase;
+ /**< 32-bit time tag of a reference time from which
+ all samples in this message are offset. This time must
+ be the same or slightly earlier than the first (oldest)
+ sample in this message. \n
+ - Units -- 1 millisecond \n
+ - Range -- ~4 million seconds, or almost 50 days between rollovers */
+
+ qmiLocVehicleOdometryMeasDeviationMaskType_v02 flags;
+ /**< Flags indicating any deviation from the default measurement
+ assumptions. Valid bitmasks: \n
+ - QMI_LOC_MASK_VEHICLE_ODOMETRY_REVERSE_MOVEMENT (0x00000001) -- Odometry data in this message includes at least some data where
+ the vehicle might have been moving in the reverse direction; this
+ bit must be set if odometry data might be in reverse, and must
+ not be set if odometry data is all in the forward direction \n
+ - QMI_LOC_MASK_VEHICLE_ODOMETRY_AFFECTED_BY_ERRORS (0x00000002) -- Odometry data in this message includes at least some data affected
+ by a major error source affecting distance-traveled accuracy,
+ such as wheel slippage due to skidding, gravel, snow, or ice, as
+ detected by the vehicle, for example, via an ABS or other system \n
+ - QMI_LOC_MASK_VEHICLE_ODOMETRY_ABSOLUTE_MEASUREMENT (0x00000004) -- Odometry data in this message is an absolute amount since the vehicle
+ began service, and is the same vehicle that is regularly used with
+ this device (so that the offset of this value, since the last time
+ this measurement was used by the location engine, can safely be used
+ as a likely correct estimate of distance traveled since last
+ use) */
+
+ qmiLocVehicleOdometryWheelFlagsMaskT_v02 wheelFlags;
+ /**< Wheels for which measurements are provided
+ in the following samples, where one or more of the following
+ bits must be set, and data samples aligned with these axes must
+ appear in groups, in this order.
+ Valid bitmasks: \n
+ - QMI_LOC_MASK_VEHICLE_ODOMETRY_LEFT_AND_RIGHT_AVERAGE (0x00000001) -- Average of left and right non-turning wheels \n
+ - QMI_LOC_MASK_VEHICLE_ODOMETRY_LEFT (0x00000002) -- Left side, non-turning wheel \n
+ - QMI_LOC_MASK_VEHICLE_ODOMETRY_RIGHT (0x00000004) -- Right side, non-turning wheel */
+
+ uint32_t distanceTravelledBase;
+ /**< Distance traveled base. \n
+ - Units of accumulated distance -- Meters \n
+ - Range -- Over 4,000,000 kilometers \n
+
+ Distance traveled (odometry) must be reported in a continuously
+ accumulating way from device power up. It can be incremental distance
+ starting at 0, or another arbitrary point, from device power up, or the
+ absolute distance traveled by the vehicle
+ (and if so, set QMI_LOC_MASK_VEHICLE_ODOMETRY_ABSOLUTE_MEASUREMENT),
+ as long as it grows incrementally from device power up.
+
+ This distance_travelled_base is added to the distance_travelled_offset
+ of each sample (below) to get the absolute distance of each sample
+ point.
+
+ Distance traveled errors are primarily due to the
+ scale factor, with some allowance for noise due to minor slippage
+ events (for example, gravel).
+ Major wheel slippage events that affect odometry
+ must be flagged -- see the flags field.
+
+ Other events, such as a vehicle traveling in reverse, can
+ also affect the available accuracy of this information, and notification
+ of those events must be provided -- see the flags field. */
+
+ uint32_t odometryData_len; /**< Must be set to # of elements in odometryData */
+ qmiLocVehicleOdometrySampleStructT_v02 odometryData[QMI_LOC_VEHICLE_SENSOR_DATA_MAX_SAMPLES_V02];
+ /**< Variable length array specifying the odometry samples.
+ Maximum length of the array is 50. */
+}qmiLocVehicleOdometrySampleListStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects on-vehicle sensor data into the location engine. */
+typedef struct {
+
+ /* Optional */
+ /* On-Vehicle Accelerometer Data */
+ uint8_t accelData_valid; /**< Must be set to true if accelData is being passed */
+ qmiLocVehicleSensorSampleListStructType_v02 accelData;
+ /**< \vspace{0.06in} \n Vehicle accelerometer sensor samples. */
+
+ /* Optional */
+ /* On-Vehicle Angular Rotation Data */
+ uint8_t angRotationData_valid; /**< Must be set to true if angRotationData is being passed */
+ qmiLocVehicleSensorSampleListStructType_v02 angRotationData;
+ /**< \vspace{0.06in} \n Vehicle angular rotation data sensor samples. */
+
+ /* Optional */
+ /* Odometry Data */
+ uint8_t odometryData_valid; /**< Must be set to true if odometryData is being passed */
+ qmiLocVehicleOdometrySampleListStructT_v02 odometryData;
+ /**< \vspace{0.06in} \n Odometer sensor samples. */
+
+ /* Optional */
+ /* External Time Sync Information */
+ uint8_t changeInTimeScales_valid; /**< Must be set to true if changeInTimeScales is being passed */
+ int32_t changeInTimeScales;
+ /**< This field is used in conjunction with an external
+ time-sync mechanism that is aligning the vehicle sensor time scale
+ with the on-device sensor time scale to ensure that updates in
+ that time offset do not appear as jumps in the relative sensor time
+ of the samples provided in this message. If there is no such sync
+ mechanism, for example, if only the vehicle time is provided, this field
+ can be left at 0.
+
+ This field is defined as the change from the previously-sent QMI
+ message with similar TLVs 0x10, 0x11, or 0x12 in it, to this QMI
+ message in the amount that the sensor_time is ahead of an
+ external vehicle time. \n
+ - Units -- Microseconds \n
+ - Range -- Approximately -2100 seconds to + 2100 seconds, where
+ full-scale (minimum and maximum value) is interpreted
+ as equal to or greater than this value of an offset change
+ (unlikely to be reached in practice, unless there is a
+ startup, major resync, or some other rollover event). */
+}qmiLocInjectVehicleSensorDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects on-vehicle sensor data into the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject Vehicle Sensor Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Vehicle Sensor Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectVehicleSensorDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the first available WWAN
+ position from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The QMI_LOC_GET_AVAILABLE_WWAN_POSITION_IND indication
+ returns the transaction ID. */
+}qmiLocGetAvailWwanPositionReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the first available WWAN
+ position from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Available WWAN Position Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the
+ QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ request. This parameter is
+ always present when the status field is set to SUCCESS. */
+
+ /* Optional */
+ /* Latitude */
+ uint8_t latitude_valid; /**< Must be set to true if latitude is being passed */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ /* Optional */
+ /* Longitude */
+ uint8_t longitude_valid; /**< Must be set to true if longitude is being passed */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ /* Optional */
+ /* Circular Horizontal Position Uncertainty */
+ uint8_t horUncCircular_valid; /**< Must be set to true if horUncCircular is being passed */
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular).\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Altitude With Respect to Ellipsoid */
+ uint8_t altitudeWrtEllipsoid_valid; /**< Must be set to true if altitudeWrtEllipsoid is being passed */
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid.\n
+ - Units -- Meters \n
+ - Range -- -500 to 15883 */
+
+ /* Optional */
+ /* Vertical Uncertainty */
+ uint8_t vertUnc_valid; /**< Must be set to true if vertUnc is being passed */
+ float vertUnc;
+ /**< Vertical uncertainty.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* UTC Timestamp */
+ uint8_t timestampUtc_valid; /**< Must be set to true if timestampUtc is being passed */
+ uint64_t timestampUtc;
+ /**< Units -- Milliseconds since Jan. 1, 1970 */
+
+ /* Optional */
+ /* Time Uncertainty */
+ uint8_t timeUnc_valid; /**< Must be set to true if timeUnc is being passed */
+ float timeUnc;
+ /**< - Units -- Milliseconds */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Semi-Minor Axis */
+ uint8_t horUncEllipseSemiMinor_valid; /**< Must be set to true if horUncEllipseSemiMinor is being passed */
+ float horUncEllipseSemiMinor;
+ /**< Semi-minor axis of horizontal elliptical uncertainty. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Semi-Major Axis */
+ uint8_t horUncEllipseSemiMajor_valid; /**< Must be set to true if horUncEllipseSemiMajor is being passed */
+ float horUncEllipseSemiMajor;
+ /**< Semi-major axis of horizontal elliptical uncertainty. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Azimuth */
+ uint8_t horUncEllipseOrientAzimuth_valid; /**< Must be set to true if horUncEllipseOrientAzimuth is being passed */
+ float horUncEllipseOrientAzimuth;
+ /**< Elliptical horizontal uncertainty azimuth of orientation. \n
+ - Units -- Decimal degrees \n
+ - Range -- 0 to 180 */
+
+ /* Optional */
+ /* Horizontal Circular Confidence */
+ uint8_t horCircularConfidence_valid; /**< Must be set to true if horCircularConfidence is being passed */
+ uint8_t horCircularConfidence;
+ /**< Horizontal circular uncertainty confidence. \n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Horizontal Elliptical Confidence */
+ uint8_t horEllipticalConfidence_valid; /**< Must be set to true if horEllipticalConfidence is being passed */
+ uint8_t horEllipticalConfidence;
+ /**< Horizontal elliptical uncertainty confidence. \n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Horizontal Reliability */
+ uint8_t horReliability_valid; /**< Must be set to true if horReliability is being passed */
+ qmiLocReliabilityEnumT_v02 horReliability;
+ /**< Specifies the reliability of the horizontal position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Altitude With Respect to Sea Level */
+ uint8_t altitudeWrtMeanSeaLevel_valid; /**< Must be set to true if altitudeWrtMeanSeaLevel is being passed */
+ float altitudeWrtMeanSeaLevel;
+ /**< Altitude with respect to mean sea level. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical uncertainty confidence. \n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Vertical Reliability */
+ uint8_t vertReliability_valid; /**< Must be set to true if vertReliability is being passed */
+ qmiLocReliabilityEnumT_v02 vertReliability;
+ /**< Specifies the reliability of the vertical position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* GPS Time */
+ uint8_t gpsTime_valid; /**< Must be set to true if gpsTime is being passed */
+ qmiLocGPSTimeStructT_v02 gpsTime;
+
+ /* Optional */
+ /* Time Source */
+ uint8_t timeSrc_valid; /**< Must be set to true if timeSrc is being passed */
+ qmiLocTimeSourceEnumT_v02 timeSrc;
+ /**< Time source.
+ Values: \n
+ - eQMI_LOC_TIME_SRC_INVALID (0) -- Invalid time \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TRANSFER (1) -- Time is set by the 1X system \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TAGGING (2) -- Time is set by WCDMA/GSM time tagging (that is,
+ associating network time with GPS time) \n
+ - eQMI_LOC_TIME_SRC_EXTERNAL_INPUT (3) -- Time is set by an external injection \n
+ - eQMI_LOC_TIME_SRC_TOW_DECODE (4) -- Time is set after decoding over-the-air GPS navigation data
+ from one GPS satellite \n
+ - eQMI_LOC_TIME_SRC_TOW_CONFIRMED (5) -- Time is set after decoding over-the-air GPS navigation data
+ from multiple satellites \n
+ - eQMI_LOC_TIME_SRC_TOW_AND_WEEK_CONFIRMED (6) -- Both time of the week and the GPS week number are known \n
+ - eQMI_LOC_TIME_SRC_NAV_SOLUTION (7) -- Time is set by the position engine after the fix is obtained \n
+ - eQMI_LOC_TIME_SRC_SOLVE_FOR_TIME (8) -- Time is set by the position engine after performing SFT;
+ this is done when the clock time uncertainty is large \n
+ - eQMI_LOC_TIME_SRC_GLO_TOW_DECODE (9) -- Time is set after decoding GLO satellites \n
+ - eQMI_LOC_TIME_SRC_TIME_TRANSFORM (10) -- Time is set after transforming the GPS to GLO time \n
+ - eQMI_LOC_TIME_SRC_WCDMA_SLEEP_TIME_TAGGING (11) -- Time is set by the sleep time tag provided by the WCDMA network \n
+ - eQMI_LOC_TIME_SRC_GSM_SLEEP_TIME_TAGGING (12) -- Time is set by the sleep time tag provided by the GSM network \n
+ - eQMI_LOC_TIME_SRC_UNKNOWN (13) -- Source of the time is unknown \n
+ - eQMI_LOC_TIME_SRC_SYSTEM_TIMETICK (14) -- Time is derived from the system clock (better known as the slow clock);
+ GNSS time is maintained irrespective of the GNSS receiver state \n
+ - eQMI_LOC_TIME_SRC_QZSS_TOW_DECODE (15) -- Time is set after decoding QZSS satellites \n
+ - eQMI_LOC_TIME_SRC_BDS_TOW_DECODE (16) -- Time is set after decoding BDS satellites \n
+ - eQMI_LOC_TIME_SRC_GAL_TOW_DECODE (17) -- Time is set after decoding Galileo satellites \n
+ - eQMI_LOC_TIME_SRC_NAVIC_TOW_DECODE (18) -- Time is set after decoding NavIC satellites
+ */
+}qmiLocGetAvailWwanPositionIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPREMIUMSERVICEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_PREMIUM_SERVICE_GTP_CELL_V02 = 0, /**< Premium service -- Global terrestrial positioning for the cell \n */
+ eQMI_LOC_PREMIUM_SERVICE_SAP_V02 = 1, /**< Premium service -- Sensor-assisted positioning \n */
+ eQMI_LOC_PREMIUM_SERVICE_GTP_ENH_CELL_V02 = 2, /**< Premium service -- Global terrestrial positioning enhanced cell \n */
+ eQMI_LOC_PREMIUM_SERVICE_GTP_WIFI_V02 = 3, /**< Premium service -- Global terrestrial positioning for Wi-Fi */
+ QMILOCPREMIUMSERVICEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPremiumServiceEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPREMIUMSERVICECFGENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_PREMIUM_SERVICE_DISABLED_V02 = 0, /**< Premium service disabled \n */
+ eQMI_LOC_PREMIUM_SERVICE_ENABLED_BASIC_V02 = 1, /**< Premium service enabled for basic \n */
+ eQMI_LOC_PREMIUM_SERVICE_ENABLED_PREMIUM_V02 = 2, /**< Premium service enabled for premium \n */
+ eQMI_LOC_PREMIUM_SERVICE_ENABLED_THIRDPARTY_V02 = 3, /**< Premium service enabled for third party integration */
+ QMILOCPREMIUMSERVICECFGENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPremiumServiceCfgEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to set the configuration */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Premium Service Type */
+ qmiLocPremiumServiceEnumT_v02 premiumServiceType;
+ /**< Specifies the premium service to configure.
+ Values: \n
+ - eQMI_LOC_PREMIUM_SERVICE_GTP_CELL (0) -- Premium service -- Global terrestrial positioning for the cell \n
+ - eQMI_LOC_PREMIUM_SERVICE_SAP (1) -- Premium service -- Sensor-assisted positioning \n
+ - eQMI_LOC_PREMIUM_SERVICE_GTP_ENH_CELL (2) -- Premium service -- Global terrestrial positioning enhanced cell \n
+ - eQMI_LOC_PREMIUM_SERVICE_GTP_WIFI (3) -- Premium service -- Global terrestrial positioning for Wi-Fi
+ */
+
+ /* Mandatory */
+ /* Set Premium Service Configuration */
+ qmiLocPremiumServiceCfgEnumT_v02 premiumServiceCfg;
+ /**< Specifies the premium service configuration mode.
+ Values: \n
+ - eQMI_LOC_PREMIUM_SERVICE_DISABLED (0) -- Premium service disabled \n
+ - eQMI_LOC_PREMIUM_SERVICE_ENABLED_BASIC (1) -- Premium service enabled for basic \n
+ - eQMI_LOC_PREMIUM_SERVICE_ENABLED_PREMIUM (2) -- Premium service enabled for premium \n
+ - eQMI_LOC_PREMIUM_SERVICE_ENABLED_THIRDPARTY (3) -- Premium service enabled for third party integration
+ */
+}qmiLocSetPremiumServicesCfgReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to set the configuration */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Premium Service Configuration Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Premium Services Configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocSetPremiumServicesCfgIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCXTRAVERSIONCHECKENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_XTRA_VERSION_CHECK_DISABLE_V02 = 0, /**< XTRA file version check is not required \n */
+ eQMI_LOC_XTRA_VERSION_CHECK_AUTO_V02 = 1, /**< XTRA file version check is required; the location service decides the expected version
+ based on the preprovisioned XTRA version configuration \n */
+ eQMI_LOC_XTRA_VERSION_CHECK_XTRA2_V02 = 2, /**< Check the XTRA file against XTRA2 format \n */
+ eQMI_LOC_XTRA_VERSION_CHECK_XTRA3_V02 = 3, /**< Check the XTRA file against XTRA3 format \n */
+ eQMI_LOC_XTRA_VERSION_CHECK_XTRA3_1_V02 = 4, /**< Check the XTRA file against XTRA3.1 format */
+ QMILOCXTRAVERSIONCHECKENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocXtraVersionCheckEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to enable or disable XTRA version
+ verification. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set XTRA Version Check Mode */
+ qmiLocXtraVersionCheckEnumT_v02 xtraVersionCheckMode;
+ /**< Specifies XTRA version check mode.
+ Values: \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_DISABLE (0) -- XTRA file version check is not required \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_AUTO (1) -- XTRA file version check is required; the location service decides the expected version
+ based on the preprovisioned XTRA version configuration \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_XTRA2 (2) -- Check the XTRA file against XTRA2 format \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_XTRA3 (3) -- Check the XTRA file against XTRA3 format \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_XTRA3_1 (4) -- Check the XTRA file against XTRA3.1 format
+ */
+}qmiLocSetXtraVersionCheckReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to enable or disable XTRA version
+ verification. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set XTRA Version Check Mode Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set XTRA version check request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocSetXtraVersionCheckIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sets the satellite constellations of interest for reporting. */
+typedef struct {
+
+ /* Optional */
+ /* GNSS Measurement Report Constellation Control */
+ uint8_t measReportConfig_valid; /**< Must be set to true if measReportConfig is being passed */
+ qmiLocGNSSConstellEnumT_v02 measReportConfig;
+ /**< GNSS measurement report constellation control. \n
+ Values: \n
+ - eQMI_SYSTEM_GPS (0x01) -- Enable GPS \n
+ - eQMI_SYSTEM_GLO (0x02) -- Enable GLONASS \n
+ - eQMI_SYSTEM_BDS (0x04) -- Enable BDS \n
+ - eQMI_SYSTEM_GAL (0x08) -- Enable Galileo \n
+ - eQMI_SYSTEM_QZSS (0x10) -- Enable QZSS \n
+ - eQMI_SYSTEM_NAVIC (0x20) -- Enable NavIC
+ */
+
+ /* Optional */
+ /* SV Polynomial Report Constellation Control */
+ uint8_t svPolyReportConfig_valid; /**< Must be set to true if svPolyReportConfig is being passed */
+ qmiLocGNSSConstellEnumT_v02 svPolyReportConfig;
+ /**< SV polynomial report constellation control. \n
+ Values: \n
+ - eQMI_SYSTEM_GPS (0x01) -- Enable GPS \n
+ - eQMI_SYSTEM_GLO (0x02) -- Enable GLONASS \n
+ - eQMI_SYSTEM_BDS (0x04) -- Enable BDS \n
+ - eQMI_SYSTEM_GAL (0x08) -- Enable Galileo \n
+ - eQMI_SYSTEM_QZSS (0x10) -- Enable QZSS \n
+ - eQMI_SYSTEM_NAVIC (0x20) -- Enable NavIC
+ */
+
+ /* Optional */
+ /* Request Full Ephemeris Data */
+ uint8_t reportFullEphemerisDb_valid; /**< Must be set to true if reportFullEphemerisDb is being passed */
+ uint8_t reportFullEphemerisDb;
+ /**< Request indicating that the client needs complete ephemeris. */
+
+ /* Optional */
+ /* Request Complete SV Polynomial Data */
+ uint8_t reportFullSvPolyDb_valid; /**< Must be set to true if reportFullSvPolyDb is being passed */
+ uint8_t reportFullSvPolyDb;
+ /**< Request indicating that the client needs complete SV polynomials. */
+
+ /* Optional */
+ /* Request Complete Iono Data */
+ uint8_t reportFullIonoDb_valid; /**< Must be set to true if reportFullIonoDb is being passed */
+ uint8_t reportFullIonoDb;
+ /**< Request indicating client needs complete Iono. */
+}qmiLocSetGNSSConstRepConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sets the satellite constellations of interest for reporting. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set GNSS Constellation Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GNSS constellation.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetGNSSConstRepConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSOURCEOFFREQENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_FREQ_SOURCE_INVALID_V02 = 0, /**< Source of the frequency is invalid \n */
+ eQMI_LOC_FREQ_SOURCE_EXTERNAL_V02 = 1, /**< Source of the frequency is from an external injection \n */
+ eQMI_LOC_FREQ_SOURCE_PE_CLK_REPORT_V02 = 2, /**< Source of the frequency is from the GNSS navigation engine \n */
+ eQMI_LOC_FREQ_SOURCE_UNKNOWN_V02 = 3, /**< Source of the frequency is unknown */
+ QMILOCSOURCEOFFREQENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSourceofFreqEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCMEASUREMENTCODETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GNSS_CODE_TYPE_A_V02 = 0, /**< Galileo E1A, Galileo E6A, IRNSS L5A, IRNSS SA. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_B_V02 = 1, /**< Galileo E1B, Galileo E6B, IRNSS L5B, IRNSS SB. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_C_V02 = 2, /**< GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A, GLONASS G2 C/A, Galileo E1C,
+ Galileo E6C, SBAS L1 C/A, QZSS L1 C/A, IRNSS L5C. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_I_V02 = 3, /**< GPS L5 I, GLONASS G3 I, Galileo E5a I, Galileo E5b I, Galileo E5a+b I,
+ SBAS L5 I, QZSS L5 I, BDS B1 I, BDS B2 I, BDS B3 I. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_L_V02 = 4, /**< GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), LEX(6) L. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_M_V02 = 5, /**< GPS L1M, GPS L2M. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_P_V02 = 6, /**< GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P.\n */
+ eQMI_LOC_GNSS_CODE_TYPE_Q_V02 = 7, /**< GPS L5 Q, GLONASS G3 Q, Galileo E5a Q, Galileo E5b Q, Galileo E5a+b Q,
+ SBAS L5 Q, QZSS L5 Q, BDS B1 Q, BDS B2 Q, BDS B3 Q. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_S_V02 = 8, /**< GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), LEX(6) S. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_W_V02 = 9, /**< GPS L1 Z-tracking, GPS L2 Z-tracking. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_X_V02 = 10, /**< GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q), GLONASS G3 (I+Q),
+ Galileo E1 (B+C), Galileo E5a (I+Q), Galileo E5b (I+Q),
+ Galileo E5a+b(I+Q), Galileo E6 (B+C), SBAS L5 (I+Q), QZSS L1C (D+P),
+ QZSS L2C (M+L), QZSS L5 (I+Q), LEX(6) (S+L), BDS B1 (I+Q), BDS B2 (I+Q),
+ BDS B3 (I+Q), IRNSS L5 (B+C). \n */
+ eQMI_LOC_GNSS_CODE_TYPE_Y_V02 = 11, /**< GPS L1Y, GPS L2Y. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_Z_V02 = 12, /**< Galileo E1 (A+B+C), Galileo E6 (A+B+C), QZSS L1-SAIF. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_N_V02 = 13, /**< GPS L1 codeless, GPS L2 codeless. \n */
+ eQMI_LOC_GNSS_CODE_TYPE_OTHER_V02 = 255, /**< This code is used in case the measurement used a GNSS signal code that is not listed above. */
+ QMILOCMEASUREMENTCODETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocMeasurementCodeTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ float clockDrift;
+ /**< Receiver clock drift. \n
+ - Units -- Meters per second
+ */
+
+ float clockDriftUnc;
+ /**< Receiver clock drift uncertainty. \n
+ - Units -- Meters per second
+ */
+
+ qmiLocSourceofFreqEnumT_v02 sourceOfFreq;
+ /**< Source of the clock frequency information.
+ Values: \n
+ - eQMI_LOC_FREQ_SOURCE_INVALID (0) -- Source of the frequency is invalid \n
+ - eQMI_LOC_FREQ_SOURCE_EXTERNAL (1) -- Source of the frequency is from an external injection \n
+ - eQMI_LOC_FREQ_SOURCE_PE_CLK_REPORT (2) -- Source of the frequency is from the GNSS navigation engine \n
+ - eQMI_LOC_FREQ_SOURCE_UNKNOWN (3) -- Source of the frequency is unknown
+ */
+}qmiLocRcvrClockFrequencyInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t leapSec;
+ /**< GPS time leap second delta to UTC time. \n
+ For nonzero values of leapSecUnc, leapSec must be treated as unknown. \n
+ - Units -- Seconds
+ */
+
+ uint8_t leapSecUnc;
+ /**< Uncertainty for the GPS leap second. \n
+ - Units -- Seconds
+ */
+}qmiLocLeapSecondInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint8_t qmiLocInterSystemBiasValidMaskT_v02;
+#define QMI_LOC_SYS_TIME_BIAS_VALID_V02 ((qmiLocInterSystemBiasValidMaskT_v02)0x01) /**< System time bias is valid \n */
+#define QMI_LOC_SYS_TIME_BIAS_UNC_VALID_V02 ((qmiLocInterSystemBiasValidMaskT_v02)0x02) /**< System time bias uncertainty is valid */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocInterSystemBiasValidMaskT_v02 validMask;
+ /**< Values: \n
+ - QMI_LOC_SYS_TIME_BIAS_VALID (0x01) -- System time bias is valid \n
+ - QMI_LOC_SYS_TIME_BIAS_UNC_VALID (0x02) -- System time bias uncertainty is valid
+ */
+
+ float timeBias;
+ /**< System 1 to system 2 time bias. \n
+ - Units -- Milliseconds
+ */
+
+ float timeBiasUnc;
+ /**< System 1 to system 2 time bias uncertainty. \n
+ - Units -- Milliseconds
+ */
+}qmiLocInterSystemBiasStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSvSystemEnumT_v02 system;
+ /**< Specifies the satellite system constellation.
+ Values: \n
+ - eQMI_LOC_SV_SYSTEM_GPS (1) -- GPS satellite \n
+ - eQMI_LOC_SV_SYSTEM_GALILEO (2) -- Galileo satellite \n
+ - eQMI_LOC_SV_SYSTEM_SBAS (3) -- SBAS satellite \n
+ - eQMI_LOC_SV_SYSTEM_COMPASS (4) -- COMPASS satellite (Deprecated) \n
+ - eQMI_LOC_SV_SYSTEM_GLONASS (5) -- GLONASS satellite \n
+ - eQMI_LOC_SV_SYSTEM_BDS (6) -- BDS satellite \n
+ - eQMI_LOC_SV_SYSTEM_QZSS (7) -- QZSS satellite \n
+ - eQMI_LOC_SV_SYSTEM_NAVIC (8) -- NavIC satellite
+ */
+
+ uint16_t systemWeek;
+ /**< Current system week. \n
+ - GPS -- Calculated from midnight, Jan. 6, 1980. \n
+ - BDS -- Calculated from 00:00:00 on January 1, 2006 of Coordinated Universal Time (UTC). \n
+ - Galileo -- Calculated from 00:00 UT on Sunday August 22, 1999 (midnight between August 21 and August 22). \n
+ If the week is unknown, set this value to 65535. \n
+ - Units -- Weeks */
+
+ uint32_t systemMsec;
+ /**< Amount of time into the current week. \n
+ - Units -- Milliseconds */
+
+ float systemClkTimeBias;
+ /**< System clock time bias (submilliseconds). \n
+ - Units -- Milliseconds
+ (system time = systemMsec - systemClkTimeBias)
+ */
+
+ float systemClkTimeUncMs;
+ /**< Single-sided maximum time bias uncertainty. \n
+ - Units -- Milliseconds
+ */
+}qmiLocGnssTimeStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t gloFourYear;
+ /**< GLONASS four year number from 1996; refer to the GLONASS ICD. \n
+ Applicable only for GLONASS, ignore for other constellations. \n
+ If unknown, set this value to 255.
+ */
+
+ uint16_t gloDays;
+ /**< GLONASS day number in four years; refer to the GLONASS ICD. \n
+ Applicable only for GLONASS, ignore for other constellations. \n
+ If unknown, set this value to 65535.
+ */
+
+ uint32_t gloMsec;
+ /**< GLONASS time of day in milliseconds; refer to the GLONASS ICD.
+ */
+
+ float gloClkTimeBias;
+ /**< System clock time bias (submillisecond). \n
+ - Units -- Milliseconds
+ (system time = systemMsec - systemClkTimeBias)
+ */
+
+ float gloClkTimeUncMs;
+ /**< Single-sided maximum time bias uncertainty. \n
+ - Units -- Milliseconds
+ */
+}qmiLocGloTimeStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t refFCount;
+ /**< Receiver frame counter value at a reference tick. \n
+ - Units -- Milliseconds
+ */
+
+ uint8_t systemRtc_valid;
+ /**< Validity indicator for the system RTC. */
+
+ uint64_t systemRtcMs;
+ /**< Platform system RTC value. \n
+ - Units -- Milliseconds
+ */
+
+ qmiLocTimeSourceEnumT_v02 sourceOfTime;
+ /**< Source of the time information.
+ Values: \n
+ - eQMI_LOC_TIME_SRC_INVALID (0) -- Invalid time \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TRANSFER (1) -- Time is set by the 1X system \n
+ - eQMI_LOC_TIME_SRC_NETWORK_TIME_TAGGING (2) -- Time is set by WCDMA/GSM time tagging (that is,
+ associating network time with GPS time) \n
+ - eQMI_LOC_TIME_SRC_EXTERNAL_INPUT (3) -- Time is set by an external injection \n
+ - eQMI_LOC_TIME_SRC_TOW_DECODE (4) -- Time is set after decoding over-the-air GPS navigation data
+ from one GPS satellite \n
+ - eQMI_LOC_TIME_SRC_TOW_CONFIRMED (5) -- Time is set after decoding over-the-air GPS navigation data
+ from multiple satellites \n
+ - eQMI_LOC_TIME_SRC_TOW_AND_WEEK_CONFIRMED (6) -- Both time of the week and the GPS week number are known \n
+ - eQMI_LOC_TIME_SRC_NAV_SOLUTION (7) -- Time is set by the position engine after the fix is obtained \n
+ - eQMI_LOC_TIME_SRC_SOLVE_FOR_TIME (8) -- Time is set by the position engine after performing SFT;
+ this is done when the clock time uncertainty is large \n
+ - eQMI_LOC_TIME_SRC_GLO_TOW_DECODE (9) -- Time is set after decoding GLO satellites \n
+ - eQMI_LOC_TIME_SRC_TIME_TRANSFORM (10) -- Time is set after transforming the GPS to GLO time \n
+ - eQMI_LOC_TIME_SRC_WCDMA_SLEEP_TIME_TAGGING (11) -- Time is set by the sleep time tag provided by the WCDMA network \n
+ - eQMI_LOC_TIME_SRC_GSM_SLEEP_TIME_TAGGING (12) -- Time is set by the sleep time tag provided by the GSM network \n
+ - eQMI_LOC_TIME_SRC_UNKNOWN (13) -- Source of the time is unknown \n
+ - eQMI_LOC_TIME_SRC_SYSTEM_TIMETICK (14) -- Time is derived from the system clock (better known as the slow clock);
+ GNSS time is maintained irrespective of the GNSS receiver state \n
+ - eQMI_LOC_TIME_SRC_QZSS_TOW_DECODE (15) -- Time is set after decoding QZSS satellites \n
+ - eQMI_LOC_TIME_SRC_BDS_TOW_DECODE (16) -- Time is set after decoding BDS satellites \n
+ - eQMI_LOC_TIME_SRC_GAL_TOW_DECODE (17) -- Time is set after decoding Galileo satellites \n
+ - eQMI_LOC_TIME_SRC_NAVIC_TOW_DECODE (18) -- Time is set after decoding NavIC satellites
+ */
+}qmiLocGnssTimeExtStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocSvMeasStatusValidMaskT_v02;
+#define QMI_LOC_MASK_MEAS_STATUS_SM_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000001ull) /**< Satellite time in submilliseconds (code-phase) \n */
+#define QMI_LOC_MASK_MEAS_STATUS_SB_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000002ull) /**< Satellite sub-bit time \n */
+#define QMI_LOC_MASK_MEAS_STATUS_MS_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000004ull) /**< Satellite time in milliseconds \n */
+#define QMI_LOC_MASK_MEAS_STATUS_BE_CONFIRM_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000008ull) /**< Signal bit edge is confirmed \n */
+#define QMI_LOC_MASK_MEAS_STATUS_VEL_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000010ull) /**< Satellite Doppler is measured \n */
+#define QMI_LOC_MASK_MEAS_STATUS_VEL_FINE_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000020ull) /**< Fine/coarse Doppler measurement indicator\n */
+#define QMI_LOC_MASK_MEAS_STATUS_LP_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000040ull) /**< TRUE/FALSE -- Lock point is valid/invalid \n */
+#define QMI_LOC_MASK_MEAS_STATUS_LP_POS_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000080ull) /**< TRUE/FALSE -- Lock point is positive/negative \n */
+#define QMI_LOC_MASK_MEAS_STATUS_FROM_RNG_DIFF_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000200ull) /**< Range update from satellite differences \n */
+#define QMI_LOC_MASK_MEAS_STATUS_FROM_VE_DIFF_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x00000400ull) /**< Doppler update from satellite differences \n */
+#define QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x08000000ull) /**< TRUE -- Fresh GNSS measurement observed in the last second \n */
+#define QMI_LOC_MASK_MEAS_STATUS_RESERVED_UNUSED_1_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x10000000ull) /**< Reserved for future use \n */
+#define QMI_LOC_MASK_MEAS_STATUS_RESERVED_UNUSED_2_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x20000000ull) /**< Reserved for future use \n */
+#define QMI_LOC_MASK_MEAS_STATUS_100MS_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x40000000ull) /**< TRUE -- SV time known with 100 ms ambiguity \n */
+#define QMI_LOC_MASK_MEAS_STATUS_2S_STAT_BIT_VALID_V02 ((qmiLocSvMeasStatusValidMaskT_v02)0x80000000ull) /**< TRUE -- SV time known with 2 seconds ambiguity */
+typedef uint64_t qmiLocSvMeasStatusMaskT_v02;
+#define QMI_LOC_MASK_MEAS_STATUS_SM_VALID_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000001ull) /**< Satellite time in submilliseconds (code phase) is known \n */
+#define QMI_LOC_MASK_MEAS_STATUS_SB_VALID_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000002ull) /**< Satellite sub-bit time is known \n */
+#define QMI_LOC_MASK_MEAS_STATUS_MS_VALID_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000004ull) /**< Satellite time in milliseconds is known \n */
+#define QMI_LOC_MASK_MEAS_STATUS_BE_CONFIRM_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000008ull) /**< Signal bit edge is confirmed \n */
+#define QMI_LOC_MASK_MEAS_STATUS_VELOCITY_VALID_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000010ull) /**< Satellite Doppler is measured \n */
+#define QMI_LOC_MASK_MEAS_STATUS_VELOCITY_FINE_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000020ull) /**< TRUE -- Fine Doppler is measured \n FALSE -- Coarse Doppler is measured \n */
+#define QMI_LOC_MASK_MEAS_STATUS_LP_VALID_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000040ull) /**< TRUE -- Lock point is valid \n FALSE -- Lock point is invalid \n */
+#define QMI_LOC_MASK_MEAS_STATUS_LP_POS_VALID_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000080ull) /**< TRUE -- Lock point is positive \n FALSE -- Lock point is negative \n */
+#define QMI_LOC_MASK_MEAS_STATUS_FROM_RNG_DIFF_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000200ull) /**< Range update from satellite differences is measured \n */
+#define QMI_LOC_MASK_MEAS_STATUS_FROM_VE_DIFF_V02 ((qmiLocSvMeasStatusMaskT_v02)0x00000400ull) /**< Doppler update from satellite differences is measured \n */
+#define QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_VALID_V02 ((qmiLocSvMeasStatusMaskT_v02)0x08000000ull) /**< TRUE -- Fresh GNSS measurement observed in last second */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint32_t svTimeMs;
+ /**< Satellite time in milliseconds. \n
+ - For GPS, BDS, Galileo, and QZSS -- Range is 0 through (604800000-1) \n
+ - For GLONASS -- Range is 0 through (86400000-1) \n
+ Valid when the QMI_LOC_MEAS_STATUS_MS_VALID bit is set
+ in the measurement status. \n
+ @note All SV times in the current measurement block are
+ already propagated to a common reference time epoch.
+ */
+
+ float svTimeSubMs;
+ /**< Satellite time in submilliseconds. \n
+ Total SV Time = svMs + svSubMs \n
+ - Units -- Milliseconds
+ */
+
+ float svTimeUncMs;
+ /**< Satellite time uncertainty. \n
+ - Units -- Milliseconds
+ */
+
+ float dopplerShift;
+ /**< Satellite Doppler. \n
+ - Units -- Meters per second
+ */
+
+ float dopplerShiftUnc;
+ /**< Satellite Doppler uncertainty. \n
+ - Units -- Meters per second
+ */
+
+ uint8_t dopplerAccel_valid;
+ /**< Validity for Doppler acceleration. */
+
+ float dopplerAccel;
+ /**< Satellite Doppler acceleration. \n
+ - Units -- Hz per second
+ */
+}qmiLocSVTimeSpeedStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint16_t qmiLocMeasFieldsValidMaskT_v02;
+#define QMI_LOC_SV_HEALTH_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x01) /**< SV health information is valid \n */
+#define QMI_LOC_SV_MULTIPATH_EST_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x02) /**< Multipath estimate for SV is valid \n */
+#define QMI_LOC_SV_FINE_SPEED_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x04) /**< Fine speed for SV is valid \n */
+#define QMI_LOC_SV_FINE_SPEED_UNC_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x08) /**< Fine speed uncertainty for SV is valid \n */
+#define QMI_LOC_SV_CARRIER_PHASE_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x10) /**< Carrier phase for SV is valid \n */
+#define QMI_LOC_SV_SV_DIRECTION_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x20) /**< SV direction information for SV is valid \n */
+#define QMI_LOC_SV_CYCLESLIP_COUNT_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x40) /**< Cycle slip count information is valid \n */
+#define QMI_LOC_SV_LOSSOFLOCK_VALID_V02 ((qmiLocMeasFieldsValidMaskT_v02)0x80) /**< Loss of lock information is valid */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t gnssSvId;
+ /**< GNSS SV ID.\n
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96. When slot-number to SV ID mapping is unknown, set as 255.\n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ uint8_t gloFrequency;
+ /**< GLONASS frequency number + 8. \n
+ Valid only for a GLONASS system, ignore for all other systems. \n
+ - Range -- 1 to 14
+ */
+
+ qmiLocSvStatusEnumT_v02 svStatus;
+ /**< Satellite search state.
+ Values: \n
+ - eQMI_LOC_SV_STATUS_IDLE (1) -- SV is not being actively processed \n
+ - eQMI_LOC_SV_STATUS_SEARCH (2) -- The system is searching for this SV \n
+ - eQMI_LOC_SV_STATUS_TRACK (3) -- SV is being tracked
+ */
+
+ qmiLocMeasFieldsValidMaskT_v02 validMask;
+ /**< Validity mask (0 = Not valid; 1 = valid). \n
+ - QMI_LOC_SV_HEALTH_VALID (0x01) -- SV health information is valid \n
+ - QMI_LOC_SV_MULTIPATH_EST_VALID (0x02) -- Multipath estimate for SV is valid \n
+ - QMI_LOC_SV_FINE_SPEED_VALID (0x04) -- Fine speed for SV is valid \n
+ - QMI_LOC_SV_FINE_SPEED_UNC_VALID (0x08) -- Fine speed uncertainty for SV is valid \n
+ - QMI_LOC_SV_CARRIER_PHASE_VALID (0x10) -- Carrier phase for SV is valid \n
+ - QMI_LOC_SV_SV_DIRECTION_VALID (0x20) -- SV direction information for SV is valid \n
+ - QMI_LOC_SV_CYCLESLIP_COUNT_VALID (0x40) -- Cycle slip count information is valid \n
+ - QMI_LOC_SV_LOSSOFLOCK_VALID (0x80) -- Loss of lock information is valid
+ */
+
+ uint8_t healthStatus;
+ /**< Health status.
+ Range -- 0 to 1 \n
+ - 0 -- Unhealthy \n
+ - 1 -- Healthy
+ */
+
+ qmiLocSvInfoMaskT_v02 svInfoMask;
+ /**< Indicates whether almanac and ephemeris information is available.
+ Values: \n
+ - QMI_LOC_SVINFO_MASK_HAS_EPHEMERIS (0x01) -- Ephemeris is available for this SV
+ - QMI_LOC_SVINFO_MASK_HAS_ALMANAC (0x02) -- Almanac is available for this SV
+ */
+
+ qmiLocSvMeasStatusValidMaskT_v02 validMeasStatusMask;
+ /**< Validity mask for measurement status information. \n
+ A set bit in validMeasStatusMask indicates that the corresponding bit
+ in measurementStatus has valid status information: \n
+ Valid masks: \n
+ - QMI_LOC_MASK_MEAS_STATUS_SM_STAT_BIT_VALID (0x00000001) -- Satellite time in submilliseconds (code-phase) \n
+ - QMI_LOC_MASK_MEAS_STATUS_SB_STAT_BIT_VALID (0x00000002) -- Satellite sub-bit time \n
+ - QMI_LOC_MASK_MEAS_STATUS_MS_STAT_BIT_VALID (0x00000004) -- Satellite time in milliseconds \n
+ - QMI_LOC_MASK_MEAS_STATUS_BE_CONFIRM_STAT_BIT_VALID (0x00000008) -- Signal bit edge is confirmed \n
+ - QMI_LOC_MASK_MEAS_STATUS_VEL_STAT_BIT_VALID (0x00000010) -- Satellite Doppler is measured \n
+ - QMI_LOC_MASK_MEAS_STATUS_VEL_FINE_STAT_BIT_VALID (0x00000020) -- Fine/coarse Doppler measurement indicator\n
+ - QMI_LOC_MASK_MEAS_STATUS_LP_STAT_BIT_VALID (0x00000040) -- TRUE/FALSE -- Lock point is valid/invalid \n
+ - QMI_LOC_MASK_MEAS_STATUS_LP_POS_STAT_BIT_VALID (0x00000080) -- TRUE/FALSE -- Lock point is positive/negative \n
+ - QMI_LOC_MASK_MEAS_STATUS_FROM_RNG_DIFF_STAT_BIT_VALID (0x00000200) -- Range update from satellite differences \n
+ - QMI_LOC_MASK_MEAS_STATUS_FROM_VE_DIFF_STAT_BIT_VALID (0x00000400) -- Doppler update from satellite differences \n
+ - QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_STAT_BIT_VALID (0x08000000) -- TRUE -- Fresh GNSS measurement observed in the last second \n
+ - QMI_LOC_MASK_MEAS_STATUS_RESERVED_UNUSED_1_BIT_VALID (0x10000000) -- Reserved for future use \n
+ - QMI_LOC_MASK_MEAS_STATUS_RESERVED_UNUSED_2_BIT_VALID (0x20000000) -- Reserved for future use \n
+ - QMI_LOC_MASK_MEAS_STATUS_100MS_STAT_BIT_VALID (0x40000000) -- TRUE -- SV time known with 100 ms ambiguity \n
+ - QMI_LOC_MASK_MEAS_STATUS_2S_STAT_BIT_VALID (0x80000000) -- TRUE -- SV time known with 2 seconds ambiguity
+ \vspace{4pt}
+ \n MSB 0xFFC0000000000000 bits indicate the validity of DONT_USE bits.
+ */
+
+ qmiLocSvMeasStatusMaskT_v02 measurementStatus;
+ /**< Bitmask indicating the SV measurement status.
+ Valid bitmasks: \n
+ - QMI_LOC_MASK_MEAS_STATUS_SM_VALID (0x00000001) -- Satellite time in submilliseconds (code phase) is known \n
+ - QMI_LOC_MASK_MEAS_STATUS_SB_VALID (0x00000002) -- Satellite sub-bit time is known \n
+ - QMI_LOC_MASK_MEAS_STATUS_MS_VALID (0x00000004) -- Satellite time in milliseconds is known \n
+ - QMI_LOC_MASK_MEAS_STATUS_BE_CONFIRM (0x00000008) -- Signal bit edge is confirmed \n
+ - QMI_LOC_MASK_MEAS_STATUS_VELOCITY_VALID (0x00000010) -- Satellite Doppler is measured \n
+ - QMI_LOC_MASK_MEAS_STATUS_VELOCITY_FINE (0x00000020) -- TRUE -- Fine Doppler is measured \n FALSE -- Coarse Doppler is measured \n
+ - QMI_LOC_MASK_MEAS_STATUS_LP_VALID (0x00000040) -- TRUE -- Lock point is valid \n FALSE -- Lock point is invalid \n
+ - QMI_LOC_MASK_MEAS_STATUS_LP_POS_VALID (0x00000080) -- TRUE -- Lock point is positive \n FALSE -- Lock point is negative \n
+ - QMI_LOC_MASK_MEAS_STATUS_FROM_RNG_DIFF (0x00000200) -- Range update from satellite differences is measured \n
+ - QMI_LOC_MASK_MEAS_STATUS_FROM_VE_DIFF (0x00000400) -- Doppler update from satellite differences is measured \n
+ - QMI_LOC_MASK_MEAS_STATUS_GNSS_FRESH_MEAS_VALID (0x08000000) -- TRUE -- Fresh GNSS measurement observed in last second
+
+ If any MSB bit in 0xFFC0000000000000 DONT_USE is set, the client must not
+ use the measurement.
+ */
+
+ uint16_t CNo;
+ /**< Carrier to noise ratio at antenna. \n
+ - Units -- dBHz \n
+ - Scale -- 0.1
+ */
+
+ uint16_t gloRfLoss;
+ /**< GLONASS RF loss reference to the antenna. \n
+ - Units -- dB \n
+ - Scale -- 0.1
+ */
+
+ int32_t measLatency;
+ /**< Age of the measurement; a positive value means the measurement precedes the reference time. \n
+ - Units -- Milliseconds
+ */
+
+ qmiLocSVTimeSpeedStructT_v02 svTimeSpeed;
+ /**< SV time and speed information. */
+
+ uint8_t lossOfLock;
+ /**< Loss of signal lock indicator. \n
+ - 0 -- Signal is in continuous track \n
+ - 1 -- Signal is not in track
+ */
+
+ float multipathEstimate;
+ /**< Estimate of multipath in a measurement. \n
+ - Units -- Meters
+ */
+
+ float fineSpeed;
+ /**< Carrier phase derived speed.\n
+ - Units -- Meters per second
+ */
+
+ float fineSpeedUnc;
+ /**< Carrier phase derived speed uncertainty. \n
+ - Units -- Meters per second
+ */
+
+ double carrierPhase;
+ /**< Carrier phase measurement (L1 cycles).
+ */
+
+ uint8_t cycleSlipCount;
+ /**< Increments when a cycle slip is detected. */
+
+ float svAzimuth;
+ /**< Satellite azimuth.\n
+ - Units -- Radians \n
+ - Range -- 0 to 2*pi()
+ */
+
+ float svElevation;
+ /**< Satellite elevation. \n
+ - Units -- Radians \n
+ - Range -- 0 to pi()/2
+ */
+}qmiLocSVMeasurementStructT_v02; /* Type */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocSvDgnssMeasStatusMaskT_v02;
+#define QMI_LOC_MASK_DGNSS_EPOCH_TIME_VALID_V02 ((qmiLocSvDgnssMeasStatusMaskT_v02)0x00000001ull) /**< DGNSS epoch time is valid. \n */
+#define QMI_LOC_MASK_DGNSS_MEAS_STATUS_PR_VALID_V02 ((qmiLocSvDgnssMeasStatusMaskT_v02)0x00000002ull) /**< Pseudorange correction is valid. \n */
+#define QMI_LOC_MASK_DGNSS_MEAS_STATUS_PRR_VALID_V02 ((qmiLocSvDgnssMeasStatusMaskT_v02)0x00000004ull) /**< Pseudorange rate correction is valid. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSvDgnssMeasStatusMaskT_v02 dgnssMeasStatus;
+ /**< Bitmask indicating the DGNSS SV measurement status.
+ Valid bitmasks: \n
+ - QMI_LOC_MASK_DGNSS_EPOCH_TIME_VALID (0x00000001) -- DGNSS epoch time is valid. \n
+ - QMI_LOC_MASK_DGNSS_MEAS_STATUS_PR_VALID (0x00000002) -- Pseudorange correction is valid. \n
+ - QMI_LOC_MASK_DGNSS_MEAS_STATUS_PRR_VALID (0x00000004) -- Pseudorange rate correction is valid.
+ */
+
+ uint32_t diffDataEpochTimeMsec;
+ /**< Age of differential data in milliseconds with respect to the easurement time.
+ */
+
+ float prCorrMeters;
+ /**< Pseudorange correction in meters.
+ */
+
+ float prrCorrMetersPerSec;
+ /**< Pseudorange rate correction in meters per second.
+ */
+}qmiLocDgnssSVMeasurementStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a satellite measurement report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Current Message Sequence Number */
+ uint8_t seqNum;
+ /**< Current message number; used for segmentation/assembly of measurement reports. */
+
+ /* Mandatory */
+ /* Maximum Number of Messages to Send for Present Time Epoch */
+ uint8_t maxMessageNum;
+ /**< Maximum number of messages to send for the present time epoch. */
+
+ /* Mandatory */
+ /* Specifies Satellite System Constellation of This Report */
+ qmiLocSvSystemEnumT_v02 system;
+ /**< Specifies the satellite system constellation of this report.
+ Values: \n
+ - eQMI_LOC_SV_SYSTEM_GPS (1) -- GPS satellite \n
+ - eQMI_LOC_SV_SYSTEM_GALILEO (2) -- Galileo satellite \n
+ - eQMI_LOC_SV_SYSTEM_SBAS (3) -- SBAS satellite \n
+ - eQMI_LOC_SV_SYSTEM_COMPASS (4) -- COMPASS satellite (Deprecated) \n
+ - eQMI_LOC_SV_SYSTEM_GLONASS (5) -- GLONASS satellite \n
+ - eQMI_LOC_SV_SYSTEM_BDS (6) -- BDS satellite \n
+ - eQMI_LOC_SV_SYSTEM_QZSS (7) -- QZSS satellite \n
+ - eQMI_LOC_SV_SYSTEM_NAVIC (8) -- NavIC satellite
+ */
+
+ /* Optional */
+ /* GNSS Receiver Clock Frequency Information */
+ uint8_t rcvrClockFrequencyInfo_valid; /**< Must be set to true if rcvrClockFrequencyInfo is being passed */
+ qmiLocRcvrClockFrequencyInfoStructT_v02 rcvrClockFrequencyInfo;
+
+ /* Optional */
+ /* Leap Second Information */
+ uint8_t leapSecondInfo_valid; /**< Must be set to true if leapSecondInfo is being passed */
+ qmiLocLeapSecondInfoStructT_v02 leapSecondInfo;
+
+ /* Optional */
+ /* GPS to GLONASS Intersystem Time Bias */
+ uint8_t gpsGloInterSystemBias_valid; /**< Must be set to true if gpsGloInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 gpsGloInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both GPS and GLONASS system
+ information reporting are enabled. \n
+ - System 1 -- GPS \n
+ - System 2 -- GLONASS
+ */
+
+ /* Optional */
+ /* GPS to BDS Intersystem Time Bias */
+ uint8_t gpsBdsInterSystemBias_valid; /**< Must be set to true if gpsBdsInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 gpsBdsInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both GPS and BDS system
+ information reporting are enabled. \n
+ - System 1 -- GPS \n
+ - System 2 -- BDS
+ */
+
+ /* Optional */
+ /* GPS to Galileo Intersystem Time Bias */
+ uint8_t gpsGalInterSystemBias_valid; /**< Must be set to true if gpsGalInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 gpsGalInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both GPS and Galileo system
+ information reporting are enabled. \n
+ - System 1 -- GPS \n
+ - System 2 -- Galileo
+ */
+
+ /* Optional */
+ /* BDS to GLONASS Intersystem Time Bias */
+ uint8_t bdsGloInterSystemBias_valid; /**< Must be set to true if bdsGloInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 bdsGloInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both BDS and GLONASS system
+ information reporting are enabled. \n
+ - System 1 -- BDS \n
+ - System 2 -- GLONASS
+ */
+
+ /* Optional */
+ /* Galileo to GLONASS Intersystem Time Bias */
+ uint8_t galGloInterSystemBias_valid; /**< Must be set to true if galGloInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 galGloInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both Galileo and GLONASS system
+ information reporting are enabled. \n
+ - System 1 -- Galileo \n
+ - System 2 -- GLONASS
+ */
+
+ /* Optional */
+ /* Galileo to BDS Intersystem Time Bias */
+ uint8_t galBdsInterSystemBias_valid; /**< Must be set to true if galBdsInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 galBdsInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both Galileo and BDS system
+ information reporting are enabled. \n
+ - System 1 -- Galileo \n
+ - System 2 -- BDS
+ */
+
+ /* Optional */
+ /* Satellite System Time Information for GPS, BDS, GAL Constellation */
+ uint8_t systemTime_valid; /**< Must be set to true if systemTime is being passed */
+ qmiLocGnssTimeStructT_v02 systemTime;
+
+ /* Optional */
+ /* GLONASS System Time Information */
+ uint8_t gloTime_valid; /**< Must be set to true if gloTime is being passed */
+ qmiLocGloTimeStructT_v02 gloTime;
+
+ /* Optional */
+ /* Extended Time Information */
+ uint8_t systemTimeExt_valid; /**< Must be set to true if systemTimeExt is being passed */
+ qmiLocGnssTimeExtStructT_v02 systemTimeExt;
+
+ /* Optional */
+ /* Satellite System Measurement Report for Enabled Constellation */
+ uint8_t svMeasurement_valid; /**< Must be set to true if svMeasurement is being passed */
+ uint32_t svMeasurement_len; /**< Must be set to # of elements in svMeasurement */
+ qmiLocSVMeasurementStructT_v02 svMeasurement[QMI_LOC_SV_MEAS_LIST_MAX_SIZE_V02];
+
+ /* Optional */
+ /* Extended Time Information - Cumulative Number of Clock Resets */
+ uint8_t numClockResets_valid; /**< Must be set to true if numClockResets is being passed */
+ uint32_t numClockResets;
+ /**< Number of clock resets/discontinuities detected, affecting the local hardware counter value. */
+
+ /* Optional */
+ /* SV Carrier Phase Measurement Uncertainty for Enabled Constellation */
+ uint8_t svCarrierPhaseUncertainty_valid; /**< Must be set to true if svCarrierPhaseUncertainty is being passed */
+ uint32_t svCarrierPhaseUncertainty_len; /**< Must be set to # of elements in svCarrierPhaseUncertainty */
+ float svCarrierPhaseUncertainty[QMI_LOC_SV_MEAS_LIST_MAX_SIZE_V02];
+
+ /* Optional */
+ /* GNSS Signal Type */
+ uint8_t gnssSignalType_valid; /**< Must be set to true if gnssSignalType is being passed */
+ qmiLocGnssSignalTypeMaskT_v02 gnssSignalType;
+ /**< GNSS signal type. \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band */
+
+ /* Optional */
+ /* Jammer Indicator */
+ uint8_t jammerIndicator_valid; /**< Must be set to true if jammerIndicator is being passed */
+ qmiLocJammerIndicatorStructT_v02 jammerIndicator;
+
+ /* Optional */
+ /* GPS L1 - L2C Intrasystem Time Bias */
+ uint8_t GpsL1L2cTimeBias_valid; /**< Must be set to true if GpsL1L2cTimeBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 GpsL1L2cTimeBias;
+ /**< GPS L1 to L2C time bias (L2C-L1). */
+
+ /* Optional */
+ /* GPS L1 - L5 Intrasystem Time Bias */
+ uint8_t GpsL1L5TimeBias_valid; /**< Must be set to true if GpsL1L5TimeBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 GpsL1L5TimeBias;
+ /**< GPS L1 to L5 time bias (L5-L1). */
+
+ /* Optional */
+ /* GLO G1 - G2 Intrasystem Time Bias */
+ uint8_t GloG1G2TimeBias_valid; /**< Must be set to true if GloG1G2TimeBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 GloG1G2TimeBias;
+ /**< GLONASS G1 to G2 time bias (G2-G1). */
+
+ /* Optional */
+ /* BDS B1I - B2A Intrasystem Time Bias */
+ uint8_t BdsB1iB2aTimeBias_valid; /**< Must be set to true if BdsB1iB2aTimeBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 BdsB1iB2aTimeBias;
+ /**< BDS B1I to B2A time bias (B2A-B1I). */
+
+ /* Optional */
+ /* BDS B1I - B1C Intrasystem Time Bias */
+ uint8_t BdsB1iB1cTimeBias_valid; /**< Must be set to true if BdsB1iB1cTimeBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 BdsB1iB1cTimeBias;
+ /**< BDS B1I to B1C time bias (B1C-B1I). */
+
+ /* Optional */
+ /* Galileo E1 - E5A Intrasystem Time Bias */
+ uint8_t GalE1E5aTimeBias_valid; /**< Must be set to true if GalE1E5aTimeBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 GalE1E5aTimeBias;
+ /**< Galileo E1 to E5a time bias (E5a-E1). */
+
+ /* Optional */
+ /* Galileo E1 - E5B Intrasystem Time Bias */
+ uint8_t GalE1E5bTimeBias_valid; /**< Must be set to true if GalE1E5bTimeBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 GalE1E5bTimeBias;
+ /**< Galileo E1 to E5b time bias (E5b-E1). */
+
+ /* Optional */
+ /* NHz Indicator */
+ uint8_t nHzMeasurement_valid; /**< Must be set to true if nHzMeasurement is being passed */
+ uint8_t nHzMeasurement;
+ /**< NHz indicator. Values: \n
+ - 0 indicates 1Hz measurement report \n
+ - 1 indicates NHz measurement report (N > 1) */
+
+ /* Optional */
+ /* GNSS Measurement Code Type */
+ uint8_t measurementCodeType_valid; /**< Must be set to true if measurementCodeType is being passed */
+ qmiLocMeasurementCodeTypeEnumT_v02 measurementCodeType;
+ /**< Specifies the GNSS measurement's code type.
+ - eQMI_LOC_GNSS_CODE_TYPE_A (0) -- Galileo E1A, Galileo E6A, IRNSS L5A, IRNSS SA. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_B (1) -- Galileo E1B, Galileo E6B, IRNSS L5B, IRNSS SB. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_C (2) -- GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A, GLONASS G2 C/A, Galileo E1C,
+ Galileo E6C, SBAS L1 C/A, QZSS L1 C/A, IRNSS L5C. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_I (3) -- GPS L5 I, GLONASS G3 I, Galileo E5a I, Galileo E5b I, Galileo E5a+b I,
+ SBAS L5 I, QZSS L5 I, BDS B1 I, BDS B2 I, BDS B3 I. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_L (4) -- GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), LEX(6) L. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_M (5) -- GPS L1M, GPS L2M. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_P (6) -- GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P.\n
+ - eQMI_LOC_GNSS_CODE_TYPE_Q (7) -- GPS L5 Q, GLONASS G3 Q, Galileo E5a Q, Galileo E5b Q, Galileo E5a+b Q,
+ SBAS L5 Q, QZSS L5 Q, BDS B1 Q, BDS B2 Q, BDS B3 Q. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_S (8) -- GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), LEX(6) S. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_W (9) -- GPS L1 Z-tracking, GPS L2 Z-tracking. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_X (10) -- GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q), GLONASS G3 (I+Q),
+ Galileo E1 (B+C), Galileo E5a (I+Q), Galileo E5b (I+Q),
+ Galileo E5a+b(I+Q), Galileo E6 (B+C), SBAS L5 (I+Q), QZSS L1C (D+P),
+ QZSS L2C (M+L), QZSS L5 (I+Q), LEX(6) (S+L), BDS B1 (I+Q), BDS B2 (I+Q),
+ BDS B3 (I+Q), IRNSS L5 (B+C). \n
+ - eQMI_LOC_GNSS_CODE_TYPE_Y (11) -- GPS L1Y, GPS L2Y. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_Z (12) -- Galileo E1 (A+B+C), Galileo E6 (A+B+C), QZSS L1-SAIF. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_N (13) -- GPS L1 codeless, GPS L2 codeless. \n
+ - eQMI_LOC_GNSS_CODE_TYPE_OTHER (255) -- This code is used in case the measurement used a GNSS signal code that is not listed above.
+ */
+
+ /* Optional */
+ /* Other Code Type Name (NULL-Terminated) */
+ uint8_t otherCodeTypeName_valid; /**< Must be set to true if otherCodeTypeName is being passed */
+ uint32_t otherCodeTypeName_len; /**< Must be set to # of elements in otherCodeTypeName */
+ char otherCodeTypeName[QMI_LOC_SV_MEAS_OTHER_CODE_TYPE_NAME_MAX_LEN_V02];
+ /**< - Type -- character string \n
+ - Maximum length of the array -- 8 \n
+ When using the measurement code type eQMI_LOC_GNSS_CODE_TYPE_OTHER,
+ the name of the code is specified in the char array above. */
+
+ /* Optional */
+ /* GPS to NavIC Intersystem Time Bias */
+ uint8_t gpsNavicInterSystemBias_valid; /**< Must be set to true if gpsNavicInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 gpsNavicInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both the GPS and NavIC system
+ information reporting are enabled. \n
+ - System 1 -- GPS \n
+ - System 2 -- NavIC
+ */
+
+ /* Optional */
+ /* Galileo to NavIC Intersystem Time Bias */
+ uint8_t galNavicInterSystemBias_valid; /**< Must be set to true if galNavicInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 galNavicInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both the Galileo and NavIC system
+ information reporting are enabled. \n
+ - System 1 -- Galileo \n
+ - System 2 -- NavIC
+ */
+
+ /* Optional */
+ /* GLONASS to NavIC Intersystem Time Bias */
+ uint8_t gloNavicInterSystemBias_valid; /**< Must be set to true if gloNavicInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 gloNavicInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both the GLO and NavIC system
+ information reporting are enabled. \n
+ - System 1 -- GLONASS \n
+ - System 2 -- NavIC
+ */
+
+ /* Optional */
+ /* BDS to NavIC Intersystem Time Bias */
+ uint8_t bdsNavicInterSystemBias_valid; /**< Must be set to true if bdsNavicInterSystemBias is being passed */
+ qmiLocInterSystemBiasStructT_v02 bdsNavicInterSystemBias;
+ /**< \vspace{4pt} \n
+ Reported when both the BDS and NavIC system
+ information reporting are enabled. \n
+ - System 1 -- BDS \n
+ - System 2 -- NavIC
+ */
+
+ /* Optional */
+ /* Measurement Report for Extended SVs */
+ uint8_t extSvMeasurement_valid; /**< Must be set to true if extSvMeasurement is being passed */
+ uint32_t extSvMeasurement_len; /**< Must be set to # of elements in extSvMeasurement */
+ qmiLocSVMeasurementStructT_v02 extSvMeasurement[QMI_LOC_EXT_SV_MEAS_LIST_MAX_SIZE_V02];
+
+ /* Optional */
+ /* Carrier Phase Measurement Uncertainty for Extended SVs */
+ uint8_t extSvCarrierPhaseUncertainty_valid; /**< Must be set to true if extSvCarrierPhaseUncertainty is being passed */
+ uint32_t extSvCarrierPhaseUncertainty_len; /**< Must be set to # of elements in extSvCarrierPhaseUncertainty */
+ float extSvCarrierPhaseUncertainty[QMI_LOC_EXT_SV_MEAS_LIST_MAX_SIZE_V02];
+
+ /* Optional */
+ /* Receiver Tick at Frame Count */
+ uint8_t refCountTicks_valid; /**< Must be set to true if refCountTicks is being passed */
+ uint64_t refCountTicks;
+ /**< Receiver frame counter value in ticks. */
+
+ /* Optional */
+ /* DGNSS Corrections Source Type */
+ uint8_t dgnssCorrectionSourceT_valid; /**< Must be set to true if dgnssCorrectionSourceT is being passed */
+ qmiLocDgnssCorrectionSourceTypeEnumT_v02 dgnssCorrectionSourceT;
+ /**< If DGNSS is used, the DGNSS correction source.
+ - eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_INVALID (0) -- Invalid DGNSS correction source type \n
+ - eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_RTCM (1) -- DGNSS correction source type RTCM \n
+ - eQMI_LOC_DGNSS_CORR_SOURCE_TYPE_3GPP (2) -- DGNSS correction source type 3GPP
+ */
+
+ /* Optional */
+ /* DGNSS SourceID */
+ uint8_t dgnssCorrectionSourceID_valid; /**< Must be set to true if dgnssCorrectionSourceID is being passed */
+ uint32_t dgnssCorrectionSourceID;
+ /**< If using DGNSS, the SourceID is a 32bit number identifying the DGNSS source ID. */
+
+ /* Optional */
+ /* DGNSS Ref Station ID */
+ uint8_t dgnssRefStationId_valid; /**< Must be set to true if dgnssRefStationId is being passed */
+ uint16_t dgnssRefStationId;
+ /**< If using DGNSS, reference Station ID 0-4095 used to produce the pos report */
+
+ /* Optional */
+ /* DGNSS Measurements Report for SVs */
+ uint8_t dgnssSvMeasurement_valid; /**< Must be set to true if dgnssSvMeasurement is being passed */
+ uint32_t dgnssSvMeasurement_len; /**< Must be set to # of elements in dgnssSvMeasurement */
+ qmiLocDgnssSVMeasurementStructT_v02 dgnssSvMeasurement[QMI_LOC_DGNSS_SV_MEAS_LIST_MAX_SIZE_V02];
+ /**< \n If using DGNSS, the per SV measurement correction data.
+ The elements 0 -- (QMI_LOC_SV_MEAS_LIST_MAX_SIZE -- 1) of this array correspond
+ to the SV measurements in the TLV svMeasurement.
+ The elements QMI_LOC_SV_MEAS_LIST_MAX_SIZE -- (QMI_LOC_DGNSS_SV_MEAS_LIST_MAX_SIZE -- 1) of
+ this array correspond to the SV measurements in the TLV extSvMeasurement.
+ */
+
+ /* Optional */
+ /* Uncertainty for Receiver Tick at Frame Count */
+ uint8_t refCountTicksUnc_valid; /**< Must be set to true if refCountTicksUnc is being passed */
+ float refCountTicksUnc;
+ /**< Uncertainty for receiver frame counter value. \n
+ - Units -- milliseconds
+ */
+
+ /* Optional */
+ /* Sub-Sequence Number */
+ uint8_t subSeqNum_valid; /**< Must be set to true if subSeqNum is being passed */
+ uint8_t subSeqNum;
+ /**< Current sub-sequence number for a specified sequence number (TLV 0x01).
+ Used for segmentation/assembly of individual sequence numbers.
+ If the number of SV measurements in one sequence number exceeds 24,
+ multiple indications are sent with unique subSeqNum and common maxSubSeqNum.
+ The control point is responsible for assembling the data for that
+ sequence number using these fields. */
+
+ /* Optional */
+ /* Maximum Sub-Sequence Number */
+ uint8_t maxSubSeqNum_valid; /**< Must be set to true if maxSubSeqNum is being passed */
+ uint8_t maxSubSeqNum;
+ /**< Maximum number of sub-sequence numbers for a specified sequence number. */
+}qmiLocEventGnssSvMeasInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint16_t qmiLocSvPolyStatusMaskT_v02;
+#define QMI_LOC_SV_POLY_SRC_ALM_CORR_V02 ((qmiLocSvPolyStatusMaskT_v02)0x01) /**< Polynomials based on XTRA. \n */
+#define QMI_LOC_SV_POLY_GLO_STR4_V02 ((qmiLocSvPolyStatusMaskT_v02)0x02) /**< GLONASS string 4 has been received. \n */
+#define QMI_LOC_SV_POLY_DELETE_V02 ((qmiLocSvPolyStatusMaskT_v02)0x04) /**< Polynomials are invalid and should be deleted. \n */
+#define QMI_LOC_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((qmiLocSvPolyStatusMaskT_v02)0x08) /**< Polynomials based on Galileo FNAV if set; INAV otherwise. */
+typedef uint16_t qmiLocSvPolyStatusMaskValidityT_v02;
+#define QMI_LOC_SV_POLY_SRC_ALM_CORR_VALID_V02 ((qmiLocSvPolyStatusMaskValidityT_v02)0x01) /**< Validity status for QMI_LOC_SV_POLY_SRC_ALM_CORR. \n */
+#define QMI_LOC_SV_POLY_GLO_STR4_VALID_V02 ((qmiLocSvPolyStatusMaskValidityT_v02)0x02) /**< Validity status for QMI_LOC_SV_POLY_GLO_STR4. \n */
+#define QMI_LOC_SV_POLY_DELETE_VALID_V02 ((qmiLocSvPolyStatusMaskValidityT_v02)0x04) /**< Validity status for QMI_LOC_SV_POLY_DELETE. \n */
+#define QMI_LOC_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((qmiLocSvPolyStatusMaskValidityT_v02)0x08) /**< Validity status for QMI_LOC_SV_POLY_SRC_GAL_FNAV_OR_INAV. */
+typedef uint64_t qmiLocSignalHealthMaskT_v02;
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L1_HEALTHY_V02 ((qmiLocSignalHealthMaskT_v02)0x0001ull) /**< L1 signal is healthy \n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L2_HEALTHY_V02 ((qmiLocSignalHealthMaskT_v02)0x0002ull) /**< L2 signal is healthy \n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L5_HEALTHY_V02 ((qmiLocSignalHealthMaskT_v02)0x0004ull) /**< L5 signal is healthy \n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L1_UNKNOWN_V02 ((qmiLocSignalHealthMaskT_v02)0x0008ull) /**< L1 signal health is unknown \n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L2_UNKNOWN_V02 ((qmiLocSignalHealthMaskT_v02)0x0010ull) /**< L2 signal health is unknown \n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L5_UNKNOWN_V02 ((qmiLocSignalHealthMaskT_v02)0x0020ull) /**< L5 signal health is unknown\n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L1_UNHEALTHY_V02 ((qmiLocSignalHealthMaskT_v02)0x0040ull) /**< L1 signal is unhealthy \n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L2_UNHEALTHY_V02 ((qmiLocSignalHealthMaskT_v02)0x0080ull) /**< L2 signal is unhealthy \n */
+#define QMI_LOC_SIGNAL_HEALTH_MASK_L5_UNHEALTHY_V02 ((qmiLocSignalHealthMaskT_v02)0x0100ull) /**< L5 signal is unhealthy */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a satellite polynomial report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* GNSS SV Polynomial Report */
+ uint16_t gnssSvId;
+ /**< GNSS SV ID. Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - SBAS -- 120 to 158 and 183 to 191 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Mandatory */
+ /* Reference Time for Polynomial Calculations */
+ double T0;
+ /**< Reference time for polynomial calculations. \n
+ - GPS, QZSS -- Seconds in the week \n
+ - GLONASS -- Full seconds since Jan. 1, 1996 \n
+ - BDS -- Full seconds since Jan. 1, 2006 \n
+ - Galileo -- Calculated from 00:00 UT on Sunday, August 22, 1999 (midnight between August 21 and August 22)
+ */
+
+ /* Mandatory */
+ /* SV Polynomial Validity Status */
+ qmiLocSvPolyStatusMaskValidityT_v02 svPolyFlagValid;
+ /**< Validity mask for bits in svPolyFlags. A set bit in svPolyFlagValid indicates that a
+ corresponding bit in svPolyFlags has valid status information.
+ Valid bitmasks: \n
+ - QMI_LOC_SV_POLY_SRC_ALM_CORR_VALID (0x01) -- Validity status for QMI_LOC_SV_POLY_SRC_ALM_CORR. \n
+ - QMI_LOC_SV_POLY_GLO_STR4_VALID (0x02) -- Validity status for QMI_LOC_SV_POLY_GLO_STR4. \n
+ - QMI_LOC_SV_POLY_DELETE_VALID (0x04) -- Validity status for QMI_LOC_SV_POLY_DELETE. \n
+ - QMI_LOC_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID (0x08) -- Validity status for QMI_LOC_SV_POLY_SRC_GAL_FNAV_OR_INAV. */
+
+ /* Mandatory */
+ /* SV Polynomial Report Status */
+ qmiLocSvPolyStatusMaskT_v02 svPolyFlags;
+ /**< Flags indicating the status of a polynomial report.
+ Valid bitmasks: \n
+ - QMI_LOC_SV_POLY_SRC_ALM_CORR (0x01) -- Polynomials based on XTRA. \n
+ - QMI_LOC_SV_POLY_GLO_STR4 (0x02) -- GLONASS string 4 has been received. \n
+ - QMI_LOC_SV_POLY_DELETE (0x04) -- Polynomials are invalid and should be deleted. \n
+ - QMI_LOC_SV_POLY_SRC_GAL_FNAV_OR_INAV (0x08) -- Polynomials based on Galileo FNAV if set; INAV otherwise. */
+
+ /* Optional */
+ /* Polynomial Coefficient's 0th Term for X, Y, and Z Coordinates */
+ uint8_t polyCoeffXYZ0_valid; /**< Must be set to true if polyCoeffXYZ0 is being passed */
+ double polyCoeffXYZ0[QMI_LOC_SV_POLY_XYZ_0_TH_ORDER_COEFF_SIZE_V02];
+ /**< 0th term of the polynomial coefficient for X, Y, and Z coordinates (C0X, C0Y, C0Z). \n
+ - Units -- Meters
+ */
+
+ /* Optional */
+ /* Polynomial Coefficient's 1st, 2nd, and 3rd Terms for X, Y, and Z Coordinates */
+ uint8_t polyCoefXYZN_valid; /**< Must be set to true if polyCoefXYZN is being passed */
+ double polyCoefXYZN[QMI_LOC_SV_POLY_XYZ_N_TH_ORDER_COEFF_SIZE_V02];
+ /**< First, second, and third terms of the Polynomial coefficient for X, Y, and Z coordinates (C1X, C2X,... C2Z, C3Z).\n
+ Units: \n
+ - 1st term -- Meters per second \n
+ - 2nd term -- Meters per second^2 \n
+ - 3rd term -- Meters per seconds^3
+ */
+
+ /* Optional */
+ /* Polynomial Coefficients for Satellite Clock Bias Correction */
+ uint8_t polyCoefClockBias_valid; /**< Must be set to true if polyCoefClockBias is being passed */
+ float polyCoefClockBias[QMI_LOC_SV_POLY_SV_CLKBIAS_COEFF_SIZE_V02];
+ /**< Polynomial coefficients for satellite clock bias correction (C0T, C1T, C2T, C3T). \n
+ Units: \n
+ - 0th term -- Milliseconds per second \n
+ - First term -- Milliseconds per second^2 \n
+ - Second term -- Milliseconds per second^3 \n
+ - Third term -- Milliseconds per second^4
+ */
+
+ /* Optional */
+ /* GLONASS Frequency Number */
+ uint8_t gloFrequency_valid; /**< Must be set to true if gloFrequency is being passed */
+ uint8_t gloFrequency;
+ /**< GLONASS frequency number + 8.
+ Valid only for GLONASS systems, ignore for all other systems. \n
+ - Range -- 1 to 14
+ */
+
+ /* Optional */
+ /* Ephemeris Reference Time */
+ uint8_t IODE_valid; /**< Must be set to true if IODE is being passed */
+ uint16_t IODE;
+ /**< Ephemeris reference time. \n
+ - GPS -- Issue of data ephemeris used (unitless) \n
+ - GLONASS -- Tb 7-bit \n
+ - Galileo -- 10-bit
+ */
+
+ /* Optional */
+ /* Enhanced Reference Time */
+ uint8_t enhancedIOD_valid; /**< Must be set to true if enhancedIOD is being passed */
+ uint32_t enhancedIOD;
+ /**< For BDS ephemeris, this is TOE.
+ */
+
+ /* Optional */
+ /* SV Position Uncertainty */
+ uint8_t svPosUnc_valid; /**< Must be set to true if svPosUnc is being passed */
+ float svPosUnc;
+ /**< SV position uncertainty. \n
+ - Units -- Meters
+ */
+
+ /* Optional */
+ /* Iono Delay */
+ uint8_t ionoDelay_valid; /**< Must be set to true if ionoDelay is being passed */
+ float ionoDelay;
+ /**< Ionospheric delay at T0. \n
+ - Units -- Meters
+ */
+
+ /* Optional */
+ /* Iono Delay Rate */
+ uint8_t ionoDot_valid; /**< Must be set to true if ionoDot is being passed */
+ float ionoDot;
+ /**< Ionospheric delay rate. \n
+ - Units -- Meters per second
+ */
+
+ /* Optional */
+ /* SBAS Iono Delay */
+ uint8_t sbasIonoDelay_valid; /**< Must be set to true if sbasIonoDelay is being passed */
+ float sbasIonoDelay;
+ /**< SBAS ionospheric delay at T0. \n
+ - Units -- Meters
+ */
+
+ /* Optional */
+ /* SBAS Iono Delay Rate */
+ uint8_t sbasIonoDot_valid; /**< Must be set to true if sbasIonoDot is being passed */
+ float sbasIonoDot;
+ /**< SBAS ionospheric delay rate. \n
+ - Units -- Meters per second
+ */
+
+ /* Optional */
+ /* Tropospheric Delay */
+ uint8_t tropoDelay_valid; /**< Must be set to true if tropoDelay is being passed */
+ float tropoDelay;
+ /**< Tropospheric delay. \n
+ - Units -- Meters
+ */
+
+ /* Optional */
+ /* Satellite Elevation */
+ uint8_t elevation_valid; /**< Must be set to true if elevation is being passed */
+ float elevation;
+ /**< Satellite elevation at T0. \n
+ - Units -- Radians
+ */
+
+ /* Optional */
+ /* Satellite Elevation Rate */
+ uint8_t elevationDot_valid; /**< Must be set to true if elevationDot is being passed */
+ float elevationDot;
+ /**< Satellite elevation rate. \n
+ - Units -- Radians per second
+ */
+
+ /* Optional */
+ /* Satellite Elevation Uncertainty */
+ uint8_t elenationUnc_valid; /**< Must be set to true if elenationUnc is being passed */
+ float elenationUnc;
+ /**< SV elevation uncertainty. \n
+ - Units -- Radians
+ */
+
+ /* Optional */
+ /* Polynomial Coefficients for SV Velocity */
+ uint8_t velCoef_valid; /**< Must be set to true if velCoef is being passed */
+ double velCoef[QMI_LOC_SV_POLY_VELOCITY_COEF_SIZE_V02];
+ /**< Polynomial coefficients for SV velocity (C0X, C1X, C2X, C3X,... C2Z, C3Z). \n
+ Units: \n
+ - 0th term -- Meters per second \n
+ - 1st term -- Meters per second^2 \n
+ - 2nd term -- Meters per second^3 \n
+ - 3rd term -- Meters per second^4
+ */
+
+ /* Optional */
+ /* Intersignal Correction - GPS/QZSS L1C/A */
+ uint8_t gpsIscL1ca_valid; /**< Must be set to true if gpsIscL1ca is being passed */
+ float gpsIscL1ca;
+ /**< Intersignal correction - GPS/QZSS L1C/A. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Intersignal Correction - GPS/QZSS L2C */
+ uint8_t gpsIscL2c_valid; /**< Must be set to true if gpsIscL2c is being passed */
+ float gpsIscL2c;
+ /**< Intersignal correction - GPS/QZSS L2C. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Intersignal Correction - GPS/QZSS L5I5 */
+ uint8_t gpsIscL5I5_valid; /**< Must be set to true if gpsIscL5I5 is being passed */
+ float gpsIscL5I5;
+ /**< Intersignal correction - GPS/QZSS L5I5. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Intersignal Correction - GPS/QZSS L5Q5 */
+ uint8_t gpsIscL5Q5_valid; /**< Must be set to true if gpsIscL5Q5 is being passed */
+ float gpsIscL5Q5;
+ /**< Intersignal correction - GPS/QZSS L5Q5. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Time of Group Delay - GPS/QZSS */
+ uint8_t gpsTgd_valid; /**< Must be set to true if gpsTgd is being passed */
+ float gpsTgd;
+ /**< Time of group delay -- GPS/QZSS.
+ 13 bits from CNAV, 8 bits from LNAV. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Time of Group Delay - GLONASS G1-G2 */
+ uint8_t gloTgdG1G2_valid; /**< Must be set to true if gloTgdG1G2 is being passed */
+ float gloTgdG1G2;
+ /**< Time of group delay - GLONASS G1-G2. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Time of Group Delay - BDS B1 */
+ uint8_t bdsTgdB1_valid; /**< Must be set to true if bdsTgdB1 is being passed */
+ float bdsTgdB1;
+ /**< Time of group delay -- BDS B1. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Time of Group Delay - BDS B2 */
+ uint8_t bdsTgdB2_valid; /**< Must be set to true if bdsTgdB2 is being passed */
+ float bdsTgdB2;
+ /**< Time of group delay -- BDS B2. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Time of Group Delay - BDS B2A */
+ uint8_t bdsTgdB2a_valid; /**< Must be set to true if bdsTgdB2a is being passed */
+ float bdsTgdB2a;
+ /**< Time of group delay -- BDS B2A. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Inter-Signal Correction - BDS B2A */
+ uint8_t bdsIscB2a_valid; /**< Must be set to true if bdsIscB2a is being passed */
+ float bdsIscB2a;
+ /**< Inter-signal correction -- BDS B2A. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Broadcast Group Delay - Galielo E1-E5a */
+ uint8_t galBgdE1E5a_valid; /**< Must be set to true if galBgdE1E5a is being passed */
+ float galBgdE1E5a;
+ /**< Broadcast group delay -- Galileo E1-E5a. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Broadcast Group Delay - Galileo E1-E5b */
+ uint8_t galBgdE1E5b_valid; /**< Must be set to true if galBgdE1E5b is being passed */
+ float galBgdE1E5b;
+ /**< Broadcast group delay -- Galileo E1-E5b. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Time of Group Delay - NavIC L5 */
+ uint8_t navicTgdL5_valid; /**< Must be set to true if navicTgdL5 is being passed */
+ float navicTgdL5;
+ /**< Time of group delay -- NavIC L5. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Time of Group Delay - BDS B1C (Pilot) */
+ uint8_t bdsTgdB1c_valid; /**< Must be set to true if bdsTgdB1c is being passed */
+ float bdsTgdB1c;
+ /**< Time of group delay -- BDS B1C. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Intersignal Correction - BDS B1C */
+ uint8_t bdsIscB1c_valid; /**< Must be set to true if bdsIscB1c is being passed */
+ float bdsIscB1c;
+ /**< Intersignal correction between BDS B1C data and pilot channels. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Multiband Health Information */
+ uint8_t multibandHealth_valid; /**< Must be set to true if multibandHealth is being passed */
+ qmiLocSignalHealthMaskT_v02 multibandHealth;
+ /**< Multiband health information. GNSS signals under L1/L2/L5 are:\n
+ - L1 -- GPS L1, QZSS L1, BDS B1, GLO G1, GAL E1 \n
+ - L2 -- BDS B1C, GPS L2C, QZSS L2C \n
+ - L5 -- GPS L5, QZSS L5, BDS B2A, GAL E5a, NAVIC L5 \n
+ Valid bitmasks \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L1_HEALTHY (0x0001) -- L1 signal is healthy \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L2_HEALTHY (0x0002) -- L2 signal is healthy \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L5_HEALTHY (0x0004) -- L5 signal is healthy \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L1_UNKNOWN (0x0008) -- L1 signal health is unknown \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L2_UNKNOWN (0x0010) -- L2 signal health is unknown \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L5_UNKNOWN (0x0020) -- L5 signal health is unknown\n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L1_UNHEALTHY (0x0040) -- L1 signal is unhealthy \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L2_UNHEALTHY (0x0080) -- L2 signal is unhealthy \n
+ - QMI_LOC_SIGNAL_HEALTH_MASK_L5_UNHEALTHY (0x0100) -- L5 signal is unhealthy
+ */
+}qmiLocEventGnssSvPolyIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t wifiApMacAddress[QMI_LOC_WIFI_MAC_ADDR_LENGTH_V02];
+ /**< MAC address of the Wi-Fi AP. */
+}qmiLocWifiApMacAddressStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ char uuid[QMI_LOC_MAX_IBEACON_UUID_STR_LENGTH_V02 + 1];
+ /**< NULL-terminated IBeacon identifier string; a 128-bit value. */
+
+ uint32_t majorNumber;
+ /**< IBeacon major number.*/
+
+ uint32_t minorNumber;
+ /**< IBeacon minor number.*/
+}qmiLocIBeaconIdStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject the Geofence context. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The
+ QMI_LOC_ADD_GEOFENCE_CONTEXT_IND indication returns the transaction ID. */
+
+ /* Optional */
+ /* Geofence ID */
+ uint8_t geofenceId_valid; /**< Must be set to true if geofenceId is being passed */
+ uint32_t geofenceId;
+ /**< Geofence identifier allocated by the engine.
+ If the Geofence ID is not provided, a Geofence is created with an Area ID
+ list only (for example, Wi-Fi only list Geofence). \n
+ If the Geofence ID is provided, the added list is used as assistance data
+ to the existing Geofence. */
+
+ /* Optional */
+ /* Wi-Fi AP SSID String */
+ uint8_t wifiApSsidInfo_valid; /**< Must be set to true if wifiApSsidInfo is being passed */
+ uint32_t wifiApSsidInfo_len; /**< Must be set to # of elements in wifiApSsidInfo */
+ qmiLocWifiApSsidStructT_v02 wifiApSsidInfo[QMI_LOC_WIFI_AREA_ID_LIST_LENGTH_V02];
+ /**< \vspace{4pt} \n The ordering of the Wi-Fi AP SSID list must match the Wi-Fi AP MAC address
+ list when both are provided, that is, the first element of the Wi-Fi AP SSID list must be
+ the SSID of the AP whose MAC address is in the first element in the Wi-Fi AP MAC address, and so on.
+ */
+
+ /* Optional */
+ /* Wi-Fi AP MAC Address List for the Geofence */
+ uint8_t wifiApMacAddressList_valid; /**< Must be set to true if wifiApMacAddressList is being passed */
+ uint32_t wifiApMacAddressList_len; /**< Must be set to # of elements in wifiApMacAddressList */
+ qmiLocWifiApMacAddressStructT_v02 wifiApMacAddressList[QMI_LOC_WIFI_AREA_ID_LIST_LENGTH_V02];
+ /**< \n The ordering of the Wi-Fi AP SSID list must match the Wi-Fi AP MAC address
+ list when both are provided, that is, the first element of the Wi-Fi AP SSID list must be the
+ SSID of the AP whose MAC address is in the first element in the Wi-Fi AP MAC address, and so on.
+ */
+
+ /* Optional */
+ /* TDSCDMA Cell ID List for the Geofence */
+ uint8_t tdsCdmaCellIDList_valid; /**< Must be set to true if tdsCdmaCellIDList is being passed */
+ qmiLocTDSCDMACellIdStructT_v02 tdsCdmaCellIDList[QMI_LOC_CELL_ID_LIST_LENGTH_V02];
+ /**< \n Identifies the TDSCDMA cell on which the device is camped. */
+
+ /* Optional */
+ /* WCDMA Cell ID List for the Geofence */
+ uint8_t wcdmaCellIDList_valid; /**< Must be set to true if wcdmaCellIDList is being passed */
+ uint32_t wcdmaCellIDList_len; /**< Must be set to # of elements in wcdmaCellIDList */
+ qmiLocWCDMACellIdStructT_v02 wcdmaCellIDList[QMI_LOC_CELL_ID_LIST_LENGTH_V02];
+ /**< \vspace{4pt} \n Identifies the WCDMA cell on which the device is camped. */
+
+ /* Optional */
+ /* GSM Cell ID List for the Geofence */
+ uint8_t gsmCellIDList_valid; /**< Must be set to true if gsmCellIDList is being passed */
+ uint32_t gsmCellIDList_len; /**< Must be set to # of elements in gsmCellIDList */
+ qmiLocGSMCellIdStructT_v02 gsmCellIDList[QMI_LOC_CELL_ID_LIST_LENGTH_V02];
+ /**< \n Identifies the GSM cell on which the device is camped. */
+
+ /* Optional */
+ /* IBeacon List of the Geofence */
+ uint8_t iBeaconList_valid; /**< Must be set to true if iBeaconList is being passed */
+ uint32_t iBeaconList_len; /**< Must be set to # of elements in iBeaconList */
+ qmiLocIBeaconIdStructT_v02 iBeaconList[QMI_LOC_IBEACON_LIST_LENGTH_V02];
+}qmiLocAddGeofenceContextReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject the Geofence context. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of the Add Geofence Context Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ request.
+ Valid values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ
+ request. This parameter is always present
+ if the status field is set to SUCCESS. */
+
+ /* Optional */
+ /* Geofence ID */
+ uint8_t geofenceId_valid; /**< Must be set to true if geofenceId is being passed */
+ uint32_t geofenceId;
+ /**< Geofence identifier allocated by the engine. \n
+ If the client specifies the Geofence ID during the QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ request,
+ the same ID is returned. \n
+ If the client does not specify the Geofence ID during the QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ request,
+ a new Geofence ID is created by the Geofence engine and returned. */
+
+ /* Optional */
+ /* Context ID */
+ uint8_t contextId_valid; /**< Must be set to true if contextId is being passed */
+ uint32_t contextId;
+ /**< Geofence context ID allocated by the engine.
+ The Geofence engine generates the context ID to identify the context
+ for a particular Geofence ID.
+ The same Geofence ID can be associated with multiple contexts. */
+}qmiLocAddGeofenceContextIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject the Geofence engine context. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_IND
+ indication returns the transaction ID . */
+
+ /* Optional */
+ /* UTC Timestamp of the Day */
+ uint8_t utcTimeOfDay_valid; /**< Must be set to true if utcTimeOfDay is being passed */
+ uint64_t utcTimeOfDay;
+ /**< The UTC time of the day. */
+
+ /* Optional */
+ /* Temperature of the Day in Fahrenheit */
+ uint8_t temperature_valid; /**< Must be set to true if temperature is being passed */
+ int32_t temperature;
+ /**< The temperature of the day in degrees Fahrenheit. */
+}qmiLocSetGeofenceEngineContextReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject the Geofence engine context. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of the Set Geofence Engine Context Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Set Geofence Engine Context request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID that was specified in the QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_REQ
+ request. This parameter is always present
+ when the status field is set to SUCCESS. */
+}qmiLocSetGeofenceEngineContextIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to delete the Geofence context. */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The QMI_LOC_DELETE_GEOFENCE_CONTEXT_IND
+ indication retruns the transaction ID. */
+
+ /* Mandatory */
+ /* Geofence ID */
+ uint32_t geofenceId;
+ /**< Identifies the Geofence whose context to delete. */
+
+ /* Optional */
+ /* Context ID */
+ uint8_t contextId_valid; /**< Must be set to true if contextId is being passed */
+ uint32_t contextId;
+ /**< Identifies the context associated with the Geofence to delete.
+ If not specified, all contexts associated with this Geofence are deleted. */
+}qmiLocDeleteGeofenceContextReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to delete the Geofence context. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of the Delete Geofence Context Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_DELETE_GEOFENCE_CONTEXT_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Transaction ID specified in the QMI_LOC_DELETE_GEOFENCE_CONTEXT_REQ request.
+ This parameter is always present
+ when the status field is set to SUCCESS. */
+
+ /* Optional */
+ /* Geofence ID */
+ uint8_t geofenceId_valid; /**< Must be set to true if geofenceId is being passed */
+ uint32_t geofenceId;
+ /**< Identifier for the Geofence whose context was deleted. */
+
+ /* Optional */
+ /* Context ID */
+ uint8_t contextId_valid; /**< Must be set to true if contextId is being passed */
+ uint32_t contextId;
+ /**< Identifier for the context of the Geofence that was deleted. */
+}qmiLocDeleteGeofenceContextIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects Global Terrestrial Positioning (GTP) WWAN client downloaded data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Data */
+ uint32_t ClientDownloadedData_len; /**< Must be set to # of elements in ClientDownloadedData */
+ char ClientDownloadedData[QMI_LOC_MAX_GTP_WWAN_CLIENT_DOWNLOADED_DATA_LEN_V02];
+ /**< WWAN client downloaded data. \n
+ - Type -- Array of bytes \n
+ - Maximum length of the array -- 512
+ */
+}qmiLocInjectGtpClientDownloadedDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects Global Terrestrial Positioning (GTP) WWAN client downloaded data. */
+typedef struct {
+
+ /* Mandatory */
+ /* GTP Client Downloaded Data Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GTP client downloaded data injection.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectGtpClientDownloadedDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sends a GDT upload begin response to GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* Access Status to GDT */
+ qmiLocGdtAccessStatusEnumT_v02 gdtAccessStatus;
+ /**< GDT status information for this service ID.
+ Values: \n
+ - eQMI_LOC_GDT_ACCESS_ALLOWED (1) -- GDT access to the service is allowed \n
+ - eQMI_LOC_GDT_ACCESS_FAILED (2) -- Any type of GDT access error \n
+ - eQMI_LOC_GDT_ACCESS_NOT_ALLOWED (3) -- GDT access to the service is not allowed
+ */
+}qmiLocGdtUploadBeginStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a GDT upload begin response to GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Upload Begin Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GDT begin request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocGdtUploadBeginStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGDTENDACKENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GDT_ACK_SUCCESS_V02 = 1, /**< The sent data is accepted \n */
+ eQMI_LOC_GDT_ACK_FAILED_V02 = 2, /**< The sent data was not accepted \n */
+ eQMI_LOC_GDT_ACK_INVALID_V02 = 3, /**< General error in the received data */
+ QMILOCGDTENDACKENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGdtEndAckEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sends a GDT upload end response to GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* Access Status to GDT */
+ qmiLocGdtEndAckEnumT_v02 gdtEndStatus;
+ /**< GDT end status information for this service ID.
+ Values: \n
+ - eQMI_LOC_GDT_ACK_SUCCESS (1) -- The sent data is accepted \n
+ - eQMI_LOC_GDT_ACK_FAILED (2) -- The sent data was not accepted \n
+ - eQMI_LOC_GDT_ACK_INVALID (3) -- General error in the received data
+ */
+}qmiLocGdtUploadEndReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a GDT upload end response to GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* UTC GDT Upload End Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GDT upload end request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocGdtUploadEndIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGTPAPSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GTP_AP_STATUS_DB_READY_V02 = 1, /**< Indicates that the AP is initialized and ready to process MP download requests */
+ eQMI_LOC_GTP_AP_STATUS_DB_REFRESHED_V02 = 2, /**< Indicates that the AP has successfully refreshed partitions \n */
+ eQMI_LOC_GTP_AP_STATUS_DB_DELETED_V02 = 3, /**< Indicates that the AP has removed local partitions */
+ QMILOCGTPAPSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGtpApStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sends a Global Terrestrial Position (GTP) message to the MP
+ notifying the GTP MP of AP DB readiness. */
+typedef struct {
+
+ /* Mandatory */
+ /* AP DB Status */
+ qmiLocGtpApStatusEnumT_v02 gtpApDbStatus;
+ /**< GTP AP DB status information.
+ Values: \n
+ - eQMI_LOC_GTP_AP_STATUS_DB_READY (1) -- Indicates that the AP is initialized and ready to process MP download requests
+ - eQMI_LOC_GTP_AP_STATUS_DB_REFRESHED (2) -- Indicates that the AP has successfully refreshed partitions \n
+ - eQMI_LOC_GTP_AP_STATUS_DB_DELETED (3) -- Indicates that the AP has removed local partitions
+ */
+
+ /* Optional */
+ /* AP PCID (8 byte) */
+ uint8_t gtpApPcid64_valid; /**< Must be set to true if gtpApPcid64 is being passed */
+ uint64_t gtpApPcid64;
+ /**< AP pseudoclient ID. */
+
+ /* Optional */
+ /* OEM ID (Non-NULL Terminated) */
+ uint8_t oemId_valid; /**< Must be set to true if oemId is being passed */
+ uint32_t oemId_len; /**< Must be set to # of elements in oemId */
+ char oemId[QMI_LOC_MAX_OEM_ID_LEN_V02];
+ /**< OEM ID. \n
+ - Type -- character string \n
+ - Maximum length of the array -- 256
+ */
+
+ /* Optional */
+ /* Model ID (Non-NULL Terminated) */
+ uint8_t modelId_valid; /**< Must be set to true if modelId is being passed */
+ uint32_t modelId_len; /**< Must be set to # of elements in modelId */
+ char modelId[QMI_LOC_MAX_MODEL_ID_LEN_V02];
+ /**< Model ID. \n
+ - Type -- character string \n
+ - Maximum length of the array -- 256
+ */
+}qmiLocGtpApStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t asnMajorVersion;
+ /**< ASN major version. */
+
+ uint8_t asnMinorVersion;
+ /**< ASN minor version. */
+
+ uint8_t asnPointVersion;
+ /**< ASN point version. */
+}qmiLocGtpAsnVerStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a Global Terrestrial Position (GTP) message to the MP
+ notifying the GTP MP of AP DB readiness. */
+typedef struct {
+
+ /* Mandatory */
+ /* GTP MP Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GTP handshake.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* MP Client Software Version */
+ uint16_t clientSoftwareVersion;
+ /**< MP client software version. */
+
+ /* Mandatory */
+ /* MP ASN Version */
+ qmiLocGtpAsnVerStructT_v02 asnVersion;
+}qmiLocGtpApStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGTPPROCESSSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GTP_PROCESS_SUCCESS_FROM_LOCAL_V02 = 1, /**< DL processing was processed successfully locally \n */
+ eQMI_LOC_GTP_PROCESS_SUCCESS_FROM_SERVER_V02 = 2, /**< DL processing was processed successfully via server access \n */
+ eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_AP_NOT_READY_V02 = 3, /**< DL processing is not allowed because the AP is not ready \n */
+ eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_AP_TIMEOUT_V02 = 4, /**< DL processing is not allowed because the AP cannot process within the specified interval \n */
+ eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_NO_CONNECTIVITY_V02 = 5, /**< DL processing via server is not allowed because the AP has no connectivity, but
+ it is processed locally \n */
+ eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_THROTTLED_V02 = 6, /**< DL processing via server is not allowed due to throttling, but it is
+ processed locally \n */
+ eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_OTHER_V02 = 7, /**< DL processing via server is not allowed for another reason, but it is
+ processed locally \n */
+ eQMI_LOC_GTP_PROCESS_FAILED_UNSPECIFIED_V02 = 8, /**< DL processing failed for any other reason */
+ QMILOCGTPPROCESSSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGtpProcessStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sends a GTP message to the MP notifying it of an AP download response. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* AP Process Status */
+ qmiLocGtpProcessStatusEnumT_v02 processingStatus;
+ /**< AP processing status information for this service ID.
+ Values: \n
+ - eQMI_LOC_GTP_PROCESS_SUCCESS_FROM_LOCAL (1) -- DL processing was processed successfully locally \n
+ - eQMI_LOC_GTP_PROCESS_SUCCESS_FROM_SERVER (2) -- DL processing was processed successfully via server access \n
+ - eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_AP_NOT_READY (3) -- DL processing is not allowed because the AP is not ready \n
+ - eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_AP_TIMEOUT (4) -- DL processing is not allowed because the AP cannot process within the specified interval \n
+ - eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_NO_CONNECTIVITY (5) -- DL processing via server is not allowed because the AP has no connectivity, but
+ it is processed locally \n
+ - eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_THROTTLED (6) -- DL processing via server is not allowed due to throttling, but it is
+ processed locally \n
+ - eQMI_LOC_GTP_PROCESS_NOT_ALLOWED_OTHER (7) -- DL processing via server is not allowed for another reason, but it is
+ processed locally \n
+ - eQMI_LOC_GTP_PROCESS_FAILED_UNSPECIFIED (8) -- DL processing failed for any other reason
+ */
+
+ /* Optional */
+ /* WWAN Download Flag */
+ uint8_t wwanDownloadFlag_valid; /**< Must be set to true if wwanDownloadFlag is being passed */
+ uint16_t wwanDownloadFlag;
+ /**< WWAN download flag. */
+
+ /* Optional */
+ /* Encoded Response Location Information */
+ uint8_t respLocInfo_valid; /**< Must be set to true if respLocInfo is being passed */
+ uint32_t respLocInfo_len; /**< Must be set to # of elements in respLocInfo */
+ uint8_t respLocInfo[QMI_LOC_MAX_GTP_RLI_LEN_V02];
+ /**< Response location information encoded in asn.1 format. \n
+ - Type -- Array of bytes \n
+ - Maximum length of the array -- 256
+ */
+
+ /* Optional */
+ /* AP Remaining Throttle Time */
+ uint8_t apRemainingThrottleTime_valid; /**< Must be set to true if apRemainingThrottleTime is being passed */
+ uint32_t apRemainingThrottleTime;
+ /**< Remaining time in seconds during which the AP remains throttled for server access. */
+}qmiLocGdtDownloadBeginStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a GTP message to the MP notifying it of an AP download response. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Download Begin Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GDT begin request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocGdtDownloadBeginStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Sends a GTP message to the MP notifying it of data readiness. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* Processing Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the AP processing request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Data File Path (NULL Terminated) */
+ uint32_t filePath_len; /**< Must be set to # of elements in filePath */
+ char filePath[QMI_LOC_MAX_GDT_PATH_LEN_V02];
+ /**< File path to the data. \n
+ - Type -- Array of bytes \n
+ - Maximum length of the array -- 255
+ */
+}qmiLocGdtDownloadReadyStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a GTP message to the MP notifying it of data readiness. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Ready Begin Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GDT ready request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocGdtDownloadReadyStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Acknowledges receipt of Receive Done to the GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* QMI LOC Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocGdtReceiveDoneStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Acknowledges receipt of Receive Done to the GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Receive Done Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Receive Done request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocGdtReceiveDoneStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Acknowledges the receipt of download completion to the GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Service ID */
+ qmiLocGdtServiceIdEnumT_v02 serviceId;
+ /**< Values: \n
+ - eQMI_LOC_GDT_SERVICE_WWAN (1) -- GDT service for WWAN UL \n
+ - eQMI_LOC_GDT_SERVICE_WWAN_DL (2) -- GDT service for WWAN DL \n
+ - eQMI_LOC_GDT_SERVICE_CSM_UL (3) -- GDT service for Crowdsource Manager UL */
+
+ /* Mandatory */
+ /* Session ID */
+ uint32_t sessionId;
+ /**< Session ID. */
+
+ /* Mandatory */
+ /* QMI LOC Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocGdtDownloadEndStatusReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Acknowledges the receipt of download completion to the GDT MP. */
+typedef struct {
+
+ /* Mandatory */
+ /* GDT Download End Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the GDT download end request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocGdtDownloadEndStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCDBTUSAGEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_DBT_USAGE_NAVIGATION_V02 = 1, /**< Navigation usage type. */
+ QMILOCDBTUSAGEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocDbtUsageEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCDBDISTANCETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_DBT_DISTANCE_TYPE_STRAIGHT_LINE_V02 = 1, /**< Straight line distance between
+ location updates. */
+ QMILOCDBDISTANCETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocDbDistanceTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to initiate a Distance Based Tracking (DBT) session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Request ID */
+ uint8_t reqId;
+ /**< ID of the request as identified by the control point. The request ID
+ is reported back in the position reports. The control point must
+ specify the same request ID in the QMI_LOC_STOP_DBT_REQ message. \n
+ - Range -- 0 to 255
+ */
+
+ /* Mandatory */
+ /* Minimum Distance Between Position Reports */
+ uint32_t minDistance;
+ /**< Minimum distance, specified by the control point,
+ that must be traversed between position reports. \n
+ - Units -- Meters
+ */
+
+ /* Mandatory */
+ /* Type of Distance to Track */
+ qmiLocDbDistanceTypeEnumT_v02 distanceType;
+ /**< Straight line distance or accumulated distance. \n
+ Values: \n
+ - eQMI_LOC_DBT_DISTANCE_TYPE_STRAIGHT_LINE (1) -- Straight line distance between
+ location updates.
+ */
+
+ /* Mandatory */
+ /* Need Origin Location */
+ uint8_t needOriginLocation;
+ /**< Indicates whether the control point wants the position
+ corresponding to the origin. \n
+ - 0x01 (TRUE) -- Control point is requesting origin
+ location \n
+ - 0x00 (FALSE) -- Control point is not requesting origin
+ location
+ */
+
+ /* Optional */
+ /* Maximum Latency Threshold for Position Reports */
+ uint8_t maxLatency_valid; /**< Must be set to true if maxLatency is being passed */
+ uint32_t maxLatency;
+ /**< Maximum time period, specified by the control point, after the minimum
+ distance criteria has been met within which a location update must
+ be provided. If not specified, an ideal value is assumed by the
+ engine. \n
+ - Units -- seconds
+ */
+
+ /* Optional */
+ /* Usage Type */
+ uint8_t usageType_valid; /**< Must be set to true if usageType is being passed */
+ qmiLocDbtUsageEnumT_v02 usageType;
+ /**< Specifies the type of usage by the control point, referring specifically
+ to the use case category of the client. For example, a navigation client can
+ set this to QMI_LOC_USAGE_NAVIGATION for better performance in difficult
+ signal conditions, such as tunnels.
+ If not specified, the service uses default algorithms to provide an ideal
+ performance.
+ Values: \n
+ - eQMI_LOC_DBT_USAGE_NAVIGATION (1) -- Navigation usage type.
+ */
+}qmiLocStartDbtReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to initiate a Distance Based Tracking (DBT) session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Start DBT Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Start DBT request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Request ID */
+ uint8_t reqId_valid; /**< Must be set to true if reqId is being passed */
+ uint8_t reqId;
+ /**< ID of the DBT start request for which this
+ indication was generated. */
+}qmiLocStartDbtIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to stop a DBT session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Request ID */
+ uint8_t reqId;
+ /**< ID of the request specified in the Start DBT
+ request (QMI_LOC_START_DBT_REQ).\n
+ - Range -- 0 to 255 */
+}qmiLocStopDbtReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to stop a DBT session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Stop DBT Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Stop DBT request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Request ID */
+ uint8_t reqId_valid; /**< Must be set to true if reqId is being passed */
+ uint8_t reqId;
+ /**< ID of the DBT stop request for which this
+ indication was generated. */
+}qmiLocStopDbtIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCDBTPOSITIONTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_DBT_POSITION_TYPE_ORIGIN_V02 = 1, /**< Position reported is at the origin \n */
+ eQMI_LOC_DBT_POSITION_TYPE_TRACKING_V02 = 2, /**< Position reported is a tracking type
+ where the origin location has already
+ been reported */
+ QMILOCDBTPOSITIONTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocDbtPositionTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ /* UTC Timestamp */
+ uint64_t timestampUtc;
+ /**< Units -- Milliseconds since Jan. 1, 1970
+ */
+
+ /* Latitude */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ /* Longitude */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ /* Horizontal elliptical uncertainty (semi-minor axis) */
+ float horUncEllipseSemiMinor;
+ /**< Semi-minor axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Horizontal elliptical uncertainty (wemi-major axis) */
+ float horUncEllipseSemiMajor;
+ /**< Semi-major axis of horizontal elliptical uncertainty.\n
+ - Units -- Meters */
+
+ /* Elliptical horizontal uncertainty azimuth */
+ float horUncEllipseOrientAzimuth;
+ /**< Elliptical horizontal uncertainty azimuth of orientation.\n
+ - Units -- Decimal degrees \n
+ - Range -- 0 to 180 */
+
+ /* Horizontal Speed Validity Bit */
+ uint8_t speedHorizontal_valid;
+ /**< Indicates whether the horizontal speed field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Horizontal Speed */
+ float speedHorizontal;
+ /**< Horizontal speed.\n
+ - Units -- Meters per second */
+
+ /* Altitude Validity Bit */
+ uint8_t altitudeWrtEllipsoid_valid;
+ /**< Indicates whether the altitude field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Altitude With Respect to Ellipsoid */
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid.\n
+ - Units -- Meters \n
+ - Range -- -500 to 15883 */
+
+ /* Vertical Uncertainty Validity Bit */
+ uint8_t vertUnc_valid;
+ /**< Indicates whether the vertical uncertainty field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Vertical Uncertainty */
+ float vertUnc;
+ /**< Units -- Meters */
+
+ /* Vertical Speed Validity Bit */
+ uint8_t speedVertical_valid;
+ /**< Indicates whether the vertical speed field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Vertical Speed */
+ float speedVertical;
+ /**< Units -- Meters per second */
+
+ /* Heading Validity Bit */
+ uint8_t heading_valid;
+ /**< Indicates whether the heading field contains valid
+ information. \n
+ - 0x01 (TRUE) -- Valid \n
+ - 0x00 (FALSE) -- Invalid and must be ignored
+ */
+
+ /* Heading */
+ float heading;
+ /**< - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+}qmiLocDbtPositionStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of
+ a DBT position report. */
+typedef struct {
+
+ /* Mandatory */
+ /* Request ID */
+ uint8_t reqId;
+ /**< ID of the DBT request for which this
+ report was generated. */
+
+ /* Mandatory */
+ /* DBT Position */
+ qmiLocDbtPositionStructT_v02 dbtPosition;
+ /**< \n Position of the client when it has traversed the
+ specified distance.
+ */
+
+ /* Mandatory */
+ /* DBT Position Type */
+ qmiLocDbtPositionTypeEnumT_v02 positionType;
+ /**< Specifies whether the position reported is at the
+ origin of the DBT session or during the tracking
+ duration of the session. Values: \n
+ - eQMI_LOC_DBT_POSITION_TYPE_ORIGIN (1) -- Position reported is at the origin \n
+ - eQMI_LOC_DBT_POSITION_TYPE_TRACKING (2) -- Position reported is a tracking type
+ where the origin location has already
+ been reported */
+
+ /* Optional */
+ /* Heading Uncertainty */
+ uint8_t headingUnc_valid; /**< Must be set to true if headingUnc is being passed */
+ float headingUnc;
+ /**< Heading uncertainty.\n
+ - Units -- Degrees \n
+ - Range -- 0 to 359.999 */
+
+ /* Optional */
+ /* Speed Uncertainty */
+ uint8_t speedUnc_valid; /**< Must be set to true if speedUnc is being passed */
+ float speedUnc;
+ /**< 3D speed uncertainty.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Horizontal Confidence */
+ uint8_t horConfidence_valid; /**< Must be set to true if horConfidence is being passed */
+ uint8_t horConfidence;
+ /**< Horizontal uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical uncertainty confidence.\n
+ - Units -- Percent \n
+ - Range -- 0 to 99 */
+
+ /* Optional */
+ /* Dilution of Precision */
+ uint8_t DOP_valid; /**< Must be set to true if DOP is being passed */
+ qmiLocDOPStructT_v02 DOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* SVs Used to Calculate the Fix */
+ uint8_t gnssSvUsedList_valid; /**< Must be set to true if gnssSvUsedList is being passed */
+ uint32_t gnssSvUsedList_len; /**< Must be set to # of elements in gnssSvUsedList */
+ uint16_t gnssSvUsedList[QMI_LOC_MAX_SV_USED_LIST_LENGTH_V02];
+ /**< Each entry in the list contains the SV ID of a satellite
+ used for calculating this position report. The following
+ information is associated with each SV ID:
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - SBAS -- 120 to 158 and 183 to 191 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* Position Source */
+ uint8_t positionSrc_valid; /**< Must be set to true if positionSrc is being passed */
+ qmiLocPositionSrcEnumT_v02 positionSrc;
+ /**< Source from which this position was obtained.
+ Values: \n
+ - eQMI_LOC_POSITION_SRC_GNSS (0) -- Position source is GNSS \n
+ - eQMI_LOC_POSITION_SRC_CELLID (1) -- Position source is Cell ID \n
+ - eQMI_LOC_POSITION_SRC_ENH_CELLID (2) -- Position source is Enhanced Cell ID \n
+ - eQMI_LOC_POSITION_SRC_WIFI (3) -- Position source is Wi-Fi \n
+ - eQMI_LOC_POSITION_SRC_TERRESTRIAL (4) -- Position source is Terrestrial \n
+ - eQMI_LOC_POSITION_SRC_GNSS_TERRESTRIAL_HYBRID (5) -- Position source is GNSS Terrestrial Hybrid \n
+ - eQMI_LOC_POSITION_SRC_OTHER (6) -- Other sources \n
+ - eQMI_LOC_POSITION_SRC_DRE (7) -- Position source is the dead reckoning engine
+ */
+
+ /* Optional */
+ /* Extended Dilution of Precision */
+ uint8_t extDOP_valid; /**< Must be set to true if extDOP is being passed */
+ qmiLocExtDOPStructT_v02 extDOP;
+ /**< \vspace{0.06in} \n Dilution of precision associated with this position. */
+
+ /* Optional */
+ /* Expanded SVs Used to Calculate the Fix */
+ uint8_t expandedGnssSvUsedList_valid; /**< Must be set to true if expandedGnssSvUsedList is being passed */
+ uint32_t expandedGnssSvUsedList_len; /**< Must be set to # of elements in expandedGnssSvUsedList */
+ uint16_t expandedGnssSvUsedList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< If the service reports expandedGnssSvUsedList, gnssSvUsedList is
+ not reported. Each entry in the list contains the SV ID of a satellite
+ used to calculate this position report. The following
+ information is associated with each SV ID. \n
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414\n
+ */
+
+ /* Optional */
+ /* Satellite Signal Types in the SVs Used List */
+ uint8_t gnssSvUsedSignalTypeList_valid; /**< Must be set to true if gnssSvUsedSignalTypeList is being passed */
+ uint32_t gnssSvUsedSignalTypeList_len; /**< Must be set to # of elements in gnssSvUsedSignalTypeList */
+ qmiLocGnssSignalTypeMaskT_v02 gnssSvUsedSignalTypeList[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the signal type of each satellite in expandedGnssSvUsedList. The
+ signal type list aligns with the SVs in expandedGnssSvUsedList. Value 0
+ means invalid.\n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band */
+}qmiLocEventDbtPositionReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCDBTSESSIONSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_DBT_UNABLE_TO_TRACK_V02 = 1, /**< Distance based tracking is unavailable and DBT fixes
+ cannot be obtained \n */
+ eQMI_LOC_DBT_ABLE_TO_TRACK_V02 = 2, /**< Distance based tracking is available and DBT fixes
+ can be obtained */
+ QMILOCDBTSESSIONSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocDbtSessionStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of the DBT session status. */
+typedef struct {
+
+ /* Mandatory */
+ /* DBT Session Status */
+ qmiLocDbtSessionStatusEnumT_v02 dbtSessionStatus;
+ /**< Specifies the DBT session status type.
+ Values: \n
+ - eQMI_LOC_DBT_UNABLE_TO_TRACK (1) -- Distance based tracking is unavailable and DBT fixes
+ cannot be obtained \n
+ - eQMI_LOC_DBT_ABLE_TO_TRACK (2) -- Distance based tracking is available and DBT fixes
+ can be obtained
+ */
+
+ /* Optional */
+ /* Request ID */
+ uint8_t reqId_valid; /**< Must be set to true if reqId is being passed */
+ uint8_t reqId;
+ /**< ID of the DBT request for which this
+ status was generated. */
+}qmiLocEventDbtSessionStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPOSITIONSOURCEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_POS_SRC_GNSS_V02 = 1, /**< Source of the position is GNSS */
+ QMILOCPOSITIONSOURCEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPositionSourceEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPOSITIONRPTPROPAGATIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_POS_REPORT_PROPAGATED_TO_CURRENT_UTC_V02 = 1, /**< Reported position is propagated to the current UTC */
+ QMILOCPOSITIONRPTPROPAGATIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPositionRptPropagationEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSECURELOCDATAMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SECURE_LOC_DATA_ENCRYPTED_V02 = 1, /**< Encrypt data in the indication \n */
+ eQMI_LOC_SECURE_LOC_DATA_UNENCRYPTED_V02 = 2, /**< Unencrypt data in the indication */
+ QMILOCSECURELOCDATAMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSecureLocDataModeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSECUREGETAVAILABLEPOSPARAMETERIDENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_PARAM_TRANSACTION_ID_V02 = 1, /**< Parameter ID for the Transaction ID field. Mandatory field.
+ Identifies the transaction. The QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND
+ indication returns the transaction ID. \n
+ - Parameter type -- uint32 \n
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_PARAM_NONCE_V02 = 2, /**< Parameter ID for the Nonce field. Optional field. \n
+ - Parameter type -- uint64 \n
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_PARAM_SOURCE_V02 = 3, /**< Parameter ID for the Position Source field. Optional field.
+ Specifies the source of the position in which the control point is interest.
+ If not included, the value defaults to GNSS. \n
+ - Parameter type -- int32 \n
+ Parameter values: \n
+ - eQMI_LOC_POS_SRC_GNSS (1) -- Source of the position is GNSS \n
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_PARAM_REPORT_DATA_SECURITY_MODE_V02 = 4, /**< Secured position report data security mode. Optional field.
+ If this TLV is not sent, the position report is encrypted by default. \n
+ - Parameter type -- int32 \n
+ Parameter values: \n
+ - eQMI_LOC_SECURE_LOC_DATA_ENCRYPTED (1) -- Position reports are encrypted \n
+ - eQMI_LOC_SECURE_LOC_DATA_UNENCRYPTED (2) -- Position reports are not encrypted \n
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_PARAM_REPORT_DATA_TIME_PROPAGATION_V02 = 5, /**< Secured position report data propagation. Optional field.
+ If this TLV is not sent, the position report is propagated to the current UTC time by default. \n
+ - Parameter type -- int32 \n
+ Parameter values: \n
+ - eQMI_LOC_POS_REPORT_PROPAGATED_TO_CURRENT_UTC (1) -- Position reports are propagated to the current UTC. \n
+ */
+ QMILOCSECUREGETAVAILABLEPOSPARAMETERIDENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSecureGetAvailablePosParameterIDEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSECUREMESSAGEDATATYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SECURE_DATA_TYPE_BYTE_8_V02 = 1, /**< Data type -- Byte (8 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_CHAR_8_V02 = 2, /**< Data type -- Char (8 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_UNSIGNED_CHAR_8_V02 = 3, /**< Data type -- Unsigned char (8 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_INT_8_V02 = 4, /**< Data type -- Int (8 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_UNSIGNED_INT_8_V02 = 5, /**< Data type -- Unsigned int (8 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_INT_16_V02 = 6, /**< Data type -- Int (16 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_UNSIGNED_INT_16_V02 = 7, /**< Data type -- Unsigned int (16 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_INT_32_V02 = 8, /**< Data type -- Int (32 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_UNSIGNED_INT_32_V02 = 9, /**< Data type -- Unsigned int (32 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_INT_64_V02 = 10, /**< Data type -- Int (64 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_UNSIGNED_INT_64_V02 = 11, /**< Data type -- Unsigned int (64 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_BOOL_8_V02 = 12, /**< Data type -- Boolean (8 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_DOUBLE_64_V02 = 13, /**< Data type -- Double (64 bits) \n */
+ eQMI_LOC_SECURE_DATA_TYPE_FLOAT_32_V02 = 14, /**< Data type -- Float (32 bits) */
+ QMILOCSECUREMESSAGEDATATYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSecureMessageDataTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to get the available
+ position estimate from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Data Security Mode for Encoded Data Buffer */
+ qmiLocSecureLocDataModeEnumT_v02 secureLocDataMode;
+ /**< Data security mode for the encoded data buffer.
+ Values: \n
+ - eQMI_LOC_SECURE_LOC_DATA_ENCRYPTED (1) -- Encrypt data in the indication \n
+ - eQMI_LOC_SECURE_LOC_DATA_UNENCRYPTED (2) -- Unencrypt data in the indication
+ */
+
+ /* Mandatory */
+ /* Encoded Data Buffer Containing Secure Get Available Position Request Parameters */
+ uint32_t qmilocSecureGetAvailablePositionRequestData_len; /**< Must be set to # of elements in qmilocSecureGetAvailablePositionRequestData */
+ uint8_t qmilocSecureGetAvailablePositionRequestData[QMI_LOC_SECURE_GET_AVAILABLE_POS_REQUEST_ENCRYPTED_MAX_V02];
+ /**< Encoded data buffer containing the secure Get Available Position Request parameters. */
+}qmiLocSecureGetAvailablePositionReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSECUREGETAVAILABLEPOSITIONINDPARAMIDENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_TRANSACTION_ID_V02 = 1, /**< Parameter ID for the Transaction ID field; mandatory field.
+ Transaction ID specified in the QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ request.
+ This parameter is present when the status field is set to SUCCESS. \n
+ - Parameter type -- uint32
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_NONCE_V02 = 2, /**< Parameter ID for the secure session nonce; echos back the nonce received from
+ the QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ request; optional field. \n
+ - Parameter type -- uint64
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_LATITUDE_V02 = 3, /**< Parameter ID for latitude (specified in WGS84 datum); optional field.\n
+ - Parameter type -- Floating point\n
+ - Parameter units -- Degrees\n
+ - Parameter range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude\n
+ - Negative values indicate southern latitude
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_LONGITUDE_V02 = 4, /**< Parameter ID for longitude (specified in WGS84 datum); optional field. \n
+ - Parameter type -- Floating point \n
+ - Parameter units -- Degrees \n
+ - Parameter range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HORIZ_UNC_CIRCULAR_V02 = 5, /**< Parameter ID for circular horizontal uncertainty; optional field. \n
+ - Parameter tnits -- Meters \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_ALTITUDE_WRT_ELP_V02 = 6, /**< Parameter ID for altitude with respect to the WGS84 ellipsoid; optional field. \n
+ - Parameter units -- Meters \n
+ - Parameter range -- -500 to 15883 \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_VERTICAL_UNC_V02 = 7, /**< Parameter ID for vertical uncertainty; optional field.\n
+ - Parameter units -- Meters \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_TIME_STAMP_UTC_V02 = 8, /**< Parameter ID for the UTC timestamp; optional field.\n
+ - Parameter type -- uint64 \n
+ - Parameter units -- Milliseconds since Jan. 1, 1970
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_TIME_UNC_V02 = 9, /**< Parameter ID for time uncertainty; optional field.\n
+ - Parameter type -- Float \n
+ - Parameter units -- Milliseconds */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HORIZ_UNC_ELP_SEMIMINOR_V02 = 10, /**< Parameter ID for the semi-minor axis of horizontal elliptical uncertainty; optional field.\n
+ - Parameter mnits -- Meters \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HORIZ_UNC_ELP_SEMIMAJOR_V02 = 11, /**< Parameter ID for the semi-major axis of horizontal elliptical uncertainty; optional field.\n
+ - Parameter units -- Meters \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HORIZ_UNC_ELP_ORIENT_AZIMUTH_V02 = 12, /**< Parameter ID for the elliptical horizontal uncertainty azimuth of orientation; optional field. \n
+ - Parameter units -- Decimal degrees \n
+ - Parameter range -- 0 to 180 \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HORIZ_CONFIDENCE_V02 = 13, /**< Parameter ID for Horizontal uncertainty confidence; optional field.\n
+ If both elliptical and horizontal uncertainties are specified in this message,
+ the confidence corresponds to the elliptical uncertainty. \n
+ - Parameter units -- Percent \n
+ - Parameter range -- 0 to 99 \n
+ - Parameter type -- uint8 */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HORIZ_ELLIP_CONFIDENCE_V02 = 14, /**< Parameter ID for Horizontal Elliptical Uncertainty Confidence; optional field.
+ If both elliptical and horizontal uncertainties are specified in this message,
+ the confidence corresponds to the elliptical uncertainty.\n
+ - Parameter units -- Percent \n
+ - Parameter range -- 0 to 99 \n
+ - Parameter type -- uint8 */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HORIZ_RELIABILITY_V02 = 15, /**< Parameter ID specifying the reliability of the horizontal position; optional field.\n
+ - Parameter type -- int32 \n
+ Parameter values: \n
+ - RELIABILITY_NOT_SET = 0 \n
+ - RELIABILITY_VERY_LOW = 1 \n
+ - RELIABILITY_LOW = 2 \n
+ - RELIABILITY_MEDIUM = 3 \n
+ - RELIABILITY_HIGH = 4
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_SPEED_HORIZ_V02 = 16, /**< Parameter ID for horizontal speed; optional field.\n
+ - Parameter units -- Meters per second \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_SPEED_HORIZ_UNC_V02 = 17, /**< Parameter ID for horizontal speed uncertainty; optional field.\n
+ - Parameter units -- Meters per second \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_ALTITUDE_WRT_MSA_V02 = 18, /**< Parameter ID for altitude with respect to mean sea level; optional field.\n
+ - Parameter units -- Meters \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_VERTICAL_CONF_V02 = 19, /**< Parameter ID for vertical uncertainty confidence; optional field.\n
+ - Parameter units -- Percent \n
+ - Parameter range -- 0 to 99 \n
+ - Parameter type -- uint8 */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_VERT_RELIABILITY_V02 = 20, /**< Parameter ID for specifies the reliability of the vertical position; optional field.
+ - Parameter type -- int32 \n
+ Parameter values: \n
+ - RELIABILITY_NOT_SET = 0 \n
+ - RELIABILITY_VERY_LOW = 1 \n
+ - RELIABILITY_LOW = 2 \n
+ - RELIABILITY_MEDIUM = 3 \n
+ - RELIABILITY_HIGH = 4
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_SPEED_VERTICAL_V02 = 21, /**< Parameter ID for vertical speed; optional field. \n
+ - Parameter units -- Meters per second \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_SPEED_VERTICAL_UNC_V02 = 22, /**< Parameter ID for vertical speed uncertainty; optional field.\n
+ - Parameter units -- Meters per second \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HEADING_V02 = 23, /**< Parameter ID for heading; optional field. \n
+ - Parameter units -- Degrees \n
+ - Parameter range -- 0 to 359.999 \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HEADING_UNC_V02 = 24, /**< Parameter ID for heading uncertaint; optional field.\n
+ - Parameter units -- Degrees \n
+ - Parameter range -- 0 to 359.999 \n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_MAGNETIC_DEVIATION_V02 = 25, /**< Parameter ID for magnetic deviation. Optional field.
+ Difference between the bearing to true north and the bearing shown
+ a magnetic compass. The deviation is positive when the magnetic
+ north is east of true north.\n
+ - Parameter type -- Float */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_TECH_MASK_V02 = 26, /**< Parameter ID for technology Used in computing this fix. Optional field.\n
+ - Parameter type -- uint32 \n
+ Parameter bitmasks: \n
+ - QMI_LOC_POS_TECH_MASK_SATELLITE = 0x00000001,\n
+ - QMI_LOC_POS_TECH_MASK_CELLID = 0x00000002,\n
+ - QMI_LOC_POS_TECH_MASK_WIFI = 0x00000004,\n
+ - QMI_LOC_POS_TECH_MASK_SENSORS = 0x00000008,\n
+ - QMI_LOC_POS_TECH_MASK_REFERENCE_LOCATION = 0x00000010,\n
+ - QMI_LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION = 0x00000020,\n
+ - QMI_LOC_POS_TECH_MASK_AFLT = 0x00000040,\n
+ - QMI_LOC_POS_TECH_MASK_HYBRID = 0x00000080
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_PDOP_V02 = 27, /**< Parameter ID for position dilution of precision associated with this position. Optional field.\n
+ - Parameter type -- Float \n
+ - Parameter range -- 0 (highest accuracy) to 50 (lowest accuracy) \n
+ - PDOP = square root of (HDOP^2 + VDOP^2)
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_HDOP_V02 = 28, /**< Parameter ID for Horizontal Dilution of Precision associated with this position; optional field.\n
+ - Parameter type -- Float \n
+ - Parameter range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_VDOP_V02 = 29, /**< Parameter ID for vertical dilution of precision associated with this position; optional field.\n
+ - Parameter type -- Float \n
+ - Parameter range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_GPS_WEEK_V02 = 30, /**< Parameter ID for the current GPS Week, as calculated from midnight, Jan. 6, 1980; optional field.\n
+ - Parameter type -- uint16 \n
+ - Parameter units -- Weeks
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_GPS_TIMEOFWEEKMS_V02 = 31, /**< Parameter ID for amount of time into the current GPS Week; optional field.\n
+ - Parameter type -- uint32 \n
+ - Parameter units -- Milliseconds
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_TIME_SRC_V02 = 32, /**< Parameter ID for time source. Optional field.\n
+ - Parameter type -- uint32 (enum qmiLocTimeSourceEnumT)
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_SENSOR_USAGE_MASK_V02 = 33, /**< Parameter ID that specifies which sensors were used in calculating the position in the
+ position report. Optional field.\n
+ - Parameter type -- uint32 \n
+ Parameter bitmasks: \n
+ - 0x00000001 -- SENSOR_USED_ACCEL \n
+ - 0x00000002 -- SENSOR_USED_GYRO
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_AIDING_IND_MASK_V02 = 34, /**< Parameter ID that specifies which results were aided by sensors. Optional field.\n
+ - Parameter type -- uint32 \n
+ Parameter bitmasks: \n
+ - 0x00000001 -- AIDED_HEADING \n
+ - 0x00000002 -- AIDED_SPEED \n
+ - 0x00000004 -- AIDED_POSITION \n
+ - 0x00000008 -- AIDED_VELOCITY
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_SV_USED_V02 = 35, /**< Each entry in the list contains the SV ID of a satellite
+ used for calculating this position report. The following
+ information is associated with each SV ID; optional field. \n
+ - Parameter type -- uint16 \n
+ Parameter range: \n
+ - GPS -- 1 to 32 \n
+ - SBAS -- 33 to 64 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_TDOP_V02 = 36, /**< Parameter ID for time dilution of precision associated with this position; optional field.\n
+ - Parameter type -- Float \n
+ - Parameter range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+ eQMI_LOC_SECURE_GET_AVAILABLE_POS_REP_PARAM_GDOP_V02 = 37, /**< Parameter ID for geometrical dilution of precision associated with this position; optional field.\n
+ - Parameter type -- Float \n
+ - Parameter range -- 0 (highest accuracy) to 50 (lowest accuracy)
+ */
+ QMILOCSECUREGETAVAILABLEPOSITIONINDPARAMIDENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSecureGetAvailablePositionIndParamIDEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to get the available
+ position estimate from the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Session Status */
+ qmiLocSessionStatusEnumT_v02 sessionStatus;
+ /**< Session status.
+ Values: \n
+ - eQMI_LOC_SESS_STATUS_SUCCESS (0) -- Session was successful \n
+ - eQMI_LOC_SESS_STATUS_IN_PROGRESS (1) -- Session is still in progress; further position reports are generated
+ until either the fix criteria specified by the client are met or the
+ client response timeout occurs \n
+ - eQMI_LOC_SESS_STATUS_GENERAL_FAILURE (2) -- Session failed \n
+ - eQMI_LOC_SESS_STATUS_TIMEOUT (3) -- Fix request failed because the session timed out \n
+ - eQMI_LOC_SESS_STATUS_USER_END (4) -- Fix request failed because the session was ended by the user \n
+ - eQMI_LOC_SESS_STATUS_BAD_PARAMETER (5) -- Fix request failed due to bad parameters in the request \n
+ - eQMI_LOC_SESS_STATUS_PHONE_OFFLINE (6) -- Fix request failed because the phone is offline \n
+ - eQMI_LOC_SESS_STATUS_ENGINE_LOCKED (7) -- Fix request failed because the engine is locked
+ */
+
+ /* Mandatory */
+ /* Data Security Mode for Encoded Data Buffer. */
+ qmiLocSecureLocDataModeEnumT_v02 secureLocDataMode;
+ /**< Data security mode for encoded data buffer.
+ Values: \n
+ - eQMI_LOC_SECURE_LOC_DATA_ENCRYPTED (1) -- Encrypt data in the indication \n
+ - eQMI_LOC_SECURE_LOC_DATA_UNENCRYPTED (2) -- Unencrypt data in the indication
+ */
+
+ /* Optional */
+ /* Encoded Data Buffer Containing Secured Get Available Position Report Indication */
+ uint8_t qmilocSecureGetAvailablePositionInd_valid; /**< Must be set to true if qmilocSecureGetAvailablePositionInd is being passed */
+ uint32_t qmilocSecureGetAvailablePositionInd_len; /**< Must be set to # of elements in qmilocSecureGetAvailablePositionInd */
+ uint8_t qmilocSecureGetAvailablePositionInd[QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_ENCRYPTED_MAX_V02];
+ /**< Encoded data buffer containing the QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND indication.*/
+}qmiLocSecureGetAvailablePositionIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCAPRELIABILITYENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_AP_RELIABILITY_NOT_SET_V02 = 0, /**< AP location reliability is not set \n */
+ eQMI_LOC_AP_RELIABILITY_LEVEL_1_V02 = 1, /**< AP location reliability level 1 \n */
+ eQMI_LOC_AP_RELIABILITY_LEVEL_2_V02 = 2, /**< AP location reliability level 2 \n */
+ eQMI_LOC_AP_RELIABILITY_LEVEL_3_V02 = 3, /**< AP location reliability level 3 \n */
+ eQMI_LOC_AP_RELIABILITY_LEVEL_4_V02 = 4, /**< AP location reliability level 4 \n */
+ eQMI_LOC_AP_RELIABILITY_LEVEL_5_V02 = 5, /**< AP location reliability level 5 \n */
+ eQMI_LOC_AP_RELIABILITY_LEVEL_6_V02 = 6, /**< AP location reliability level 6 \n */
+ eQMI_LOC_AP_RELIABILITY_LEVEL_7_V02 = 7, /**< AP location reliability level 7 */
+ QMILOCAPRELIABILITYENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocApReliabilityEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint64_t macAddress;
+ /**< AP MAC address. */
+
+ float xLat;
+ /**< AP latitude. \n
+ - Units -- degrees */
+
+ float yLon;
+ /**< AP longitude sensor y-axis sample. \n
+ - Units -- degrees */
+
+ float mar;
+ /**< Maximum antenna range. \n
+ - Units -- Meters */
+}qmiLocApCacheStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t hepeValid;
+ /**< Indicates whether HEPE data is available. Values: \n
+ - 0x00 (FALSE) -- Ignore the HEPE data of this AP \n
+ - 0x01 (TRUE) -- HEPE data of this AP is available */
+
+ uint16_t hepe;
+ /**< Horizontal estimated position error. \n
+ - Units -- Meters */
+
+ qmiLocApReliabilityEnumT_v02 apReliability;
+ /**< Specifies the reliability of the AP position.
+ The lowest is eQMI_LOC_AP_RELIABILITY_LEVEL_1 and the highest is eQMI_LOC_AP_RELIABILITY_LEVEL_7.
+ The AP reliability increases as the level increases.
+ Values: \n
+ - eQMI_LOC_AP_RELIABILITY_NOT_SET (0) -- AP location reliability is not set \n
+ - eQMI_LOC_AP_RELIABILITY_LEVEL_1 (1) -- AP location reliability level 1 \n
+ - eQMI_LOC_AP_RELIABILITY_LEVEL_2 (2) -- AP location reliability level 2 \n
+ - eQMI_LOC_AP_RELIABILITY_LEVEL_3 (3) -- AP location reliability level 3 \n
+ - eQMI_LOC_AP_RELIABILITY_LEVEL_4 (4) -- AP location reliability level 4 \n
+ - eQMI_LOC_AP_RELIABILITY_LEVEL_5 (5) -- AP location reliability level 5 \n
+ - eQMI_LOC_AP_RELIABILITY_LEVEL_6 (6) -- AP location reliability level 6 \n
+ - eQMI_LOC_AP_RELIABILITY_LEVEL_7 (7) -- AP location reliability level 7
+ */
+}qmiLocApCacheHepeRelStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject APs into the cache of
+ the low power Wi-Fi engine for fix computation. */
+typedef struct {
+
+ /* Mandatory */
+ /* Version Number */
+ uint8_t versionNumber;
+ /**< AP cache protocol version number. */
+
+ /* Mandatory */
+ /* Part Number */
+ uint8_t partNumber;
+ /**< Multiple message part number; used for ordering AP information. */
+
+ /* Mandatory */
+ /* Total Parts */
+ uint8_t totalParts;
+ /**< Total number of parts or messages for a complete cache update. */
+
+ /* Mandatory */
+ /* AP Cache Data */
+ uint32_t apCacheData_len; /**< Must be set to # of elements in apCacheData */
+ qmiLocApCacheStructT_v02 apCacheData[QMI_LOC_APCACHE_DATA_MAX_SAMPLES_V02];
+ /**< \vspace{4pt} \n AP cache information. */
+
+ /* Optional */
+ /* AP Cache HEPE Data */
+ uint8_t apCacheHepeRelData_valid; /**< Must be set to true if apCacheHepeRelData is being passed */
+ uint32_t apCacheHepeRelData_len; /**< Must be set to # of elements in apCacheHepeRelData */
+ qmiLocApCacheHepeRelStructT_v02 apCacheHepeRelData[QMI_LOC_APCACHE_DATA_MAX_SAMPLES_V02];
+ /**< \vspace{4pt} \n
+ The ordering of the apCacheHepeRelData list must match the apCacheData list.
+ That is, the first element of the apCacheHepeRelData must be the cache HEPE data of the AP
+ whose cache data is the first element in the apCacheData, and so on. */
+}qmiLocInjectApCacheDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject APs into the cache of
+ the low power Wi-Fi engine for fix computation. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Inject APCACHE Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject AP Cache Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* AP Cache Size */
+ uint8_t apCacheSize_valid; /**< Must be set to true if apCacheSize is being passed */
+ uint32_t apCacheSize;
+ /**< Key performance indicator (KPI) for apCacheSize that measures the size
+ of the last AP cache used. This parameter is always present. */
+
+ /* Optional */
+ /* AP Do Not Cache Size */
+ uint8_t apDoNotCacheSize_valid; /**< Must be set to true if apDoNotCacheSize is being passed */
+ uint32_t apDoNotCacheSize;
+ /**< KPI for apDoNotCacheSize that measures the size of the last AP cache used.
+ This parameter is always present. */
+
+ /* Optional */
+ /* AP Cache Hits */
+ uint8_t apCacheHits_valid; /**< Must be set to true if apCacheHits is being passed */
+ uint32_t apCacheHits;
+ /**< KPI for apCacheHits that measures the number of hits to the
+ AP cache of the last cache content. */
+
+ /* Optional */
+ /* AP Do Not Cache Hits */
+ uint8_t apDoNotCacheHits_valid; /**< Must be set to true if apDoNotCacheHits is being passed */
+ uint32_t apDoNotCacheHits;
+ /**< KPI for apDoNotCacheHits that measures the number of hits to
+ apDoNotCache of the last cache content. */
+
+ /* Optional */
+ /* Unknown APs */
+ uint8_t unknownAps_valid; /**< Must be set to true if unknownAps is being passed */
+ uint32_t unknownAps;
+ /**< KPI for unknownAps that measures the number of unknown APs, those that are
+ not found in any cache content. */
+
+ /* Optional */
+ /* Async Scans */
+ uint8_t asyncScans_valid; /**< Must be set to true if asyncScans is being passed */
+ uint32_t asyncScans;
+ /**< KPI for asyncScans that measures the number of async scans
+ perceived since the last modem boot. */
+
+ /* Optional */
+ /* Async Fixes */
+ uint8_t asyncFixes_valid; /**< Must be set to true if asyncFixes is being passed */
+ uint32_t asyncFixes;
+ /**< KPI for asyncFixes that measures the number of async fixes
+ generated since the last modem boot. */
+
+ /* Optional */
+ /* Sync Scans */
+ uint8_t syncScans_valid; /**< Must be set to true if syncScans is being passed */
+ uint32_t syncScans;
+ /**< KPI for syncScans that measures the number of sync scans
+ perceived since the last modem boot. */
+
+ /* Optional */
+ /* Sync Fixes */
+ uint8_t syncFixes_valid; /**< Must be set to true if syncFixes is being passed */
+ uint32_t syncFixes;
+ /**< KPI for asyncFixes that measures the number of sync fixes
+ generated since the last modem boot. */
+}qmiLocInjectApCacheDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint64_t macAddress;
+ /**< AP's MAC address. */
+}qmiLocApDoNotCacheStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject blacked out APs into
+ the low power location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Version Number */
+ uint8_t versionNumber;
+ /**< AP cache protocol version number. */
+
+ /* Mandatory */
+ /* Part Number */
+ uint8_t partNumber;
+ /**< Multiple message part number, used to order AP information. */
+
+ /* Mandatory */
+ /* Total Parts */
+ uint8_t totalParts;
+ /**< Total number of parts or messages for a complete cache update. */
+
+ /* Mandatory */
+ /* No AP Cache Data */
+ uint32_t apDoNotCacheData_len; /**< Must be set to # of elements in apDoNotCacheData */
+ qmiLocApDoNotCacheStructT_v02 apDoNotCacheData[QMI_LOC_APCACHE_DATA_MAX_SAMPLES_V02];
+ /**< \n APDoNotCache information. */
+}qmiLocInjectApDoNotCacheDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject blacked out APs into
+ the low power location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Inject APDONOTCACHE Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject APDONOTCACHE Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectApDoNotCacheDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCBATCHINGSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_BATCH_POS_UNAVAILABLE_V02 = 1, /**< Service is unable to compute the positions for batching \n */
+ eQMI_LOC_BATCH_POS_AVAILABLE_V02 = 2, /**< Service is able to compute the positions for batching */
+ QMILOCBATCHINGSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocBatchingStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the control point of the
+ batching status. */
+typedef struct {
+
+ /* Mandatory */
+ /* Batching Status */
+ qmiLocBatchingStatusEnumT_v02 batchingStatus;
+ /**< Specifies the batching status.
+ Values: \n
+ - eQMI_LOC_BATCH_POS_UNAVAILABLE (1) -- Service is unable to compute the positions for batching \n
+ - eQMI_LOC_BATCH_POS_AVAILABLE (2) -- Service is able to compute the positions for batching
+ */
+}qmiLocEventBatchingStatusIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** Identifies the always-on service capabilities. */
+typedef uint32_t qmiLocAonCapabilityMaskT_v02;
+#define QMI_LOC_MASK_AON_AUTO_BATCHING_SUPPORTED_V02 ((qmiLocAonCapabilityMaskT_v02)0x00000001) /**< The service supports auto batching; the client can enable auto
+ batching by setting the distance parameter to 0 in the START_BATCHING request */
+#define QMI_LOC_MASK_AON_DISTANCE_BASED_BATCHING_SUPPORTED_V02 ((qmiLocAonCapabilityMaskT_v02)0x00000002) /**< The service supports distance-based batching */
+#define QMI_LOC_MASK_AON_TIME_BASED_BATCHING_SUPPORTED_V02 ((qmiLocAonCapabilityMaskT_v02)0x00000004) /**< The service supports time-based batching */
+#define QMI_LOC_MASK_AON_DISTANCE_BASED_TRACKING_SUPPORTED_V02 ((qmiLocAonCapabilityMaskT_v02)0x00000008) /**< The service supports distance-based tracking */
+#define QMI_LOC_MASK_AON_UPDATE_TBF_SUPPORTED_V02 ((qmiLocAonCapabilityMaskT_v02)0x00000010) /**< The service supports changing TBF dynamically */
+#define QMI_LOC_MASK_AON_OUTDOOR_TRIP_BATCHING_SUPPORTED_V02 ((qmiLocAonCapabilityMaskT_v02)0x00000020) /**< The service supports outdoor trip batching */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the clients to get always-on (AON) service settings.
+ */
+typedef struct {
+
+ /* Mandatory */
+ /* Transaction ID */
+ uint32_t transactionId;
+ /**< Identifies the transaction. The same transaction ID
+ is returned in the QUERY_AON_CONFIG indication. */
+}qmiLocQueryAonConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the clients to get always-on (AON) service settings.
+ */
+typedef struct {
+
+ /* Mandatory */
+ /* Always-On Config Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the QMI_LOC_QUERY_AON_CONFIG_REQ request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Transaction ID */
+ uint8_t transactionId_valid; /**< Must be set to true if transactionId is being passed */
+ uint32_t transactionId;
+ /**< Identifies the transaction. It is the same transaction
+ ID that was passed in the QUERY_AON_CONFIG request. */
+
+ /* Optional */
+ /* Always-On Capability */
+ uint8_t aonCapability_valid; /**< Must be set to true if aonCapability is being passed */
+ qmiLocAonCapabilityMaskT_v02 aonCapability;
+ /**< Always-on capabilities supported by the service. \n
+ Values: \n
+ - QMI_LOC_MASK_AON_AUTO_BATCHING_SUPPORTED (0x00000001) -- The service supports auto batching; the client can enable auto
+ batching by setting the distance parameter to 0 in the START_BATCHING request
+ - QMI_LOC_MASK_AON_DISTANCE_BASED_BATCHING_SUPPORTED (0x00000002) -- The service supports distance-based batching
+ - QMI_LOC_MASK_AON_TIME_BASED_BATCHING_SUPPORTED (0x00000004) -- The service supports time-based batching
+ - QMI_LOC_MASK_AON_DISTANCE_BASED_TRACKING_SUPPORTED (0x00000008) -- The service supports distance-based tracking
+ - QMI_LOC_MASK_AON_UPDATE_TBF_SUPPORTED (0x00000010) -- The service supports changing TBF dynamically
+ - QMI_LOC_MASK_AON_OUTDOOR_TRIP_BATCHING_SUPPORTED (0x00000020) -- The service supports outdoor trip batching */
+}qmiLocQueryAonConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocDeleteCommonDataMaskT_v02;
+#define QMI_LOC_DELETE_COMMON_MASK_POS_V02 ((qmiLocDeleteCommonDataMaskT_v02)0x00000001) /**< Position estimate; common for all GNSS types */
+#define QMI_LOC_DELETE_COMMON_MASK_TIME_V02 ((qmiLocDeleteCommonDataMaskT_v02)0x00000002) /**< Reset all CLOCK_INFO mask */
+#define QMI_LOC_DELETE_COMMON_MASK_UTC_V02 ((qmiLocDeleteCommonDataMaskT_v02)0x00000004) /**< UTC estimate */
+#define QMI_LOC_DELETE_COMMON_MASK_RTI_V02 ((qmiLocDeleteCommonDataMaskT_v02)0x00000008) /**< RTI */
+#define QMI_LOC_DELETE_COMMON_MASK_FREQ_BIAS_EST_V02 ((qmiLocDeleteCommonDataMaskT_v02)0x00000010) /**< Frequency bias estimate; common for all GNSS types */
+typedef uint32_t qmiLocDeleteSatelliteDataMaskT_v02;
+#define QMI_LOC_DELETE_DATA_MASK_EPHEMERIS_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000001) /**< Ephemeris \n */
+#define QMI_LOC_DELETE_DATA_MASK_ALMANAC_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000002) /**< Almanac \n */
+#define QMI_LOC_DELETE_DATA_MASK_SVHEALTH_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000004) /**< SV health \n */
+#define QMI_LOC_DELETE_DATA_MASK_SVDIR_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000008) /**< SV direction \n */
+#define QMI_LOC_DELETE_DATA_MASK_SVSTEER_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000010) /**< SV steer \n */
+#define QMI_LOC_DELETE_DATA_MASK_ALM_CORR_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000020) /**< Almanac correction \n */
+#define QMI_LOC_DELETE_DATA_MASK_BLACKLIST_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000040) /**< Blacklist SVs \n */
+#define QMI_LOC_DELETE_DATA_MASK_SA_DATA_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000080) /**< Sensitivity assistance data \n */
+#define QMI_LOC_DELETE_DATA_MASK_SV_NO_EXIST_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000100) /**< SV does not exist \n */
+#define QMI_LOC_DELETE_DATA_MASK_IONO_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000200) /**< Ionosphere correction \n */
+#define QMI_LOC_DELETE_DATA_MASK_TIME_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000400) /**< Reset satellite time \n */
+#define QMI_LOC_DELETE_DATA_MASK_MB_DATA_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00000800) /**< Delete multiband data \n */
+#define QMI_LOC_DELETE_DATA_MASK_TGD_DATA_V02 ((qmiLocDeleteSatelliteDataMaskT_v02)0x00001000) /**< Reset TGD (group delay) data */
+typedef uint32_t qmiLocGNSSConstellMaskT_v02;
+#define QMI_LOC_SYSTEM_GPS_V02 ((qmiLocGNSSConstellMaskT_v02)0x00000001) /**< System GPS data \n */
+#define QMI_LOC_SYSTEM_GLO_V02 ((qmiLocGNSSConstellMaskT_v02)0x00000002) /**< System GLONASS data \n */
+#define QMI_LOC_SYSTEM_BDS_V02 ((qmiLocGNSSConstellMaskT_v02)0x00000004) /**< System BDS data \n */
+#define QMI_LOC_SYSTEM_GAL_V02 ((qmiLocGNSSConstellMaskT_v02)0x00000008) /**< System Galileo data \n */
+#define QMI_LOC_SYSTEM_QZSS_V02 ((qmiLocGNSSConstellMaskT_v02)0x00000010) /**< System QZSS data \n */
+#define QMI_LOC_SYSTEM_NAVIC_V02 ((qmiLocGNSSConstellMaskT_v02)0x00000020) /**< System NavIC data */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocGNSSConstellMaskT_v02 system;
+ /**< Indicates which satellite system's data is to delete.
+ The control point can delete multiple systems at a time.
+ Values: \n
+ - QMI_LOC_SYSTEM_GPS (0x00000001) -- System GPS data \n
+ - QMI_LOC_SYSTEM_GLO (0x00000002) -- System GLONASS data \n
+ - QMI_LOC_SYSTEM_BDS (0x00000004) -- System BDS data \n
+ - QMI_LOC_SYSTEM_GAL (0x00000008) -- System Galileo data \n
+ - QMI_LOC_SYSTEM_QZSS (0x00000010) -- System QZSS data \n
+ - QMI_LOC_SYSTEM_NAVIC (0x00000020) -- System NavIC data
+ */
+
+ qmiLocDeleteSatelliteDataMaskT_v02 deleteSatelliteDataMask;
+ /**< Requested bitmask of data to delete for the specified satellite system. \n
+ Values: \n
+ - QMI_LOC_DELETE_DATA_MASK_EPHEMERIS (0x00000001) -- Ephemeris \n
+ - QMI_LOC_DELETE_DATA_MASK_ALMANAC (0x00000002) -- Almanac \n
+ - QMI_LOC_DELETE_DATA_MASK_SVHEALTH (0x00000004) -- SV health \n
+ - QMI_LOC_DELETE_DATA_MASK_SVDIR (0x00000008) -- SV direction \n
+ - QMI_LOC_DELETE_DATA_MASK_SVSTEER (0x00000010) -- SV steer \n
+ - QMI_LOC_DELETE_DATA_MASK_ALM_CORR (0x00000020) -- Almanac correction \n
+ - QMI_LOC_DELETE_DATA_MASK_BLACKLIST (0x00000040) -- Blacklist SVs \n
+ - QMI_LOC_DELETE_DATA_MASK_SA_DATA (0x00000080) -- Sensitivity assistance data \n
+ - QMI_LOC_DELETE_DATA_MASK_SV_NO_EXIST (0x00000100) -- SV does not exist \n
+ - QMI_LOC_DELETE_DATA_MASK_IONO (0x00000200) -- Ionosphere correction \n
+ - QMI_LOC_DELETE_DATA_MASK_TIME (0x00000400) -- Reset satellite time \n
+ - QMI_LOC_DELETE_DATA_MASK_MB_DATA (0x00000800) -- Delete multiband data \n
+ - QMI_LOC_DELETE_DATA_MASK_TGD_DATA (0x00001000) -- Reset TGD (group delay) data
+ */
+}qmiLocDeleteSatelliteDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Deletes the location engine
+ service data from memory. */
+typedef struct {
+
+ /* Mandatory */
+ /* Reset All */
+ uint8_t deleteAllFlag;
+ /**< Indicates whether to delete all GNSS service data.\n
+ Values: \n
+ - OxO1 (TRUE) -- Reset all constellation service data;
+ when this flag is set, ignore all the other information
+ contained in the optional fields for this
+ message \n
+ - 0x00 (FALSE) -- Use the optional fields in the message
+ to determine which data to delete
+ */
+
+ /* Optional */
+ /* Requested Bitmask of Clock Info Data to Delete */
+ uint8_t deleteClockInfoMask_valid; /**< Must be set to true if deleteClockInfoMask is being passed */
+ qmiLocDeleteClockInfoMaskT_v02 deleteClockInfoMask;
+ /**< Mask for the clock information service data to delete.
+ If QMI_LOC_DELETE_DATA_MASK_TIME is set in deleteServiceDataMask,
+ deleteClockInfoMask is ignored.
+ Values: \n
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_TIME_EST (0x00000001) -- Delete time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_FREQ_EST (0x00000002) -- Delete frequency estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_WEEK_NUMBER (0x00000004) -- Delete week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_RTC_TIME (0x00000008) -- Delete RTC time
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_TIME_TRANSFER (0x00000010) -- Delete time transfer
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GPSTIME_EST (0x00000020) -- Delete GPS time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLOTIME_EST (0x00000040) -- Delete GLONASS time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLODAY_NUMBER (0x00000080) -- Delete GLONASS day number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLO4YEAR_NUMBER (0x00000100) -- Delete GLONASS four year number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GLO_RF_GRP_DELAY (0x00000200) -- Delete GLONASS RF GRP delay
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_DISABLE_TT (0x00000400) -- Delete disable TT
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GG_LEAPSEC (0x00000800) -- Delete GG leap second
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GG_GGTB (0x00001000) -- Delete GG GGTB
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BDSTIME_EST (0x00002000) -- Delete a BDS time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GB_GBTB (0x00004000) -- Delete GLONASS-to-BDS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BG_BGTB (0x00008000) -- Delete BDS-to-GLONASS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BDSWEEK_NUMBER (0x00010000) -- Delete the BDS week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_BDS_RF_GRP_DELAY (0x00020000) -- Delete the BDS RF GRP delay
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTIME_EST (0x00040000) -- Delete a Galileo time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOGPS_TB (0x00080000) -- Delete Galileo-to-GPS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOGLO_TB (0x00100000) -- Delete Galileo-to-GLO time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALTOBDS_TB (0x00200000) -- Delete Galileo-to-BDS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GALWEEK_NUMBER (0x00800000) -- Delete the Galileo week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_GAL_RF_GRP_DELAY (0x01000000) -- Delete the Galileo RF GRP delay
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TIME_EST (0x02000000) -- Delete a NavIC time estimate
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_WEEK_NUMBER (0x04000000) -- Delete the NavIC week number
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_RF_GRP_DELAY (0x08000000) -- Delete the NavIC RF GRP delay
+ */
+
+ /* Optional */
+ /* Requested Bitmask of Cell DB Data to Delete */
+ uint8_t deleteCellDbDataMask_valid; /**< Must be set to true if deleteCellDbDataMask is being passed */
+ qmiLocDeleteCelldbDataMaskT_v02 deleteCellDbDataMask;
+ /**< Mask for the cell database service data to delete;
+ common for all GNSS types.
+ Values: \n
+ - QMI_LOC_MASK_DELETE_CELLDB_POS (0x00000001) -- Delete cell database position
+ - QMI_LOC_MASK_DELETE_CELLDB_LATEST_GPS_POS (0x00000002) -- Delete cell database latest GPS position
+ - QMI_LOC_MASK_DELETE_CELLDB_OTA_POS (0x00000004) -- Delete cell database OTA position
+ - QMI_LOC_MASK_DELETE_CELLDB_EXT_REF_POS (0x00000008) -- Delete cell database external reference position
+ - QMI_LOC_MASK_DELETE_CELLDB_TIMETAG (0x00000010) -- Delete cell database time tag
+ - QMI_LOC_MASK_DELETE_CELLDB_CELLID (0x00000020) -- Delete cell database cell ID
+ - QMI_LOC_MASK_DELETE_CELLDB_CACHED_CELLID (0x00000040) -- Delete cell database cached cell ID
+ - QMI_LOC_MASK_DELETE_CELLDB_LAST_SRV_CELL (0x00000080) -- Delete cell database last service cell
+ - QMI_LOC_MASK_DELETE_CELLDB_CUR_SRV_CELL (0x00000100) -- Delete cell database current service cell
+ - QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO (0x00000200) -- Delete cell database neighbor information
+ */
+
+ /* Optional */
+ /* Requested Bitmask of Common Data to Delete */
+ uint8_t deleteCommonDataMask_valid; /**< Must be set to true if deleteCommonDataMask is being passed */
+ qmiLocDeleteCommonDataMaskT_v02 deleteCommonDataMask;
+ /**< Mask for the common service data to delete.
+ Values: \n
+ - QMI_LOC_DELETE_COMMON_MASK_POS (0x00000001) -- Position estimate; common for all GNSS types
+ - QMI_LOC_DELETE_COMMON_MASK_TIME (0x00000002) -- Reset all CLOCK_INFO mask
+ - QMI_LOC_DELETE_COMMON_MASK_UTC (0x00000004) -- UTC estimate
+ - QMI_LOC_DELETE_COMMON_MASK_RTI (0x00000008) -- RTI
+ - QMI_LOC_DELETE_COMMON_MASK_FREQ_BIAS_EST (0x00000010) -- Frequency bias estimate; common for all GNSS types
+ */
+
+ /* Optional */
+ /* GNSS Service Data to Delete */
+ uint8_t deleteSatelliteData_valid; /**< Must be set to true if deleteSatelliteData is being passed */
+ qmiLocDeleteSatelliteDataStructT_v02 deleteSatelliteData;
+ /**< Request to delete the GNSS service data.*/
+
+ /* Optional */
+ /* Requested Extended Bitmask of Clock Info Data to Delete */
+ uint8_t deleteExtClockInfoMask_valid; /**< Must be set to true if deleteExtClockInfoMask is being passed */
+ qmiLocExtDeleteClockInfoMaskT_v02 deleteExtClockInfoMask;
+ /**< Extended mask for the clock information service data to delete.
+ If QMI_LOC_DELETE_DATA_MASK_TIME is set in deleteServiceDataMask,
+ deleteExtClockInfoMask is ignored.
+ Values: \n
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_GPS_TB (0x000001) -- Delete NavIC-to-GPS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_GLO_TB (0x000002) -- Delete NavIC-to-GLO time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_BDS_TB (0x000004) -- Delete NavIC-to-BDS time bias-related information
+ - QMI_LOC_MASK_DELETE_CLOCK_INFO_NAVIC_TO_GAL_TB (0x000008) -- Delete NavIC-to-GAL time bias-related information
+ */
+}qmiLocDeleteGNSSServiceDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Deletes the location engine
+ service data from memory. */
+typedef struct {
+
+ /* Mandatory */
+ /* Delete GNSS Service Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Delete Assist Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocDeleteGNSSServiceDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCXTRADATAFORMATENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_XTRA_DATA_V02 = 0, /**< Default is XTRA format. */
+ QMILOCXTRADATAFORMATENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocXtraDataFormatEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects XTRA data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Total Size */
+ uint32_t totalSize;
+ /**< Total size of the XTRA data to inject. \n
+ - Units -- Bytes */
+
+ /* Mandatory */
+ /* Total Parts */
+ uint16_t totalParts;
+ /**< Total number of parts to divide the XTRA data into. */
+
+ /* Mandatory */
+ /* Part Number */
+ uint16_t partNum;
+ /**< Number of the current XTRA data part; starts at 1. */
+
+ /* Mandatory */
+ /* Data */
+ uint32_t partData_len; /**< Must be set to # of elements in partData */
+ uint8_t partData[QMI_LOC_MAX_XTRA_PART_LEN_V02];
+ /**< XTRA data. \n
+ - Type -- Array of bytes \n
+ - Maximum length of the array -- 1024
+ */
+
+ /* Optional */
+ /* Format Type */
+ uint8_t formatType_valid; /**< Must be set to true if formatType is being passed */
+ qmiLocXtraDataFormatEnumT_v02 formatType;
+ /**< XTRA data format. \n
+ Values: \n
+ - eQMI_LOC_XTRA_DATA (0) -- Default is XTRA format.
+ */
+}qmiLocInjectXtraDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects XTRA data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Data Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the data injection request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Part Number */
+ uint8_t partNum_valid; /**< Must be set to true if partNum is being passed */
+ uint16_t partNum;
+ /**< Number of the XTRA data part for which this indication
+ is sent; starts at 1. */
+
+ /* Optional */
+ /* Success Constellation Mask */
+ uint8_t ConstellationMask_valid; /**< Must be set to true if ConstellationMask is being passed */
+ qmiLocGNSSConstellEnumT_v02 ConstellationMask;
+ /**< Constellation mask set when the XTRA data is accepted by the modem GNSS engine.
+ This optional TLV is only available when at least one constellation injection is successful,
+ and it is only available in the last XTRA injection indication.
+ - eQMI_SYSTEM_GPS (0x01) -- Enable GPS \n
+ - eQMI_SYSTEM_GLO (0x02) -- Enable GLONASS \n
+ - eQMI_SYSTEM_BDS (0x04) -- Enable BDS \n
+ - eQMI_SYSTEM_GAL (0x08) -- Enable Galileo \n
+ - eQMI_SYSTEM_QZSS (0x10) -- Enable QZSS \n
+ - eQMI_SYSTEM_NAVIC (0x20) -- Enable NavIC */
+}qmiLocInjectXtraDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject PCID, which the XTRA service uses. */
+typedef struct {
+
+ /* Mandatory */
+ /* XTRA PCID */
+ uint64_t xtraPcid;
+ /**< XTRA PCID data. \n
+ - Type -- uint64 */
+}qmiLocInjectXtraPcidReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject PCID, which the XTRA service uses. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject XTRA PCID Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the inject XTRA PCID command.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectXtraPcidIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to query the QMI_LOC service supported features. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocGetSupportedFeatureReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSUPPORTEDFEATUREENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0, /**< Support the ODCPI version 2 feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02 = 1, /**< Support the Wi-Fi AP data inject version 2 feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02 = 2, /**< Support the debug NMEA feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_GNSS_ONLY_POSITION_REPORT_V02 = 3, /**< Support the GNSS only position report feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_FDCL_V02 = 4, /**< Support the FDCL feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02 = 5, /**< Support the GNSS constellation enablement feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_AGPM_V02 = 6, /**< Support the advanced GNSS power management feature\n */
+ eQMI_LOC_SUPPORTED_FEATURE_XTRA_INTEGRITY_V02 = 7, /**< Support the XTRA integrity feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_FDCL_2_V02 = 8, /**< Support the FDCL version 2 feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY_V02 = 9, /**< Support the location privacy feature \n */
+ eQMI_LOC_SUPPORTED_FEATURE_NAVIC_V02 = 10, /**< Support the NavIC constellation \n */
+ eQMI_LOC_SUPPORTED_FEATURE_ENV_AIDING_V02 = 11, /**< Support environment aiding \n */
+ eQMI_LOC_SUPPORTED_FEATURE_ROBUST_LOCATION_V02 = 12, /**< Support Robust Location feature */
+ eQMI_LOC_SUPPORTED_FEATURE_EDGNSS_V02 = 13, /**< Support enhanced DGNSS */
+ eQMI_LOC_SUPPORTED_FEATURE_MULTIBAND_CONFIG_V02 = 14, /**< Support the multiband GNSS configuration feature */
+ QMILOCSUPPORTEDFEATUREENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSupportedFeatureEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocFeaturesStatusMaskT_v02;
+#define QMI_LOC_FEATURE_STATUS_CARRIER_PHASE_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000001ull) /**< Carrier Phase feature status. \n */
+#define QMI_LOC_FEATURE_STATUS_SV_POLYNOMIALS_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000002ull) /**< SV Polynomial reporting status.\n */
+#define QMI_LOC_FEATURE_STATUS_SV_EPHEMERIS_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000004ull) /**< SV Ephemeris reporting status.\n */
+#define QMI_LOC_FEATURE_STATUS_SINGLE_FREQUENCY_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000008ull) /**< GNSS Single Frequency status.\n */
+#define QMI_LOC_FEATURE_STATUS_MULTI_FREQUENCY_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000010ull) /**< GNSS Multi Frequency status. \n */
+#define QMI_LOC_FEATURE_STATUS_TIME_FREQUENCY_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000020ull) /**< Time and Frequency status.\n */
+#define QMI_LOC_FEATURE_STATUS_TIME_UNCERTAINTY_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000040ull) /**< Time Uncertainty status. \n */
+#define QMI_LOC_FEATURE_STATUS_CLOCK_ESTIMATE_V02 ((qmiLocFeaturesStatusMaskT_v02)0x00000080ull) /**< Clock Estimate status. \n */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query the QMI_LOC service supported features. */
+typedef struct {
+
+ /* Mandatory */
+ /* Supported Feature Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Query Supported Feature request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Supported Features */
+ uint32_t feature_len; /**< Must be set to # of elements in feature */
+ uint8_t feature[QMI_LOC_SUPPORTED_FEATURE_LENGTH_V02];
+ /**< Describes which features are supported in the running
+ QMI_LOC service. The array of unit8 is the bitmask where each bit
+ represents a feature enum. Bit 0 represents feature enum ID 0,
+ bit 1 represents feature enum ID 1, etc.
+ For example, if QMI_LOC supports feature enum 0,1,2,8,
+ feature_len is 2, and
+ feature array is [7,1]. \n
+ - Type -- Array of uint8 \n
+ - Maximum array length -- 100
+ */
+
+ /* Optional */
+ /* Features Mask */
+ uint8_t featureStatusReport_valid; /**< Must be set to true if featureStatusReport is being passed */
+ qmiLocFeaturesStatusMaskT_v02 featureStatusReport;
+ /**< Bitmask indicating the modem feature status for
+ features controlled with licenses.
+ Valid bitmasks: \n
+ - QMI_LOC_FEATURE_STATUS_CARRIER_PHASE (0x00000001) -- Carrier Phase feature status. \n
+ - QMI_LOC_FEATURE_STATUS_SV_POLYNOMIALS (0x00000002) -- SV Polynomial reporting status.\n
+ - QMI_LOC_FEATURE_STATUS_SV_EPHEMERIS (0x00000004) -- SV Ephemeris reporting status.\n
+ - QMI_LOC_FEATURE_STATUS_SINGLE_FREQUENCY (0x00000008) -- GNSS Single Frequency status.\n
+ - QMI_LOC_FEATURE_STATUS_MULTI_FREQUENCY (0x00000010) -- GNSS Multi Frequency status. \n
+ - QMI_LOC_FEATURE_STATUS_TIME_FREQUENCY (0x00000020) -- Time and Frequency status.\n
+ - QMI_LOC_FEATURE_STATUS_TIME_UNCERTAINTY (0x00000040) -- Time Uncertainty status. \n
+ - QMI_LOC_FEATURE_STATUS_CLOCK_ESTIMATE (0x00000080) -- Clock Estimate status. \n
+ */
+}qmiLocGetSupportedFeatureIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Location service internal status configuration message. */
+typedef struct {
+
+ /* Mandatory */
+ /* Location Service Internal Status Configuration */
+ uint8_t config;
+ /**< Request to turn on/off the location service internal status report.\n
+ - 0x01 (TRUE) -- Turn the report on \n
+ - 0x00 (FALSE) -- Turn the report off
+ */
+}qmiLocSetInternalStatusConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Location service internal status configuration message. */
+typedef struct {
+
+ /* Mandatory */
+ /* Set Location Service Internal Status Configuration Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the set location service internal status configuration request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetInternalStatusConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t data[QMI_LOC_INTERNAL_STATUS_REPORT_DATA_LENGTH_V02];
+ /**< The data of the reported GPS message. */
+}qmiLocInternalStatusReportDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the location service internal status report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Internal Status Report Data */
+ uint32_t reportData_len; /**< Must be set to # of elements in reportData */
+ qmiLocInternalStatusReportDataStructT_v02 reportData[QMI_LOC_INTERNAL_STATUS_MAX_LIST_SIZE_V02];
+}qmiLocEventInternalStatusReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocSrnApDataDeviceTypeMaskT_v02;
+#define QMI_LOC_SRN_AP_DATA_TECH_TYPE_BT_V02 ((qmiLocSrnApDataDeviceTypeMaskT_v02)0x00000001) /**< SRN AP technology Bluetooth */
+#define QMI_LOC_SRN_AP_DATA_TECH_TYPE_BTLE_V02 ((qmiLocSrnApDataDeviceTypeMaskT_v02)0x00000002) /**< SRN AP technology Bluetooth low energy */
+#define QMI_LOC_SRN_AP_DATA_TECH_TYPE_NFC_V02 ((qmiLocSrnApDataDeviceTypeMaskT_v02)0x00000004) /**< SRN AP technology NFC */
+#define QMI_LOC_SRN_AP_DATA_TECH_TYPE_MOBILE_CODE_V02 ((qmiLocSrnApDataDeviceTypeMaskT_v02)0x00000008) /**< SRN AP technology mobile code */
+#define QMI_LOC_SRN_AP_DATA_TECH_TYPE_OTHER_V02 ((qmiLocSrnApDataDeviceTypeMaskT_v02)0x00000010) /**< SRN AP technology other */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSRNAPDATAMACADDRTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SRN_AP_DATA_PUBLIC_MAC_ADDR_V02 = 0, /**< SRN AP MAC address type PUBLIC \n */
+ eQMI_LOC_SRN_AP_DATA_PRIVATE_MAC_ADDR_V02 = 1, /**< SRN AP MAC address type PRIVATE \n */
+ eQMI_LOC_SRN_AP_DATA_OTHER_MAC_ADDR_V02 = 2, /**< SRN AP MAC address type OTHER */
+ QMILOCSRNAPDATAMACADDRTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSrnApDataMacAddrTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to inject SRN (BT, BLE, NFC, etc.) AP data. */
+typedef struct {
+
+ /* Mandatory */
+ /* SRN Request Tech Mask */
+ qmiLocSrnApDataDeviceTypeMaskT_v02 srnTechMask;
+ /**< Specifies which SRN technologies AP measurement data
+ is being requested by the client.
+ Values: \n
+ - QMI_LOC_SRN_AP_DATA_TECH_TYPE_BT (0x00000001) -- SRN AP technology Bluetooth
+ - QMI_LOC_SRN_AP_DATA_TECH_TYPE_BTLE (0x00000002) -- SRN AP technology Bluetooth low energy
+ - QMI_LOC_SRN_AP_DATA_TECH_TYPE_NFC (0x00000004) -- SRN AP technology NFC
+ - QMI_LOC_SRN_AP_DATA_TECH_TYPE_MOBILE_CODE (0x00000008) -- SRN AP technology mobile code
+ - QMI_LOC_SRN_AP_DATA_TECH_TYPE_OTHER (0x00000010) -- SRN AP technology other */
+
+ /* Mandatory */
+ /* SRN Request */
+ uint8_t srnRequest;
+ /**< Specifies whether the GPS engine is requesting a start or stop
+ for an SRN measurement.
+ Values: \n
+ - 0x01 (TRUE) -- Start \n
+ - 0x00 (FALSE) -- Stop
+
+ */
+
+ /* Optional */
+ /* E911 Mode */
+ uint8_t e911Mode_valid; /**< Must be set to true if e911Mode is being passed */
+ uint8_t e911Mode;
+ /**< Indicates to the client whether the GPS engine
+ is in E911 mode.
+ Values: \n
+ - 0x01 (TRUE) -- GPS engine is in E911 mode \n
+ - 0x00 (FALSE) -- GPS engine is not in E911 mode
+ */
+
+ /* Optional */
+ /* SRN MAC Address Type */
+ uint8_t srnApMacAddrType_valid; /**< Must be set to true if srnApMacAddrType is being passed */
+ qmiLocSrnApDataMacAddrTypeEnumT_v02 srnApMacAddrType;
+ /**< Specifies the MAC address type requested.
+ Values: \n
+ - eQMI_LOC_SRN_AP_DATA_PUBLIC_MAC_ADDR (0) -- SRN AP MAC address type PUBLIC \n
+ - eQMI_LOC_SRN_AP_DATA_PRIVATE_MAC_ADDR (1) -- SRN AP MAC address type PRIVATE \n
+ - eQMI_LOC_SRN_AP_DATA_OTHER_MAC_ADDR (2) -- SRN AP MAC address type OTHER */
+}qmiLocEventInjectSrnApDataReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSRNAPDATATECHTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SRN_AP_DATA_TECH_TYPE_BT_V02 = 0, /**< SRN AP technology Bluetooth \n */
+ eQMI_LOC_SRN_AP_DATA_TECH_TYPE_BTLE_V02 = 1, /**< SRN AP technology Bluetooth low energy \n */
+ eQMI_LOC_SRN_AP_DATA_TECH_TYPE_NFC_V02 = 2, /**< SRN AP technology NFC \n */
+ eQMI_LOC_SRN_AP_DATA_TECH_TYPE_MOBILE_CODE_V02 = 3, /**< SRN AP technology mobile code \n */
+ eQMI_LOC_SRN_AP_DATA_TECH_TYPE_OTHER_V02 = 4, /**< SRN AP technology other */
+ QMILOCSRNAPDATATECHTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSrnApDataTechTypeEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocSrnApDataMaskT_v02;
+#define QMI_LOC_SRN_APDATA_MASK_AP_MAC_V02 ((qmiLocSrnApDataMaskT_v02)0x00000001) /**< SRN AP MAC address is valid \n */
+#define QMI_LOC_SRN_APDATA_MASK_AP_RSSI_V02 ((qmiLocSrnApDataMaskT_v02)0x00000002) /**< SRN AP RSSI is valid \n */
+#define QMI_LOC_SRN_APDATA_MASK_RSSI_TIMESTAMP_V02 ((qmiLocSrnApDataMaskT_v02)0x00000004) /**< SRN AP RSSI timestamp is valid */
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSRNAPERRENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_SRN_AP_ERR_UNKNOWN_V02 = 0, /**< Error is unknown \n */
+ eQMI_LOC_SRN_AP_ERR_NO_REQ_MEAS_AVAILABLE_V02 = 1, /**< None of the requested measurements could be provided \n */
+ eQMI_LOC_SRN_AP_ERR_SENSOR_OFF_V02 = 2, /**< Sensor is off */
+ QMILOCSRNAPERRENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSrnApErrEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSrnApDataMaskT_v02 srnApDataMask;
+ /**< Specifies which SRN AP information types are used.
+ Values:
+ - QMI_LOC_SRN_APDATA_MASK_AP_MAC (0x00000001) -- SRN AP MAC address is valid \n
+ - QMI_LOC_SRN_APDATA_MASK_AP_RSSI (0x00000002) -- SRN AP RSSI is valid \n
+ - QMI_LOC_SRN_APDATA_MASK_RSSI_TIMESTAMP (0x00000004) -- SRN AP RSSI timestamp is valid */
+
+ uint8_t macAddress[QMI_LOC_SRN_MAC_ADDR_LENGTH_V02];
+ /**< MAC address.
+ Each address is of length QMI_LOC_SRN_MAC_ADDR_LENGTH. */
+
+ int32_t apSrnRssi;
+ /**< AP signal strength indicator in dBm. */
+
+ int64_t apSrnTimestamp;
+ /**< UTC timestamp at which the scan was requested. \n
+ Units -- Milliseconds \n
+ Type -- int64 */
+}qmiLocSrnBtleApDeviceDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Injects BT, BLE, NFC AP data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Scan Receive Timestamp */
+ qmiLocSrnApDataTechTypeEnumT_v02 apDeviceTechType;
+ /**< List of AP device types.
+ Values: \n
+ - eQMI_LOC_SRN_AP_DATA_TECH_TYPE_BT (0) -- SRN AP technology Bluetooth \n
+ - eQMI_LOC_SRN_AP_DATA_TECH_TYPE_BTLE (1) -- SRN AP technology Bluetooth low energy \n
+ - eQMI_LOC_SRN_AP_DATA_TECH_TYPE_NFC (2) -- SRN AP technology NFC \n
+ - eQMI_LOC_SRN_AP_DATA_TECH_TYPE_MOBILE_CODE (3) -- SRN AP technology mobile code \n
+ - eQMI_LOC_SRN_AP_DATA_TECH_TYPE_OTHER (4) -- SRN AP technology other */
+
+ /* Optional */
+ /* SRN AP Scan Data */
+ uint8_t srnBtleApInfo_valid; /**< Must be set to true if srnBtleApInfo is being passed */
+ uint32_t srnBtleApInfo_len; /**< Must be set to # of elements in srnBtleApInfo */
+ qmiLocSrnBtleApDeviceDataStructT_v02 srnBtleApInfo[QMI_LOC_SRN_MAX_REPORTED_APS_PER_MSG_V02];
+ /**< List of Wi-Fi AP scan information entered by the control point. */
+
+ /* Optional */
+ /* Scan Request Timestamp */
+ uint8_t requestTimestamp_valid; /**< Must be set to true if requestTimestamp is being passed */
+ int64_t requestTimestamp;
+ /**< UTC timestamp at which the scan was started. \n
+ Units -- Milliseconds \n
+ */
+
+ /* Optional */
+ /* Scan Receive Timestamp */
+ uint8_t receiveTimestamp_valid; /**< Must be set to true if receiveTimestamp is being passed */
+ int64_t receiveTimestamp;
+ /**< UTC timestamp at which the scan was received. \n
+ Units -- Milliseconds \n
+ */
+
+ /* Optional */
+ /* Failure Reason for SRN Measurements Not Available */
+ uint8_t errorCause_valid; /**< Must be set to true if errorCause is being passed */
+ qmiLocSrnApErrEnumT_v02 errorCause;
+ /**< If SRN measurements are not available,
+ indicate the reason for the error/failure.
+ This field is not present when SRN measurements are available.
+ Values:
+ - eQMI_LOC_SRN_AP_ERR_UNKNOWN (0) -- Error is unknown \n
+ - eQMI_LOC_SRN_AP_ERR_NO_REQ_MEAS_AVAILABLE (1) -- None of the requested measurements could be provided \n
+ - eQMI_LOC_SRN_AP_ERR_SENSOR_OFF (2) -- Sensor is off */
+}qmiLocInjectSrnApDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Injects BT, BLE, NFC AP data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Bluetooth, Bluetooth LE, NFC AP Scan Information Injection Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject Bluetooth AP Scan Information request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled */
+}qmiLocInjectSrnApDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocCrowdSourcingTechnologyMaskT_v02;
+#define QMI_LOC_CROWDSOURCING_MASK_WIFI_V02 ((qmiLocCrowdSourcingTechnologyMaskT_v02)0x00000001) /**< Wi-Fi crowdsourcing */
+typedef uint32_t qmiLocCrowdSourcingSourceMaskT_v02;
+#define QMI_LOC_CROWDSOURCING_SOURCE_MASK_BARO_V02 ((qmiLocCrowdSourcingSourceMaskT_v02)0x00000001) /**< Baro crowdsourcing */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t enableCrowdSourcingOnDemand;
+ /**< Indicates whether on-demand crowdsourcing is enabled by the OEM.
+ If enabled, GNSS, sensors, and Wi-Fi measurements are requested
+ on demand. This directly affects the power consumption. \n
+ When enabled by the OEM, the location engine performs on-demand crowdsourcing
+ only when enabled by the server via the server configuration.
+ When disabled by the OEM, the location engine does not perform on-demand crowdsourcing. \n
+ Values: \n
+ - 0x01 (TRUE) -- Enable on-demand crowdsourcing (default) \n
+ - 0x00 (FALSE) -- Disable on-demand crowdsourcing
+ */
+
+ uint8_t enableCrowdSourcingOnUnsolicitedGnss;
+ /**< Indicates whether crowdsourcing on unsolicited GNSS fixes is enabled by the OEM.
+ If enabled, Wi-Fi crowdsourcing might be done upon receipt of a GNSS fix.
+ No power is spent requesting the GNSS fix, but power can be spent
+ requesting a Wi-Fi scan or any other measurement sources. \n
+ When enabled by the OEM, the location engine performs crowdsourcing of unsolicited GNSS fixes
+ only when enabled by the server via the server configuration.
+ When disabled by the OEM, the location engine does not perform crowdsourcing of unsolicited GNSS fixes. \n
+ Values: \n
+ - 0x01 (TRUE) -- Enable crowdsourcing of unsolicited GNSS fixes (default) \n
+ - 0x00 (FALSE) -- Disable crowdsourcing of unsolicited GNSS fixes
+ */
+
+ uint8_t enableBatteryLevelBasedThrottling;
+ /**< Indicates whether to throttle crowdsourcing based on the battery level.
+ If enabled, no power is spent on crowdsourcing if the battery runs below
+ 25% charge unless a charger is connected. \n
+ Values: \n
+ - 0x01 (TRUE) -- Enable throttling on the battery level (default) \n
+ - 0x00 (FALSE) -- Disable throttling on the battery level
+ */
+
+ uint8_t enableRttCrowdSourcing;
+ /**< Enable round-trip time (RTT) for crowdsourcing. \n
+ Values: \n
+ - 0x01 (TRUE) -- Enable RTT for crowdsourcing (default) \n
+ - 0x00 (FALSE) -- Disable RTT for crowdsourcing
+ */
+
+ uint8_t enableRtt3CrowdSourcing;
+ /**< Enable 2-sided RTT (RTT3) for crowdsourcing. \n
+ Values: \n
+ - 0x01 (TRUE) -- Enable RTT3 for crowdsourcing (default)\n
+ - 0x00 (FALSE) -- Disable RTT3 for crowdsourcing
+ */
+
+ int32_t rttSignalDbmThresh;
+ /**< Indicates the signal strength threshold in dbM below which
+ AP measurements are filtered out. \n
+ - Default -- -90 \n
+ - Units -- dbM
+ */
+
+ uint16_t maxDataTransferFormatVersionSupported;
+ /**< Maximum version of the format in which data can be transferred.
+ This version is the maximum data format version in which the control point can read/write data
+ while sending/receiving the crowdsourced data to the location engine. \n
+ - Format -- The data format version is an integer that is incremented every time
+ the data format changes. \n
+ - Version negotiation -- The location engine also sends the maximum version of the data format
+ it supports in QMI_LOC_CROWDSOURCE_MANAGER_IND. The control point uses
+ the minimum of the data format version it supports and the data format version the location engine
+ supports. It calls this minimum version the negotiation data format version. The control point
+ then reads or writes the data in the negotiated version format. \n
+ - Units -- N/A
+ */
+}qmiLocWifiCrowdSourcingLocalConfigStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to send crowdsource manager controls to the location engine. */
+typedef struct {
+
+ /* Optional */
+ /* Crowdsourcing Technology Mask */
+ uint8_t enableCrowdSourcingMask_valid; /**< Must be set to true if enableCrowdSourcingMask is being passed */
+ qmiLocCrowdSourcingTechnologyMaskT_v02 enableCrowdSourcingMask;
+ /**< Bitmask of technologies to enable for crowdsourcing.
+ Values: \n
+ - QMI_LOC_CROWDSOURCING_MASK_WIFI (0x00000001) -- Wi-Fi crowdsourcing
+ */
+
+ /* Optional */
+ /* Wi-Fi Crowdsourcing Local Configuration */
+ uint8_t wifiCrowdSourcingLocalConfig_valid; /**< Must be set to true if wifiCrowdSourcingLocalConfig is being passed */
+ qmiLocWifiCrowdSourcingLocalConfigStructT_v02 wifiCrowdSourcingLocalConfig;
+ /**< \n Local configuration for Wi-Fi crowdsourcing.
+ */
+
+ /* Optional */
+ /* Wi-Fi Crowdsourcing Server Configuration */
+ uint8_t wifiCrowdSourcingServerConfig_valid; /**< Must be set to true if wifiCrowdSourcingServerConfig is being passed */
+ uint32_t wifiCrowdSourcingServerConfig_len; /**< Must be set to # of elements in wifiCrowdSourcingServerConfig */
+ char wifiCrowdSourcingServerConfig[QMI_LOC_MAX_WIFI_CROWDSOURCING_SERVER_CONFIG_LEN_V02];
+ /**< Most recent ASN.1 encoded Wi-Fi crowdsourcing server configuration control received.
+ */
+
+ /* Optional */
+ /* Crowdsourcing Source Mask */
+ uint8_t enableSourceMask_valid; /**< Must be set to true if enableSourceMask is being passed */
+ qmiLocCrowdSourcingSourceMaskT_v02 enableSourceMask;
+ /**< Bitmask of sources to enable for crowdsourcing.
+ Values: \n
+ - QMI_LOC_CROWDSOURCING_SOURCE_MASK_BARO (0x00000001) -- Baro crowdsourcing
+ */
+}qmiLocCrowdSourceManagerControlReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t onDemandCrowdSourcingSupported;
+ /**< Indicates whether on-demand crowdsourcing is supported.
+ If supported, GNSS, sensors, and Wi-Fi measurements are requested
+ on demand. This directly affects power consumption. \n
+ Values: \n
+ - 0x01 (TRUE) -- On-demand crowdsourcing is supported \n
+ - 0x00 (FALSE) -- On-demand crowdsourcing is not supported (default)
+ */
+
+ uint8_t UnsolicitedGnssCrowdSourcingSupported;
+ /**< Indicates whether crowdsourcing of unsolicited GNSS fixes is supported.
+ If supported, Wi-Fi crowdsourcing might be done upon receipt of a GNSS fix.
+ No power is spent requesting a GNSS fix, but power might be spent
+ requesting a Wi-Fi scan. \n
+ Values: \n
+ - 0x01 (TRUE) -- Crowdsourcing of unsolicited GNSS fixes is supported \n
+ - 0x00 (FALSE) -- Crowdsourcing of unsolicited GNSS fixes is not supported (default)
+ */
+
+ uint8_t majorVersionSupported;
+ /**< Major version of crowdsourcing supported.
+ */
+
+ uint8_t minorVersionSupported;
+ /**< Minor version of crowdsourcing supported.
+ */
+
+ uint16_t maxDataTransferFormatVersionSupported;
+ /**< Maximum version of the format in which data can be transferred.
+ This version is the maximum data format version in which the location engine can read/write data
+ while sending/receiving the crowdsourced data to the control point. \n
+ - Format -- Data format version is an integer that is incremented every time
+ the data format changes. \n
+ - Version negotiation -- The control point also sends the maximum version of the data format
+ it supports in QMI_LOC_CROWDSOURCE_MANAGER_REQ. The location engine uses
+ the minimum of the data format version it supports and the data format version the control point
+ supports. It calls this minimum version the negotiation data format version. The location engine
+ then reads or writes the data in the negotiated version format. \n
+ - Units -- N/A
+ */
+}qmiLocWifiCrowdSourcingCapabilityStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to send crowdsource manager controls to the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Crowdsource Control Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the crowdsource control request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ \n The status eQMI_LOC_GENERAL_FAILURE indicates that the
+ control point does not support fusion crowdsourcing.
+ */
+
+ /* Optional */
+ /* Crowdsource Technologies Supported Mask. */
+ uint8_t supportedCrowdSourcingMask_valid; /**< Must be set to true if supportedCrowdSourcingMask is being passed */
+ qmiLocCrowdSourcingTechnologyMaskT_v02 supportedCrowdSourcingMask;
+ /**< Bitmask of technologies supported for crowdsourcing. \n
+ Values: \n
+ - QMI_LOC_CROWDSOURCING_MASK_WIFI (0x00000001) -- Wi-Fi crowdsourcing
+ */
+
+ /* Optional */
+ /* Wi-Fi Crowd Sourcing Capability */
+ uint8_t wifiCrowdSourcingCapabaility_valid; /**< Must be set to true if wifiCrowdSourcingCapabaility is being passed */
+ qmiLocWifiCrowdSourcingCapabilityStructT_v02 wifiCrowdSourcingCapabaility;
+ /**< \n Supported capabilities for Wi-Fi crowdsourcing.
+ */
+
+ /* Optional */
+ /* Encoded Client Information */
+ uint8_t modemClientInfo_valid; /**< Must be set to true if modemClientInfo is being passed */
+ uint32_t modemClientInfo_len; /**< Must be set to # of elements in modemClientInfo */
+ uint8_t modemClientInfo[QMI_LOC_MAX_CROWDSOURCING_MODEM_CLIENT_INFO_LEN_V02];
+ /**< Modem client information from the control point encoded in ASN.1 format.\n
+ -- Type -- Array of bytes \n
+ -- Maximum length of the array -- 256
+ */
+}qmiLocCrowdSourceManagerControlIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Requests the location engine to send crowdsourced data
+ to the control point. */
+typedef struct {
+
+ /* Optional */
+ /* Crowd Sourcing Technology Mask */
+ uint8_t crowdSourcingTechMask_valid; /**< Must be set to true if crowdSourcingTechMask is being passed */
+ qmiLocCrowdSourcingTechnologyMaskT_v02 crowdSourcingTechMask;
+ /**< Bitmask of crowdsourcing technologies for which the crowdsource data is being requested. \n
+ Values: \n
+ - QMI_LOC_CROWDSOURCING_MASK_WIFI (0x00000001) -- Wi-Fi crowdsourcing
+ */
+}qmiLocCrowdSourceManagerReadDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocXtraConfigMaskT_v02;
+#define QMI_LOC_XTRA_CONFIG_DISABLE_AUTO_DOWNLOAD_TIMER_V02 ((qmiLocXtraConfigMaskT_v02)0x00000001) /**< Ask the engine to disable the XTRA auto download timer \n */
+#define QMI_LOC_XTRA_CONFIG_NAVIC_EPH_ASSIST_V02 ((qmiLocXtraConfigMaskT_v02)0x00000002) /**< Inform the engine of NAVIC ephemeris assist support */
+typedef uint32_t qmiLocXtraInfoMaskT_v02;
+#define QMI_LOC_XTRA_INFO_MASK_ABS_AGE_V02 ((qmiLocXtraInfoMaskT_v02)0x00000001) /**< Number of hours for which the current XTRA information is valid \n */
+#define QMI_LOC_XTRA_INFO_MASK_REL_AGE_V02 ((qmiLocXtraInfoMaskT_v02)0x00000002) /**< Last XTRA data download time \n */
+#define QMI_LOC_XTRA_INFO_MASK_XTRA_SERVER_V02 ((qmiLocXtraInfoMaskT_v02)0x00000004) /**< XTRA server URLs n */
+#define QMI_LOC_XTRA_INFO_MASK_NTP_SERVER_V02 ((qmiLocXtraInfoMaskT_v02)0x00000008) /**< Network Time Protocol (NTP) server URLs \n */
+#define QMI_LOC_XTRA_INFO_MASK_TIME_REQUEST_V02 ((qmiLocXtraInfoMaskT_v02)0x00000010) /**< Requests the control point to send QMI_LOC_INJECT_UTC_TIME_REQ
+ to the engine \n */
+#define QMI_LOC_XTRA_INFO_MASK_PREF_VALID_AGE_V02 ((qmiLocXtraInfoMaskT_v02)0x00000020) /**< Preferred valid age \n */
+#define QMI_LOC_XTRA_INFO_MASK_NAVIC_EPH_ASSIST_V02 ((qmiLocXtraInfoMaskT_v02)0x00000040) /**< Support for Navic ephemeris assistance data */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocXtraInfoMaskT_v02 reportMask;
+ /**< Bitmask indicating which of the fields in this TLV are reported. \n
+ Values: \n
+ - QMI_LOC_XTRA_INFO_MASK_ABS_AGE (0x00000001) -- Number of hours for which the current XTRA information is valid \n
+ - QMI_LOC_XTRA_INFO_MASK_REL_AGE (0x00000002) -- Last XTRA data download time \n
+ - QMI_LOC_XTRA_INFO_MASK_XTRA_SERVER (0x00000004) -- XTRA server URLs n
+ - QMI_LOC_XTRA_INFO_MASK_NTP_SERVER (0x00000008) -- Network Time Protocol (NTP) server URLs \n
+ - QMI_LOC_XTRA_INFO_MASK_TIME_REQUEST (0x00000010) -- Requests the control point to send QMI_LOC_INJECT_UTC_TIME_REQ
+ to the engine \n
+ - QMI_LOC_XTRA_INFO_MASK_PREF_VALID_AGE (0x00000020) -- Preferred valid age \n
+ - QMI_LOC_XTRA_INFO_MASK_NAVIC_EPH_ASSIST (0x00000040) -- Support for Navic ephemeris assistance data */
+
+ uint16_t absAgeHrs;
+ /**< Number of hours for which the current XTRA information is valid \n
+ - Units -- Hours */
+
+ uint64_t relAgeInUTC;
+ /**< Last XTRA data download time in UTC. \n
+ - Units -- Milliseconds */
+
+ qmiLocPredictedOrbitsServerListStructT_v02 xtraServerInfo;
+ /**< Contains information about the XTRA servers that can be used by the control
+ point to download XTRA data. */
+
+ qmiLocTimeServerListStructT_v02 ntpServerInfo;
+ /**< Contains information about the time servers recommended by the
+ location service for the UTC time. */
+
+ uint8_t timeRequest;
+ /**< Requests the control point to send QMI_LOC_INJECT_UTC_TIME_REQ
+ to the engine. \n
+ - 0x00 (FALSE) -- The engine has the UTC time \n
+ - 0x01 (TRUE) -- Requests the control point to inject the UTC time to the engine */
+
+ uint16_t preferedValidAgeHrs;
+ /**< Preferred valid age. \n
+ - Units -- Hours */
+}qmiLocXtraInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t majorVersion;
+ /**< Major version number. */
+
+ uint8_t minorVersion;
+ /**< Minor version number. */
+}qmiLocVersionStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to query the XTRA information. */
+typedef struct {
+
+ /* Mandatory */
+ /* XTRA Configure */
+ qmiLocXtraConfigMaskT_v02 xtraConfig;
+ /**< XTRA configuration.
+ Values: \n
+ - QMI_LOC_XTRA_CONFIG_DISABLE_AUTO_DOWNLOAD_TIMER (0x00000001) -- Ask the engine to disable the XTRA auto download timer \n
+ - QMI_LOC_XTRA_CONFIG_NAVIC_EPH_ASSIST (0x00000002) -- Inform the engine of NAVIC ephemeris assist support
+ */
+
+ /* Optional */
+ /* XTRA Client Version */
+ uint8_t xcVersion_valid; /**< Must be set to true if xcVersion is being passed */
+ qmiLocVersionStructT_v02 xcVersion;
+}qmiLocQueryXtraInfoReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query the XTRA information. */
+typedef struct {
+
+ /* Mandatory */
+ /* Query XTRA Info Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the query XTRA information.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* XTRA Info */
+ qmiLocXtraInfoStructT_v02 xtraInfo;
+ /**< \n The XTRA information returned from the engine. */
+
+ /* Optional */
+ /* MP XTRA Version */
+ uint8_t mpVersion_valid; /**< Must be set to true if mpVersion is being passed */
+ qmiLocVersionStructT_v02 mpVersion;
+}qmiLocQueryXtraInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to initiate an outdoor trip batching session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Batch Distance */
+ uint32_t batchDistance;
+ /**< The trip distance from the start of outdoor trip batching,
+ which triggers the QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND indication
+ to report to the control point. \n
+ - Units -- Meters
+ */
+
+ /* Mandatory */
+ /* Minimum Interval Between Position Reports */
+ uint32_t minTimeInterval;
+ /**< Minimum time interval, specified by the control point, that must elapse between
+ position reports. \n
+ - Units -- Milliseconds
+ */
+
+ /* Optional */
+ /* Fix Session Timeout Period */
+ uint8_t fixSessionTimeout_valid; /**< Must be set to true if fixSessionTimeout is being passed */
+ uint32_t fixSessionTimeout;
+ /**< Configures the fix session timeout duration. \n
+ - Units -- Milliseconds \n
+ - Default -- 20,000 milliseconds
+ */
+
+ /* Optional */
+ /* Batch All Positions */
+ uint8_t batchAllPos_valid; /**< Must be set to true if batchAllPos is being passed */
+ uint8_t batchAllPos;
+ /**< Values: \n
+ - TRUE -- All positions that are available must be batched. For example,
+ if any other type of positioning is active (such as 1 Hz tracking), all
+ positions computed for that use case are also batched. This can
+ result in the BATCH_FULL indication being generated earlier. \n
+ - FALSE -- Only positions that meet the time and/or distance criteria are batched
+ (default).
+ */
+}qmiLocStartOutdoorTripBatchingReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to initiate an outdoor trip batching session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Start Distance-Based Batching Session Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the outdoor distance batching session start request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocStartOutdoorTripBatchingIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to query the accumulated distance
+ of an outdoor trip batching session. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocQueryOTBAccumulatedDistanceReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query the accumulated distance
+ of an outdoor trip batching session. */
+typedef struct {
+
+ /* Mandatory */
+ /* Query Outdoor Trip Batching Session Accumulated Distance Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the OTB session accumulated distance request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Accumulated OTB Distance */
+ uint32_t accumulatedDistance;
+ /**< The accumulated distance from the last QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ. \n
+ - Units -- Meters
+ */
+
+ /* Mandatory */
+ /* Number of Batched Position Reports */
+ uint32_t batchedPosition;
+ /**< The number of the position reports that have been batched from the last
+ QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ.
+ */
+}qmiLocQueryOTBAccumulatedDistanceIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t gtpClientSwMajorVersion;
+ /**< Major version number from 0 to 255. */
+
+ uint8_t gtpClientSwMinorVersion;
+ /**< Minor version number from 0 to 255. */
+}qmiLocGtpClientSwVerStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t homeMncValid;
+ /**< Boolean indicating if homeMnc is valid. */
+
+ uint32_t homeMcc;
+ /**< MCC of home carrier. */
+
+ uint32_t homeMnc;
+ /**< MNC of home carrier. */
+}qmiLocHomeCarrierIdStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t unspecifiedInternal;
+ /**< Unspecified internal contribution. \n
+ - Range -- 0 to 100 percent */
+
+ uint8_t unspecifiedExternal;
+ /**< Unspecified external contribution. \n
+ - Range -- 0 to 100 percent */
+
+ uint8_t gnss;
+ /**< GNSS contribution. \n
+ - Range -- 0 to 100 percent */
+
+ uint8_t sensors;
+ /**< Sensors contribution. \n
+ - Range - 0 to 100 percent */
+
+ uint8_t wifi;
+ /**< Wifi contribution. \n
+ - Range -- 0 to 100 percent */
+
+ uint8_t wwan;
+ /**< WWAN contribution. \n
+ - Range -- 0 to 100 percent */
+}qmiLocPositionSourceStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ double latitude;
+ /**< Latitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude\n
+ - Negative values indicate southern latitude
+ */
+
+ double longitude;
+ /**< Longitude (specified in WGS84 datum).\n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ float horizontalUnc;
+ /**< Horizontal circular uncertainty. \n
+ - Unit -- Meters */
+
+ float altitude;
+ /**< Altitude with respect to mean sea level. \n
+ - Units -- Meters */
+
+ float altitudeUnc;
+ /**< Vertical uncertainty. \n
+ - Units -- Meters */
+
+ qmiLocPositionSourceStructT_v02 latestPositionSources;
+ /**< Percentage contributions from all sources for position fix (sum must be ~100%). */
+}qmiLocBsBestPositionStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCFDCLAIRINTERFACETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_CDMA_V02 = 0, /**< FDCL CDMA cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_GSM_V02 = 1, /**< FDCL GSM cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_WCDMA_V02 = 2, /**< FDCL WCDMA cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_LTE_V02 = 3, /**< FDCL LTE cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_LTE_M1_V02 = 4, /**< FDCL LTE-M1 cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_LTE_NB1_V02 = 5, /**< FDCL LTE-NB1 cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_LTE_M1_MODE_A_V02 = 6, /**< FDCL LTE-M1 ModeA cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_LTE_M1_MODE_B_V02 = 7, /**< FDCL LTE-M1 ModeB cell \n */
+ eQMI_LOC_FDCL_AIR_INTERFACE_TYPE_LTE_UNKNOWN_V02 = 8, /**< FDCL LTE-Unknown cell */
+ QMILOCFDCLAIRINTERFACETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocFdclAirInterfaceTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocFdclAirInterfaceTypeEnumT_v02 airInterfaceType;
+ /**< The cell type for this record. */
+
+ uint32_t id1;
+ /**< ID1. \n
+ - For all air interface -- MCC
+ */
+
+ uint32_t id2;
+ /**< ID2. \n
+ - For GSM, WCDMA \n
+ - For LTE -- MNC
+ */
+
+ uint32_t id3;
+ /**< ID3. \n
+ - For CDMA -- NID \n
+ - For GSM and WCDMA -- LAC \n
+ - For LTE -- TAC
+ */
+
+ uint32_t id4;
+ /**< ID4. \n
+ - For CDMA -- BSID \n
+ - For GSM -- CI \n
+ - For WCDMA -- U_CI \n
+ - For LTE -- G_CI
+ */
+}qmiLocFdclCellIdStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point for making a FDCL request. */
+typedef struct {
+
+ /* Optional */
+ /* GTP client software version */
+ uint8_t gtpClientSwVer_valid; /**< Must be set to true if gtpClientSwVer is being passed */
+ qmiLocGtpClientSwVerStructT_v02 gtpClientSwVer;
+ /**< GTP client software version. */
+
+ /* Optional */
+ /* Modem Build String (non-NULL Terminated) */
+ uint8_t modemSwVersion_valid; /**< Must be set to true if modemSwVersion is being passed */
+ char modemSwVersion[QMI_LOC_GNSS_SW_VERSION_STRING_MAX_LENGTH_V02 + 1];
+ /**< First 255 characters of the modem build string. \n
+ - Type -- character string \n
+ - Maximum length of the array -- 255
+ */
+
+ /* Optional */
+ /* Home carrier ID */
+ uint8_t homeCarrierId_valid; /**< Must be set to true if homeCarrierId is being passed */
+ qmiLocHomeCarrierIdStructT_v02 homeCarrierId;
+ /**< Home carrier ID (only for GSM, WCDMA, or LTE carrier). */
+
+ /* Optional */
+ /* CDMA Realm (non-NULL Terminated) */
+ uint8_t cdmaRealm_valid; /**< Must be set to true if cdmaRealm is being passed */
+ char cdmaRealm[QMI_LOC_GNSS_SW_VERSION_STRING_MAX_LENGTH_V02 + 1];
+ /**< CDMA Realm (for home network on CDMA only). \n
+ First 255 characters of the CDMA Realm. \n
+ - Type -- character string \n
+ - Maximum length of the array -- 255
+ */
+
+ /* Optional */
+ /* Maximum number of records that can be accepted */
+ uint8_t gtpMaxNumRecordsAccepted_valid; /**< Must be set to true if gtpMaxNumRecordsAccepted is being passed */
+ uint16_t gtpMaxNumRecordsAccepted;
+ /**< Range -- 1 to 65,535 (defaults to 650) */
+
+ /* Optional */
+ /* GPS Week */
+ uint8_t gpsWeek_valid; /**< Must be set to true if gpsWeek is being passed */
+ uint16_t gpsWeek;
+ /**< Units -- Week number (since Jan. 1, 1970) */
+
+ /* Optional */
+ /* GPS Milliseconds */
+ uint8_t gpsMilliseconds_valid; /**< Must be set to true if gpsMilliseconds is being passed */
+ uint32_t gpsMilliseconds;
+ /**< Units -- Milliseconds (since Jan. 1, 1970) */
+
+ /* Optional */
+ /* Base Station Best Position */
+ uint8_t bsBestPosition_valid; /**< Must be set to true if bsBestPosition is being passed */
+ qmiLocBsBestPositionStructT_v02 bsBestPosition;
+
+ /* Optional */
+ /* Current Cell ID */
+ uint8_t currentCellId_valid; /**< Must be set to true if currentCellId is being passed */
+ qmiLocFdclCellIdStructT_v02 currentCellId;
+ /**< Current cell Id. */
+
+ /* Optional */
+ /* Requested Data Types */
+ uint8_t requestedDataTypes_valid; /**< Must be set to true if requestedDataTypes is being passed */
+ uint8_t requestedDataTypes;
+ /**< Requested data types. */
+
+ /* Optional */
+ /* Restricted Region Version */
+ uint8_t restrictedRegionVersion_valid; /**< Must be set to true if restrictedRegionVersion is being passed */
+ uint8_t restrictedRegionVersion;
+ /**< Restricted region version. */
+}qmiLocEventFdclServiceReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to request the FDCL BS (Base Station)
+ list from TLE. */
+typedef struct {
+
+ /* Optional */
+ /* Expire In Days */
+ uint8_t expireInDays_valid; /**< Must be set to true if expireInDays is being passed */
+ uint32_t expireInDays;
+ /**< Get the base station list that expire in less than or equal to
+ expireInDays.
+ */
+
+ /* Optional */
+ /* UTC Timestamp */
+ uint8_t timestampUtc_valid; /**< Must be set to true if timestampUtc is being passed */
+ uint64_t timestampUtc;
+ /**< Units -- Milliseconds (since Jan. 1, 1970) */
+
+ /* Optional */
+ /* Maximum Number of BS to Send */
+ uint8_t maxNumBs_valid; /**< Must be set to true if maxNumBs is being passed */
+ uint16_t maxNumBs;
+ /**< Specifies the maximum number of BS to send by the TLE. All the available BS are sent if this optional field is not included. \n
+ - Range -- 1 to 65,535 */
+}qmiLocGetFdclBsListReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCCELLRECORDTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_CELL_RECORD_TYPE_INVALID_V02 = 0, /**< Invalid value \n */
+ eQMI_LOC_CELL_RECORD_TYPE_L1_REGION_WITH_POSITION_V02 = 1, /**< L1 region with position \n */
+ eQMI_LOC_CELL_RECORD_TYPE_L2_REGION_WITH_POSITION_V02 = 2, /**< L2 region with position \n */
+ eQMI_LOC_CELL_RECORD_TYPE_L3_REGION_WITH_POSITION_V02 = 3, /**< L3 region with position \n */
+ eQMI_LOC_CELL_RECORD_TYPE_L4_CELL_RECORD_WITH_POSITION_V02 = 4, /**< L4 cell record with position \n */
+ eQMI_LOC_CELL_RECORD_TYPE_L4_CELL_RECORD_NOT_RESOLVED_V02 = 5, /**< L4 cell record not resolved \n */
+ eQMI_LOC_CELL_RECORD_TYPE_L4_CELL_RECORD_NO_INFO_V02 = 6, /**< L4 cell record no information */
+ QMILOCCELLRECORDTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocCellRecordTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to request the FDCL BS (Base Station)
+ list from TLE. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get FDCL BS List request Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Get FDCL BS List request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Base station list */
+ uint32_t BsList_len; /**< Must be set to # of elements in BsList */
+ qmiLocFdclCellIdStructT_v02 BsList[QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02];
+ /**< \vspace{4pt} \n A list of base station IDs for FDCL request. */
+
+ /* Optional */
+ /* More BS lists are available */
+ uint8_t moreBsAvailable_valid; /**< Must be set to true if moreBsAvailable is being passed */
+ uint8_t moreBsAvailable;
+ /**< Indicates whether more base station lists are available. \n
+ - 0x00 (FALSE) -- No more base station lists are available\n
+ - 0x01 (TRUE) -- More base station lists are available \n
+ If not specified, moreBsAvailable defaults to FALSE.
+ */
+
+ /* Optional */
+ /* Base Station Local Timestamp List */
+ uint8_t bsLocalTimestampList_valid; /**< Must be set to true if bsLocalTimestampList is being passed */
+ uint32_t bsLocalTimestampList_len; /**< Must be set to # of elements in bsLocalTimestampList */
+ uint32_t bsLocalTimestampList[QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02];
+ /**< A list of last observed local timestamps for each cell in BsList. \n
+ The list is aligned with the base stations in the BsList. */
+
+ /* Optional */
+ /* Base Station Best Position */
+ uint8_t bsBestPosition_valid; /**< Must be set to true if bsBestPosition is being passed */
+ qmiLocBsBestPositionStructT_v02 bsBestPosition;
+}qmiLocGetFdclBsListIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocFdclCellPosValidMaskT_v02;
+#define QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALTITUDE_V02 ((qmiLocFdclCellPosValidMaskT_v02)0x00000001) /**< Altitude field is valid in cell position */
+#define QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALT_UNC_V02 ((qmiLocFdclCellPosValidMaskT_v02)0x00000002) /**< Altitude uncertainty field is valid in cell position */
+#define QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALT_CONFIDENCE_V02 ((qmiLocFdclCellPosValidMaskT_v02)0x00000004) /**< Altitude confidence is valid in cell position */
+#define QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALT_RELIABILITY_V02 ((qmiLocFdclCellPosValidMaskT_v02)0x00000008) /**< Altitude reliability field is valid in cell position */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocFdclCellPosValidMaskT_v02 validMask;
+ /**< Bitmask indicating which of the fields in this TLV are valid.
+ Bitmasks: \n
+ - QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALTITUDE (0x00000001) -- Altitude field is valid in cell position
+ - QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALT_UNC (0x00000002) -- Altitude uncertainty field is valid in cell position
+ - QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALT_CONFIDENCE (0x00000004) -- Altitude confidence is valid in cell position
+ - QMI_LOC_FDCL_CELL_POS_MASK_VALID_ALT_RELIABILITY (0x00000008) -- Altitude reliability field is valid in cell position
+ */
+
+ qmiLocFdclCellIdStructT_v02 cellId;
+ /**< \n The cell ID for this record. */
+
+ double latitude;
+ /**< Latitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ double longitude;
+ /**< Longitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ float horCoverageRadius;
+ /**< Horizontal coverage radius (circular).\n
+ - Units -- Meters */
+
+ uint8_t horConfidence;
+ /**< Horizontal confidence, as defined by ETSI TS 101 109 (3GPP \hyperref[TS 03.32]{TS 03.32}).\n
+ - Units -- Percent (1 to 99)\n
+ - 0, 101 to 255 -- invalid value \n
+ - If 100 is received, reinterpret to 99
+ */
+
+ qmiLocReliabilityEnumT_v02 horReliability;
+ /**< Specifies the reliability of the horizontal position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ float altitude;
+ /**< Altitude with respect to mean sea level.\n
+ - Units -- Meters */
+
+ float altUnc;
+ /**< Vertical uncertainty; mandatory if either altitudeWrtEllipsoid
+ or altitudeWrtMeanSeaLevel is specified.\n
+ - Units -- Meters */
+
+ uint8_t altConfidence;
+ /**< Vertical confidence, as defined by ETSI TS 101 109 (3GPP \hyperref[TS 03.32]{TS 03.32}).\n
+ - Units -- Percent (0-99) \n
+ - 0 -- invalid value \n
+ - 100 to 256 -- not used \n
+ - If 100 is received, reinterpret to 99
+ */
+
+ qmiLocReliabilityEnumT_v02 altReliability;
+ /**< Specifies the reliability of the vertical position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+}qmiLocFdclCellPosStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject FDCL data to TLE. */
+typedef struct {
+
+ /* Mandatory */
+ /* FDCL Cell Position List */
+ uint32_t cellPosList_len; /**< Must be set to # of elements in cellPosList */
+ qmiLocFdclCellPosStructT_v02 cellPosList[QMI_LOC_FDCL_CELL_POS_LIST_LENGTH_V02];
+
+ /* Mandatory */
+ /* Number of Days this FDCL Data is Valid For */
+ uint32_t daysValid;
+ /**< Days valid. */
+
+ /* Optional */
+ /* UTC Timestamp */
+ uint8_t timestampUtc_valid; /**< Must be set to true if timestampUtc is being passed */
+ uint64_t timestampUtc;
+ /**< Units -- Milliseconds (since Jan. 1, 1970)
+ */
+
+ /* Optional */
+ /* Cell Record Type List */
+ uint8_t cellRecordTypeList_valid; /**< Must be set to true if cellRecordTypeList is being passed */
+ uint32_t cellRecordTypeList_len; /**< Must be set to # of elements in cellRecordTypeList */
+ qmiLocCellRecordTypeEnumT_v02 cellRecordTypeList[QMI_LOC_FDCL_CELL_POS_LIST_LENGTH_V02];
+ /**< A list of cell record types for FDCL request. \n
+ The cell record type list is aligned with the records in cellPosList. \n
+ Values: \n
+ - eQMI_LOC_CELL_RECORD_TYPE_INVALID (0) -- Invalid value \n
+ - eQMI_LOC_CELL_RECORD_TYPE_L1_REGION_WITH_POSITION (1) -- L1 region with position \n
+ - eQMI_LOC_CELL_RECORD_TYPE_L2_REGION_WITH_POSITION (2) -- L2 region with position \n
+ - eQMI_LOC_CELL_RECORD_TYPE_L3_REGION_WITH_POSITION (3) -- L3 region with position \n
+ - eQMI_LOC_CELL_RECORD_TYPE_L4_CELL_RECORD_WITH_POSITION (4) -- L4 cell record with position \n
+ - eQMI_LOC_CELL_RECORD_TYPE_L4_CELL_RECORD_NOT_RESOLVED (5) -- L4 cell record not resolved \n
+ - eQMI_LOC_CELL_RECORD_TYPE_L4_CELL_RECORD_NO_INFO (6) -- L4 cell record no information
+ */
+
+ /* Optional */
+ /* More FDCL Data Available */
+ uint8_t moreBsAvailable_valid; /**< Must be set to true if moreBsAvailable is being passed */
+ uint8_t moreBsAvailable;
+ /**< Indicates whether more FDCL data is available. \n
+ - 0x00 (FALSE) -- No more FDCL data is available. \n
+ - 0x01 (TRUE) -- More FDCL data is available. \n
+ If not specified, moreBsAvailable defaults to FALSE.
+ */
+
+ /* Optional */
+ /* Client Controls */
+ uint8_t clientControls_valid; /**< Must be set to true if clientControls is being passed */
+ uint16_t clientControls;
+ /**< Client controls. */
+
+ /* Optional */
+ /* Maximum Number of Cells to Upload */
+ uint8_t maxNumCellsToUpload_valid; /**< Must be set to true if maxNumCellsToUpload is being passed */
+ uint16_t maxNumCellsToUpload;
+ /**< Maximum number of cells to upload. */
+
+ /* Optional */
+ /* Minimum Seconds Between Requests */
+ uint8_t minSecsBtwRequests_valid; /**< Must be set to true if minSecsBtwRequests is being passed */
+ uint16_t minSecsBtwRequests;
+ /**< Minimum seconds between requests. */
+
+ /* Optional */
+ /* Restricted Region Version */
+ uint8_t restrictedRegionVersion_valid; /**< Must be set to true if restrictedRegionVersion is being passed */
+ uint8_t restrictedRegionVersion;
+ /**< Restricted region version. */
+
+ /* Optional */
+ /* List of Restricted Regions */
+ uint8_t restrictedRegions_valid; /**< Must be set to true if restrictedRegions is being passed */
+ uint32_t restrictedRegions_len; /**< Must be set to # of elements in restrictedRegions */
+ qmiLocHomeCarrierIdStructT_v02 restrictedRegions[QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02];
+}qmiLocInjectFdclDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCINJECTFDCLDATASTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_INJECT_FDCL_DATA_SUCCESS_V02 = 0, /**< Request was completed successfully \n */
+ eQMI_LOC_INJECT_FDCL_DATA_FAILURE_GENERAL_V02 = 1, /**< Request failed \n */
+ eQMI_LOC_INJECT_FDCL_DATA_FAILURE_NO_CELLS_INJECTED_V02 = 2, /**< Request failed because no cells were injected */
+ QMILOCINJECTFDCLDATASTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocInjectFdclDataStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject FDCL data to TLE. */
+typedef struct {
+
+ /* Mandatory */
+ /* Inject FDCL Data Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the Inject FDCL Data request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* FDCL Data Injection Status */
+ qmiLocInjectFdclDataStatusEnumT_v02 inject_status;
+ /**< Status of the FDCL data injection.
+ Values: \n
+ - eQMI_LOC_INJECT_FDCL_DATA_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_INJECT_FDCL_DATA_FAILURE_GENERAL (1) -- Request failed \n
+ - eQMI_LOC_INJECT_FDCL_DATA_FAILURE_NO_CELLS_INJECTED (2) -- Request failed because no cells were injected
+ */
+
+ /* Optional */
+ /* Error Message (NULL-Terminated) */
+ uint8_t errorMsg_valid; /**< Must be set to true if errorMsg is being passed */
+ char errorMsg[QMI_LOC_INJECT_FDCL_DATA_ERROR_MSG_LEN_V02 + 1];
+ /**< Error message. \n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 256
+ */
+}qmiLocInjectFdclDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to blacklist GNSS SVs. */
+typedef struct {
+
+ /* Optional */
+ /* GLONASS SV IDs to Blacklist */
+ uint8_t glo_persist_blacklist_sv_valid; /**< Must be set to true if glo_persist_blacklist_sv is being passed */
+ uint64_t glo_persist_blacklist_sv;
+ /**< Specifies the GLONASS SV mask to disable/blacklist.
+ SV ID mapping -- SV 65 maps to bit 0. */
+
+ /* Optional */
+ /* GLONASS SV IDs to Remove from Blacklist */
+ uint8_t glo_clear_persist_blacklist_sv_valid; /**< Must be set to true if glo_clear_persist_blacklist_sv is being passed */
+ uint64_t glo_clear_persist_blacklist_sv;
+ /**< Specifies the GLONASS SV mask to remove from persistent blacklist.\n
+ SV ID mapping -- SV 65 maps to bit 0. */
+
+ /* Optional */
+ /* BDS SV IDs to Blacklist */
+ uint8_t bds_persist_blacklist_sv_valid; /**< Must be set to true if bds_persist_blacklist_sv is being passed */
+ uint64_t bds_persist_blacklist_sv;
+ /**< Specifies the BDS SV mask to disable/blacklist.\n
+ SV ID mapping -- SV 201 maps to bit 0. */
+
+ /* Optional */
+ /* BDS SV IDs to Remove from Blacklist */
+ uint8_t bds_clear_persist_blacklist_sv_valid; /**< Must be set to true if bds_clear_persist_blacklist_sv is being passed */
+ uint64_t bds_clear_persist_blacklist_sv;
+ /**< Specifies the BDS SV mask to remove from persistent blacklist.\n
+ SV ID mapping -- SV 201 maps to bit 0. */
+
+ /* Optional */
+ /* QZSS SV IDs to Blacklist */
+ uint8_t qzss_persist_blacklist_sv_valid; /**< Must be set to true if qzss_persist_blacklist_sv is being passed */
+ uint64_t qzss_persist_blacklist_sv;
+ /**< Specifies the QZSS SV mask to disable/blacklist.\n
+ SV ID mapping -- SV 193 maps to bit 0 */
+
+ /* Optional */
+ /* QZSS SV IDs to Remove from Blacklist */
+ uint8_t qzss_clear_persist_blacklist_sv_valid; /**< Must be set to true if qzss_clear_persist_blacklist_sv is being passed */
+ uint64_t qzss_clear_persist_blacklist_sv;
+ /**< Specifies the QZSS SV mask to remove from persistent blacklist.\n
+ SV ID mapping -- SV 193 maps to bit 0. */
+
+ /* Optional */
+ /* Galileo SV IDs to Blacklist */
+ uint8_t gal_persist_blacklist_sv_valid; /**< Must be set to true if gal_persist_blacklist_sv is being passed */
+ uint64_t gal_persist_blacklist_sv;
+ /**< Specifies the Galileo SV mask to disable/blacklist.\n
+ SV ID mapping -- SV 301 maps to bit 0. */
+
+ /* Optional */
+ /* Galileo SV IDs to Remove from Blacklist */
+ uint8_t gal_clear_persist_blacklist_sv_valid; /**< Must be set to true if gal_clear_persist_blacklist_sv is being passed */
+ uint64_t gal_clear_persist_blacklist_sv;
+ /**< Specifies the Galileo SV mask to remove from persistent blacklist.\n
+ SV ID mapping -- SV 301 maps to bit 0. */
+
+ /* Optional */
+ /* SBAS SV IDs to Blacklist */
+ uint8_t sbas_persist_blacklist_sv_valid; /**< Must be set to true if sbas_persist_blacklist_sv is being passed */
+ uint64_t sbas_persist_blacklist_sv;
+ /**< Specifies the SBAS SV mask to disable/blacklist. SV ID mapping: \n
+ - SV IDs 120-158 map to bits 0-38 \n
+ - SV IDs 183-191 map to bits 39-47 */
+
+ /* Optional */
+ /* SBAS SV IDs to Remove from Blacklist */
+ uint8_t sbas_clear_persist_blacklist_sv_valid; /**< Must be set to true if sbas_clear_persist_blacklist_sv is being passed */
+ uint64_t sbas_clear_persist_blacklist_sv;
+ /**< Specifies the SBAS SV mask to remove from persistent blacklist. SV ID mapping: \n
+ - SV IDs 120-158 map to bits 0-38 \n
+ - SV IDs 183-191 map to bits 39-47 */
+
+ /* Optional */
+ /* NAVIC SV IDs to Blacklist */
+ uint8_t navic_persist_blacklist_sv_valid; /**< Must be set to true if navic_persist_blacklist_sv is being passed */
+ uint64_t navic_persist_blacklist_sv;
+ /**< Specifies the NAVIC SV mask to disable/blacklist. SV ID mapping: \n
+ - SV IDs 401-414 map to bits 0-13. */
+
+ /* Optional */
+ /* NAVIC SV IDs to Remove from Blacklist */
+ uint8_t navic_clear_persist_blacklist_sv_valid; /**< Must be set to true if navic_clear_persist_blacklist_sv is being passed */
+ uint64_t navic_clear_persist_blacklist_sv;
+ /**< Specifies the NavIC SV mask to remove from persistent blacklist. SV ID mapping: \n
+ - SV IDs 401-414 map to bits 0-13. */
+}qmiLocSetBlacklistSvReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query the GNSS blacklist
+ SV information. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Blacklist SV Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of Get Blacklist SV request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* GLONASS SV IDs Blacklisted */
+ uint8_t glo_persist_blacklist_sv_valid; /**< Must be set to true if glo_persist_blacklist_sv is being passed */
+ uint64_t glo_persist_blacklist_sv;
+ /**< Specifies the blacklisted GLONASS SV mask. \n
+ SV ID mapping -- SV 65 maps to bit 0. */
+
+ /* Optional */
+ /* BDS SV IDs Blacklisted */
+ uint8_t bds_persist_blacklist_sv_valid; /**< Must be set to true if bds_persist_blacklist_sv is being passed */
+ uint64_t bds_persist_blacklist_sv;
+ /**< Specifies the blacklisted BDS SV mask. \n
+ SV ID mapping -- SV 201 maps to bit 0. */
+
+ /* Optional */
+ /* QZSS SV IDs Blacklisted */
+ uint8_t qzss_persist_blacklist_sv_valid; /**< Must be set to true if qzss_persist_blacklist_sv is being passed */
+ uint64_t qzss_persist_blacklist_sv;
+ /**< Specifies the blacklisted QZSS SV mask.\n
+ SV ID mapping -- SV 193 maps to bit 0 */
+
+ /* Optional */
+ /* Galileo SV IDs Blacklisted */
+ uint8_t gal_persist_blacklist_sv_valid; /**< Must be set to true if gal_persist_blacklist_sv is being passed */
+ uint64_t gal_persist_blacklist_sv;
+ /**< Specifies the blacklisted Galileo SV mask. \n
+ SV ID mapping -- SV 301 maps to bit 0 */
+
+ /* Optional */
+ /* SBAS SV IDs Blacklisted */
+ uint8_t sbas_persist_blacklist_sv_valid; /**< Must be set to true if sbas_persist_blacklist_sv is being passed */
+ uint64_t sbas_persist_blacklist_sv;
+ /**< Specifies the blacklisted SBAS SV mask. SV ID mapping: \n
+ - SV IDs 120-158 map to bits 0-38 \n
+ - SV IDs 183-191 map to bits 39-47 */
+
+ /* Optional */
+ /* NAVIC SV IDs Blacklisted */
+ uint8_t navic_persist_blacklist_sv_valid; /**< Must be set to true if navic_persist_blacklist_sv is being passed */
+ uint64_t navic_persist_blacklist_sv;
+ /**< Specifies the blacklisted NAVIC SV mask. SV ID mapping: \n
+ - SV IDs 401-414 map to bits 0-13 */
+}qmiLocGetBlacklistSvIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocConstellationMaskT_v02;
+#define QMI_LOC_CONSTELLATION_GLO_V02 ((qmiLocConstellationMaskT_v02)0x00000001ull) /**< Enable GLONASS. \n */
+#define QMI_LOC_CONSTELLATION_BDS_V02 ((qmiLocConstellationMaskT_v02)0x00000002ull) /**< Enable BDS.\n */
+#define QMI_LOC_CONSTELLATION_QZSS_V02 ((qmiLocConstellationMaskT_v02)0x00000004ull) /**< Enable QZSS. \n */
+#define QMI_LOC_CONSTELLATION_GAL_V02 ((qmiLocConstellationMaskT_v02)0x00000008ull) /**< Enable Galileo. \n */
+#define QMI_LOC_CONSTELLATION_NAVIC_V02 ((qmiLocConstellationMaskT_v02)0x00000010ull) /**< Enable NavIC. */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to enable/disable
+ GNSS constellations */
+typedef struct {
+
+ /* Mandatory */
+ /* Reset GNSS Constellation Control */
+ uint8_t resetConstellations;
+ /**< Values: \n
+ - TRUE -- Resets the GNSS constellation control to NV default. \n
+ Optional TLVs are disregarded.\n
+ - FALSE -- Does not reset GNSS constellation control.
+ */
+
+ /* Optional */
+ /* GNSS Constellations to Enable */
+ uint8_t enableMask_valid; /**< Must be set to true if enableMask is being passed */
+ qmiLocConstellationMaskT_v02 enableMask;
+ /**< Specifies which GNSS constellations to enable.
+ GPS is always enabled.
+ Valid only when resetConstellations is FALSE.
+ Valid bitmasks: \n
+ - QMI_LOC_CONSTELLATION_GLO (0x00000001) -- Enable GLONASS. \n
+ - QMI_LOC_CONSTELLATION_BDS (0x00000002) -- Enable BDS.\n
+ - QMI_LOC_CONSTELLATION_QZSS (0x00000004) -- Enable QZSS. \n
+ - QMI_LOC_CONSTELLATION_GAL (0x00000008) -- Enable Galileo. \n
+ - QMI_LOC_CONSTELLATION_NAVIC (0x00000010) -- Enable NavIC. */
+
+ /* Optional */
+ /* GNSS Constellations to Disable */
+ uint8_t disableMask_valid; /**< Must be set to true if disableMask is being passed */
+ qmiLocConstellationMaskT_v02 disableMask;
+ /**< Specifies which GNSS constellations to disable.
+ GPS cannot be disabled.
+ Valid only when resetConstellations is FALSE.
+ Valid bitmasks: \n
+ - QMI_LOC_CONSTELLATION_GLO (0x00000001) -- Enable GLONASS. \n
+ - QMI_LOC_CONSTELLATION_BDS (0x00000002) -- Enable BDS.\n
+ - QMI_LOC_CONSTELLATION_QZSS (0x00000004) -- Enable QZSS. \n
+ - QMI_LOC_CONSTELLATION_GAL (0x00000008) -- Enable Galileo. \n
+ - QMI_LOC_CONSTELLATION_NAVIC (0x00000010) -- Enable NavIC. */
+}qmiLocSetConstellationConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCDCREPORTMSGTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_QZSS_JMA_DISASTER_PREVENTION_INFO_V02 = 43, /**< Disaster Prevention information provided by Japan Meteolorogical Agency \n */
+ eQMI_LOC_QZSS_NON_JMA_DISASTER_PREVENTION_INFO_V02 = 44, /**< Disaster Prevention information provided by other organizations */
+ QMILOCDCREPORTMSGTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocDcReportMsgTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the Disaster and Crisis report to the control point. */
+typedef struct {
+
+ /* Optional */
+ /* DC Report Message Type */
+ uint8_t msgType_valid; /**< Must be set to true if msgType is being passed */
+ qmiLocDcReportMsgTypeEnumT_v02 msgType;
+ /**< Message type of DC report.
+ Values:\n
+ - eQMI_LOC_QZSS_JMA_DISASTER_PREVENTION_INFO (43) -- Disaster Prevention information provided by Japan Meteolorogical Agency \n
+ - eQMI_LOC_QZSS_NON_JMA_DISASTER_PREVENTION_INFO (44) -- Disaster Prevention information provided by other organizations
+ */
+
+ /* Optional */
+ /* DC Report No of Valid Bits */
+ uint8_t numValidBits_valid; /**< Must be set to true if numValidBits is being passed */
+ uint16_t numValidBits;
+ /**< Number of valid bits in dcReportData. \n
+ Client makes use of only the specified number of valid bits. */
+
+ /* Optional */
+ /* Data */
+ uint8_t dcReportData_valid; /**< Must be set to true if dcReportData is being passed */
+ uint32_t dcReportData_len; /**< Must be set to # of elements in dcReportData */
+ uint8_t dcReportData[QMI_LOC_MAX_DCREPORT_LEN_V02];
+ /**< Disaster and crisis report. \n
+ - Type -- Array of bytes \n
+ - Maximum length of the array -- 64
+ */
+}qmiLocEventDcReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by a control point to register itself as a master
+ client. */
+typedef struct {
+
+ /* Mandatory */
+ /* Master Client 32-bit Key */
+ uint32_t key;
+ /**< 32-bit master client key */
+}qmiLocRegisterMasterClientReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCREGISTERMASTERCLIENTSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_REGISTER_MASTER_CLIENT_SUCCESS_V02 = 0, /**< Request was completed successfully - the associated control point is now the master client \n */
+ eQMI_LOC_REGISTER_MASTER_CLIENT_INVALID_KEY_V02 = 1, /**< Request failed because the supplied master key is invalid \n */
+ eQMI_LOC_REGISTER_MASTER_CLIENT_ALREADY_HAVE_MASTER_CLIENT_V02 = 2, /**< Request failed because there is already a master client registered \n */
+ eQMI_LOC_REGISTER_MASTER_CLIENT_INTERNAL_FAILURE_V02 = 3, /**< Request failed due to unforeseen internal error */
+ QMILOCREGISTERMASTERCLIENTSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocRegisterMasterClientStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by a control point to register itself as a master
+ client. */
+typedef struct {
+
+ /* Mandatory */
+ /* Register Master Client Status */
+ qmiLocRegisterMasterClientStatusEnumT_v02 status;
+ /**< Status of the master client registration
+ Values: \n
+ - eQMI_LOC_REGISTER_MASTER_CLIENT_SUCCESS (0) -- Request was completed successfully - the associated control point is now the master client \n
+ - eQMI_LOC_REGISTER_MASTER_CLIENT_INVALID_KEY (1) -- Request failed because the supplied master key is invalid \n
+ - eQMI_LOC_REGISTER_MASTER_CLIENT_ALREADY_HAVE_MASTER_CLIENT (2) -- Request failed because there is already a master client registered \n
+ - eQMI_LOC_REGISTER_MASTER_CLIENT_INTERNAL_FAILURE (3) -- Request failed due to unforeseen internal error
+ */
+}qmiLocRegisterMasterClientIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCENGINELOCKSTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_ENGINE_LOCK_STATE_ENABLED_V02 = 1, /**< Location engine is enabled \n */
+ eQMI_LOC_ENGINE_LOCK_STATE_DISABLED_V02 = 2, /**< location engine is disabled for mobile-initiated sessions */
+ QMILOCENGINELOCKSTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocEngineLockStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the engine lock state to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Engine State */
+ qmiLocEngineLockStateEnumT_v02 engineLockState;
+ /**< Location engine lock state.
+ Values: \n
+ - eQMI_LOC_ENGINE_LOCK_STATE_ENABLED (1) -- Location engine is enabled \n
+ - eQMI_LOC_ENGINE_LOCK_STATE_DISABLED (2) -- location engine is disabled for mobile-initiated sessions
+ */
+
+ /* Optional */
+ /* Subscription Type */
+ uint8_t subType_valid; /**< Must be set to true if subType is being passed */
+ qmiLocLockSubInfoEnumT_v02 subType;
+ /**< Subscription to which Lock Type must be applied.
+ Values: \n
+ - eQMI_LOC_LOCK_DV_SUB (1) -- Lock Dedicated Voice subscription (DV sub) \n
+ - eQMI_LOC_LOCK_DD_SUB (2) -- Lock Dedicated Data subscription (DD sub) \n
+ - eQMI_LOC_LOCK_ALL_SUB (3) -- Lock all subscriptions
+ */
+
+ /* Optional */
+ /* Lock Client */
+ uint8_t lockClient_valid; /**< Must be set to true if lockClient is being passed */
+ qmiLocLockClientMaskT_v02 lockClient;
+ /**< The client(s) who have been locked to the request position.
+ If specified, the control point ignores engineLockState.
+ Values: \n
+ - QMI_LOC_LOCK_CLIENT_MASK_AFW (0x00000001) -- Lock AFW client \n
+ - QMI_LOC_LOCK_CLIENT_MASK_NFW (0x00000002) -- Lock NFW client \n
+ - QMI_LOC_LOCK_CLIENT_MASK_PRIVILEGED (0x00000004) -- Lock privileged client
+ */
+}qmiLocEventEngineLockStateIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to receive position reports. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocStartListenPositionReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to stop receiving position reports. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocStopListenPositionReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSYSTEMINFOENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_UNDEFINED_INFO_V02 = 0, /**< Undefined \n */
+ eQMI_LOC_NEXT_LEAP_SECOND_INFO_V02 = 1, /**< Information about next (upcoming) leap second */
+ QMILOCSYSTEMINFOENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocSystemInfoEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t gpsTimeCurrent_valid;
+ /**< Specifies whether the gpsTimeCurrent field contains
+ a valid value. */
+
+ qmiLocGPSTimeStructT_v02 gpsTimeCurrent;
+ /**< \vspace{0.06in} \n The number of weeks since Jan. 5, 1980, and
+ milliseconds into the current week. */
+
+ uint8_t leapSecondsCurrent_valid;
+ /**< Specifies whether the leapSecondsCurrent field contains
+ a valid value.*/
+
+ uint8_t leapSecondsCurrent;
+ /**< Current leap second information.\n
+ - Units -- Seconds */
+
+ uint8_t gpsTimeNextLsEvent_valid;
+ /**< Specifies whether the gpsTimeNextLsEvent field contains
+ a valid value*/
+
+ qmiLocGPSTimeStructT_v02 gpsTimeNextLsEvent;
+ /**< \vspace{0.06in} \n The number of weeks since Jan. 5, 1980, and
+ milliseconds into the week for next leap-second change event.
+ Reported only when receiver has information
+ on upcoming change event. */
+
+ uint8_t leapSecondsNext_valid;
+ /**< Specifies whether the leapSecondsNext field contains
+ a valid value*/
+
+ uint8_t leapSecondsNext;
+ /**< Upcoming leap second information.
+ Reported only when receiver has information
+ on upcoming change event.\n
+ - Units -- Seconds */
+}qmiLocNextLeapSecondInfoStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Generic request used by the control point to query about system information. */
+typedef struct {
+
+ /* Mandatory */
+ /* System Information */
+ qmiLocSystemInfoEnumT_v02 systemInfo;
+ /**< System info being requested.
+ Values: \n
+ - eQMI_LOC_UNDEFINED_INFO (0) -- Undefined \n
+ - eQMI_LOC_NEXT_LEAP_SECOND_INFO (1) -- Information about next (upcoming) leap second
+ */
+}qmiLocSystemInfoReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Generic request used by the control point to query about system information. */
+typedef struct {
+
+ /* Mandatory */
+ /* System Information */
+ qmiLocSystemInfoEnumT_v02 systemInfo;
+ /**< System information being requested.
+ Values: \n
+ - eQMI_LOC_UNDEFINED_INFO (0) -- Undefined \n
+ - eQMI_LOC_NEXT_LEAP_SECOND_INFO (1) -- Information about next (upcoming) leap second
+ */
+
+ /* Optional */
+ /* Next Leap Second Information */
+ uint8_t nextLeapSecondInfo_valid; /**< Must be set to true if nextLeapSecondInfo is being passed */
+ qmiLocNextLeapSecondInfoStructT_v02 nextLeapSecondInfo;
+ /**< \n Upcoming leap second information.
+ Reported only when the receiver has information
+ on an upcoming leap second change event.*/
+}qmiLocSystemInfoIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCCONSTELLATIONSTATUSENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY_V02 = 0, /**< Mandatory constellation, always enabled \n */
+ eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY_V02 = 1, /**< Enabled internally by the system software \n */
+ eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT_V02 = 2, /**< Enabled by the external client \n */
+ eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED_V02 = 100, /**< Constellation not supported \n */
+ eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY_V02 = 101, /**< Disabled internally by the system software \n */
+ eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT_V02 = 102, /**< Disabled by the external client \n */
+ eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY_V02 = 103, /**< Could not be enabled due to memory allocation failure */
+ QMILOCCONSTELLATIONSTATUSENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocConstellationStatusEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query the GNSS constellation
+ configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get Constellation Configuration Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the constellation configuration query request. \n
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* GPS Constellation Status */
+ uint8_t gps_status_valid; /**< Must be set to true if gps_status is being passed */
+ qmiLocConstellationStatusEnumT_v02 gps_status;
+ /**< Specifies the enablement status of GPS. \n
+ Values: \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY (0) -- Mandatory constellation, always enabled \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY (1) -- Enabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT (2) -- Enabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED (100) -- Constellation not supported \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY (101) -- Disabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT (102) -- Disabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY (103) -- Could not be enabled due to memory allocation failure
+ */
+
+ /* Optional */
+ /* GLONASS Constellation Status */
+ uint8_t glonass_status_valid; /**< Must be set to true if glonass_status is being passed */
+ qmiLocConstellationStatusEnumT_v02 glonass_status;
+ /**< Specifies the enablement status of GLONASS. \n
+ Values: \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY (0) -- Mandatory constellation, always enabled \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY (1) -- Enabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT (2) -- Enabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED (100) -- Constellation not supported \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY (101) -- Disabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT (102) -- Disabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY (103) -- Could not be enabled due to memory allocation failure
+ */
+
+ /* Optional */
+ /* BDS Constellation Status */
+ uint8_t bds_status_valid; /**< Must be set to true if bds_status is being passed */
+ qmiLocConstellationStatusEnumT_v02 bds_status;
+ /**< Specifies the enablement status of BDS. \n
+ Values: \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY (0) -- Mandatory constellation, always enabled \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY (1) -- Enabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT (2) -- Enabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED (100) -- Constellation not supported \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY (101) -- Disabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT (102) -- Disabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY (103) -- Could not be enabled due to memory allocation failure
+ */
+
+ /* Optional */
+ /* QZSS Constellation Status */
+ uint8_t qzss_status_valid; /**< Must be set to true if qzss_status is being passed */
+ qmiLocConstellationStatusEnumT_v02 qzss_status;
+ /**< Specifies the enablement status of QZSS. \n
+ Values: \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY (0) -- Mandatory constellation, always enabled \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY (1) -- Enabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT (2) -- Enabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED (100) -- Constellation not supported \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY (101) -- Disabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT (102) -- Disabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY (103) -- Could not be enabled due to memory allocation failure
+ */
+
+ /* Optional */
+ /* Galileo Constellation Status */
+ uint8_t galileo_status_valid; /**< Must be set to true if galileo_status is being passed */
+ qmiLocConstellationStatusEnumT_v02 galileo_status;
+ /**< Specifies the enablement status of Galileo. \n
+ Values: \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY (0) -- Mandatory constellation, always enabled \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY (1) -- Enabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT (2) -- Enabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED (100) -- Constellation not supported \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY (101) -- Disabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT (102) -- Disabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY (103) -- Could not be enabled due to memory allocation failure
+ */
+
+ /* Optional */
+ /* NavIC Constellation Status */
+ uint8_t navic_status_valid; /**< Must be set to true if navic_status is being passed */
+ qmiLocConstellationStatusEnumT_v02 navic_status;
+ /**< Specifies the enablement status of NavIC. \n
+ Values: \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_MANDATORY (0) -- Mandatory constellation, always enabled \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_INTERNALLY (1) -- Enabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_ENABLED_BY_CLIENT (2) -- Enabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NOT_SUPPORTED (100) -- Constellation not supported \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_INTERNALLY (101) -- Disabled internally by the system software \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_BY_CLIENT (102) -- Disabled by the external client \n
+ - eQMI_LOC_CONSTELLATION_DISABLED_NO_MEMORY (103) -- Could not be enabled due to memory allocation failure
+ */
+}qmiLocGetConstellationConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to enable position injection
+ in test mode. */
+typedef struct {
+
+ /* Mandatory */
+ /* Enable/Disable Test Mode */
+ uint8_t enableTestMode;
+ /**< Specifies whether the test mode is enabled.
+ If the control point has already enabled the test mode
+ then this command has no effect */
+}qmiLocEnablePositionInjectionTestModeReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCENABLEPOSITIONINJECTIONTESTMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_TEST_MODE_UNKNOWN_V02 = 0, /**< Test mode in unknown state \n */
+ eQMI_LOC_TEST_MODE_ENABLED_V02 = 1, /**< Test mode is enabled \n */
+ eQMI_LOC_TEST_MODE_DISABLED_V02 = 2, /**< Test mode is disbled \n */
+ eQMI_LOC_TEST_MODE_ALREADY_ENABLED_V02 = 3, /**< Test mode is already enabled \n */
+ eQMI_LOC_TEST_MODE_ALREADY_DISABLED_V02 = 4, /**< Test mode is already disabled */
+ QMILOCENABLEPOSITIONINJECTIONTESTMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocEnablePositionInjectionTestModeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to enable position injection
+ in test mode. */
+typedef struct {
+
+ /* Mandatory */
+ /* Position Injection Test Mode Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of enable position injection test mode request. \n
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Test Mode State */
+ uint8_t testModeState_valid; /**< Must be set to true if testModeState is being passed */
+ qmiLocEnablePositionInjectionTestModeEnumT_v02 testModeState;
+ /**< State of the test mode. \n
+ Values: \n
+ - eQMI_LOC_TEST_MODE_UNKNOWN (0) -- Test mode in unknown state \n
+ - eQMI_LOC_TEST_MODE_ENABLED (1) -- Test mode is enabled \n
+ - eQMI_LOC_TEST_MODE_DISABLED (2) -- Test mode is disbled \n
+ - eQMI_LOC_TEST_MODE_ALREADY_ENABLED (3) -- Test mode is already enabled \n
+ - eQMI_LOC_TEST_MODE_ALREADY_DISABLED (4) -- Test mode is already disabled
+ */
+}qmiLocEnablePositionInjectionTestModeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject a test position. */
+typedef struct {
+
+ /* Mandatory */
+ /* Latitude */
+ double latitude;
+ /**< Latitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude
+ */
+
+ /* Mandatory */
+ /* Longitude */
+ double longitude;
+ /**< Longitude (specified in WGS84 datum). \n
+ - Type -- Floating point \n
+ - Units -- Degrees \n
+ - Range -- -180.0 to 180.0 \n
+ - Positive values indicate eastern longitude \n
+ - Negative values indicate western longitude
+ */
+
+ /* Mandatory */
+ /* Circular Horizontal Uncertainty */
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular).\n
+ - Units - Meters */
+
+ /* Mandatory */
+ /* UTC Timestamp */
+ uint64_t timestampUtc;
+ /**< - Units - Milliseconds since Jan. 1, 1970
+ */
+
+ /* Optional */
+ /* Position Source */
+ uint8_t positionSource_valid; /**< Must be set to true if positionSource is being passed */
+ qmiLocPositionSourceEnumT_v02 positionSource;
+ /**< Values: \n
+ - eQMI_LOC_POS_SRC_GNSS (1) -- Source of the position is GNSS
+ */
+}qmiLocInjectTestPositionReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject a test position. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the injected test position.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocInjectTestPositionIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to upload observed BS data. */
+typedef struct {
+
+ /* Mandatory */
+ /* Number of Cells Available */
+ uint16_t numCellsAvailable;
+ /**< BS observed data cells available.
+ - Range -- 1 to 65535 */
+}qmiLocEventBsObsDataServiceReqIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to request the BS observed location
+ data from TLE. */
+typedef struct {
+
+ /* Optional */
+ /* UTC Timestamp */
+ uint8_t timestampUtc_valid; /**< Must be set to true if timestampUtc is being passed */
+ uint64_t timestampUtc;
+ /**< UTC timestamp. \n
+ - Units -- Milliseconds (since Jan. 1, 1970) */
+
+ /* Optional */
+ /* Number of Cells Requested to Upload */
+ uint8_t numCellsUpload_valid; /**< Must be set to true if numCellsUpload is being passed */
+ uint16_t numCellsUpload;
+ /**< Number of cells requested to upload.\n
+ - Range -- 1 to 65535 \n
+ Default is to upload all cells if this TLV is not included. */
+}qmiLocGetBsObsDataReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocBsObservedDataValidMaskT_v02;
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_GPSWEEK_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000001ull) /**< GPS week field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_GPSMSEC_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000002ull) /**< GPS milliseconds field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_LATITUDE_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000004ull) /**< Latitude field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_LONGITUDE_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000008ull) /**< Longitude field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_HOR_UNC_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000010ull) /**< Horizontal Uncertainty field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_ALTITUDE_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000020ull) /**< Altitude field is valid.\n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_ALT_UNC_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000040ull) /**< Altitude uncertainty field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_SPEED_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000080ull) /**< Speed field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_SPEED_UNC_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000100ull) /**< Speed uncertainty field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_HEADING_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000200ull) /**< Heading field is valid. \n */
+#define QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_HEADING_UNC_V02 ((qmiLocBsObservedDataValidMaskT_v02)0x00000400ull) /**< Heading uncertainty field is valid. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocBsObservedDataValidMaskT_v02 validMask;
+ /**< Bitmask indicating which of the fields in this TLV are valid. \n
+ Valid bitmasks: \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_GPSWEEK (0x00000001) -- GPS week field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_GPSMSEC (0x00000002) -- GPS milliseconds field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_LATITUDE (0x00000004) -- Latitude field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_LONGITUDE (0x00000008) -- Longitude field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_HOR_UNC (0x00000010) -- Horizontal Uncertainty field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_ALTITUDE (0x00000020) -- Altitude field is valid.\n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_ALT_UNC (0x00000040) -- Altitude uncertainty field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_SPEED (0x00000080) -- Speed field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_SPEED_UNC (0x00000100) -- Speed uncertainty field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_HEADING (0x00000200) -- Heading field is valid. \n
+ - QMI_LOC_BS_OBSERVED_DATA_MASK_VALID_HEADING_UNC (0x00000400) -- Heading uncertainty field is valid.
+ */
+
+ qmiLocFdclCellIdStructT_v02 cellId;
+ /**< Cell ID for this record. */
+
+ uint16_t gpsWeek;
+ /**< GPS week. \n
+ - Units -- Weeks (since Jan. 1, 1970) */
+
+ uint32_t gpsMilliseconds;
+ /**< GPS milliseconds. \n
+ - Units -- Milliseconds (since Jan. 1, 1970) */
+
+ uint32_t bsLocalTimestamp;
+ /**< Last observed local timestamp for the cell. */
+
+ int32_t posDeltaTime;
+ /**< Delta time between position and cell ID detection. \n
+ - Units -- Milliseconds */
+
+ float speed;
+ /**< Horizontal speed. \n
+ - Units -- Meters per second */
+
+ float speedUnc;
+ /**< Horizontal speed uncertainty. \n
+ - Units -- Meters per second */
+
+ double heading;
+ /**< Heading. \n
+ - Units -- Radian */
+
+ double headingUnc;
+ /**< Heading uncertainty. \n
+ - Units -- Radian */
+
+ qmiLocBsBestPositionStructT_v02 bsBestPosition;
+ /**< Base station best position. */
+}qmiLocBsObservedDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to request the BS observed location
+ data from TLE. */
+typedef struct {
+
+ /* Mandatory */
+ /* Get BS Observed Data Request Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the BS observed data request. \n
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Base Station List */
+ uint32_t bsData_len; /**< Must be set to # of elements in bsData */
+ qmiLocBsObservedDataStructT_v02 bsData[QMI_LOC_FDCL_BS_LIST_MAX_SIZE_V02];
+ /**< A list of base station IDs for the FDCL request. */
+
+ /* Optional */
+ /* More BS Data is Available */
+ uint8_t moreBsAvailable_valid; /**< Must be set to true if moreBsAvailable is being passed */
+ uint8_t moreBsAvailable;
+ /**< Indicates whether more base station data is available. \n
+ - 0x00 (FALSE) -- No more base station data is available. \n
+ - 0x01 (TRUE) -- More base station data is available. \n
+ If not specified, moreBsAvailable defaults to FALSE.
+ */
+}qmiLocGetBsObsDataIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCEPHUPDATEACTIONENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_UPDATE_EPH_SRC_UNKNOWN_V02 = 0, /**< Update ephemeris; source of ephemeris is unknown \n */
+ eQMI_LOC_UPDATE_EPH_SRC_OTA_V02 = 1, /**< Update ephemeris; source of ephemeris is OTA \n */
+ eQMI_LOC_UPDATE_EPH_SRC_NETWORK_V02 = 2, /**< Update ephemeris; source of ephemeris is network \n */
+ eQMI_LOC_UPDATE_EPH_SRC_MAX_V02 = 999, /**< Max value for update ephemeris action; do not use. \n */
+ eQMI_LOC_DELETE_EPH_SRC_UNKNOWN_V02 = 1000, /**< Delete previous ephemeris from unknown source \n */
+ eQMI_LOC_DELETE_EPH_SRC_NETWORK_V02 = 1001, /**< Delete previous ephemeris from network \n */
+ eQMI_LOC_DELETE_EPH_SRC_OTA_V02 = 1002, /**< Delete previous ephemeris from OTA \n */
+ eQMI_LOC_DELETE_EPH_SRC_MAX_V02 = 1999, /**< Maximum value for delete ephemeris action; do not use. */
+ QMILOCEPHUPDATEACTIONENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocEphUpdateActionEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t gnssSvId;
+ /**< GNSS SV ID.
+ Range:\n
+ - GPS -- 1 to 32 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414 \n
+ */
+
+ qmiLocEphUpdateActionEnumT_v02 updateAction;
+ /**< Specifies the source of ephemeris. \n
+ - Type -- int32 enum \n
+ Values: \n
+ - eQMI_LOC_UPDATE_EPH_SRC_UNKNOWN (0) -- Update ephemeris; source of ephemeris is unknown \n
+ - eQMI_LOC_UPDATE_EPH_SRC_OTA (1) -- Update ephemeris; source of ephemeris is OTA \n
+ - eQMI_LOC_UPDATE_EPH_SRC_NETWORK (2) -- Update ephemeris; source of ephemeris is network \n
+ - eQMI_LOC_UPDATE_EPH_SRC_MAX (999) -- Max value for update ephemeris action; do not use. \n
+ - eQMI_LOC_DELETE_EPH_SRC_UNKNOWN (1000) -- Delete previous ephemeris from unknown source \n
+ - eQMI_LOC_DELETE_EPH_SRC_NETWORK (1001) -- Delete previous ephemeris from network \n
+ - eQMI_LOC_DELETE_EPH_SRC_OTA (1002) -- Delete previous ephemeris from OTA \n
+ - eQMI_LOC_DELETE_EPH_SRC_MAX (1999) -- Maximum value for delete ephemeris action; do not use.
+ */
+
+ uint16_t IODE;
+ /**< Issue of data ephemeris used (unitless). \n
+ - GPS -- IODE 8 bits \n
+ - BDS -- AODE 5 bits \n
+ - Galileo -- SIS IOD 10 bits */
+
+ double aSqrt;
+ /**< Square root of semi-major axis. \n
+ - Units -- Square root of meters */
+
+ double deltaN;
+ /**< Mean motion difference from computed value. \n
+ - Units -- Radians per second */
+
+ double m0;
+ /**< Mean anomaly at reference time. \n
+ - Units -- Radians */
+
+ double eccentricity;
+ /**< Eccentricity (unitless).
+ */
+
+ double omega0;
+ /**< Longitude of ascending node of orbital plane at the weekly epoch. \n
+ - Units -- Radians */
+
+ double i0;
+ /**< Inclination angle at reference time. \n
+ - Units -- Radians */
+
+ double omega;
+ /**< Argument of perigee. \n
+ Units -- Radians */
+
+ double omegaDot;
+ /**< Rate of change of right ascension. \n
+ - Units -- Radians/second */
+
+ double iDot;
+ /**< Rate of change of inclination angle. \n
+ - Units -- Radians/second */
+
+ double cUc;
+ /**< Amplitude of the cosine harmonic correction term to the argument of latitude. \n
+ - Units -- Radians */
+
+ double cUs;
+ /**< Amplitude of the sine harmonic correction term to the argument of latitude. \n
+ - Units -- Radians */
+
+ double cRc;
+ /**< Amplitude of the cosine harmonic correction term to the orbit radius. \n
+ - Units -- Meters */
+
+ double cRs;
+ /**< Amplitude of the sine harmonic correction term to the orbit radius. \n
+ - Units -- Meters */
+
+ double cIc;
+ /**< Amplitude of the cosine harmonic correction term to the angle of inclination. \n
+ - Units -- Radians */
+
+ double cIs;
+ /**< Amplitude of the sine harmonic correction term to the angle of inclination. \n
+ - Units -- Radians */
+
+ uint32_t toe;
+ /**< Reference time of ephemeris. \n
+ - Units -- Seconds */
+
+ uint32_t toc;
+ /**< Clock data reference time of week. \n
+ - Units -- Seconds */
+
+ double af0;
+ /**< Clock bias correction coefficient. \n
+ - Units -- Seconds */
+
+ double af1;
+ /**< Clock drift coefficient. \n
+ - Units -- Seconds/second */
+
+ double af2;
+ /**< Clock drift rate correction coefficient. \n
+ - Units -- Seconds/seconds^2 */
+}qmiLocEphGnssDataStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocEphGnssDataStructT_v02 commonEphemerisData;
+ /**< Common ephemeris data. */
+
+ uint8_t signalHealth;
+ /**< Three bitmask of signal health, where the set bit indicates an unhealthy signal. \n
+ Bit 0 -- L5 signal health. \n
+ Bit 1 -- L2 signal health. \n
+ Bit 2 -- L1 signal health. \n
+ */
+
+ uint8_t URAI;
+ /**< User range accuracy index (unitless).
+ */
+
+ uint8_t codeL2;
+ /**< Indicates which codes are commanded ON for the L2 channel (2-bits). \n
+ Values: \n
+ - 00 -- Reserved \n
+ - 01 -- P code ON \n
+ - 10 -- C/A code ON */
+
+ uint8_t dataFlagL2P;
+ /**< L2 P-code indication flag.
+ Value 1 indicates that the navigation data stream was commanded OFF on the P-code of the L2 channel. */
+
+ double tgd;
+ /**< Time of group delay. \n
+ - Units -- Seconds */
+
+ uint8_t fitInterval;
+ /**< Indicates the curve-fit interval used by the CS.
+ Values: \n
+ - 0 -- Four hours \n
+ - 1 -- Greater than four hours */
+
+ uint16_t IODC;
+ /**< Issue of data, clock (unitless).
+ */
+}qmiLocGpsEphemerisT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends GPS ephemeris report for all signal types (L1/L2/L5)
+ to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* GPS Ephemeris Data */
+ uint32_t gpsEphemerisList_len; /**< Must be set to # of elements in gpsEphemerisList */
+ qmiLocGpsEphemerisT_v02 gpsEphemerisList[QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02];
+ /**< \n GPS ephemeris parameters. */
+
+ /* Optional */
+ /* GPS Time When Ephemeris Report Is Sent */
+ uint8_t gpsSystemTime_valid; /**< Must be set to true if gpsSystemTime is being passed */
+ qmiLocGnssTimeStructT_v02 gpsSystemTime;
+ /**< */
+}qmiLocGpsEphemerisReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t gnssSvId;
+ /**< GNSS SV ID. \n
+ - Type -- uint16 \n
+ - Range -- 65 to 96 (if known). When the slot number to SV ID mapping is unknown, set to 255. */
+
+ qmiLocEphUpdateActionEnumT_v02 updateAction;
+ /**< Specifies the source of ephemeris. \n
+ - Type -- int32 enum \n
+ Values: \n
+ - eQMI_LOC_UPDATE_EPH_SRC_UNKNOWN (0) -- Update ephemeris; source of ephemeris is unknown \n
+ - eQMI_LOC_UPDATE_EPH_SRC_OTA (1) -- Update ephemeris; source of ephemeris is OTA \n
+ - eQMI_LOC_UPDATE_EPH_SRC_NETWORK (2) -- Update ephemeris; source of ephemeris is network \n
+ - eQMI_LOC_UPDATE_EPH_SRC_MAX (999) -- Max value for update ephemeris action; do not use. \n
+ - eQMI_LOC_DELETE_EPH_SRC_UNKNOWN (1000) -- Delete previous ephemeris from unknown source \n
+ - eQMI_LOC_DELETE_EPH_SRC_NETWORK (1001) -- Delete previous ephemeris from network \n
+ - eQMI_LOC_DELETE_EPH_SRC_OTA (1002) -- Delete previous ephemeris from OTA \n
+ - eQMI_LOC_DELETE_EPH_SRC_MAX (1999) -- Maximum value for delete ephemeris action; do not use.
+ */
+
+ uint8_t bnHealth;
+ /**< SV health flags.
+ Values: \n
+ - 0 -- Healthy \n
+ - 1 -- Unhealthy */
+
+ uint8_t lnHealth;
+ /**< Ln SV health flags; GLONASS-M.
+ Values: \n
+ - 0 -- Healthy \n
+ - 1 -- Unhealthy */
+
+ uint8_t tb;
+ /**< Index of a time interval within current day according to UTC(SU) + 03 hours 00 min (unitless). \n
+ */
+
+ uint8_t ft;
+ /**< SV accuracy index (unitless). \n
+ */
+
+ uint8_t gloM;
+ /**< GLONASS-M flag. Values: \n
+ - 0 -- GLONASS \n
+ - 1 -- GLONASS-M */
+
+ uint8_t enAge;
+ /**< Characterizes age of current information. \n
+ - Units -- Days */
+
+ uint8_t gloFrequency;
+ /**< GLONASS frequency number + 8. \n
+ - Range -- 1 to 14
+ */
+
+ uint8_t p1;
+ /**< Time interval between two adjacent values of tb parameter. \n
+ - Units -- Minutes */
+
+ uint8_t p2;
+ /**< Flag of oddness (1) or evenness (0) of the value of tb
+ for intervals 30 or 60 minutes. */
+
+ float deltaTau;
+ /**< Time difference between navigation RF signal transmitted in L2 sub-band \n
+ and aviation RF signal transmitted in L1 sub-band. \n
+ - Units -- Seconds */
+
+ double position[3];
+ /**< Satellite XYZ position. \n
+ - Type -- array of doubles \n
+ - Units -- Meters */
+
+ double velocity[3];
+ /**< Satellite XYZ velocity. \n
+ - Type -- Array of doubles \n
+ - Units -- Meters per second */
+
+ double acceleration[3];
+ /**< Satellite XYZ sola-luni acceleration. \n
+ - Type -- Array of doubles \n
+ - Units -- Meters per second^2 */
+
+ float tauN;
+ /**< Satellite clock correction relative to GLONASS time. \n
+ - Units -- Seconds */
+
+ float gamma;
+ /**< Relative deviation of predicted carrier frequency value
+ from nominal value at the instant tb (unitless). \n
+ */
+
+ double toe;
+ /**< Complete ephemeris time, including N4, NT, and Tb.
+ [(N4-1)*1461 + (NT-1)]*86400 + tb*900 \n
+ - Units -- Seconds */
+
+ uint16_t nt;
+ /**< Current date, calendar number of days within four-year interval.
+ Starting from the 1st of January in a leap year. \n
+ - Units -- Days */
+}qmiLocGloEphemerisT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends GLONASS ephemeris report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* GLONASS Ephemeris Data */
+ uint32_t gloEphemerisList_len; /**< Must be set to # of elements in gloEphemerisList */
+ qmiLocGloEphemerisT_v02 gloEphemerisList[QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02];
+ /**< GLONASS ephemeris parameters. */
+
+ /* Optional */
+ /* GPS Time When Ephemeris Report Is Sent */
+ uint8_t gpsSystemTime_valid; /**< Must be set to true if gpsSystemTime is being passed */
+ qmiLocGnssTimeStructT_v02 gpsSystemTime;
+ /**< \n GPS system time. */
+}qmiLocGloEphemerisReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocEphGnssDataStructT_v02 commonEphemerisData;
+ /**< Common ephemeris data. */
+
+ uint8_t svHealth;
+ /**< Satellite health information applied to both B1 and B2 (SatH1).
+ Values: \n
+ - 0 -- Healthy \n
+ - 1 -- Unhealthy */
+
+ uint8_t AODC;
+ /**< Age of data clock. \n
+ - Units -- Hours */
+
+ double tgd1;
+ /**< Equipment group delay differential on B1 signal. \n
+ - Units -- Nanoseconds */
+
+ double tgd2;
+ /**< Equipment group delay differential on B2 signal. \n
+ - Units -- Nanoseconds */
+
+ uint8_t URAI;
+ /**< User range accuracy index (four bits), unitless. \n
+ */
+}qmiLocBdsEphemerisT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the BDS ephemeris report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* BDS Ephemeris Data */
+ uint32_t bdsEphemerisList_len; /**< Must be set to # of elements in bdsEphemerisList */
+ qmiLocBdsEphemerisT_v02 bdsEphemerisList[QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02];
+
+ /* Optional */
+ /* GPS Time When Ephemeris Report Is Sent */
+ uint8_t gpsSystemTime_valid; /**< Must be set to true if gpsSystemTime is being passed */
+ qmiLocGnssTimeStructT_v02 gpsSystemTime;
+ /**< */
+}qmiLocBdsEphemerisReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGALEPHSOURCESIGNAL_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GAL_EPH_SIGNAL_SRC_UNKNOWN_V02 = 0, /**< Galileo signal is unknown \n */
+ eQMI_LOC_GAL_EPH_SIGNAL_SRC_E1B_V02 = 1, /**< Galileo signal is E1B \n */
+ eQMI_LOC_GAL_EPH_SIGNAL_SRC_E5A_V02 = 2, /**< Galileo signal is E5A \n */
+ eQMI_LOC_GAL_EPH_SIGNAL_SRC_E5B_V02 = 3, /**< Galileo signal is E5B */
+ QMILOCGALEPHSOURCESIGNAL_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGalEphSourceSignal_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocEphGnssDataStructT_v02 commonEphemerisData;
+ /**< Common ephemeris data. */
+
+ qmiLocGalEphSourceSignal_v02 dataSourceSignal;
+ /**< Galileo signal source. \n
+ Values: \n
+ - eQMI_LOC_GAL_EPH_SIGNAL_SRC_UNKNOWN (0) -- Galileo signal is unknown \n
+ - eQMI_LOC_GAL_EPH_SIGNAL_SRC_E1B (1) -- Galileo signal is E1B \n
+ - eQMI_LOC_GAL_EPH_SIGNAL_SRC_E5A (2) -- Galileo signal is E5A \n
+ - eQMI_LOC_GAL_EPH_SIGNAL_SRC_E5B (3) -- Galileo signal is E5B */
+
+ uint8_t sisIndex;
+ /**< Signal-in-space index for dual frequency E1-E5b/E5a based on dataSignalSource (unitless). \n
+ */
+
+ double bgdE1E5a;
+ /**< E1-E5a broadcast group delay from F/Nav (E5A). \n
+ - Units -- Seconds */
+
+ double bgdE1E5b;
+ /**< E1-E5b broadcast group delay from I/Nav (E1B or E5B). \n
+ For E1B or E5B signal, both bgdE1E5a and bgdE1E5b are valid. \n
+ For E5A signal, only bgdE1E5a is valid. \n
+ Signal source identified using dataSignalSource. \n
+ - Units -- Seconds */
+
+ uint8_t svHealth;
+ /**< SV health status of the signal identified by dataSourceSignal. \n
+ Values: \n
+ - Only 3 bits for E5a (F/NAV) \n
+ - 6 bits for E1B, E5b (I/NAV) \n
+ - F/NAV Bit 0 is the DVS (Data Validity Status) bit \n
+ - F/NAV Bits 1 and 2 are HS bits (Signal Health Status) \n
+ - I/NAV Bits 0, 2, 3 are for E1B, bits 1, 4, 5 are for E5B \n
+ - I/NAV Bit 0, 1 are the DVS bit \n
+ - I/NAV Bit 2, 3, 4, 5 are the HS bits \n
+ - A signal is only useful when all three bits for a component are 0. */
+}qmiLocGalEphemerisT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the Galileo ephemeris report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Galileo Ephemeris Data */
+ uint32_t galEphemerisList_len; /**< Must be set to # of elements in galEphemerisList */
+ qmiLocGalEphemerisT_v02 galEphemerisList[QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02];
+
+ /* Optional */
+ /* GPS Time When Ephemeris Report Is Sent */
+ uint8_t gpsSystemTime_valid; /**< Must be set to true if gpsSystemTime is being passed */
+ qmiLocGnssTimeStructT_v02 gpsSystemTime;
+ /**< */
+}qmiLocGalEphemerisReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the QZSS ephemeris report to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* QZSS Ephemeris Data */
+ uint32_t qzssEphemerisList_len; /**< Must be set to # of elements in qzssEphemerisList */
+ qmiLocGpsEphemerisT_v02 qzssEphemerisList[QMI_LOC_EPHEMERIS_LIST_MAX_SIZE_V02];
+
+ /* Optional */
+ /* GPS Time When Ephemeris Report Is Sent */
+ uint8_t gpsSystemTime_valid; /**< Must be set to true if gpsSystemTime is being passed */
+ qmiLocGnssTimeStructT_v02 gpsSystemTime;
+ /**< */
+}qmiLocQzssEphemerisReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to put the engine in or out of a
+ constrained Time Unc mode, where the engine keeps its Time
+ Unc below the specified constraint. */
+typedef struct {
+
+ /* Mandatory */
+ /* Tunc Constraint On */
+ uint8_t tuncConstraintOn;
+ /**< Specifies the constrained tunc mode desired by the control point.
+ Values:\n
+ - True -- Engine maintains Tunc below specified constraint. \n
+ - False -- Engine does not maintain Tunc.
+ */
+
+ /* Optional */
+ /* Tunc Constraint */
+ uint8_t tuncConstraint_valid; /**< Must be set to true if tuncConstraint is being passed */
+ float tuncConstraint;
+ /**< If tuncConstraint is set to ON, the engine maintains its time
+ uncertainty below the specified constraint in tuncConstraint. The units
+ are in ms. If this parameter is not specified and tuncConstraint is set
+ to ON, the engine picks up the default tuncConstraint.
+ */
+
+ /* Optional */
+ /* Energy Budget */
+ uint8_t energyBudget_valid; /**< Must be set to true if energyBudget is being passed */
+ uint32_t energyBudget;
+ /**< If tuncConstraintOn is set to ON and energyBudget is specified, the
+ engine uses Energy Budget as the maximum energy to use while keeping the
+ engine in constrained tunc mode. If no energy budget is specified, the
+ engine assumes that the budget is infinite. \n
+ - Units -- 0.1 milliwatt second
+ */
+}qmiLocSetConstrainedTuncModeReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to put the engine in or out of a
+ constrained Time Unc mode, where the engine keeps its Time
+ Unc below the specified constraint. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the set tunc constrained mode request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocSetConstrainedTuncModeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to enable position-assisted clock
+ estimation mode in the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* enablePositionAssistedClockEst */
+ uint8_t enablePositionAssistedClockEst;
+ /**< Specifies the position-assisted clock estimation mode desired by the control point.
+ Values: \n
+ - True -- Engine enables position-assisted clock estimation mode. \n
+ - False -- Engine disables position-assisted clock estimation mode.
+ */
+}qmiLocEnablePositionAssistedClockEstReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to enable position-assisted clock
+ estimation mode in the location engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the enable position-assisted clock estimator mode request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+}qmiLocEnablePositionAssistedClockEstIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to query the energy consumed by
+ the GNSS engine. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocQueryGNSSEnergyConsumedReqMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query the energy consumed by
+ the GNSS engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Energy Consumed Since Last Boot */
+ uint64_t energyConsumedSinceLastBoot;
+ /**< Energy consumed by the GNSS engine since bootup in units of 0.1 milliwatt seconds.
+ A value of 0xffffffffffffffff indicates an invalid reading.
+ */
+
+ /* Mandatory */
+ /* Energy Consumed Since First Boot */
+ uint64_t energyConsumedSinceFirstBoot;
+ /**< Energy consumed by the GNSS engine since the first bootup in units of 0.1 milliwatt seconds.
+ A value of 0xffffffffffffffff indicates an invalid reading.
+ */
+}qmiLocQueryGNSSEnergyConsumedIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocEventReportMaskT_v02;
+#define QMI_LOC_DELETE_GPS_EPHEMERIS_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000001ull) /**< GPS ephemeris parameters have been deleted. \n */
+#define QMI_LOC_DELETE_GLO_EPHEMERIS_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000002ull) /**< GLONASS ephemeris parameters have been deleted.\n */
+#define QMI_LOC_DELETE_BDS_EPHEMERIS_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000004ull) /**< BDS ephemeris parameters have been deleted.\n */
+#define QMI_LOC_DELETE_GAL_EPHEMERIS_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000008ull) /**< Galileo ephemeris parameters have been deleted.\n */
+#define QMI_LOC_DELETE_QZSS_EPHEMERIS_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000010ull) /**< QZSS ephemeris parameters have been deleted. \n */
+#define QMI_LOC_DELETE_RESERVED_EPHEMERIS_1_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000020ull) /**< Reserved delete ephemeris bit 1.\n */
+#define QMI_LOC_DELETE_RESERVED_EPHEMERIS_2_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000040ull) /**< Reserved delete ephemeris bit 2. \n */
+#define QMI_LOC_DELETE_RESERVED_EPHEMERIS_3_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000080ull) /**< Reserved delete ephemeris bit 3. \n */
+#define QMI_LOC_DELETE_RESERVED_EPHEMERIS_4_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000100ull) /**< Reserved delete ephemeris bit 4. \n */
+#define QMI_LOC_DELETE_RESERVED_EPHEMERIS_5_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000200ull) /**< Reserved delete ephemeris bit 5. \n */
+#define QMI_LOC_DELETE_RESERVED_EPHEMERIS_6_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000400ull) /**< Reserved delete ephemeris bit 6. \n */
+#define QMI_LOC_DELETE_RESERVED_EPHEMERIS_7_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00000800ull) /**< Reserved delete ephemeris bit 7. \n */
+#define QMI_LOC_DELETE_GPS_SV_POLY_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00001000ull) /**< GPS SV polynomials have been deleted.\n */
+#define QMI_LOC_DELETE_GLO_SV_POLY_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00002000ull) /**< GLONASS SV polynomials have been deleted. */
+#define QMI_LOC_DELETE_BDS_SV_POLY_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00004000ull) /**< BDS SV polynomials have been deleted. */
+#define QMI_LOC_DELETE_GAL_SV_POLY_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00008000ull) /**< Galileo SV polynomials have been deleted.\n */
+#define QMI_LOC_DELETE_QZSS_SV_POLY_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00010000ull) /**< QZSS SV polynomials have been deleted. \n */
+#define QMI_LOC_DELETE_RESERVED_SV_POLY_1_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00020000ull) /**< Reserved delete SV poly bit 1.\n */
+#define QMI_LOC_DELETE_RESERVED_SV_POLY_2_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00040000ull) /**< Reserved delete SV poly bit 2. \n */
+#define QMI_LOC_DELETE_RESERVED_SV_POLY_3_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00080000ull) /**< Reserved delete SV poly bit 3. \n */
+#define QMI_LOC_DELETE_RESERVED_SV_POLY_4_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00100000ull) /**< Reserved delete SV poly bit 4. \n */
+#define QMI_LOC_DELETE_RESERVED_SV_POLY_5_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00200000ull) /**< Reserved delete SV poly bit 5. \n */
+#define QMI_LOC_DELETE_RESERVED_SV_POLY_6_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00400000ull) /**< Reserved delete SV poly bit 6. \n */
+#define QMI_LOC_DELETE_RESERVED_SV_POLY_7_ALL_V02 ((qmiLocEventReportMaskT_v02)0x00800000ull) /**< Reserved delete SV poly bit 7. \n */
+#define QMI_LOC_DELETE_GPS_IONO_ALL_V02 ((qmiLocEventReportMaskT_v02)0x01000000ull) /**< GPS IONO parameters have been deleted. \n */
+#define QMI_LOC_DELETE_GLO_IONO_ALL_V02 ((qmiLocEventReportMaskT_v02)0x02000000ull) /**< GLONASS IONO parameters have been deleted. \n */
+#define QMI_LOC_DELETE_BDS_IONO_ALL_V02 ((qmiLocEventReportMaskT_v02)0x04000000ull) /**< BDS IONO parameters have been deleted. \n */
+#define QMI_LOC_DELETE_GAL_IONO_ALL_V02 ((qmiLocEventReportMaskT_v02)0x08000000ull) /**< Galileo IONO parameters have been deleted.\n */
+#define QMI_LOC_DELETE_QZSS_IONO_ALL_V02 ((qmiLocEventReportMaskT_v02)0x10000000ull) /**< QZSS IONO parameters have been deleted. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocSvSystemEnumT_v02 dataSource;
+ /**< Specifies the satellite system source of the ionospheric model.
+ Values: \n
+ - eQMI_LOC_SV_SYSTEM_GPS (1) -- GPS satellite \n
+ - eQMI_LOC_SV_SYSTEM_GALILEO (2) -- Galileo satellite \n
+ - eQMI_LOC_SV_SYSTEM_SBAS (3) -- SBAS satellite \n
+ - eQMI_LOC_SV_SYSTEM_COMPASS (4) -- COMPASS satellite (Deprecated) \n
+ - eQMI_LOC_SV_SYSTEM_GLONASS (5) -- GLONASS satellite \n
+ - eQMI_LOC_SV_SYSTEM_BDS (6) -- BDS satellite \n
+ - eQMI_LOC_SV_SYSTEM_QZSS (7) -- QZSS satellite \n
+ - eQMI_LOC_SV_SYSTEM_NAVIC (8) -- NavIC satellite
+ */
+
+ float alpha0;
+ /**< Klobuchar model parameter alpha 0.\n
+ - Unit -- Seconds
+ */
+
+ float alpha1;
+ /**< Klobuchar model parameter alpha 1.\n
+ - Unit -- Seconds / Semi-circle
+ */
+
+ float alpha2;
+ /**< Klobuchar model parameter alpha 2.\n
+ - Unit -- Seconds / Semi-circle^2
+ */
+
+ float alpha3;
+ /**< Klobuchar model parameter alpha 3.\n
+ - Unit -- Seconds / semi-circle^3
+ */
+
+ float beta0;
+ /**< Klobuchar model parameter beta 0.\n
+ - Unit -- Seconds
+ */
+
+ float beta1;
+ /**< Klobuchar Model parameter beta 1.\n
+ - Unit -- Seconds / Semi-circle
+ */
+
+ float beta2;
+ /**< Klobuchar model parameter beta 2.\n
+ - Unit -- Seconds / Semi-circle^2
+ */
+
+ float beta3;
+ /**< Klobuchar model parameter beta 3.\n
+ - Unit -- Seconds / semi-circle^3
+ */
+}qmiLocKlobucharIonoModelT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends a report of modem events to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Event Report */
+ qmiLocEventReportMaskT_v02 eventReport;
+ /**< Bitmask indicating the modem event.
+ Valid bitmasks: \n
+ - QMI_LOC_DELETE_GPS_EPHEMERIS_ALL (0x00000001) -- GPS ephemeris parameters have been deleted. \n
+ - QMI_LOC_DELETE_GLO_EPHEMERIS_ALL (0x00000002) -- GLONASS ephemeris parameters have been deleted.\n
+ - QMI_LOC_DELETE_BDS_EPHEMERIS_ALL (0x00000004) -- BDS ephemeris parameters have been deleted.\n
+ - QMI_LOC_DELETE_GAL_EPHEMERIS_ALL (0x00000008) -- Galileo ephemeris parameters have been deleted.\n
+ - QMI_LOC_DELETE_QZSS_EPHEMERIS_ALL (0x00000010) -- QZSS ephemeris parameters have been deleted. \n
+ - QMI_LOC_DELETE_RESERVED_EPHEMERIS_1_ALL (0x00000020) -- Reserved delete ephemeris bit 1.\n
+ - QMI_LOC_DELETE_RESERVED_EPHEMERIS_2_ALL (0x00000040) -- Reserved delete ephemeris bit 2. \n
+ - QMI_LOC_DELETE_RESERVED_EPHEMERIS_3_ALL (0x00000080) -- Reserved delete ephemeris bit 3. \n
+ - QMI_LOC_DELETE_RESERVED_EPHEMERIS_4_ALL (0x00000100) -- Reserved delete ephemeris bit 4. \n
+ - QMI_LOC_DELETE_RESERVED_EPHEMERIS_5_ALL (0x00000200) -- Reserved delete ephemeris bit 5. \n
+ - QMI_LOC_DELETE_RESERVED_EPHEMERIS_6_ALL (0x00000400) -- Reserved delete ephemeris bit 6. \n
+ - QMI_LOC_DELETE_RESERVED_EPHEMERIS_7_ALL (0x00000800) -- Reserved delete ephemeris bit 7. \n
+ - QMI_LOC_DELETE_GPS_SV_POLY_ALL (0x00001000) -- GPS SV polynomials have been deleted.\n
+ - QMI_LOC_DELETE_GLO_SV_POLY_ALL (0x00002000) -- GLONASS SV polynomials have been deleted.
+ - QMI_LOC_DELETE_BDS_SV_POLY_ALL (0x00004000) -- BDS SV polynomials have been deleted.
+ - QMI_LOC_DELETE_GAL_SV_POLY_ALL (0x00008000) -- Galileo SV polynomials have been deleted.\n
+ - QMI_LOC_DELETE_QZSS_SV_POLY_ALL (0x00010000) -- QZSS SV polynomials have been deleted. \n
+ - QMI_LOC_DELETE_RESERVED_SV_POLY_1_ALL (0x00020000) -- Reserved delete SV poly bit 1.\n
+ - QMI_LOC_DELETE_RESERVED_SV_POLY_2_ALL (0x00040000) -- Reserved delete SV poly bit 2. \n
+ - QMI_LOC_DELETE_RESERVED_SV_POLY_3_ALL (0x00080000) -- Reserved delete SV poly bit 3. \n
+ - QMI_LOC_DELETE_RESERVED_SV_POLY_4_ALL (0x00100000) -- Reserved delete SV poly bit 4. \n
+ - QMI_LOC_DELETE_RESERVED_SV_POLY_5_ALL (0x00200000) -- Reserved delete SV poly bit 5. \n
+ - QMI_LOC_DELETE_RESERVED_SV_POLY_6_ALL (0x00400000) -- Reserved delete SV poly bit 6. \n
+ - QMI_LOC_DELETE_RESERVED_SV_POLY_7_ALL (0x00800000) -- Reserved delete SV poly bit 7. \n
+ - QMI_LOC_DELETE_GPS_IONO_ALL (0x01000000) -- GPS IONO parameters have been deleted. \n
+ - QMI_LOC_DELETE_GLO_IONO_ALL (0x02000000) -- GLONASS IONO parameters have been deleted. \n
+ - QMI_LOC_DELETE_BDS_IONO_ALL (0x04000000) -- BDS IONO parameters have been deleted. \n
+ - QMI_LOC_DELETE_GAL_IONO_ALL (0x08000000) -- Galileo IONO parameters have been deleted.\n
+ - QMI_LOC_DELETE_QZSS_IONO_ALL (0x10000000) -- QZSS IONO parameters have been deleted.
+ */
+
+ /* Optional */
+ /* GPS System Time of Event Report */
+ uint8_t gpsSystemTime_valid; /**< Must be set to true if gpsSystemTime is being passed */
+ qmiLocGnssTimeStructT_v02 gpsSystemTime;
+ /**< \n GPS time when the event report is sent. */
+
+ /* Optional */
+ /* Klobuchar Ionospheric Model */
+ uint8_t klobucharIonoModel_valid; /**< Must be set to true if klobucharIonoModel is being passed */
+ qmiLocKlobucharIonoModelT_v02 klobucharIonoModel;
+
+ /* Optional */
+ /* GLONASS Time Scale Correction */
+ uint8_t tauC_valid; /**< Must be set to true if tauC is being passed */
+ double tauC;
+ /**< GLONASS time scale correction to UTC time,
+ as defined in the GLONASS ICD Edition 5.1 page 36. \n
+ - Unit -- Seconds
+ */
+
+ /* Optional */
+ /* Leap Seconds */
+ uint8_t leapSec_valid; /**< Must be set to true if leapSec is being passed */
+ int8_t leapSec;
+ /**< Leap seconds (GPS-UTC) from GPS.\n
+ - Unit -- Seconds
+ */
+
+ /* Optional */
+ /* Features Mask */
+ uint8_t featureStatusReport_valid; /**< Must be set to true if featureStatusReport is being passed */
+ qmiLocFeaturesStatusMaskT_v02 featureStatusReport;
+ /**< Bitmask indicating the modem feature status for
+ features controlled with licenses.
+ Valid bitmasks: \n
+ - QMI_LOC_FEATURE_STATUS_CARRIER_PHASE (0x00000001) -- Carrier Phase feature status. \n
+ - QMI_LOC_FEATURE_STATUS_SV_POLYNOMIALS (0x00000002) -- SV Polynomial reporting status.\n
+ - QMI_LOC_FEATURE_STATUS_SV_EPHEMERIS (0x00000004) -- SV Ephemeris reporting status.\n
+ - QMI_LOC_FEATURE_STATUS_SINGLE_FREQUENCY (0x00000008) -- GNSS Single Frequency status.\n
+ - QMI_LOC_FEATURE_STATUS_MULTI_FREQUENCY (0x00000010) -- GNSS Multi Frequency status. \n
+ - QMI_LOC_FEATURE_STATUS_TIME_FREQUENCY (0x00000020) -- Time and Frequency status.\n
+ - QMI_LOC_FEATURE_STATUS_TIME_UNCERTAINTY (0x00000040) -- Time Uncertainty status. \n
+ - QMI_LOC_FEATURE_STATUS_CLOCK_ESTIMATE (0x00000080) -- Clock Estimate status. \n
+ */
+}qmiLocEventReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint16_t bpAmpI;
+ /**< GNSS BP amplitude I; for GLO, it is the average BP amplitude I.*/
+
+ uint16_t bpAmpQ;
+ /**< GNSS BP amplitude Q ; for GLO, it is the average BP amplitude Q. */
+
+ int32_t jammerPwrDb;
+ /**< Jammer power metrics, in units of dB. */
+}qmiLocMePerGnssRfStructType_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to request the band measurement metrics. */
+typedef struct {
+
+ /* Mandatory */
+ /* System Tick */
+ uint64_t systemTick;
+ /**< System counter at which RF status is updated.*/
+
+ /* Mandatory */
+ /* Band1 PGA Gain Db */
+ int32_t band1PgaGainDb;
+ /**< GNSS Band1 RX path PGA gain in units of dB. \n
+ - GEN9 (nominal values) -- 0 to +4 \n
+ - Limit -- -12 to +18
+ */
+
+ /* Optional */
+ /* GPS L1ca RF Statistics */
+ uint8_t gpsL1caRfStats_valid; /**< Must be set to true if gpsL1caRfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 gpsL1caRfStats;
+ /**< GNSS BP amplitude in dB. \n
+ - GEN9 (nominal values) -- 160-200 \n
+ - Limit -- 89-356 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* GloG1 RF Statistics */
+ uint8_t gloG1RfStats_valid; /**< Must be set to true if gloG1RfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 gloG1RfStats;
+ /**< GNSS BP amplitude in dB. \n
+ - GEN9 (nominal values) -- 120-180 \n
+ - Limit -- 128-512 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* BDS B1 RF Statistics */
+ uint8_t bdsB1RfStats_valid; /**< Must be set to true if bdsB1RfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 bdsB1RfStats;
+ /**< GNSS BP amplitude in dB. \n
+ - GEN9 (nominal values) -- 160-200 \n
+ - Limit -- 75-582 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* Galileo E1 RF Statistics */
+ uint8_t galE1RfStats_valid; /**< Must be set to true if galE1RfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 galE1RfStats;
+ /**< GNSS BP amplitude in dB.\n
+ - GEN9 (nominal values) -- 160-200 \n
+ - Limit -- 75-582 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* GPS L2 cRf Statistics */
+ uint8_t gpsL2cRfStats_valid; /**< Must be set to true if gpsL2cRfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 gpsL2cRfStats;
+ /**< GNSS BP amplitude in dB.\n
+ - GEN9 (nominal values) -- 160-200 \n
+ - Limit -- 89-356 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* Glo G2 RF Statistics */
+ uint8_t gloG2RfStats_valid; /**< Must be set to true if gloG2RfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 gloG2RfStats;
+ /**< GNSS BP amplitude in dB. \n
+ - GEN9 (nominal values) -- 120-180 \n
+ - Limit -- 128-512 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* BDS B2 RF Statistics */
+ uint8_t bdsB2RfStats_valid; /**< Must be set to true if bdsB2RfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 bdsB2RfStats;
+ /**< GNSS BP amplitude in dB. \n
+ - GEN9 (nominal values) -- 160-200 \n
+ - Limit -- 75-582 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* Band 5 PGA Gain dB */
+ uint8_t band5PgaGainDb_valid; /**< Must be set to true if band5PgaGainDb is being passed */
+ int32_t band5PgaGainDb;
+ /**< GNSS Band5 RX path PGA gain in units of dB. \n
+ - GEN9 (nominal values) -- -4 to 0 \n
+ - Limit -- -12 to +18
+ */
+
+ /* Optional */
+ /* GPS L5 RF Statistics */
+ uint8_t gpsL5RfStats_valid; /**< Must be set to true if gpsL5RfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 gpsL5RfStats;
+ /**< \n GNSS BP amplitude in dB. \n
+ - GEN9 (nominal values) -- 60-100 \n
+ - Limit -- 60-150 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+
+ /* Optional */
+ /* GalE5A RF Statistics */
+ uint8_t galE5ARfStats_valid; /**< Must be set to true if galE5ARfStats is being passed */
+ qmiLocMePerGnssRfStructType_v02 galE5ARfStats;
+ /**< \n GNSS BP amplitude in dB. \n
+ - GEN9 (nominal values) -- 60-100 \n
+ - Limit -- 60-150 \n
+ - Limit of l_JammerPwrDb -- -18 to 105 dB
+ */
+}qmiLocGetBandMeasurementMetricsIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCREQUESTPROTOCOLENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_CTRL_PLANE_V02 = 0, /**< Cellular control plane requests the location \n */
+ eQMI_LOC_SUPL_V02 = 1, /**< SUPL requests the location \n */
+ eQMI_LOC_IMS_V02 = 2, /**< IMS requests the location \n */
+ eQMI_LOC_SIM_V02 = 3, /**< SIM requests the location \n */
+ eQMI_LOC_MDT_V02 = 4, /**< MDT requests the location \n */
+ eQMI_LOC_TLOC_V02 = 5, /**< Trusted location requests the location \n */
+ eQMI_LOC_OTHER_V02 = 6, /**< Other protocol stack requests the location */
+ QMILOCREQUESTPROTOCOLENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocRequestProtocolEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCREQUESTORENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_REQUESTOR_CARRIER_V02 = 0, /**< Wireless service provider \n */
+ eQMI_LOC_REQUESTOR_OEM_V02 = 1, /**< Device manufacturer \n */
+ eQMI_LOC_REQUESTOR_MODEM_CHIPSET_VENDOR_V02 = 2, /**< Modem chipset vendor \n */
+ eQMI_LOC_REQUESTOR_GNSS_CHIPSET_VENDOR_V02 = 3, /**< GNSS chipset vendor \n */
+ eQMI_LOC_REQUESTOR_OTHER_CHIPSET_VENDOR_V02 = 4, /**< Other chipset vendor \n */
+ eQMI_LOC_REQUESTOR_AUTOMOBILE_CLIENT_V02 = 5, /**< Automobile client \n */
+ eQMI_LOC_REQUESTOR_OTHER_V02 = 6, /**< Other requestor */
+ QMILOCREQUESTORENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocRequestorEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCREQUESTRESPONSETYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_REJECTED_V02 = 0, /**< Request rejected because framework has not provided permission for this use case \n */
+ eQMI_LOC_ACCEPTED_NO_LOCATION_PROVIDED_V02 = 1, /**< Request accepted but could not provide location because of a failure \n */
+ eQMI_LOC_ACCEPTED_LOCATION_PROVIDED_V02 = 2, /**< Request accepted and location provided */
+ QMILOCREQUESTRESPONSETYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocRequestResponseTypeEnumT_v02;
+/**
+ @}
+ */
+
+typedef uint32_t qmiLocResponseLocProtocolMaskT_v02;
+#define QMI_LOC_GNSS_POSITION_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000001) /**< GNSS position has been reported to the client \n */
+#define QMI_LOC_GNSS_MEASUREMENT_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000002) /**< GNSS measurement has been reported to the client \n */
+#define QMI_LOC_OTDOA_MEASUREMENT_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000004) /**< OTDOA measurement has been reported to the client \n */
+#define QMI_LOC_DBH_DATA_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000008) /**< DBH data has been reported to the client \n */
+#define QMI_LOC_SRN_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000010) /**< SRN has been reported to the client \n */
+#define QMI_LOC_ECID_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000020) /**< Enhanced cell ID has been reported to the client \n */
+#define QMI_LOC_WLAN_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000040) /**< WLAN measurement has been reported to the client \n */
+#define QMI_LOC_BARO_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000080) /**< Barometer has been reported to the client \n */
+#define QMI_LOC_PPM_V02 ((qmiLocResponseLocProtocolMaskT_v02)0x00000100) /**< Pilot phase measurement has been reported to the client */
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Notifies the application framework that location
+ related information has been requested. */
+typedef struct {
+
+ /* Mandatory */
+ /* Location Request Protocol Stack */
+ qmiLocRequestProtocolEnumT_v02 protocolStack;
+ /**< Protocol stack that is requesting the non-framework location information.
+ Values: \n
+ - eQMI_LOC_CTRL_PLANE (0) -- Cellular control plane requests the location \n
+ - eQMI_LOC_SUPL (1) -- SUPL requests the location \n
+ - eQMI_LOC_IMS (2) -- IMS requests the location \n
+ - eQMI_LOC_SIM (3) -- SIM requests the location \n
+ - eQMI_LOC_MDT (4) -- MDT requests the location \n
+ - eQMI_LOC_TLOC (5) -- Trusted location requests the location \n
+ - eQMI_LOC_OTHER (6) -- Other protocol stack requests the location
+ */
+
+ /* Mandatory */
+ /* Location Requestor */
+ qmiLocRequestorEnumT_v02 requestor;
+ /**< Entity that is requesting/receiving the location information.
+ Values: \n
+ - eQMI_LOC_REQUESTOR_CARRIER (0) -- Wireless service provider \n
+ - eQMI_LOC_REQUESTOR_OEM (1) -- Device manufacturer \n
+ - eQMI_LOC_REQUESTOR_MODEM_CHIPSET_VENDOR (2) -- Modem chipset vendor \n
+ - eQMI_LOC_REQUESTOR_GNSS_CHIPSET_VENDOR (3) -- GNSS chipset vendor \n
+ - eQMI_LOC_REQUESTOR_OTHER_CHIPSET_VENDOR (4) -- Other chipset vendor \n
+ - eQMI_LOC_REQUESTOR_AUTOMOBILE_CLIENT (5) -- Automobile client \n
+ - eQMI_LOC_REQUESTOR_OTHER (6) -- Other requestor
+ */
+
+ /* Mandatory */
+ /* Requestor Identification String */
+ char requestorId[QMI_LOC_MAX_REQUESTOR_ID_STRING_LENGTH_V02 + 1];
+ /**< String identification of the endpoint receiving the location information.
+ */
+
+ /* Mandatory */
+ /* Location Requestor Response Type */
+ qmiLocRequestResponseTypeEnumT_v02 responseType;
+ /**< Indicates whether the location information was provided for this request.
+ Values: \n
+ - eQMI_LOC_REJECTED (0) -- Request rejected because framework has not provided permission for this use case \n
+ - eQMI_LOC_ACCEPTED_NO_LOCATION_PROVIDED (1) -- Request accepted but could not provide location because of a failure \n
+ - eQMI_LOC_ACCEPTED_LOCATION_PROVIDED (2) -- Request accepted and location provided
+ */
+
+ /* Mandatory */
+ /* Location Response Protocol Mask */
+ qmiLocResponseLocProtocolMaskT_v02 responseProtocol;
+ /**< Indicates types of location information that have been reported.
+ Values: \n
+ - QMI_LOC_GNSS_POSITION (0x00000001) -- GNSS position has been reported to the client \n
+ - QMI_LOC_GNSS_MEASUREMENT (0x00000002) -- GNSS measurement has been reported to the client \n
+ - QMI_LOC_OTDOA_MEASUREMENT (0x00000004) -- OTDOA measurement has been reported to the client \n
+ - QMI_LOC_DBH_DATA (0x00000008) -- DBH data has been reported to the client \n
+ - QMI_LOC_SRN (0x00000010) -- SRN has been reported to the client \n
+ - QMI_LOC_ECID (0x00000020) -- Enhanced cell ID has been reported to the client \n
+ - QMI_LOC_WLAN (0x00000040) -- WLAN measurement has been reported to the client \n
+ - QMI_LOC_BARO (0x00000080) -- Barometer has been reported to the client \n
+ - QMI_LOC_PPM (0x00000100) -- Pilot phase measurement has been reported to the client
+ */
+
+ /* Mandatory */
+ /* Emergency Mode */
+ uint8_t inEmergencyMode;
+ /**< Indicates whether the device is in a user-initiated emergency session.
+ */
+
+ /* Mandatory */
+ /* Cached Location */
+ uint8_t isCachedLocation;
+ /**< Indicates the cached location provided.
+ */
+
+ /* Optional */
+ /* Client Identification String */
+ uint8_t clientStrId_valid; /**< Must be set to true if clientStrId is being passed */
+ char clientStrId[QMI_LOC_MAX_CLIENT_ID_STRING_LENGTH_V02 + 1];
+ /**< String identification of the client who requested the location.\n
+ - Type -- NULL-terminated string \n
+ - Maximum string length (including NULL terminator) -- 5
+ */
+}qmiLocLocationRequestNotificationIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPLATFORMPOWERSTATEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_POWER_STATE_UNKNOWN_V02 = 0, /**< Platform power state unknown \n */
+ eQMI_LOC_POWER_STATE_SUSPENDED_V02 = 1, /**< Platform has entered a lower power state \n */
+ eQMI_LOC_POWER_STATE_RESUME_V02 = 2, /**< Platform has entered a higher power state \n */
+ eQMI_LOC_POWER_STATE_SHUTDOWN_V02 = 3, /**< Platform has started to gracefully shutdown */
+ QMILOCPLATFORMPOWERSTATEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocPlatformPowerStateEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject the platform power state
+ on CV2x and other platforms. */
+typedef struct {
+
+ /* Mandatory */
+ /* Power State */
+ qmiLocPlatformPowerStateEnumT_v02 powerState;
+ /**< Power state of the platform; can be used by the location
+ engine for its own power modes. */
+}qmiLocInjectPlatformPowerStateReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to inject the platform power state
+ on CV2x and other platforms. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the platform power state injection request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+
+ */
+}qmiLocInjectPlatformPowerStateIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Configures the robust location. */
+typedef struct {
+
+ /* Mandatory */
+ /* Enable */
+ uint8_t enable;
+ /**< Specifies the robust location configuration. \n
+ - 0x00 (FALSE) -- Disable \n
+ - 0x01 (TRUE) -- Enable
+ */
+
+ /* Optional */
+ /* Enable for E911 */
+ uint8_t enableForE911_valid; /**< Must be set to true if enableForE911 is being passed */
+ uint8_t enableForE911;
+ /**< Specifies the robust location configuration during e911 state. \n
+ - 0x00 (FALSE) -- Disable \n
+ - 0x01 (TRUE) -- Enable
+ */
+}qmiLocSetRobustLocationReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ uint8_t major;
+ /**< Major version number. */
+
+ uint16_t minor;
+ /**< Minor version number. */
+}qmiLocRobustLocationVersionT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Queries the robust location configuration. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Enable */
+ uint8_t isEnabled_valid; /**< Must be set to true if isEnabled is being passed */
+ uint8_t isEnabled;
+ /**< Configuration of robust location. \n
+ - 0x00 (FALSE) -- Disabled \n
+ - 0x01 (TRUE) -- Enabled
+ */
+
+ /* Optional */
+ /* Enable for E911 */
+ uint8_t isEnabledForE911_valid; /**< Must be set to true if isEnabledForE911 is being passed */
+ uint8_t isEnabledForE911;
+ /**< Configuration of robust location during e911 state. \n
+ - 0x00 (FALSE) -- Disabled \n
+ - 0x01 (TRUE) -- Enabled
+ */
+
+ /* Optional */
+ /* Robust Location Version */
+ uint8_t robustLocationVersion_valid; /**< Must be set to true if robustLocationVersion is being passed */
+ qmiLocRobustLocationVersionT_v02 robustLocationVersion;
+ /**< \n Major and minor version of the supported robust location feature. */
+}qmiLocGetRobustLocationConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+typedef uint64_t qmiLocEnvAidingSvCorrectionValidMaskT_v02;
+#define QMI_LOC_ENV_AIDING_SV_CORRECTION_LINE_OF_SIGHT_PROBABILITY_VALID_V02 ((qmiLocEnvAidingSvCorrectionValidMaskT_v02)0x00000001ull) /**< Validity of the probabilitySvIsLineofSight field. \n */
+#define QMI_LOC_ENV_AIDING_SV_CORRECTION_EXCESS_PATH_LENGTH_VALID_V02 ((qmiLocEnvAidingSvCorrectionValidMaskT_v02)0x00000002ull) /**< Validity of the excessPathLengthMeters field . \n */
+#define QMI_LOC_ENV_AIDING_SV_CORRECTION_EXCESS_PATH_LENGTH_UNC_VALID_V02 ((qmiLocEnvAidingSvCorrectionValidMaskT_v02)0x00000004ull) /**< Validity of the excessPathLengthUncMeters field. \n */
+#define QMI_LOC_ENV_AIDING_SV_CORRECTION_REFLECTING_PLANE_VALID_V02 ((qmiLocEnvAidingSvCorrectionValidMaskT_v02)0x00000008ull) /**< Validity of the reflectingPlane field. */
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ double latitudeDegrees;
+ /**< Latitude of the reflecting plane. \n
+ - Units -- Degrees */
+
+ double longitudeDegrees;
+ /**< Longitude of the reflecting plane.\n
+ - Units -- Degrees */
+
+ double altitudeMeters;
+ /**< Altitude of the reflecting point in the plane above the WGS-84 reference ellipsoid. \n
+ - Units -- Meters */
+
+ double azimuthDegrees;
+ /**< Azimuth clockwise from north of the reflecting plane. \n
+ - Units -- Degrees */
+}qmiLocEnvAidingReflectingPlaneStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_aggregates
+ @{
+ */
+typedef struct {
+
+ qmiLocEnvAidingSvCorrectionValidMaskT_v02 svCorrectionFlags;
+ /**< Indicates which correction values are valid. \n
+ - QMI_LOC_ENV_AIDING_SV_CORRECTION_LINE_OF_SIGHT_PROBABILITY_VALID (0x00000001) -- Validity of the probabilitySvIsLineofSight field. \n
+ - QMI_LOC_ENV_AIDING_SV_CORRECTION_EXCESS_PATH_LENGTH_VALID (0x00000002) -- Validity of the excessPathLengthMeters field . \n
+ - QMI_LOC_ENV_AIDING_SV_CORRECTION_EXCESS_PATH_LENGTH_UNC_VALID (0x00000004) -- Validity of the excessPathLengthUncMeters field. \n
+ - QMI_LOC_ENV_AIDING_SV_CORRECTION_REFLECTING_PLANE_VALID (0x00000008) -- Validity of the reflectingPlane field. */
+
+ qmiLocSvSystemEnumT_v02 constellation;
+ /**< Constellation of the given satellite. \n
+ - eQMI_LOC_SV_SYSTEM_GPS (1) -- GPS satellite \n
+ - eQMI_LOC_SV_SYSTEM_GALILEO (2) -- Galileo satellite \n
+ - eQMI_LOC_SV_SYSTEM_SBAS (3) -- SBAS satellite \n
+ - eQMI_LOC_SV_SYSTEM_COMPASS (4) -- COMPASS satellite (Deprecated) \n
+ - eQMI_LOC_SV_SYSTEM_GLONASS (5) -- GLONASS satellite \n
+ - eQMI_LOC_SV_SYSTEM_BDS (6) -- BDS satellite \n
+ - eQMI_LOC_SV_SYSTEM_QZSS (7) -- QZSS satellite \n
+ - eQMI_LOC_SV_SYSTEM_NAVIC (8) -- NavIC satellite */
+
+ uint16_t svid;
+ /**< GNSS SV ID. Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96 \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414 */
+
+ float carrierFrequencyHz;
+ /**< Carrier frequency of the signal to correct.
+ For example, the GPS L1 center frequency 1,575,420,000 Hz,
+ or varying GLO channels.
+ For a receiver with capabilities to track multiple frequencies for the same satellite,
+ multiple corrections for the same satellite can be provided. \n
+ - Units -- Hz */
+
+ float probabilitySvIsLineofSight;
+ /**< Probability that the satellite is estimated to be in line-of-sight condition at the specified location.
+ Validity is determined by setting the relevant bit in the svCorrectionFlags. \n
+ - Range -- 0-1 */
+
+ float excessPathLengthMeters;
+ /**< Excess path length to subtract from pseudorange before using it for positioning.
+ Determines validity by setting the relevant bit in the svCorrectionFlags. \n
+ - Units -- Meters */
+
+ float excessPathLengthUncMeters;
+ /**< Error estimate (1-sigma) for the excess path length estimate.
+ Determines validity by setting the relevant bit in svCorrectionFlags. \n
+ - Units -- Meters */
+
+ qmiLocEnvAidingReflectingPlaneStructT_v02 reflectingPlane;
+ /**< Reflects plane characteristics such as location and azimuth.
+ Determines validity by setting the relevant bit in svCorrectionFlags */
+}qmiLocEnvAidingSVCorrectionStructT_v02; /* Type */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to inject environment aided
+ measurement corrections. */
+typedef struct {
+
+ /* Mandatory */
+ /* Current Message Sequence Number */
+ uint8_t seqNum;
+ /**< Current message number; used for segmentation/assembly of environment aiding
+ injection data. */
+
+ /* Mandatory */
+ /* Maximum Number of Messages to send */
+ uint8_t maxMessageNum;
+ /**< Maximum number of messages to send for injecting environment aiding data. */
+
+ /* Optional */
+ /* Environment Bearing Validity */
+ uint8_t envBearingValidity_valid; /**< Must be set to true if envBearingValidity is being passed */
+ uint8_t envBearingValidity;
+ /**< Indicates whether the environment bearing is valid. */
+
+ /* Optional */
+ /* Environment Bearing */
+ uint8_t envBearingDegrees_valid; /**< Must be set to true if envBearingDegrees is being passed */
+ float envBearingDegrees;
+ /**< Environment bearing in degrees clockwise from true North (0.0 to 360.0],
+ in the direction of user motion. Environment bearing is provided when it is
+ known with high probability that velocity is aligned with an environment
+ feature, such as a building or road. If user speed is zero,
+ envBearingDegrees represents bearing of most recent speed that was > 0.
+ As position approaches another road or open area, envBearingUncDegrees grows, and
+ at some stage envBearingDegrees becomes invalid. If the road is curved in the vicinity
+ of the user location, envBearingUncDegrees includes the amount
+ by which the road direction changes in the area of position uncertainty.
+ */
+
+ /* Optional */
+ /* Environment Bearing Uncertainty */
+ uint8_t envBearingUncDegrees_valid; /**< Must be set to true if envBearingUncDegrees is being passed */
+ float envBearingUncDegrees;
+ /**< Environment bearing uncertainty. \n
+ - Range -- 0 to 180 \n
+ - Units -- Degrees */
+
+ /* Optional */
+ /* Latitude */
+ uint8_t latitudeDegrees_valid; /**< Must be set to true if latitudeDegrees is being passed */
+ double latitudeDegrees;
+ /**< Latitude at which the corrections are computed. \n
+ - Units -- Degrees */
+
+ /* Optional */
+ /* Longitude */
+ uint8_t longitudeDegrees_valid; /**< Must be set to true if longitudeDegrees is being passed */
+ double longitudeDegrees;
+ /**< Longitude at which the corrections are computed.\n
+ - Units -- Degrees */
+
+ /* Optional */
+ /* Horizontal Position Uncertainty */
+ uint8_t horizontalPositionUncMeters_valid; /**< Must be set to true if horizontalPositionUncMeters is being passed */
+ double horizontalPositionUncMeters;
+ /**< Horizontal uncertainty (68% confidence) on the device position at which
+ the corrections are provided. This value is useful to judge
+ accuracy of the provided corrections. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Altitude */
+ uint8_t altitudeMeters_valid; /**< Must be set to true if altitudeMeters is being passed */
+ double altitudeMeters;
+ /**< Altitude above the WGS-84 reference ellipsoid at which the corrections are computed. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Altitude Uncertainty */
+ uint8_t altitudeUncMeters_valid; /**< Must be set to true if altitudeUncMeters is being passed */
+ double altitudeUncMeters;
+ /**< Altitude uncertainty (68% confidence) on the device position at which the
+ corrections are provided. This value is useful to judge accuracy of the
+ provided corrections. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Time of Applicability */
+ uint8_t toaGpsNanosecondsOfWeek_valid; /**< Must be set to true if toaGpsNanosecondsOfWeek is being passed */
+ uint64_t toaGpsNanosecondsOfWeek;
+ /**< Time of applicability, GPS time of week. \n
+ - Units -- Nanoseconds */
+
+ /* Optional */
+ /* SV Corrections */
+ uint8_t svCorrection_valid; /**< Must be set to true if svCorrection is being passed */
+ uint32_t svCorrection_len; /**< Must be set to # of elements in svCorrection */
+ qmiLocEnvAidingSVCorrectionStructT_v02 svCorrection[QMI_LOC_ENV_AIDING_CORRECTION_MAX_SV_USED_V02];
+ /**< \n Measurement corrections for satellites in view. */
+}qmiLocEventInjectEnvAidingReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to set the minimum GPS week number. */
+typedef struct {
+
+ /* Mandatory */
+ /* Minimum GPS Week Number */
+ uint16_t minGpsWeekNumber;
+ /**< Minimum GPS week number. */
+}qmiLocSetMinGpsWeekNumberReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by control point to query the minimum GPS week number. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Minimum GPS Week Number */
+ uint8_t minGpsWeekNumber_valid; /**< Must be set to true if minGpsWeekNumber is being passed */
+ uint16_t minGpsWeekNumber;
+ /**< Minimum GPS week number. */
+}qmiLocGetMinGpsWeekNumberIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends SAP-INS generated aiding information to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Filter Status */
+ uint8_t status;
+ /**< Filter status. */
+
+ /* Mandatory */
+ /* Filter Fix Status */
+ uint8_t fixStatus;
+ /**< Filter fix status information. */
+
+ /* Mandatory */
+ /* GNSS System Time Information */
+ qmiLocGnssTimeStructT_v02 systemTime;
+
+ /* Optional */
+ /* Filter State Information */
+ uint8_t state_valid; /**< Must be set to true if state is being passed */
+ double state[QMI_LOC_FILTER_ELEMENT_SIZE_SEVENTEEN_V02];
+ /**< Filter state information. */
+
+ /* Optional */
+ /* Filter Variance Information */
+ uint8_t var_valid; /**< Must be set to true if var is being passed */
+ double var[QMI_LOC_FILTER_ELEMENT_SIZE_SEVENTEEN_V02];
+ /**< Filter variance information. */
+
+ /* Optional */
+ /* Filter Reliability 1 */
+ uint8_t rel1_valid; /**< Must be set to true if rel1 is being passed */
+ uint8_t rel1;
+ /**< Filter reliability 1. */
+
+ /* Optional */
+ /* Filter Reliability 2 */
+ uint8_t rel2_valid; /**< Must be set to true if rel2 is being passed */
+ uint8_t rel2;
+ /**< Filter reliability 2. */
+
+ /* Optional */
+ /* Filter Residual 1 */
+ uint8_t residual1_valid; /**< Must be set to true if residual1 is being passed */
+ double residual1;
+ /**< Filter residual 1. */
+
+ /* Optional */
+ /* Filter Observation 1 */
+ uint8_t obs1_valid; /**< Must be set to true if obs1 is being passed */
+ double obs1[QMI_LOC_FILTER_ELEMENT_SIZE_SIX_V02];
+ /**< Filter observation 1. */
+
+ /* Optional */
+ /* Filter Variance 1 */
+ uint8_t var1_valid; /**< Must be set to true if var1 is being passed */
+ double var1;
+ /**< Filter variance 1. */
+
+ /* Optional */
+ /* Filter Result 1 */
+ uint8_t result1_valid; /**< Must be set to true if result1 is being passed */
+ uint8_t result1;
+ /**< Filter result 1. */
+
+ /* Optional */
+ /* Filter Residual 2 */
+ uint8_t residual2_valid; /**< Must be set to true if residual2 is being passed */
+ double residual2;
+ /**< Filter residual 2. */
+
+ /* Optional */
+ /* Filter Observation 2 */
+ uint8_t obs2_valid; /**< Must be set to true if obs2 is being passed */
+ double obs2[QMI_LOC_FILTER_ELEMENT_SIZE_SIX_V02];
+ /**< Filter observation 2. */
+
+ /* Optional */
+ /* Filter Variance 2 */
+ uint8_t var2_valid; /**< Must be set to true if var2 is being passed */
+ double var2;
+ /**< Filter variance 2. */
+
+ /* Optional */
+ /* Filter Result 2 */
+ uint8_t result2_valid; /**< Must be set to true if result2 is being passed */
+ uint8_t result2;
+ /**< Filter result 2. */
+
+ /* Optional */
+ /* Filter Residual 3 */
+ uint8_t residual3_valid; /**< Must be set to true if residual3 is being passed */
+ double residual3[QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02];
+ /**< Filter residual 3. */
+
+ /* Optional */
+ /* Filter Variance 3 */
+ uint8_t var3_valid; /**< Must be set to true if var3 is being passed */
+ double var3[QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02];
+ /**< Filter variance 3. */
+
+ /* Optional */
+ /* Filter Result 3 */
+ uint8_t result3_valid; /**< Must be set to true if result3 is being passed */
+ uint8_t result3[QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02];
+ /**< Filter result 3. */
+
+ /* Optional */
+ /* Filter Residual 4 */
+ uint8_t residual4_valid; /**< Must be set to true if residual4 is being passed */
+ double residual4[QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02];
+ /**< Filter residual 4. */
+
+ /* Optional */
+ /* Filter Variance 4 */
+ uint8_t var4_valid; /**< Must be set to true if var4 is being passed */
+ double var4[QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02];
+ /**< Filter variance 4. */
+
+ /* Optional */
+ /* Filter Result 4 */
+ uint8_t result4_valid; /**< Must be set to true if result4 is being passed */
+ uint8_t result4[QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02];
+ /**< Filter result 4. */
+
+ /* Optional */
+ /* Filter Acceleration */
+ uint8_t acc_valid; /**< Must be set to true if acc is being passed */
+ double acc[QMI_LOC_FILTER_ELEMENT_SIZE_THREE_V02];
+ /**< Filter acceleration. */
+
+ /* Optional */
+ /* Filter Quaternion */
+ uint8_t quat_valid; /**< Must be set to true if quat is being passed */
+ double quat[QMI_LOC_FILTER_ELEMENT_SIZE_FOUR_V02];
+ /**< Filter quaternion. */
+
+ /* Optional */
+ /* Bias M1 */
+ uint8_t biasM1_valid; /**< Must be set to true if biasM1 is being passed */
+ float biasM1[QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02];
+ /**< Bias M1. */
+
+ /* Optional */
+ /* Bias V1 */
+ uint8_t biasV1_valid; /**< Must be set to true if biasV1 is being passed */
+ float biasV1[QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02];
+ /**< Bias V1. */
+
+ /* Optional */
+ /* Bias M2 */
+ uint8_t biasM2_valid; /**< Must be set to true if biasM2 is being passed */
+ float biasM2[QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02];
+ /**< Bias M2. */
+
+ /* Optional */
+ /* Bias V2 */
+ uint8_t biasV2_valid; /**< Must be set to true if biasV2 is being passed */
+ float biasV2[QMI_LOC_IPM_ELEMENT_SIZE_THREE_V02];
+ /**< Bias V2. */
+
+ /* Optional */
+ /* Rotation Matrix 1 */
+ uint8_t rMat1_valid; /**< Must be set to true if rMat1 is being passed */
+ double rMat1[QMI_LOC_IPM_ELEMENT_SIZE_NINE_V02];
+ /**< Rotation matrix 1, Arranged row-wise. */
+
+ /* Optional */
+ /* Rotation Matrix 1 count */
+ uint8_t rMat1Count_valid; /**< Must be set to true if rMat1Count is being passed */
+ uint32_t rMat1Count;
+ /**< Rotation matrix 1 count. */
+
+ /* Optional */
+ /* Rotation Matrix 2 */
+ uint8_t rMat2_valid; /**< Must be set to true if rMat2 is being passed */
+ double rMat2[QMI_LOC_IPM_ELEMENT_SIZE_NINE_V02];
+ /**< Rotation matrix 2, arranged row-wise. */
+
+ /* Optional */
+ /* Detector 1 Reset */
+ uint8_t det1Reset_valid; /**< Must be set to true if det1Reset is being passed */
+ uint8_t det1Reset;
+ /**< Detector 1 reset. */
+
+ /* Optional */
+ /* Detector 2 Status */
+ uint8_t det2Status_valid; /**< Must be set to true if det2Status is being passed */
+ uint8_t det2Status;
+ /**< Detector 2 status. */
+
+ /* Optional */
+ /* Detector 2 Position */
+ uint8_t det2Position_valid; /**< Must be set to true if det2Position is being passed */
+ double det2Position[QMI_LOC_INS_ELEMENT_SIZE_THREE_V02];
+ /**< Detector 2 position. */
+
+ /* Optional */
+ /* Detector 2 Position Uncertainty */
+ uint8_t det2PositionUnc_valid; /**< Must be set to true if det2PositionUnc is being passed */
+ float det2PositionUnc[QMI_LOC_INS_ELEMENT_SIZE_TWO_V02];
+ /**< Detector 2 position uncertainty. */
+
+ /* Optional */
+ /* Detector 3 Status */
+ uint8_t det3Status_valid; /**< Must be set to true if det3Status is being passed */
+ uint8_t det3Status;
+ /**< Detector 3 status. */
+
+ /* Optional */
+ /* Detector 3 Variance 1 */
+ uint8_t det3Variance1_valid; /**< Must be set to true if det3Variance1 is being passed */
+ float det3Variance1[QMI_LOC_INS_ELEMENT_SIZE_THREE_V02];
+ /**< Detector 3 variance 1 */
+
+ /* Optional */
+ /* Detector 3 Variance 2 */
+ uint8_t det3Variance2_valid; /**< Must be set to true if det3Variance2 is being passed */
+ float det3Variance2[QMI_LOC_INS_ELEMENT_SIZE_THREE_V02];
+ /**< Detector 3 variance 2. */
+
+ /* Optional */
+ /* Detector 4 Status */
+ uint8_t det4Status_valid; /**< Must be set to true if det4Status is being passed */
+ uint8_t det4Status;
+ /**< Detector 4 status. */
+
+ /* Optional */
+ /* Detector 4 Position */
+ uint8_t det4Position_valid; /**< Must be set to true if det4Position is being passed */
+ double det4Position[QMI_LOC_INS_ELEMENT_SIZE_THREE_V02];
+ /**< Detector 4 position. */
+
+ /* Optional */
+ /* Detector 5 Status */
+ uint8_t det5Status_valid; /**< Must be set to true if det5Status is being passed */
+ uint8_t det5Status;
+ /**< Detector 5 status. */
+
+ /* Optional */
+ /* Detector 6 Status */
+ uint8_t det6Status_valid; /**< Must be set to true if det6Status is being passed */
+ float det6Status;
+ /**< Detector 6 status. */
+
+ /* Optional */
+ /* Satellite Identifier */
+ uint8_t gnssSvId_valid; /**< Must be set to true if gnssSvId is being passed */
+ uint32_t gnssSvId_len; /**< Must be set to # of elements in gnssSvId */
+ uint16_t gnssSvId[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< GNSS SV ID.
+ Range: \n
+ - GPS -- 1 to 32 \n
+ - GLONASS -- 65 to 96; set as 255 when slot-number to SV ID mapping is unknown \n
+ - QZSS -- 193 to 197 \n
+ - BDS -- 201 to 263 \n
+ - Galileo -- 301 to 336 \n
+ - NavIC -- 401 to 414
+ */
+
+ /* Optional */
+ /* GNSS Signal Type */
+ uint8_t measType_valid; /**< Must be set to true if measType is being passed */
+ uint32_t measType_len; /**< Must be set to # of elements in measType */
+ qmiLocGnssSignalTypeMaskT_v02 measType[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< Indicates the GNSS signal type of each satellite in gnssSvID. The
+ signal type list is aligned with the SVs in gnssSvId. Value 0
+ means invalid.
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1CA (0x00000001) -- GPS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L1C (0x00000002) -- GPS L1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L2C_L (0x00000004) -- GPS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GPS_L5_Q (0x00000008) -- GPS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G1 (0x00000010) -- GLONASS G1 (L1OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GLONASS_G2 (0x00000020) -- GLONASS G2 (L2OF) RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E1_C (0x00000040) -- Galileo E1_C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5A_Q (0x00000080) -- Galileo E5A_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_GALILEO_E5B_Q (0x00000100) -- Galileo E5B_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1_I (0x00000200) -- BeiDou B1_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B1C (0x00000400) -- BeiDou B1C RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2_I (0x00000800) -- BeiDou B2_I RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_I (0x00001000) -- BeiDou B2A_I RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1CA (0x00002000) -- QZSS L1CA RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L1S (0x00004000) -- QZSS L1S RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L2C_L (0x00008000) -- QZSS L2C_L RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_QZSS_L5_Q (0x00010000) -- QZSS L5_Q RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_SBAS_L1_CA (0x00020000) -- SBAS L1_CA RF band
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_NAVIC_L5 (0x00040000) -- NavIC L5 RF band \n
+ - QMI_LOC_MASK_GNSS_SIGNAL_TYPE_BEIDOU_B2A_Q (0x00080000) -- BeiDou B2A_Q RF band */
+
+ /* Optional */
+ /* Measurement Variance 1 */
+ uint8_t measVar1_valid; /**< Must be set to true if measVar1 is being passed */
+ uint32_t measVar1_len; /**< Must be set to # of elements in measVar1 */
+ float measVar1[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< This list matches the order of SVs in gnssSvID list. */
+
+ /* Optional */
+ /* Measurement Usage Information 1 */
+ uint8_t measUse1_valid; /**< Must be set to true if measUse1 is being passed */
+ uint32_t measUse1_len; /**< Must be set to # of elements in measUse1 */
+ uint32_t measUse1[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< This list matches the order of SVs in gnssSvID list. */
+
+ /* Optional */
+ /* Measurement Variance 2 */
+ uint8_t measVar2_valid; /**< Must be set to true if measVar2 is being passed */
+ uint32_t measVar2_len; /**< Must be set to # of elements in measVar2 */
+ float measVar2[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< This list matches the order of SVs in gnssSvID list. */
+
+ /* Optional */
+ /* Measurement Usage Information 2 */
+ uint8_t measUse2_valid; /**< Must be set to true if measUse2 is being passed */
+ uint32_t measUse2_len; /**< Must be set to # of elements in measUse2 */
+ uint32_t measUse2[QMI_LOC_EXPANDED_SV_INFO_LIST_MAX_SIZE_V02];
+ /**< This list matches the order of SVs in gnssSvID list.*/
+}qmiLocSapInsParamsIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Requests the control point to query XTRA information. */
+typedef struct {
+ /* This element is a placeholder to prevent the declaration of
+ an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE */
+ char __placeholder;
+}qmiLocEventQueryXtraInfoReqIndMsgT_v02;
+
+ /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCPARAMETERTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_PARAMETER_TYPE_RESERVED_V02 = 0, /**< Do not use. */
+ eQMI_LOC_PARAMETER_TYPE_MINIMUM_SV_ELEVATION_V02 = 1, /**< Minimum SV elevation to use for computing position. */
+ QMILOCPARAMETERTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocParameterTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control to
+ set a specific parameter for the GNSS engine to use. */
+typedef struct {
+
+ /* Mandatory */
+ /* Parameter Type */
+ qmiLocParameterTypeEnumT_v02 paramType;
+ /**< Parameter type. Values: \n
+ - eQMI_LOC_PARAMETER_TYPE_RESERVED (0) -- Do not use.
+ - eQMI_LOC_PARAMETER_TYPE_MINIMUM_SV_ELEVATION (1) -- Minimum SV elevation to use for computing position.
+ */
+
+ /* Optional */
+ /* Minimum SV Elevation */
+ uint8_t minSvElevation_valid; /**< Must be set to true if minSvElevation is being passed */
+ uint8_t minSvElevation;
+ /**< Specifies the minimum SV elevation to use for positioning.
+ GNSS Position Engine does not use SVs with elevation lower than the
+ configured minimum elevation setting to compute position.\n
+ - Units -- Degrees \n
+ - Range -- 0 - 90
+ */
+}qmiLocSetParameterReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to query a specific
+ parameter in use by GNSS engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Parameter Type */
+ qmiLocParameterTypeEnumT_v02 paramType;
+ /**< Parameter type. Values:
+ - eQMI_LOC_PARAMETER_TYPE_RESERVED (0) -- Do not use.
+ - eQMI_LOC_PARAMETER_TYPE_MINIMUM_SV_ELEVATION (1) -- Minimum SV elevation to use for computing position.
+ */
+}qmiLocGetParameterReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query a specific
+ parameter in use by GNSS engine. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the request. Values:\n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Mandatory */
+ /* Parameter Type */
+ qmiLocParameterTypeEnumT_v02 paramType;
+ /**< Parameter type. Values: \n
+ - eQMI_LOC_PARAMETER_TYPE_RESERVED (0) -- Do not use.
+ - eQMI_LOC_PARAMETER_TYPE_MINIMUM_SV_ELEVATION (1) -- Minimum SV elevation to use for computing position.
+ */
+
+ /* Optional */
+ /* Minimum SV Elevation */
+ uint8_t minSvElevation_valid; /**< Must be set to true if minSvElevation is being passed */
+ uint8_t minSvElevation;
+ /**< Specifies the minimum SV elevation to use for positioning.
+ GNSS Position Engine does not use SVs with elevation lower than the
+ configured minimum elevation setting to compute position fix. \n
+ - Units -- Degrees \n
+ - Range -- 0 - 90
+ */
+}qmiLocGetParameterIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCSTATSREPORTINGCONFIGENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_REPORT_CURRENT_STATUS_V02 = 0, /**< Current status of the engine statistics. \n */
+ eQMI_LOC_REPORTING_INTERVAL_10_SEC_V02 = 1, /**< The time interval is 10 seconds \n */
+ eQMI_LOC_REPORTING_INTERVAL_20_SEC_V02 = 2, /**< The time interval 20 seconds \n */
+ eQMI_LOC_REPORTING_INTERVAL_30_SEC_V02 = 3, /**< The time interval is 30 seconds \n */
+ eQMI_LOC_REPORTING_INTERVAL_60_SEC_V02 = 4, /**< The time interval is 60 seconds \n */
+ eQMI_LOC_REPORTING_INTERVAL_SESSION_V02 = 5, /**< The time interval is the entire session (receiver ON to receiver OFF) */
+ QMILOCSTATSREPORTINGCONFIGENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocStatsReportingConfigEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to start or stop receiving the
+ location engine statistics.
+ */
+typedef struct {
+
+ /* Mandatory */
+ /* Enable Statistics Reporting */
+ uint8_t enable;
+ /**< When set to True, configure to start sending the location engine statistics
+ at the interval provided. \n
+ When set to False, configure to stop sending the locationeEngine statistics. */
+
+ /* Optional */
+ /* Interval Duration */
+ uint8_t interval_valid; /**< Must be set to true if interval is being passed */
+ qmiLocStatsReportingConfigEnumT_v02 interval;
+ /**< Interval for the location statistics reporting.
+ Values: \n
+ - eQMI_LOC_REPORT_CURRENT_STATUS (0) -- Current status of the engine statistics. \n
+ - eQMI_LOC_REPORTING_INTERVAL_10_SEC (1) -- The time interval is 10 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_20_SEC (2) -- The time interval 20 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_30_SEC (3) -- The time interval is 30 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_60_SEC (4) -- The time interval is 60 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_SESSION (5) -- The time interval is the entire session (receiver ON to receiver OFF)
+
+ */
+}qmiLocSetStatisticsConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to request the current configuration
+ of receving the location engine statistics. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the get location engine statistics report request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Statistics Report Enabled */
+ uint8_t enabled_valid; /**< Must be set to true if enabled is being passed */
+ uint8_t enabled;
+ /**< When set to True, send the location engine statistics at the interval
+ provided by the Interval Duration TLV. \n
+ When set to False, do not send the location engine statistics. */
+
+ /* Optional */
+ /* Interval Duration */
+ uint8_t interval_valid; /**< Must be set to true if interval is being passed */
+ qmiLocStatsReportingConfigEnumT_v02 interval;
+ /**< Interval for the location statistics reporting.
+ Values: \n
+ - eQMI_LOC_REPORT_CURRENT_STATUS (0) -- Current status of the engine statistics. \n
+ - eQMI_LOC_REPORTING_INTERVAL_10_SEC (1) -- The time interval is 10 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_20_SEC (2) -- The time interval 20 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_30_SEC (3) -- The time interval is 30 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_60_SEC (4) -- The time interval is 60 seconds \n
+ - eQMI_LOC_REPORTING_INTERVAL_SESSION (5) -- The time interval is the entire session (receiver ON to receiver OFF)
+
+ */
+}qmiLocGetStatisticsConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the location engine statistics to the control point. */
+typedef struct {
+
+ /* Optional */
+ /* Absolute Valid Age for XTRA Data */
+ uint8_t absValidAge_valid; /**< Must be set to true if absValidAge is being passed */
+ uint32_t absValidAge;
+ /**< Number of hours (absolute) for which the current XTRA information is valid. \n
+ - Units -- Hours */
+
+ /* Optional */
+ /* Average Power Consumed */
+ uint8_t averagePowerConsumed_valid; /**< Must be set to true if averagePowerConsumed is being passed */
+ float averagePowerConsumed;
+ /**< Indicates the average power consumed by the receiver during
+ the requested interval of time (interval). \n
+ - Unit -- milliwatts */
+
+ /* Optional */
+ /* Receiver Power Consumption Duration */
+ uint8_t powerConsumptionDuration_valid; /**< Must be set to true if powerConsumptionDuration is being passed */
+ uint32_t powerConsumptionDuration;
+ /**< Indicates the duration for average power consumed (averagePowerConsumed)
+ by the receiver during the requested interval of time (interval). \n
+ - Unit -- Milliseconds */
+
+ /* Optional */
+ /* Latitude */
+ uint8_t latitude_valid; /**< Must be set to true if latitude is being passed */
+ double latitude;
+ /**< - Units -- Degrees \n
+ - Range -- -90.0 to 90.0 \n
+ - Positive values indicate northern latitude \n
+ - Negative values indicate southern latitude */
+
+ /* Optional */
+ /* Longitude */
+ uint8_t longitude_valid; /**< Must be set to true if longitude is being passed */
+ double longitude;
+ /**< Longitude; valid range is 180.0 to 180.0 degrees.
+ Postive values indicate eastern longitude, negative values
+ indicate western longitude.
+ */
+
+ /* Optional */
+ /* Altitude With Respect to Ellipsoid */
+ uint8_t altitudeWrtEllipsoid_valid; /**< Must be set to true if altitudeWrtEllipsoid is being passed */
+ float altitudeWrtEllipsoid;
+ /**< Altitude with respect to the WGS84 ellipsoid.\n
+ - Units -- Meters \n
+ - Range -- -500 to 15883 */
+
+ /* Optional */
+ /* Altitude With Respect to Sea Level */
+ uint8_t altitudeWrtMeanSeaLevel_valid; /**< Must be set to true if altitudeWrtMeanSeaLevel is being passed */
+ float altitudeWrtMeanSeaLevel;
+ /**< Altitude with respect to mean sea level.\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Circular Horizontal Position Uncertainty */
+ uint8_t horUncCircular_valid; /**< Must be set to true if horUncCircular is being passed */
+ float horUncCircular;
+ /**< Horizontal position uncertainty (circular).\n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Vertical Uncertainty */
+ uint8_t vertUnc_valid; /**< Must be set to true if vertUnc is being passed */
+ float vertUnc;
+ /**< - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Semi-Minor Axis */
+ uint8_t horUncEllipseSemiMinor_valid; /**< Must be set to true if horUncEllipseSemiMinor is being passed */
+ float horUncEllipseSemiMinor;
+ /**< Semi-minor axis of horizontal elliptical uncertainty. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Elliptical Uncertainty Semi-Major Axis */
+ uint8_t horUncEllipseSemiMajor_valid; /**< Must be set to true if horUncEllipseSemiMajor is being passed */
+ float horUncEllipseSemiMajor;
+ /**< Semi-major axis of horizontal elliptical uncertainty. \n
+ - Units -- Meters */
+
+ /* Optional */
+ /* Horizontal Circular Confidence */
+ uint8_t horCircularConfidence_valid; /**< Must be set to true if horCircularConfidence is being passed */
+ uint8_t horCircularConfidence;
+ /**< Horizontal circular uncertainty confidence; valid range is 0 to 99 percent.
+ */
+
+ /* Optional */
+ /* Horizontal Reliability */
+ uint8_t horReliability_valid; /**< Must be set to true if horReliability is being passed */
+ qmiLocReliabilityEnumT_v02 horReliability;
+ /**< Specifies the reliability of the horizontal position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Horizontal Speed */
+ uint8_t horSpeed_valid; /**< Must be set to true if horSpeed is being passed */
+ float horSpeed;
+ /**< Horizontal speed.\n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Horizontal Speed Uncertainty */
+ uint8_t horSpeedUnc_valid; /**< Must be set to true if horSpeedUnc is being passed */
+ float horSpeedUnc;
+ /**< Horizontal speed uncertainty. \n
+ - Units -- Meters per second */
+
+ /* Optional */
+ /* Vertical Confidence */
+ uint8_t vertConfidence_valid; /**< Must be set to true if vertConfidence is being passed */
+ uint8_t vertConfidence;
+ /**< Vertical uncertainty confidence; valid range is 0 to 99 percent. */
+
+ /* Optional */
+ /* Vertical Reliability */
+ uint8_t vertReliability_valid; /**< Must be set to true if vertReliability is being passed */
+ qmiLocReliabilityEnumT_v02 vertReliability;
+ /**< Specifies the reliability of the vertical position.
+ Values: \n
+ - eQMI_LOC_RELIABILITY_NOT_SET (0) -- Location reliability is not set \n
+ - eQMI_LOC_RELIABILITY_VERY_LOW (1) -- Location reliability is very low; use it at your own risk \n
+ - eQMI_LOC_RELIABILITY_LOW (2) -- Location reliability is low; little or no cross-checking is possible \n
+ - eQMI_LOC_RELIABILITY_MEDIUM (3) -- Location reliability is medium; limited cross-check passed \n
+ - eQMI_LOC_RELIABILITY_HIGH (4) -- Location reliability is high; strong cross-check passed
+ */
+
+ /* Optional */
+ /* Vertical Speed */
+ uint8_t vertSpeed_valid; /**< Must be set to true if vertSpeed is being passed */
+ float vertSpeed;
+ /**< - Units -- Meters per second */
+
+ /* Optional */
+ /* Vertical Speed Uncertainty */
+ uint8_t vertSpeedUnc_valid; /**< Must be set to true if vertSpeedUnc is being passed */
+ float vertSpeedUnc;
+ /**< - Units -- Meters per second */
+
+ /* Optional */
+ /* GPS Week */
+ uint8_t gpsWeek_valid; /**< Must be set to true if gpsWeek is being passed */
+ uint16_t gpsWeek;
+ /**< GPS week number at reference tick. \n
+ - Units -- Weeks */
+
+ /* Optional */
+ /* GPS Reference Tick */
+ uint8_t gpsMsec_valid; /**< Must be set to true if gpsMsec is being passed */
+ uint32_t gpsMsec;
+ /**< GPS millisecond at reference tick.
+ */
+
+ /* Optional */
+ /* Clock Bias */
+ uint8_t clkTimeBias_valid; /**< Must be set to true if clkTimeBias is being passed */
+ float clkTimeBias;
+ /**< Clock bias in milliseconds.
+ Range is greater than -0.5 and less than 0.5. */
+
+ /* Optional */
+ /* Clock Bias Uncertainity */
+ uint8_t clkTimeBiasUnc_valid; /**< Must be set to true if clkTimeBiasUnc is being passed */
+ float clkTimeBiasUnc;
+ /**< One-sided maximum time bias uncertainty in float. \n
+ - Units -- Milliseconds */
+}qmiLocGnssStatisticsReportIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCGNSSPDRMODEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_GNSS_PDR_CASUAL_MODE_V02 = 0, /**< Casual mode when GNSS is in PDR. */
+ eQMI_LOC_GNSS_PDR_FITNESS_MODE_V02 = 1, /**< Fitness mode when GNSS is in PDR. */
+ QMILOCGNSSPDRMODEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocGnssPdrModeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to configure the GNSS mode for PDR.
+ */
+typedef struct {
+
+ /* Optional */
+ /* GNSS PDR Mode */
+ uint8_t mode_valid; /**< Must be set to true if mode is being passed */
+ qmiLocGnssPdrModeEnumT_v02 mode;
+ /**< PDR Mode for GNSS.
+ Values: \n
+ - eQMI_LOC_GNSS_PDR_CASUAL_MODE (0) -- Casual mode when GNSS is in PDR.
+ - eQMI_LOC_GNSS_PDR_FITNESS_MODE (1) -- Fitness mode when GNSS is in PDR.
+
+ */
+}qmiLocSetGnssPdrModeReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to request the current mode
+ of the GNSS engine for PDR. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the request to get GNSS mode when in PDR.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+
+ */
+
+ /* Optional */
+ /* GNSS Mode: Casual or Fitness When in PDR */
+ uint8_t mode_valid; /**< Must be set to true if mode is being passed */
+ qmiLocGnssPdrModeEnumT_v02 mode;
+ /**< Mode for GNSS when in PDR. */
+}qmiLocGetGnssPdrModeIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to request for the current
+ Calibrated state when in PDR. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the request to get the current Calibrated state
+ of the magnetometer when in PDR.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+
+ */
+
+ /* Optional */
+ /* Calibrated State */
+ uint8_t isCalibrated_valid; /**< Must be set to true if isCalibrated is being passed */
+ uint8_t isCalibrated;
+ /**< Calibrated state of the Magnetometer when in PDR.
+ Values: \n
+ - TRUE -- Calibrated \n
+ - FALSE -- Not calibrated */
+}qmiLocGetMagCalStatePdrIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Request Message; Used by the control point to set the multiband configuration
+ for all GNSS constellations. */
+typedef struct {
+
+ /* Optional */
+ /* Secondary GNSS Constellation Configuration */
+ uint8_t secondaryGnssConfig_valid; /**< Must be set to true if secondaryGnssConfig is being passed */
+ qmiLocGNSSConstellEnumT_v02 secondaryGnssConfig;
+ /**< Specifies the secondary GNSS constellation configuration. \n
+ Primary GNSS bands are as follows: \n
+ - GPS L1 \n
+ - GLONASS G1 \n
+ - BDS B1i and BDS B1c \n
+ - Gallileo E1a \n
+ - QZSS L1 \n
+ - NavIc L5 \n
+ All other GNSS bands are considered secondary GNSS bands.
+ Set bits enable all secondary bands of specified GNSS system.
+ Unset bits disable all secondary bands of specified GNSS system.
+ Valid bitmasks: \n
+ - eQMI_SYSTEM_GPS (0x01) -- Enable GPS \n
+ - eQMI_SYSTEM_GLO (0x02) -- Enable GLONASS \n
+ - eQMI_SYSTEM_BDS (0x04) -- Enable BDS \n
+ - eQMI_SYSTEM_GAL (0x08) -- Enable Galileo \n
+ - eQMI_SYSTEM_QZSS (0x10) -- Enable QZSS \n
+ - eQMI_SYSTEM_NAVIC (0x20) -- Enable NavIC
+ */
+}qmiLocSetMultibandConfigReqMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Used by the control point to query the multiband
+ configuration for all GNSS constellations. */
+typedef struct {
+
+ /* Mandatory */
+ /* Status of the Request */
+ qmiLocStatusEnumT_v02 status;
+ /**< Status of the request.
+ Values: \n
+ - eQMI_LOC_SUCCESS (0) -- Request was completed successfully \n
+ - eQMI_LOC_GENERAL_FAILURE (1) -- Request failed because of a general failure \n
+ - eQMI_LOC_UNSUPPORTED (2) -- Request failed because it is not supported \n
+ - eQMI_LOC_INVALID_PARAMETER (3) -- Request failed because it contained invalid parameters \n
+ - eQMI_LOC_ENGINE_BUSY (4) -- Request failed because the engine is busy \n
+ - eQMI_LOC_PHONE_OFFLINE (5) -- Request failed because the phone is offline \n
+ - eQMI_LOC_TIMEOUT (6) -- Request failed because it has timed out \n
+ - eQMI_LOC_CONFIG_NOT_SUPPORTED (7) -- Request failed because an undefined configuration was requested \n
+ - eQMI_LOC_INSUFFICIENT_MEMORY (8) -- Request failed because the engine could not allocate sufficient memory for the request \n
+ - eQMI_LOC_MAX_GEOFENCE_PROGRAMMED (9) -- Request failed because the maximum number of Geofences are already programmed \n
+ - eQMI_LOC_XTRA_VERSION_CHECK_FAILURE (10) -- Location service failed because of an XTRA version-based file format check failure \n
+ - eQMI_LOC_GNSS_DISABLED (11) -- Request failed because the location service is disabled
+ */
+
+ /* Optional */
+ /* Secondary GNSS Constellation Configuration */
+ uint8_t secondaryGnssConfig_valid; /**< Must be set to true if secondaryGnssConfig is being passed */
+ qmiLocGNSSConstellEnumT_v02 secondaryGnssConfig;
+ /**< Specifies the secondary GNSS constellation configuration.
+ Primary GNSS bands are as follows: \n
+ - GPS L1 \n
+ - GLONASS G1 \n
+ - BDS B1i and BDS B1c \n
+ - Galileo E1a \n
+ - QZSS L1 \n
+ - NavIc L5 \n
+ All other GNSS bands are considered secondary GNSS bands. \n
+ Set bit -- All secondary bands of specified GNSS system are enabled. \n
+ Unset bit -- All secondary bands of specified GNSS system are disabled. \n
+ Valid bitmasks: \n
+ - eQMI_SYSTEM_GPS (0x01) -- Enable GPS \n
+ - eQMI_SYSTEM_GLO (0x02) -- Enable GLONASS \n
+ - eQMI_SYSTEM_BDS (0x04) -- Enable BDS \n
+ - eQMI_SYSTEM_GAL (0x08) -- Enable Galileo \n
+ - eQMI_SYSTEM_QZSS (0x10) -- Enable QZSS \n
+ - eQMI_SYSTEM_NAVIC (0x20) -- Enable NavIC
+ */
+}qmiLocGetMultibandConfigIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_enums
+ @{
+ */
+typedef enum {
+ QMILOCLATENCYINFOTYPEENUMT_MIN_ENUM_VAL_V02 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ eQMI_LOC_LATENCY_INFO_TYPE_INVALID_V02 = 0, /**< Invalid latency information type. \n */
+ eQMI_LOC_LATENCY_INFO_TYPE_MEASUREMENT_V02 = 1, /**< Latency information type measurement. */
+ QMILOCLATENCYINFOTYPEENUMT_MAX_ENUM_VAL_V02 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}qmiLocLatencyInfoTypeEnumT_v02;
+/**
+ @}
+ */
+
+/** @addtogroup loc_qmi_messages
+ @{
+ */
+/** Indication Message; Sends the latency information to the control point. */
+typedef struct {
+
+ /* Mandatory */
+ /* Latency Information Type */
+ qmiLocLatencyInfoTypeEnumT_v02 latencyInfo;
+ /**< Latency information type. Values: \n
+ - eQMI_LOC_LATENCY_INFO_TYPE_INVALID (0) -- Invalid latency information type. \n
+ - eQMI_LOC_LATENCY_INFO_TYPE_MEASUREMENT (1) -- Latency information type measurement.
+ */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 1 */
+ uint8_t sysTickAtChkPt1_valid; /**< Must be set to true if sysTickAtChkPt1 is being passed */
+ uint64_t sysTickAtChkPt1;
+ /**< Latency measurement at checkpoint 1. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 2 */
+ uint8_t sysTickAtChkPt2_valid; /**< Must be set to true if sysTickAtChkPt2 is being passed */
+ uint64_t sysTickAtChkPt2;
+ /**< Latency measurement at checkpoint 2. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 3 */
+ uint8_t sysTickAtChkPt3_valid; /**< Must be set to true if sysTickAtChkPt3 is being passed */
+ uint64_t sysTickAtChkPt3;
+ /**< Latency measurement at checkpoint 3. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 4 */
+ uint8_t sysTickAtChkPt4_valid; /**< Must be set to true if sysTickAtChkPt4 is being passed */
+ uint64_t sysTickAtChkPt4;
+ /**< Latency measurement at checkpoint 4 \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 5 */
+ uint8_t sysTickAtChkPt5_valid; /**< Must be set to true if sysTickAtChkPt5 is being passed */
+ uint64_t sysTickAtChkPt5;
+ /**< Latency measurement at checkpoint 5. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 6 */
+ uint8_t sysTickAtChkPt6_valid; /**< Must be set to true if sysTickAtChkPt6 is being passed */
+ uint64_t sysTickAtChkPt6;
+ /**< Latency measurement at checkpoint 6. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 7 */
+ uint8_t sysTickAtChkPt7_valid; /**< Must be set to true if sysTickAtChkPt7 is being passed */
+ uint64_t sysTickAtChkPt7;
+ /**< Latency measurement at checkpoint 7. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 8 */
+ uint8_t sysTickAtChkPt8_valid; /**< Must be set to true if sysTickAtChkPt8 is being passed */
+ uint64_t sysTickAtChkPt8;
+ /**< Latency measurement at checkpoint 8. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 9 */
+ uint8_t sysTickAtChkPt9_valid; /**< Must be set to true if sysTickAtChkPt9 is being passed */
+ uint64_t sysTickAtChkPt9;
+ /**< Latency measurement at checkpoint 9. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Latency Measurement at Checkpoint 10 */
+ uint8_t sysTickAtChkPt10_valid; /**< Must be set to true if sysTickAtChkPt10 is being passed */
+ uint64_t sysTickAtChkPt10;
+ /**< Latency measurement at checkpoint 10. \n
+ - Units -- ticks */
+
+ /* Optional */
+ /* Measurement Report Frame Count */
+ uint8_t fCountOfMeasBlk_valid; /**< Must be set to true if fCountOfMeasBlk is being passed */
+ uint32_t fCountOfMeasBlk;
+ /**< Time information to tie measblk and latency IPC. */
+}qmiLocLatencyInformationIndMsgT_v02; /* Message */
+/**
+ @}
+ */
+
+/* Conditional compilation tags for message removal */
+//#define REMOVE_QMI_LOC_ADD_CIRCULAR_GEOFENCE_V02
+//#define REMOVE_QMI_LOC_ADD_GEOFENCE_CONTEXT_V02
+//#define REMOVE_QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_V02
+//#define REMOVE_QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_V02
+//#define REMOVE_QMI_LOC_DC_REPORT_V02
+//#define REMOVE_QMI_LOC_DELETE_ASSIST_DATA_V02
+//#define REMOVE_QMI_LOC_DELETE_GEOFENCE_V02
+//#define REMOVE_QMI_LOC_DELETE_GEOFENCE_CONTEXT_V02
+//#define REMOVE_QMI_LOC_DELETE_GNSS_SERVICE_DATA_V02
+//#define REMOVE_QMI_LOC_DELETE_SUPL_CERTIFICATE_V02
+//#define REMOVE_QMI_LOC_EDIT_GEOFENCE_V02
+//#define REMOVE_QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_V02
+//#define REMOVE_QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_V02
+//#define REMOVE_QMI_LOC_EVENT_BATCHING_STATUS_V02
+//#define REMOVE_QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_V02
+//#define REMOVE_QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_DBT_POSITION_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_DBT_SESSION_STATUS_V02
+//#define REMOVE_QMI_LOC_EVENT_ENGINE_LOCK_STATE_V02
+//#define REMOVE_QMI_LOC_EVENT_ENGINE_STATE_V02
+//#define REMOVE_QMI_LOC_EVENT_FDCL_SERVICE_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_FIX_SESSION_STATE_V02
+//#define REMOVE_QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_GDT_RECEIVE_DONE_V02
+//#define REMOVE_QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_V02
+//#define REMOVE_QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_V02
+//#define REMOVE_QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_V02
+//#define REMOVE_QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_V02
+//#define REMOVE_QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_V02
+//#define REMOVE_QMI_LOC_EVENT_GET_TIME_ZONE_INFO_V02
+//#define REMOVE_QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02
+//#define REMOVE_QMI_LOC_EVENT_GNSS_SV_INFO_V02
+//#define REMOVE_QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_INJECT_POSITION_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_INJECT_TIME_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_INJECT_WIFI_AP_DATA_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_INTERNAL_STATUS_REPORT_IND_V02
+//#define REMOVE_QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_MOTION_DATA_CONTROL_V02
+//#define REMOVE_QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_V02
+//#define REMOVE_QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_NMEA_V02
+//#define REMOVE_QMI_LOC_EVENT_PEDOMETER_CONTROL_V02
+//#define REMOVE_QMI_LOC_EVENT_POSITION_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_QUERY_XTRA_INFO_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_SAP_INS_PARAMETERS_V02
+//#define REMOVE_QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_V02
+//#define REMOVE_QMI_LOC_EVENT_SET_SPI_STREAMING_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02
+//#define REMOVE_QMI_LOC_EVENT_TIME_SYNC_REQ_V02
+//#define REMOVE_QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_V02
+//#define REMOVE_QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_V02
+//#define REMOVE_QMI_LOC_EVENT_WIFI_REQ_V02
+//#define REMOVE_QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_V02
+//#define REMOVE_QMI_LOC_GDT_DOWNLOAD_END_STATUS_V02
+//#define REMOVE_QMI_LOC_GDT_DOWNLOAD_READY_STATUS_V02
+//#define REMOVE_QMI_LOC_GDT_RECEIVE_DONE_STATUS_V02
+//#define REMOVE_QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_V02
+//#define REMOVE_QMI_LOC_GDT_UPLOAD_END_V02
+//#define REMOVE_QMI_LOC_GET_AVAILABLE_WWAN_POSITION_V02
+//#define REMOVE_QMI_LOC_GET_BAND_MEASUREMENT_METRICS_V02
+//#define REMOVE_QMI_LOC_GET_BATCH_SIZE_V02
+//#define REMOVE_QMI_LOC_GET_BEST_AVAILABLE_POSITION_V02
+//#define REMOVE_QMI_LOC_GET_BLACKLIST_SV_V02
+//#define REMOVE_QMI_LOC_GET_BS_OBS_DATA_V02
+//#define REMOVE_QMI_LOC_GET_CONSTELLATION_CONTROL_V02
+//#define REMOVE_QMI_LOC_GET_CRADLE_MOUNT_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_ENGINE_LOCK_V02
+//#define REMOVE_QMI_LOC_GET_EXTERNAL_POWER_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_FDCL_BS_LIST_V02
+//#define REMOVE_QMI_LOC_GET_FIX_CRITERIA_V02
+//#define REMOVE_QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_GNSS_PDR_MODE_V02
+//#define REMOVE_QMI_LOC_GET_LOW_POWER_MODE_V02
+//#define REMOVE_QMI_LOC_GET_MAG_CAL_STATE_PDR_V02
+//#define REMOVE_QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_V02
+//#define REMOVE_QMI_LOC_GET_MULTIBAND_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_NI_GEOFENCE_ID_LIST_V02
+//#define REMOVE_QMI_LOC_GET_NMEA_TYPES_V02
+//#define REMOVE_QMI_LOC_GET_OPERATION_MODE_V02
+//#define REMOVE_QMI_LOC_GET_PARAMETER_V02
+//#define REMOVE_QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_V02
+//#define REMOVE_QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_V02
+//#define REMOVE_QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_V02
+//#define REMOVE_QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_V02
+//#define REMOVE_QMI_LOC_GET_REGISTERED_EVENTS_V02
+//#define REMOVE_QMI_LOC_GET_ROBUST_LOCATION_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_SBAS_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_SENSOR_CONTROL_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_V02
+//#define REMOVE_QMI_LOC_GET_SENSOR_PROPERTIES_V02
+//#define REMOVE_QMI_LOC_GET_SERVER_V02
+//#define REMOVE_QMI_LOC_GET_SERVICE_REVISION_V02
+//#define REMOVE_QMI_LOC_GET_STATISTICS_CONFIG_V02
+//#define REMOVE_QMI_LOC_GET_SUPPORTED_FEATURE_V02
+//#define REMOVE_QMI_LOC_GET_SUPPORTED_FIELDS_V02
+//#define REMOVE_QMI_LOC_GET_SUPPORTED_MSGS_V02
+//#define REMOVE_QMI_LOC_GET_XTRA_T_SESSION_CONTROL_V02
+//#define REMOVE_QMI_LOC_GNSS_STATISTICS_REPORT_V02
+//#define REMOVE_QMI_LOC_GTP_AP_STATUS_V02
+//#define REMOVE_QMI_LOC_INFORM_CLIENT_REVISION_V02
+//#define REMOVE_QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_V02
+//#define REMOVE_QMI_LOC_INFORM_NI_USER_RESPONSE_V02
+//#define REMOVE_QMI_LOC_INJECT_APCACHE_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_APDONOTCACHE_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_ENV_AIDING_V02
+//#define REMOVE_QMI_LOC_INJECT_FDCL_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_GSM_CELL_INFO_V02
+//#define REMOVE_QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_MOTION_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_V02
+//#define REMOVE_QMI_LOC_INJECT_PLATFORM_POWER_STATE_V02
+//#define REMOVE_QMI_LOC_INJECT_POSITION_V02
+//#define REMOVE_QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_SENSOR_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_SRN_AP_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_SUBSCRIBER_ID_V02
+//#define REMOVE_QMI_LOC_INJECT_SUPL_CERTIFICATE_V02
+//#define REMOVE_QMI_LOC_INJECT_TDSCDMA_CELL_INFO_V02
+//#define REMOVE_QMI_LOC_INJECT_TEST_POSITION_V02
+//#define REMOVE_QMI_LOC_INJECT_TIME_SYNC_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_TIME_ZONE_INFO_V02
+//#define REMOVE_QMI_LOC_INJECT_UTC_TIME_V02
+//#define REMOVE_QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_WCDMA_CELL_INFO_V02
+//#define REMOVE_QMI_LOC_INJECT_WIFI_AP_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_WIFI_POSITION_V02
+//#define REMOVE_QMI_LOC_INJECT_XTRA_DATA_V02
+//#define REMOVE_QMI_LOC_INJECT_XTRA_PCID_V02
+//#define REMOVE_QMI_LOC_LATENCY_INFORMATION_V02
+//#define REMOVE_QMI_LOC_LOCATION_REQUEST_NOTIFICATION_V02
+//#define REMOVE_QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_V02
+//#define REMOVE_QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_V02
+//#define REMOVE_QMI_LOC_NOTIFY_WIFI_STATUS_V02
+//#define REMOVE_QMI_LOC_PEDOMETER_REPORT_V02
+//#define REMOVE_QMI_LOC_QUERY_AON_CONFIG_V02
+//#define REMOVE_QMI_LOC_QUERY_GEOFENCE_V02
+//#define REMOVE_QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_V02
+//#define REMOVE_QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_V02
+//#define REMOVE_QMI_LOC_QUERY_XTRA_INFO_V02
+//#define REMOVE_QMI_LOC_READ_FROM_BATCH_V02
+//#define REMOVE_QMI_LOC_REGISTER_MASTER_CLIENT_V02
+//#define REMOVE_QMI_LOC_REG_EVENTS_V02
+//#define REMOVE_QMI_LOC_RELEASE_BATCH_V02
+//#define REMOVE_QMI_LOC_SECURE_GET_AVAILABLE_POSITION_V02
+//#define REMOVE_QMI_LOC_SET_BLACKLIST_SV_V02
+//#define REMOVE_QMI_LOC_SET_CONSTELLATION_CONTROL_V02
+//#define REMOVE_QMI_LOC_SET_CONSTRAINED_TUNC_MODE_V02
+//#define REMOVE_QMI_LOC_SET_CRADLE_MOUNT_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_ENGINE_LOCK_V02
+//#define REMOVE_QMI_LOC_SET_EXTERNAL_POWER_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_V02
+//#define REMOVE_QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_GNSS_PDR_MODE_V02
+//#define REMOVE_QMI_LOC_SET_INTERNAL_STATUS_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_LOW_POWER_MODE_V02
+//#define REMOVE_QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_V02
+//#define REMOVE_QMI_LOC_SET_MULTIBAND_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_NMEA_TYPES_V02
+//#define REMOVE_QMI_LOC_SET_OPERATION_MODE_V02
+//#define REMOVE_QMI_LOC_SET_PARAMETER_V02
+//#define REMOVE_QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_V02
+//#define REMOVE_QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_V02
+//#define REMOVE_QMI_LOC_SET_ROBUST_LOCATION_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_SBAS_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_SENSOR_CONTROL_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_V02
+//#define REMOVE_QMI_LOC_SET_SENSOR_PROPERTIES_V02
+//#define REMOVE_QMI_LOC_SET_SERVER_V02
+//#define REMOVE_QMI_LOC_SET_SPI_STATUS_V02
+//#define REMOVE_QMI_LOC_SET_STATISTICS_CONFIG_V02
+//#define REMOVE_QMI_LOC_SET_XTRA_T_SESSION_CONTROL_V02
+//#define REMOVE_QMI_LOC_SET_XTRA_VERSION_CHECK_V02
+//#define REMOVE_QMI_LOC_START_V02
+//#define REMOVE_QMI_LOC_START_BATCHING_V02
+//#define REMOVE_QMI_LOC_START_DBT_V02
+//#define REMOVE_QMI_LOC_START_LISTEN_POSITION_V02
+//#define REMOVE_QMI_LOC_START_OUTDOOR_TRIP_BATCHING_V02
+//#define REMOVE_QMI_LOC_STOP_V02
+//#define REMOVE_QMI_LOC_STOP_BATCHING_V02
+//#define REMOVE_QMI_LOC_STOP_DBT_V02
+//#define REMOVE_QMI_LOC_STOP_LISTEN_POSITION_V02
+//#define REMOVE_QMI_LOC_SYSTEM_INFO_V02
+//#define REMOVE_QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_V02
+
+/*Service Message Definition*/
+/** @addtogroup loc_qmi_msg_ids
+ @{
+ */
+#define QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02 0x001E
+#define QMI_LOC_GET_SUPPORTED_MSGS_RESP_V02 0x001E
+#define QMI_LOC_GET_SUPPORTED_FIELDS_REQ_V02 0x001F
+#define QMI_LOC_GET_SUPPORTED_FIELDS_RESP_V02 0x001F
+#define QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02 0x0020
+#define QMI_LOC_INFORM_CLIENT_REVISION_RESP_V02 0x0020
+#define QMI_LOC_REG_EVENTS_REQ_V02 0x0021
+#define QMI_LOC_REG_EVENTS_RESP_V02 0x0021
+#define QMI_LOC_START_REQ_V02 0x0022
+#define QMI_LOC_START_RESP_V02 0x0022
+#define QMI_LOC_STOP_REQ_V02 0x0023
+#define QMI_LOC_STOP_RESP_V02 0x0023
+#define QMI_LOC_EVENT_POSITION_REPORT_IND_V02 0x0024
+#define QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02 0x0025
+#define QMI_LOC_EVENT_NMEA_IND_V02 0x0026
+#define QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02 0x0027
+#define QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02 0x0028
+#define QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02 0x0029
+#define QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02 0x002A
+#define QMI_LOC_EVENT_ENGINE_STATE_IND_V02 0x002B
+#define QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02 0x002C
+#define QMI_LOC_EVENT_WIFI_REQ_IND_V02 0x002D
+#define QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_IND_V02 0x002E
+#define QMI_LOC_EVENT_TIME_SYNC_REQ_IND_V02 0x002F
+#define QMI_LOC_EVENT_SET_SPI_STREAMING_REPORT_IND_V02 0x0030
+#define QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02 0x0031
+#define QMI_LOC_GET_SERVICE_REVISION_REQ_V02 0x0032
+#define QMI_LOC_GET_SERVICE_REVISION_RESP_V02 0x0032
+#define QMI_LOC_GET_SERVICE_REVISION_IND_V02 0x0032
+#define QMI_LOC_GET_FIX_CRITERIA_REQ_V02 0x0033
+#define QMI_LOC_GET_FIX_CRITERIA_RESP_V02 0x0033
+#define QMI_LOC_GET_FIX_CRITERIA_IND_V02 0x0033
+#define QMI_LOC_NI_USER_RESPONSE_REQ_V02 0x0034
+#define QMI_LOC_NI_USER_RESPONSE_RESP_V02 0x0034
+#define QMI_LOC_NI_USER_RESPONSE_IND_V02 0x0034
+#define QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02 0x0035
+#define QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_RESP_V02 0x0035
+#define QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02 0x0035
+#define QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02 0x0036
+#define QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_RESP_V02 0x0036
+#define QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_IND_V02 0x0036
+#define QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_REQ_V02 0x0037
+#define QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_RESP_V02 0x0037
+#define QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_IND_V02 0x0037
+#define QMI_LOC_INJECT_UTC_TIME_REQ_V02 0x0038
+#define QMI_LOC_INJECT_UTC_TIME_RESP_V02 0x0038
+#define QMI_LOC_INJECT_UTC_TIME_IND_V02 0x0038
+#define QMI_LOC_INJECT_POSITION_REQ_V02 0x0039
+#define QMI_LOC_INJECT_POSITION_RESP_V02 0x0039
+#define QMI_LOC_INJECT_POSITION_IND_V02 0x0039
+#define QMI_LOC_SET_ENGINE_LOCK_REQ_V02 0x003A
+#define QMI_LOC_SET_ENGINE_LOCK_RESP_V02 0x003A
+#define QMI_LOC_SET_ENGINE_LOCK_IND_V02 0x003A
+#define QMI_LOC_GET_ENGINE_LOCK_REQ_V02 0x003B
+#define QMI_LOC_GET_ENGINE_LOCK_RESP_V02 0x003B
+#define QMI_LOC_GET_ENGINE_LOCK_IND_V02 0x003B
+#define QMI_LOC_SET_SBAS_CONFIG_REQ_V02 0x003C
+#define QMI_LOC_SET_SBAS_CONFIG_RESP_V02 0x003C
+#define QMI_LOC_SET_SBAS_CONFIG_IND_V02 0x003C
+#define QMI_LOC_GET_SBAS_CONFIG_REQ_V02 0x003D
+#define QMI_LOC_GET_SBAS_CONFIG_RESP_V02 0x003D
+#define QMI_LOC_GET_SBAS_CONFIG_IND_V02 0x003D
+#define QMI_LOC_SET_NMEA_TYPES_REQ_V02 0x003E
+#define QMI_LOC_SET_NMEA_TYPES_RESP_V02 0x003E
+#define QMI_LOC_SET_NMEA_TYPES_IND_V02 0x003E
+#define QMI_LOC_GET_NMEA_TYPES_REQ_V02 0x003F
+#define QMI_LOC_GET_NMEA_TYPES_RESP_V02 0x003F
+#define QMI_LOC_GET_NMEA_TYPES_IND_V02 0x003F
+#define QMI_LOC_SET_LOW_POWER_MODE_REQ_V02 0x0040
+#define QMI_LOC_SET_LOW_POWER_MODE_RESP_V02 0x0040
+#define QMI_LOC_SET_LOW_POWER_MODE_IND_V02 0x0040
+#define QMI_LOC_GET_LOW_POWER_MODE_REQ_V02 0x0041
+#define QMI_LOC_GET_LOW_POWER_MODE_RESP_V02 0x0041
+#define QMI_LOC_GET_LOW_POWER_MODE_IND_V02 0x0041
+#define QMI_LOC_SET_SERVER_REQ_V02 0x0042
+#define QMI_LOC_SET_SERVER_RESP_V02 0x0042
+#define QMI_LOC_SET_SERVER_IND_V02 0x0042
+#define QMI_LOC_GET_SERVER_REQ_V02 0x0043
+#define QMI_LOC_GET_SERVER_RESP_V02 0x0043
+#define QMI_LOC_GET_SERVER_IND_V02 0x0043
+#define QMI_LOC_DELETE_ASSIST_DATA_REQ_V02 0x0044
+#define QMI_LOC_DELETE_ASSIST_DATA_RESP_V02 0x0044
+#define QMI_LOC_DELETE_ASSIST_DATA_IND_V02 0x0044
+#define QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02 0x0045
+#define QMI_LOC_SET_XTRA_T_SESSION_CONTROL_RESP_V02 0x0045
+#define QMI_LOC_SET_XTRA_T_SESSION_CONTROL_IND_V02 0x0045
+#define QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ_V02 0x0046
+#define QMI_LOC_GET_XTRA_T_SESSION_CONTROL_RESP_V02 0x0046
+#define QMI_LOC_GET_XTRA_T_SESSION_CONTROL_IND_V02 0x0046
+#define QMI_LOC_INJECT_WIFI_POSITION_REQ_V02 0x0047
+#define QMI_LOC_INJECT_WIFI_POSITION_RESP_V02 0x0047
+#define QMI_LOC_INJECT_WIFI_POSITION_IND_V02 0x0047
+#define QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02 0x0048
+#define QMI_LOC_NOTIFY_WIFI_STATUS_RESP_V02 0x0048
+#define QMI_LOC_NOTIFY_WIFI_STATUS_IND_V02 0x0048
+#define QMI_LOC_GET_REGISTERED_EVENTS_REQ_V02 0x0049
+#define QMI_LOC_GET_REGISTERED_EVENTS_RESP_V02 0x0049
+#define QMI_LOC_GET_REGISTERED_EVENTS_IND_V02 0x0049
+#define QMI_LOC_SET_OPERATION_MODE_REQ_V02 0x004A
+#define QMI_LOC_SET_OPERATION_MODE_RESP_V02 0x004A
+#define QMI_LOC_SET_OPERATION_MODE_IND_V02 0x004A
+#define QMI_LOC_GET_OPERATION_MODE_REQ_V02 0x004B
+#define QMI_LOC_GET_OPERATION_MODE_RESP_V02 0x004B
+#define QMI_LOC_GET_OPERATION_MODE_IND_V02 0x004B
+#define QMI_LOC_SET_SPI_STATUS_REQ_V02 0x004C
+#define QMI_LOC_SET_SPI_STATUS_RESP_V02 0x004C
+#define QMI_LOC_SET_SPI_STATUS_IND_V02 0x004C
+#define QMI_LOC_INJECT_SENSOR_DATA_REQ_V02 0x004D
+#define QMI_LOC_INJECT_SENSOR_DATA_RESP_V02 0x004D
+#define QMI_LOC_INJECT_SENSOR_DATA_IND_V02 0x004D
+#define QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02 0x004E
+#define QMI_LOC_INJECT_TIME_SYNC_DATA_RESP_V02 0x004E
+#define QMI_LOC_INJECT_TIME_SYNC_DATA_IND_V02 0x004E
+#define QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ_V02 0x004F
+#define QMI_LOC_SET_CRADLE_MOUNT_CONFIG_RESP_V02 0x004F
+#define QMI_LOC_SET_CRADLE_MOUNT_CONFIG_IND_V02 0x004F
+#define QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02 0x0050
+#define QMI_LOC_GET_CRADLE_MOUNT_CONFIG_RESP_V02 0x0050
+#define QMI_LOC_GET_CRADLE_MOUNT_CONFIG_IND_V02 0x0050
+#define QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02 0x0051
+#define QMI_LOC_SET_EXTERNAL_POWER_CONFIG_RESP_V02 0x0051
+#define QMI_LOC_SET_EXTERNAL_POWER_CONFIG_IND_V02 0x0051
+#define QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02 0x0052
+#define QMI_LOC_GET_EXTERNAL_POWER_CONFIG_RESP_V02 0x0052
+#define QMI_LOC_GET_EXTERNAL_POWER_CONFIG_IND_V02 0x0052
+#define QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02 0x0053
+#define QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_RESP_V02 0x0053
+#define QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02 0x0053
+#define QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02 0x0054
+#define QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_RESP_V02 0x0054
+#define QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02 0x0054
+#define QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02 0x0055
+#define QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_RESP_V02 0x0055
+#define QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_IND_V02 0x0055
+#define QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02 0x0056
+#define QMI_LOC_SET_SENSOR_CONTROL_CONFIG_RESP_V02 0x0056
+#define QMI_LOC_SET_SENSOR_CONTROL_CONFIG_IND_V02 0x0056
+#define QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02 0x0057
+#define QMI_LOC_GET_SENSOR_CONTROL_CONFIG_RESP_V02 0x0057
+#define QMI_LOC_GET_SENSOR_CONTROL_CONFIG_IND_V02 0x0057
+#define QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02 0x0058
+#define QMI_LOC_SET_SENSOR_PROPERTIES_RESP_V02 0x0058
+#define QMI_LOC_SET_SENSOR_PROPERTIES_IND_V02 0x0058
+#define QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02 0x0059
+#define QMI_LOC_GET_SENSOR_PROPERTIES_RESP_V02 0x0059
+#define QMI_LOC_GET_SENSOR_PROPERTIES_IND_V02 0x0059
+#define QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02 0x005A
+#define QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_RESP_V02 0x005A
+#define QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02 0x005A
+#define QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02 0x005B
+#define QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_RESP_V02 0x005B
+#define QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_IND_V02 0x005B
+#define QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02 0x005C
+#define QMI_LOC_INJECT_SUPL_CERTIFICATE_RESP_V02 0x005C
+#define QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02 0x005C
+#define QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02 0x005D
+#define QMI_LOC_DELETE_SUPL_CERTIFICATE_RESP_V02 0x005D
+#define QMI_LOC_DELETE_SUPL_CERTIFICATE_IND_V02 0x005D
+#define QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02 0x005E
+#define QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_RESP_V02 0x005E
+#define QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02 0x005E
+#define QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02 0x005F
+#define QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_RESP_V02 0x005F
+#define QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02 0x005F
+#define QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02 0x0060
+#define QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02 0x0061
+#define QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02 0x0062
+#define QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02 0x0063
+#define QMI_LOC_ADD_CIRCULAR_GEOFENCE_RESP_V02 0x0063
+#define QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02 0x0063
+#define QMI_LOC_DELETE_GEOFENCE_REQ_V02 0x0064
+#define QMI_LOC_DELETE_GEOFENCE_RESP_V02 0x0064
+#define QMI_LOC_DELETE_GEOFENCE_IND_V02 0x0064
+#define QMI_LOC_QUERY_GEOFENCE_REQ_V02 0x0065
+#define QMI_LOC_QUERY_GEOFENCE_RESP_V02 0x0065
+#define QMI_LOC_QUERY_GEOFENCE_IND_V02 0x0065
+#define QMI_LOC_EDIT_GEOFENCE_REQ_V02 0x0066
+#define QMI_LOC_EDIT_GEOFENCE_RESP_V02 0x0066
+#define QMI_LOC_EDIT_GEOFENCE_IND_V02 0x0066
+#define QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02 0x0067
+#define QMI_LOC_GET_BEST_AVAILABLE_POSITION_RESP_V02 0x0067
+#define QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02 0x0067
+#define QMI_LOC_INJECT_MOTION_DATA_REQ_V02 0x0068
+#define QMI_LOC_INJECT_MOTION_DATA_RESP_V02 0x0068
+#define QMI_LOC_INJECT_MOTION_DATA_IND_V02 0x0068
+#define QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02 0x0069
+#define QMI_LOC_GET_NI_GEOFENCE_ID_LIST_RESP_V02 0x0069
+#define QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02 0x0069
+#define QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02 0x006A
+#define QMI_LOC_INJECT_GSM_CELL_INFO_RESP_V02 0x006A
+#define QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02 0x006A
+#define QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02 0x006B
+#define QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_RESP_V02 0x006B
+#define QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02 0x006B
+#define QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02 0x006C
+#define QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_RESP_V02 0x006C
+#define QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_IND_V02 0x006C
+#define QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02 0x006D
+#define QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02 0x006E
+#define QMI_LOC_PEDOMETER_REPORT_REQ_V02 0x006F
+#define QMI_LOC_PEDOMETER_REPORT_RESP_V02 0x006F
+#define QMI_LOC_PEDOMETER_REPORT_IND_V02 0x006F
+#define QMI_LOC_INJECT_WCDMA_CELL_INFO_REQ_V02 0x0070
+#define QMI_LOC_INJECT_WCDMA_CELL_INFO_RESP_V02 0x0070
+#define QMI_LOC_INJECT_WCDMA_CELL_INFO_IND_V02 0x0070
+#define QMI_LOC_INJECT_TDSCDMA_CELL_INFO_REQ_V02 0x0071
+#define QMI_LOC_INJECT_TDSCDMA_CELL_INFO_RESP_V02 0x0071
+#define QMI_LOC_INJECT_TDSCDMA_CELL_INFO_IND_V02 0x0071
+#define QMI_LOC_INJECT_SUBSCRIBER_ID_REQ_V02 0x0072
+#define QMI_LOC_INJECT_SUBSCRIBER_ID_RESP_V02 0x0072
+#define QMI_LOC_INJECT_SUBSCRIBER_ID_IND_V02 0x0072
+#define QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_REQ_V02 0x0073
+#define QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_RESP_V02 0x0073
+#define QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_IND_V02 0x0073
+#define QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_REQ_V02 0x0074
+#define QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_RESP_V02 0x0074
+#define QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_IND_V02 0x0074
+#define QMI_LOC_GET_BATCH_SIZE_REQ_V02 0x0075
+#define QMI_LOC_GET_BATCH_SIZE_RESP_V02 0x0075
+#define QMI_LOC_GET_BATCH_SIZE_IND_V02 0x0075
+#define QMI_LOC_START_BATCHING_REQ_V02 0x0076
+#define QMI_LOC_START_BATCHING_RESP_V02 0x0076
+#define QMI_LOC_START_BATCHING_IND_V02 0x0076
+#define QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02 0x0077
+#define QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02 0x0078
+#define QMI_LOC_READ_FROM_BATCH_REQ_V02 0x0079
+#define QMI_LOC_READ_FROM_BATCH_RESP_V02 0x0079
+#define QMI_LOC_READ_FROM_BATCH_IND_V02 0x0079
+#define QMI_LOC_STOP_BATCHING_REQ_V02 0x007A
+#define QMI_LOC_STOP_BATCHING_RESP_V02 0x007A
+#define QMI_LOC_STOP_BATCHING_IND_V02 0x007A
+#define QMI_LOC_RELEASE_BATCH_REQ_V02 0x007B
+#define QMI_LOC_RELEASE_BATCH_RESP_V02 0x007B
+#define QMI_LOC_RELEASE_BATCH_IND_V02 0x007B
+#define QMI_LOC_EVENT_INJECT_WIFI_AP_DATA_REQ_IND_V02 0x007C
+#define QMI_LOC_INJECT_WIFI_AP_DATA_REQ_V02 0x007D
+#define QMI_LOC_INJECT_WIFI_AP_DATA_RESP_V02 0x007D
+#define QMI_LOC_INJECT_WIFI_AP_DATA_IND_V02 0x007D
+#define QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_REQ_V02 0x007E
+#define QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_RESP_V02 0x007E
+#define QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_IND_V02 0x007E
+#define QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_REQ_V02 0x007F
+#define QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_RESP_V02 0x007F
+#define QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_IND_V02 0x007F
+#define QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02 0x0080
+#define QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_IND_V02 0x0081
+#define QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02 0x0082
+#define QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_RESP_V02 0x0082
+#define QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_IND_V02 0x0082
+#define QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02 0x0083
+#define QMI_LOC_GET_AVAILABLE_WWAN_POSITION_RESP_V02 0x0083
+#define QMI_LOC_GET_AVAILABLE_WWAN_POSITION_IND_V02 0x0083
+#define QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_REQ_V02 0x0084
+#define QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_RESP_V02 0x0084
+#define QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_IND_V02 0x0084
+#define QMI_LOC_SET_XTRA_VERSION_CHECK_REQ_V02 0x0085
+#define QMI_LOC_SET_XTRA_VERSION_CHECK_RESP_V02 0x0085
+#define QMI_LOC_SET_XTRA_VERSION_CHECK_IND_V02 0x0085
+#define QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02 0x0086
+#define QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02 0x0087
+#define QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02 0x0088
+#define QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_RESP_V02 0x0088
+#define QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_IND_V02 0x0088
+#define QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ_V02 0x0089
+#define QMI_LOC_ADD_GEOFENCE_CONTEXT_RESP_V02 0x0089
+#define QMI_LOC_ADD_GEOFENCE_CONTEXT_IND_V02 0x0089
+#define QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_REQ_V02 0x008A
+#define QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_RESP_V02 0x008A
+#define QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_IND_V02 0x008A
+#define QMI_LOC_DELETE_GEOFENCE_CONTEXT_REQ_V02 0x008B
+#define QMI_LOC_DELETE_GEOFENCE_CONTEXT_RESP_V02 0x008B
+#define QMI_LOC_DELETE_GEOFENCE_CONTEXT_IND_V02 0x008B
+#define QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_IND_V02 0x008C
+#define QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_REQ_V02 0x008D
+#define QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_RESP_V02 0x008D
+#define QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_IND_V02 0x008D
+#define QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_REQ_V02 0x008E
+#define QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_RESP_V02 0x008E
+#define QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_IND_V02 0x008E
+#define QMI_LOC_GDT_UPLOAD_END_REQ_V02 0x008F
+#define QMI_LOC_GDT_UPLOAD_END_RESP_V02 0x008F
+#define QMI_LOC_GDT_UPLOAD_END_IND_V02 0x008F
+#define QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_IND_V02 0x0090
+#define QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_IND_V02 0x0091
+#define QMI_LOC_START_DBT_REQ_V02 0x0092
+#define QMI_LOC_START_DBT_RESP_V02 0x0092
+#define QMI_LOC_START_DBT_IND_V02 0x0092
+#define QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02 0x0093
+#define QMI_LOC_EVENT_DBT_SESSION_STATUS_IND_V02 0x0094
+#define QMI_LOC_STOP_DBT_REQ_V02 0x0095
+#define QMI_LOC_STOP_DBT_RESP_V02 0x0095
+#define QMI_LOC_STOP_DBT_IND_V02 0x0095
+#define QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ_V02 0x0096
+#define QMI_LOC_SECURE_GET_AVAILABLE_POSITION_RESP_V02 0x0096
+#define QMI_LOC_SECURE_GET_AVAILABLE_POSITION_IND_V02 0x0096
+#define QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02 0x0097
+#define QMI_LOC_EVENT_GET_TIME_ZONE_INFO_IND_V02 0x0098
+#define QMI_LOC_INJECT_TIME_ZONE_INFO_REQ_V02 0x0099
+#define QMI_LOC_INJECT_TIME_ZONE_INFO_RESP_V02 0x0099
+#define QMI_LOC_INJECT_TIME_ZONE_INFO_IND_V02 0x0099
+#define QMI_LOC_INJECT_APCACHE_DATA_REQ_V02 0x009A
+#define QMI_LOC_INJECT_APCACHE_DATA_RESP_V02 0x009A
+#define QMI_LOC_INJECT_APCACHE_DATA_IND_V02 0x009A
+#define QMI_LOC_INJECT_APDONOTCACHE_DATA_REQ_V02 0x009B
+#define QMI_LOC_INJECT_APDONOTCACHE_DATA_RESP_V02 0x009B
+#define QMI_LOC_INJECT_APDONOTCACHE_DATA_IND_V02 0x009B
+#define QMI_LOC_EVENT_BATCHING_STATUS_IND_V02 0x009C
+#define QMI_LOC_QUERY_AON_CONFIG_REQ_V02 0x009D
+#define QMI_LOC_QUERY_AON_CONFIG_RESP_V02 0x009D
+#define QMI_LOC_QUERY_AON_CONFIG_IND_V02 0x009D
+#define QMI_LOC_GTP_AP_STATUS_REQ_V02 0x009E
+#define QMI_LOC_GTP_AP_STATUS_RESP_V02 0x009E
+#define QMI_LOC_GTP_AP_STATUS_IND_V02 0x009E
+#define QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02 0x009F
+#define QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_RESP_V02 0x009F
+#define QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_IND_V02 0x009F
+#define QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02 0x00A0
+#define QMI_LOC_GDT_DOWNLOAD_READY_STATUS_RESP_V02 0x00A0
+#define QMI_LOC_GDT_DOWNLOAD_READY_STATUS_IND_V02 0x00A0
+#define QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02 0x00A1
+#define QMI_LOC_GDT_RECEIVE_DONE_STATUS_RESP_V02 0x00A1
+#define QMI_LOC_GDT_RECEIVE_DONE_STATUS_IND_V02 0x00A1
+#define QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02 0x00A2
+#define QMI_LOC_GDT_DOWNLOAD_END_STATUS_RESP_V02 0x00A2
+#define QMI_LOC_GDT_DOWNLOAD_END_STATUS_IND_V02 0x00A2
+#define QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02 0x00A3
+#define QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02 0x00A4
+#define QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02 0x00A5
+#define QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02 0x00A6
+#define QMI_LOC_DELETE_GNSS_SERVICE_DATA_RESP_V02 0x00A6
+#define QMI_LOC_DELETE_GNSS_SERVICE_DATA_IND_V02 0x00A6
+#define QMI_LOC_INJECT_XTRA_DATA_REQ_V02 0x00A7
+#define QMI_LOC_INJECT_XTRA_DATA_RESP_V02 0x00A7
+#define QMI_LOC_INJECT_XTRA_DATA_IND_V02 0x00A7
+#define QMI_LOC_INJECT_XTRA_PCID_REQ_V02 0x00A8
+#define QMI_LOC_INJECT_XTRA_PCID_RESP_V02 0x00A8
+#define QMI_LOC_INJECT_XTRA_PCID_IND_V02 0x00A8
+#define QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02 0x00A9
+#define QMI_LOC_GET_SUPPORTED_FEATURE_RESP_V02 0x00A9
+#define QMI_LOC_GET_SUPPORTED_FEATURE_IND_V02 0x00A9
+#define QMI_LOC_SET_INTERNAL_STATUS_CONFIG_REQ_V02 0x00AA
+#define QMI_LOC_SET_INTERNAL_STATUS_CONFIG_RESP_V02 0x00AA
+#define QMI_LOC_SET_INTERNAL_STATUS_CONFIG_IND_V02 0x00AA
+#define QMI_LOC_EVENT_INTERNAL_STATUS_REPORT_IND_V02 0x00AB
+#define QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_IND_V02 0x00AC
+#define QMI_LOC_INJECT_SRN_AP_DATA_REQ_V02 0x00AD
+#define QMI_LOC_INJECT_SRN_AP_DATA_RESP_V02 0x00AD
+#define QMI_LOC_INJECT_SRN_AP_DATA_IND_V02 0x00AD
+#define QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ_V02 0x00AE
+#define QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_RESP_V02 0x00AE
+#define QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_IND_V02 0x00AE
+#define QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_REQ_V02 0x00AF
+#define QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_RESP_V02 0x00AF
+#define QMI_LOC_QUERY_XTRA_INFO_REQ_V02 0x00B0
+#define QMI_LOC_QUERY_XTRA_INFO_RESP_V02 0x00B0
+#define QMI_LOC_QUERY_XTRA_INFO_IND_V02 0x00B0
+#define QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ_V02 0x00B1
+#define QMI_LOC_START_OUTDOOR_TRIP_BATCHING_RESP_V02 0x00B1
+#define QMI_LOC_START_OUTDOOR_TRIP_BATCHING_IND_V02 0x00B1
+#define QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02 0x00B2
+#define QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_RESP_V02 0x00B2
+#define QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_IND_V02 0x00B2
+#define QMI_LOC_EVENT_FDCL_SERVICE_REQ_IND_V02 0x00B3
+#define QMI_LOC_GET_FDCL_BS_LIST_REQ_V02 0x00B4
+#define QMI_LOC_GET_FDCL_BS_LIST_RESP_V02 0x00B4
+#define QMI_LOC_GET_FDCL_BS_LIST_IND_V02 0x00B4
+#define QMI_LOC_INJECT_FDCL_DATA_REQ_V02 0x00B5
+#define QMI_LOC_INJECT_FDCL_DATA_RESP_V02 0x00B5
+#define QMI_LOC_INJECT_FDCL_DATA_IND_V02 0x00B5
+#define QMI_LOC_SET_BLACKLIST_SV_REQ_V02 0x00B6
+#define QMI_LOC_SET_BLACKLIST_SV_RESP_V02 0x00B6
+#define QMI_LOC_SET_BLACKLIST_SV_IND_V02 0x00B6
+#define QMI_LOC_GET_BLACKLIST_SV_REQ_V02 0x00B7
+#define QMI_LOC_GET_BLACKLIST_SV_RESP_V02 0x00B7
+#define QMI_LOC_GET_BLACKLIST_SV_IND_V02 0x00B7
+#define QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02 0x00B8
+#define QMI_LOC_SET_CONSTELLATION_CONTROL_RESP_V02 0x00B8
+#define QMI_LOC_SET_CONSTELLATION_CONTROL_IND_V02 0x00B8
+#define QMI_LOC_DC_REPORT_IND_V02 0x00B9
+#define QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02 0x00BA
+#define QMI_LOC_REGISTER_MASTER_CLIENT_RESP_V02 0x00BA
+#define QMI_LOC_REGISTER_MASTER_CLIENT_IND_V02 0x00BA
+#define QMI_LOC_EVENT_ENGINE_LOCK_STATE_IND_V02 0x00BB
+#define QMI_LOC_START_LISTEN_POSITION_REQ_V02 0x00BC
+#define QMI_LOC_START_LISTEN_POSITION_RESP_V02 0x00BC
+#define QMI_LOC_STOP_LISTEN_POSITION_REQ_V02 0x00BD
+#define QMI_LOC_STOP_LISTEN_POSITION_RESP_V02 0x00BD
+#define QMI_LOC_SYSTEM_INFO_REQ_V02 0x00BE
+#define QMI_LOC_SYSTEM_INFO_RESP_V02 0x00BE
+#define QMI_LOC_SYSTEM_INFO_IND_V02 0x00BE
+#define QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02 0x00BF
+#define QMI_LOC_GET_CONSTELLATION_CONTROL_RESP_V02 0x00BF
+#define QMI_LOC_GET_CONSTELLATION_CONTROL_IND_V02 0x00BF
+#define QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02 0x00C0
+#define QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_REQ_V02 0x00C1
+#define QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_RESP_V02 0x00C1
+#define QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_IND_V02 0x00C1
+#define QMI_LOC_INJECT_TEST_POSITION_REQ_V02 0x00C2
+#define QMI_LOC_INJECT_TEST_POSITION_RESP_V02 0x00C2
+#define QMI_LOC_INJECT_TEST_POSITION_IND_V02 0x00C2
+#define QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02 0x00C3
+#define QMI_LOC_GET_BS_OBS_DATA_REQ_V02 0x00C4
+#define QMI_LOC_GET_BS_OBS_DATA_RESP_V02 0x00C4
+#define QMI_LOC_GET_BS_OBS_DATA_IND_V02 0x00C4
+#define QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02 0x00C5
+#define QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02 0x00C6
+#define QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02 0x00C7
+#define QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02 0x00C8
+#define QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02 0x00C9
+#define QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02 0x00CA
+#define QMI_LOC_SET_CONSTRAINED_TUNC_MODE_RESP_V02 0x00CA
+#define QMI_LOC_SET_CONSTRAINED_TUNC_MODE_IND_V02 0x00CA
+#define QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02 0x00CB
+#define QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_RESP_V02 0x00CB
+#define QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_IND_V02 0x00CB
+#define QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02 0x00CC
+#define QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_RESP_V02 0x00CC
+#define QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_IND_V02 0x00CC
+#define QMI_LOC_EVENT_REPORT_IND_V02 0x00CD
+#define QMI_LOC_GET_BAND_MEASUREMENT_METRICS_IND_V02 0x00CE
+#define QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02 0x00CF
+#define QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ_V02 0x00D0
+#define QMI_LOC_INJECT_PLATFORM_POWER_STATE_RESP_V02 0x00D0
+#define QMI_LOC_INJECT_PLATFORM_POWER_STATE_IND_V02 0x00D0
+#define QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ_V02 0x00D1
+#define QMI_LOC_SET_ROBUST_LOCATION_CONFIG_RESP_V02 0x00D1
+#define QMI_LOC_SET_ROBUST_LOCATION_CONFIG_IND_V02 0x00D1
+#define QMI_LOC_GET_ROBUST_LOCATION_CONFIG_REQ_V02 0x00D2
+#define QMI_LOC_GET_ROBUST_LOCATION_CONFIG_RESP_V02 0x00D2
+#define QMI_LOC_GET_ROBUST_LOCATION_CONFIG_IND_V02 0x00D2
+#define QMI_LOC_INJECT_ENV_AIDING_REQ_V02 0x00D3
+#define QMI_LOC_INJECT_ENV_AIDING_RESP_V02 0x00D3
+#define QMI_LOC_INJECT_ENV_AIDING_IND_V02 0x00D3
+#define QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_REQ_V02 0x00D4
+#define QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_RESP_V02 0x00D4
+#define QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_IND_V02 0x00D4
+#define QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_REQ_V02 0x00D5
+#define QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_RESP_V02 0x00D5
+#define QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_IND_V02 0x00D5
+#define QMI_LOC_EVENT_QUERY_XTRA_INFO_REQ_IND_V02 0x00D6
+#define QMI_LOC_SET_PARAMETER_REQ_V02 0x00D7
+#define QMI_LOC_SET_PARAMETER_RESP_V02 0x00D7
+#define QMI_LOC_SET_PARAMETER_IND_V02 0x00D7
+#define QMI_LOC_GET_PARAMETER_REQ_V02 0x00D8
+#define QMI_LOC_GET_PARAMETER_RESP_V02 0x00D8
+#define QMI_LOC_GET_PARAMETER_IND_V02 0x00D8
+#define QMI_LOC_SET_STATISTICS_CONFIG_REQ_V02 0x00D9
+#define QMI_LOC_SET_STATISTICS_CONFIG_RESP_V02 0x00D9
+#define QMI_LOC_SET_STATISTICS_CONFIG_IND_V02 0x00D9
+#define QMI_LOC_GET_STATISTICS_CONFIG_REQ_V02 0x00DA
+#define QMI_LOC_GET_STATISTICS_CONFIG_RESP_V02 0x00DA
+#define QMI_LOC_GET_STATISTICS_CONFIG_IND_V02 0x00DA
+#define QMI_LOC_GNSS_STATISTICS_REPORT_IND_V02 0x00DB
+#define QMI_LOC_SET_GNSS_PDR_MODE_REQ_V02 0x00DC
+#define QMI_LOC_SET_GNSS_PDR_MODE_RESP_V02 0x00DC
+#define QMI_LOC_SET_GNSS_PDR_MODE_IND_V02 0x00DC
+#define QMI_LOC_GET_GNSS_PDR_MODE_REQ_V02 0x00DD
+#define QMI_LOC_GET_GNSS_PDR_MODE_RESP_V02 0x00DD
+#define QMI_LOC_GET_GNSS_PDR_MODE_IND_V02 0x00DD
+#define QMI_LOC_GET_MAG_CAL_STATE_PDR_REQ_V02 0x00DE
+#define QMI_LOC_GET_MAG_CAL_STATE_PDR_RESP_V02 0x00DE
+#define QMI_LOC_GET_MAG_CAL_STATE_PDR_IND_V02 0x00DE
+#define QMI_LOC_EVENT_SAP_INS_PARAMETERS_IND_V02 0x00DF
+#define QMI_LOC_SET_MULTIBAND_CONFIG_REQ_V02 0x00E0
+#define QMI_LOC_SET_MULTIBAND_CONFIG_RESP_V02 0x00E0
+#define QMI_LOC_SET_MULTIBAND_CONFIG_IND_V02 0x00E0
+#define QMI_LOC_GET_MULTIBAND_CONFIG_REQ_V02 0x00E1
+#define QMI_LOC_GET_MULTIBAND_CONFIG_RESP_V02 0x00E1
+#define QMI_LOC_GET_MULTIBAND_CONFIG_IND_V02 0x00E1
+#define QMI_LOC_LATENCY_INFORMATION_IND_V02 0x00E2
+/**
+ @}
+ */
+
+/* Service Object Accessor */
+/** @addtogroup wms_qmi_accessor
+ @{
+ */
+/** This function is used internally by the autogenerated code. Clients should use the
+ macro loc_get_service_object_v02( ) that takes in no arguments. */
+qmi_idl_service_object_type loc_get_service_object_internal_v02
+ ( int32_t idl_maj_version, int32_t idl_min_version, int32_t library_version );
+
+/** This macro should be used to get the service object */
+#define loc_get_service_object_v02( ) \
+ loc_get_service_object_internal_v02( \
+ LOC_V02_IDL_MAJOR_VERS, LOC_V02_IDL_MINOR_VERS, \
+ LOC_V02_IDL_TOOL_VERS )
+/**
+ @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/location/loc_net_iface/LocNetIfaceAgps.cpp b/location/loc_net_iface/LocNetIfaceAgps.cpp
new file mode 100644
index 0000000..9ba95e5
--- /dev/null
+++ b/location/loc_net_iface/LocNetIfaceAgps.cpp
@@ -0,0 +1,232 @@
+
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#define LOG_TAG "LocSvc_LocNetIfaceHolder"
+
+#include <LocNetIfaceAgps.h>
+#include <loc_pla.h>
+#include <log_util.h>
+
+/* LocNetIfaceAgps members */
+LocNetIface* LocNetIfaceAgps::sLocNetIfaceAgpsInternet = NULL;
+LocNetIface* LocNetIfaceAgps::sLocNetIfaceAgpsSupl = NULL;
+LocNetAgpsState LocNetIfaceAgps::sAgpsStateInternet = LOC_NET_AGPS_STATE_CLOSED;
+LocNetAgpsState LocNetIfaceAgps::sAgpsStateSupl = LOC_NET_AGPS_STATE_CLOSED;
+LocAgpsOpenResultCb LocNetIfaceAgps::sAgpsOpenResultCb = NULL;
+LocAgpsCloseResultCb LocNetIfaceAgps::sAgpsCloseResultCb = NULL;
+void* LocNetIfaceAgps::sUserDataPtr = NULL;
+AgpsCbInfo LocNetIfaceAgps::sAgpsCbInfo = {};
+
+/* Method accessed from HAL */
+AgpsCbInfo& LocNetIfaceAgps_getAgpsCbInfo(
+ LocAgpsOpenResultCb openResultCb,
+ LocAgpsCloseResultCb closeResultCb, void* userDataPtr) {
+
+ ENTRY_LOG();
+
+ /* Save callbacks and userDataPtr */
+ LocNetIfaceAgps::sAgpsOpenResultCb = openResultCb;
+ LocNetIfaceAgps::sAgpsCloseResultCb = closeResultCb;
+ LocNetIfaceAgps::sUserDataPtr = userDataPtr;
+
+ /* Create LocNetIface instances */
+ if (LocNetIfaceAgps::sLocNetIfaceAgpsInternet == NULL) {
+ LocNetIfaceAgps::sLocNetIfaceAgpsInternet =
+ new LocNetIface(LOC_NET_CONN_TYPE_WWAN_INTERNET);
+ LocNetIfaceAgps::sLocNetIfaceAgpsInternet->
+ registerWwanCallStatusCallback(
+ LocNetIfaceAgps::wwanStatusCallback,
+ LocNetIfaceAgps::sLocNetIfaceAgpsInternet);
+ } else {
+ LOC_LOGE("sLocNetIfaceAgpsInternet not NULL");
+ }
+
+ if (LocNetIfaceAgps::sLocNetIfaceAgpsSupl == NULL) {
+ LocNetIfaceAgps::sLocNetIfaceAgpsSupl =
+ new LocNetIface(LOC_NET_CONN_TYPE_WWAN_SUPL);
+ LocNetIfaceAgps::sLocNetIfaceAgpsSupl->
+ registerWwanCallStatusCallback(
+ LocNetIfaceAgps::wwanStatusCallback,
+ LocNetIfaceAgps::sLocNetIfaceAgpsSupl);
+ } else {
+ LOC_LOGE("sLocNetIfaceAgpsSupl not NULL");
+ }
+
+ /* Return our callback */
+ LocNetIfaceAgps::sAgpsCbInfo.statusV4Cb = (void*)LocNetIfaceAgps::agpsStatusCb;
+ return LocNetIfaceAgps::sAgpsCbInfo;
+}
+
+void LocNetIfaceAgps::agpsStatusCb(AGnssExtStatusIpV4 status){
+
+ ENTRY_LOG();
+
+ /* Validate */
+ if (sLocNetIfaceAgpsInternet == NULL) {
+ LOC_LOGE("Not init'd");
+ return;
+ }
+
+ if (status.status == LOC_GPS_REQUEST_AGPS_DATA_CONN) {
+
+ if (status.type == LOC_AGPS_TYPE_SUPL) {
+
+ LOC_LOGV("REQUEST LOC_AGPS_TYPE_SUPL");
+ sAgpsStateSupl = LOC_NET_AGPS_STATE_OPEN_PENDING;
+ if (!sLocNetIfaceAgpsSupl->setupWwanCall()) {
+ LOC_LOGE("Setup wwan call failed !");
+ wwanStatusCallback(
+ sLocNetIfaceAgpsSupl,
+ LOC_NET_WWAN_CALL_EVT_OPEN_FAILED,
+ NULL, LOC_NET_CONN_IP_TYPE_INVALID);
+ sAgpsStateSupl = LOC_NET_AGPS_STATE_CLOSED;
+ }
+ } else if (status.type == LOC_AGPS_TYPE_WWAN_ANY) {
+
+ LOC_LOGV("REQUEST LOC_AGPS_TYPE_WWAN_ANY");
+ sAgpsStateInternet = LOC_NET_AGPS_STATE_OPEN_PENDING;
+ if (!sLocNetIfaceAgpsInternet->connectBackhaul()) {
+ LOC_LOGE("Connect Backhaul failed");
+ wwanStatusCallback(
+ sLocNetIfaceAgpsInternet,
+ LOC_NET_WWAN_CALL_EVT_OPEN_FAILED,
+ NULL, LOC_NET_CONN_IP_TYPE_INVALID);
+ sAgpsStateInternet = LOC_NET_AGPS_STATE_CLOSED;
+ }
+ } else {
+
+ LOC_LOGE("Unsupported AGPS type %d", status.type);
+ }
+ }
+ else if (status.status == LOC_GPS_RELEASE_AGPS_DATA_CONN) {
+
+ if (status.type == LOC_AGPS_TYPE_SUPL) {
+
+ LOC_LOGV("RELEASE LOC_AGPS_TYPE_SUPL");
+ sAgpsStateSupl = LOC_NET_AGPS_STATE_CLOSE_PENDING;
+ if (!sLocNetIfaceAgpsSupl->stopWwanCall()) {
+ LOC_LOGE("Stop wwan call failed !");
+ wwanStatusCallback(
+ sLocNetIfaceAgpsSupl,
+ LOC_NET_WWAN_CALL_EVT_CLOSE_FAILED,
+ NULL, LOC_NET_CONN_IP_TYPE_INVALID);
+ sAgpsStateSupl = LOC_NET_AGPS_STATE_CLOSED;
+ }
+ } else if (status.type == LOC_AGPS_TYPE_WWAN_ANY) {
+
+ LOC_LOGV("RELEASE LOC_AGPS_TYPE_WWAN_ANY");
+ sAgpsStateInternet = LOC_NET_AGPS_STATE_CLOSE_PENDING;
+ if (!sLocNetIfaceAgpsInternet->disconnectBackhaul()) {
+ LOC_LOGE("Disconnect backhaul failed !");
+ wwanStatusCallback(
+ sLocNetIfaceAgpsInternet,
+ LOC_NET_WWAN_CALL_EVT_CLOSE_FAILED,
+ NULL, LOC_NET_CONN_IP_TYPE_INVALID);
+ sAgpsStateInternet = LOC_NET_AGPS_STATE_CLOSED;
+ }
+ } else {
+
+ LOC_LOGE("Unsupported AGPS type %d", status.type);
+ }
+ }
+ else {
+ LOC_LOGE("Unsupported AGPS action %d", status.status);
+ }
+}
+
+void LocNetIfaceAgps::wwanStatusCallback(
+ void* userDataPtr, LocNetWwanCallEvent event,
+ const char* apn, LocNetConnIpType apnIpType){
+
+ ENTRY_LOG();
+ LOC_LOGV("event: %d, apnIpType: %d", event, apnIpType);
+
+ /* Derive bearer type */
+ AGpsBearerType bearerType = AGPS_APN_BEARER_INVALID;
+ switch (apnIpType) {
+ case LOC_NET_CONN_IP_TYPE_V4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case LOC_NET_CONN_IP_TYPE_V6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case LOC_NET_CONN_IP_TYPE_V4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ LOC_LOGE("Invalid APN IP type %d", apnIpType);
+ }
+
+ /* Derive AGPS type */
+ AGpsExtType agpsType = LOC_AGPS_TYPE_INVALID;
+ LocNetAgpsState* agpsStatePtr = NULL;
+ if (userDataPtr == (void*)sLocNetIfaceAgpsInternet) {
+ agpsType = LOC_AGPS_TYPE_WWAN_ANY;
+ agpsStatePtr = &sAgpsStateInternet;
+ }
+ else if (userDataPtr == (void*)sLocNetIfaceAgpsSupl) {
+ agpsType = LOC_AGPS_TYPE_SUPL;
+ agpsStatePtr = &sAgpsStateSupl;
+ }
+ else {
+ LOC_LOGE("Invalid user data ptr %p", userDataPtr);
+ return;
+ }
+
+ /* Complete AGPS call flow */
+ if (event == LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS &&
+ *agpsStatePtr == LOC_NET_AGPS_STATE_OPEN_PENDING) {
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS");
+ sAgpsOpenResultCb(
+ true, agpsType, apn, bearerType, sUserDataPtr);
+ *agpsStatePtr = LOC_NET_AGPS_STATE_OPENED;
+ }
+ else if (event == LOC_NET_WWAN_CALL_EVT_OPEN_FAILED &&
+ *agpsStatePtr == LOC_NET_AGPS_STATE_OPEN_PENDING) {
+ LOC_LOGE("LOC_NET_WWAN_CALL_EVT_OPEN_FAILED");
+ sAgpsOpenResultCb(
+ false, agpsType, apn, bearerType, sUserDataPtr);
+ *agpsStatePtr = LOC_NET_AGPS_STATE_CLOSED;
+ }
+ else if (event == LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS &&
+ *agpsStatePtr == LOC_NET_AGPS_STATE_CLOSE_PENDING) {
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS");
+ sAgpsCloseResultCb(true, agpsType, sUserDataPtr);
+ *agpsStatePtr = LOC_NET_AGPS_STATE_CLOSED;
+ }
+ else if (event == LOC_NET_WWAN_CALL_EVT_CLOSE_FAILED &&
+ *agpsStatePtr == LOC_NET_AGPS_STATE_CLOSE_PENDING) {
+ LOC_LOGE("LOC_NET_WWAN_CALL_EVT_CLOSE_FAILED");
+ sAgpsCloseResultCb(false, agpsType, sUserDataPtr);
+ *agpsStatePtr = LOC_NET_AGPS_STATE_CLOSED;
+ }
+ else {
+ LOC_LOGE("Unsupported event %d, type %d, state %d",
+ event, agpsType, *agpsStatePtr);
+ }
+}
diff --git a/location/loc_net_iface/LocNetIfaceAgps.h b/location/loc_net_iface/LocNetIfaceAgps.h
new file mode 100644
index 0000000..e82dd83
--- /dev/null
+++ b/location/loc_net_iface/LocNetIfaceAgps.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef LOC_NET_IFACE_AGPS_H
+#define LOC_NET_IFACE_AGPS_H
+
+#include <LocNetIface.h>
+#include <gps_extended_c.h>
+
+/* AGPS state Enum */
+typedef enum {
+ LOC_NET_AGPS_STATE_INVALID,
+ LOC_NET_AGPS_STATE_OPEN_PENDING,
+ LOC_NET_AGPS_STATE_OPENED,
+ LOC_NET_AGPS_STATE_CLOSE_PENDING,
+ LOC_NET_AGPS_STATE_CLOSED,
+ LOC_NET_AGPS_STATE_MAX
+} LocNetAgpsState;
+
+/*--------------------------------------------------------------------
+ * CLASS LocNetIfaceAgps
+ *
+ * Functionality:
+ * This class holds reference to LocNetIface instances for AGPS
+ *-------------------------------------------------------------------*/
+class LocNetIfaceAgps {
+
+public:
+ /* status method registered as part of AGPS Extended callbacks */
+ static void agpsStatusCb(AGnssExtStatusIpV4 status);
+
+ /* Callbacks registered with Internet and SUPL LocNetIface instances */
+ static void wwanStatusCallback(
+ void* userDataPtr, LocNetWwanCallEvent event,
+ const char* apn, LocNetConnIpType apnIpType);
+
+ /* LocNetIface instances for different clients */
+ static LocNetIface* sLocNetIfaceAgpsInternet;
+ static LocNetIface* sLocNetIfaceAgpsSupl;
+
+ /* AGPS states */
+ static LocNetAgpsState sAgpsStateInternet;
+ static LocNetAgpsState sAgpsStateSupl;
+
+ /* AGPS interface methods to be invoked on call setup/failure */
+ static LocAgpsOpenResultCb sAgpsOpenResultCb;
+ static LocAgpsCloseResultCb sAgpsCloseResultCb;
+ static void* sUserDataPtr;
+ static AgpsCbInfo sAgpsCbInfo;
+};
+
+/* Global method accessed from HAL to fetch AGPS status cb */
+extern "C" AgpsCbInfo& LocNetIfaceAgps_getAgpsCbInfo(
+ LocAgpsOpenResultCb openResultCb,
+ LocAgpsCloseResultCb closeResultCb, void* userDataPtr);
+
+#endif /* #ifndef LOC_NET_IFACE_AGPS_H */
diff --git a/location/loc_net_iface/LocNetIfaceBase.cpp b/location/loc_net_iface/LocNetIfaceBase.cpp
new file mode 100644
index 0000000..4e6ac48
--- /dev/null
+++ b/location/loc_net_iface/LocNetIfaceBase.cpp
@@ -0,0 +1,136 @@
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#define LOG_TAG "LocSvc_LocNetIfaceBase"
+
+#include <LocNetIfaceBase.h>
+#include <loc_pla.h>
+#include <log_util.h>
+#include <loc_cfg.h>
+
+/* Data Item notify callback
+ * Only one instance of LocNetIfaceBase can register this callback.
+ * No support for multiple clients */
+LocNetStatusChangeCb LocNetIfaceBase::sNotifyCb = NULL;
+void* LocNetIfaceBase::sNotifyCbUserDataPtr = NULL;
+
+void LocNetIfaceBase::registerWwanCallStatusCallback(
+ LocWwanCallStatusCb wwanCallStatusCb, void* userDataPtr) {
+
+ ENTRY_LOG();
+
+ mWwanCallStatusCb = wwanCallStatusCb;
+ mWwanCbUserDataPtr = userDataPtr;
+}
+
+void LocNetIfaceBase::registerDataItemNotifyCallback(
+ LocNetStatusChangeCb callback, void* userDataPtr) {
+
+ ENTRY_LOG();
+
+ if (LocNetIfaceBase::sNotifyCb != NULL) {
+ LOC_LOGE("Notify cb already registered !");
+ return;
+ }
+
+ LocNetIfaceBase::sNotifyCb = callback;
+ LocNetIfaceBase::sNotifyCbUserDataPtr = userDataPtr;
+}
+
+bool LocNetIfaceBase::updateSubscribedItemList(
+ const std::list<DataItemId>& itemList, bool addOrDelete){
+
+ ENTRY_LOG();
+ bool anyUpdatesToList = false;
+
+ /* Scroll through specified item list */
+ std::list<DataItemId>::const_iterator it = itemList.begin();
+ for (; it != itemList.end(); it++) {
+
+ DataItemId itemId = *it;
+
+ bool itemInSubscribedList = isItemSubscribed(itemId);
+
+ /* Request to add */
+ if (addOrDelete == true && !itemInSubscribedList) {
+
+ mSubscribedItemList.push_back(itemId);
+ anyUpdatesToList = true;
+
+ } else if (addOrDelete == false && itemInSubscribedList) {
+ /* Request to delete */
+ mSubscribedItemList.erase(
+ std::remove(
+ mSubscribedItemList.begin(),
+ mSubscribedItemList.end(), itemId),
+ mSubscribedItemList.end());
+ anyUpdatesToList = true;
+ }
+ }
+
+ return anyUpdatesToList;
+}
+
+char* LocNetIfaceBase::getApnNameFromConfig(){
+
+ return mApnName;
+}
+
+LocNetConnIpType LocNetIfaceBase::getIpTypeFromConfig(){
+
+ /* Convert config value to LocNetConnIpType */
+ if (mIpType == 4) {
+ return LOC_NET_CONN_IP_TYPE_V4;
+ } else if (mIpType == 6) {
+ return LOC_NET_CONN_IP_TYPE_V6;
+ } else if (mIpType == 10) {
+ return LOC_NET_CONN_IP_TYPE_V4V6;
+ }
+ return LOC_NET_CONN_IP_TYPE_INVALID;
+}
+
+void LocNetIfaceBase::fetchConfigItems(){
+
+ ENTRY_LOG();
+
+ /* Fetch config items from gps.conf */
+ if (mLocNetConnType == LOC_NET_CONN_TYPE_WWAN_INTERNET) {
+ loc_param_s_type confItemsToFetchArray[] = {
+ { "INTERNET_APN", &mApnName, NULL, 's' },
+ { "INTERNET_IP_TYPE", &mIpType, NULL, 'n' } };
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, confItemsToFetchArray);
+
+ } else if (mLocNetConnType == LOC_NET_CONN_TYPE_WWAN_SUPL) {
+ loc_param_s_type confItemsToFetchArray[] = {
+ { "SUPL_APN", &mApnName, NULL, 's' },
+ { "SUPL_IP_TYPE", &mIpType, NULL, 'n' } };
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, confItemsToFetchArray);
+
+ } else {
+ LOC_LOGE("Invalid connType %d", mLocNetConnType);
+ }
+}
diff --git a/location/loc_net_iface/LocNetIfaceBase.h b/location/loc_net_iface/LocNetIfaceBase.h
new file mode 100644
index 0000000..c9767eb
--- /dev/null
+++ b/location/loc_net_iface/LocNetIfaceBase.h
@@ -0,0 +1,209 @@
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef LOC_NET_IFACE_BASE_H
+#define LOC_NET_IFACE_BASE_H
+
+#include <IDataItemCore.h>
+#include <loc_gps.h>
+#include <loc_cfg.h>
+#include <algorithm>
+#include <vector>
+#include <list>
+#include <string.h>
+
+using namespace loc_core;
+
+/* Connectivity Type Enum
+ *
+ * These values are same as we define in case of LA,
+ * except for emergency type WWAN which is not defined there. */
+
+typedef enum {
+ LOC_NET_CONN_TYPE_INVALID = 0,
+ LOC_NET_CONN_TYPE_WLAN = 100,
+ LOC_NET_CONN_TYPE_ETHERNET = 101,
+ LOC_NET_CONN_TYPE_BLUETOOTH = 102,
+ LOC_NET_CONN_TYPE_USB_CRADLE = 103,
+ LOC_NET_CONN_TYPE_WWAN_INTERNET = 201,
+ LOC_NET_CONN_TYPE_WWAN_SUPL = 205,
+ LOC_NET_CONN_TYPE_WWAN_EMERGENCY = 206,
+ LOC_NET_CONN_TYPE_MAX
+} LocNetConnType;
+
+/* Connection IP type */
+typedef enum {
+ LOC_NET_CONN_IP_TYPE_INVALID = 0,
+ LOC_NET_CONN_IP_TYPE_V4,
+ LOC_NET_CONN_IP_TYPE_V6,
+ LOC_NET_CONN_IP_TYPE_V4V6,
+ LOC_NET_CONN_IP_TYPE_MAX
+} LocNetConnIpType;
+
+/* WWAN call event */
+typedef enum {
+ LOC_NET_WWAN_CALL_EVT_INVALID = 0,
+ LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS,
+ LOC_NET_WWAN_CALL_EVT_OPEN_FAILED,
+ LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS,
+ LOC_NET_WWAN_CALL_EVT_CLOSE_FAILED,
+ LOC_NET_WWAN_CALL_EVT_MAX
+} LocNetWwanCallEvent;
+
+/* Connectivity State */
+typedef enum {
+ LOC_NET_CONN_STATE_INVALID = 0,
+ LOC_NET_CONN_STATE_ENABLED,
+ LOC_NET_CONN_STATE_DISABLED,
+ LOC_NET_CONN_STATE_CONNECTED,
+ LOC_NET_CONN_STATE_DISCONNECTED,
+ LOC_NET_CONN_STATE_MAX
+} LocNetConnState;
+
+/* WWAN call status callback
+ * apn and apnIpType values are valid based on event. */
+typedef void (*LocWwanCallStatusCb)(
+ void* userDataPtr, LocNetWwanCallEvent event,
+ const char* apn, LocNetConnIpType apnIpType);
+
+/* DataItem Notification callback */
+typedef void (*LocNetStatusChangeCb)(
+ void* userDataPtr, std::list<IDataItemCore*>& itemList);
+
+/*--------------------------------------------------------------------
+ * CLASS LocNetIfaceBase
+ *
+ * Functionality:
+ * Interface to OS specific network connection functionality.
+ * Currently supported actions:
+ * - Register for WLAN/WWAN connectivity indications
+ * - Setup / Teardown WWAN data call
+ *-------------------------------------------------------------------*/
+class LocNetIfaceBase {
+
+public:
+ /* To be used for WWAN data call setup
+ *
+ * Call setup status is notified via Subscriber interface if network info
+ * data item is subscribed.
+ *
+ * Call setup status is also notified via LocWwanCallStatusCb callback
+ * function if registered. */
+ virtual bool setupWwanCall() = 0;
+
+ /* Stop the ongoing data call */
+ virtual bool stopWwanCall() = 0;
+
+ /* Register data call setup callback
+ * If callback is registered, we notify back data call status with it. */
+ void registerWwanCallStatusCallback(
+ LocWwanCallStatusCb wwanCallStatusCb, void* userDataPtr);
+
+ /* Register for data items */
+ virtual void subscribe(
+ const std::list<DataItemId>& itemListToSubscribe) = 0;
+
+ /* Unregister for data items */
+ virtual void unsubscribe(
+ const std::list<DataItemId>& itemListToUnsubscribe) = 0;
+
+ /* Unregister all data items */
+ virtual void unsubscribeAll() = 0;
+
+ /* Request data items current value */
+ virtual void requestData(
+ const std::list<DataItemId>& itemListToRequestData) = 0;
+
+ /* Register Notification callback */
+ void registerDataItemNotifyCallback(
+ LocNetStatusChangeCb callback, void* userDataPtr);
+
+ /* Virtual destructor since we have other virtual methods */
+ virtual ~LocNetIfaceBase() {};
+
+protected:
+ /* List of data items subscribed at any instant */
+ std::vector<DataItemId> mSubscribedItemList;
+
+ /* Data Item notification callback registered.
+ * This information is not instance specific, supports only single
+ * client. */
+ static LocNetStatusChangeCb sNotifyCb;
+ static void* sNotifyCbUserDataPtr;
+
+ /* WWAN data call setup callback */
+ LocWwanCallStatusCb mWwanCallStatusCb;
+ void* mWwanCbUserDataPtr;
+
+ /* WWAN Call type supported by this instance */
+ LocNetConnType mLocNetConnType;
+
+ /* Config items */
+ char mApnName[LOC_MAX_PARAM_STRING];
+ int mIpType;
+
+ LocNetIfaceBase(LocNetConnType connType) :
+ mSubscribedItemList(), mWwanCallStatusCb(NULL),
+ mWwanCbUserDataPtr(NULL), mLocNetConnType(connType),
+ mIpType(0) {
+
+ memset(mApnName, 0, LOC_MAX_PARAM_STRING);
+ fetchConfigItems();
+ }
+
+ /* Utility method to fetch required config items */
+ void fetchConfigItems();
+
+ /* Fetch configured APN for specified call type
+ * APNs can be configured in gps.conf as:
+ * INTERNET_APN = xyz
+ * SUPL_APN = xyz */
+ char* getApnNameFromConfig();
+
+ /* Fetch configured IP Type for specified call type
+ * IP Type can be configured in gps.conf as:
+ * INTERNET_IP_TYPE = 4 / 6 / 10
+ * SUPL_IP_TYPE = 4 / 6 / 10 */
+ LocNetConnIpType getIpTypeFromConfig();
+
+ /* Update the subscribed item list
+ * addOrDelete: true = append items to subscribed list
+ * false = delete items from subscribed list
+ * Just a utility method to be used from platform specific sub-classes
+ * Returns true if any updates are made to the subscription list,
+ * or else false. */
+ bool updateSubscribedItemList(
+ const std::list<DataItemId>& itemList, bool addOrDelete);
+
+ /* Utility method */
+ inline bool isItemSubscribed(DataItemId itemId){
+ return ( mSubscribedItemList.end() !=
+ std::find( mSubscribedItemList.begin(),
+ mSubscribedItemList.end(), itemId));
+ }
+};
+#endif /* #ifndef LOC_NET_IFACE_BASE_H */
diff --git a/location/loc_net_iface/Makefile.am b/location/loc_net_iface/Makefile.am
new file mode 100644
index 0000000..bcc4367
--- /dev/null
+++ b/location/loc_net_iface/Makefile.am
@@ -0,0 +1,58 @@
+AM_CFLAGS = \
+ -I./ \
+ -I./le \
+ $(LOCPLA_CFLAGS) \
+ $(LOCCORE_CFLAGS) \
+ $(LOCHAL_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ $(QMIF_CFLAGS) \
+ $(QMI_CFLAGS) \
+ $(DATA_CFLAGS) \
+ $(DSUTILS_CFLAGS) \
+ $(DATAITEMS_CFLAGS)
+
+ACLOCAL_AMFLAGS = -I m4
+
+if USE_MOBILEAP_INDICATION
+ AM_CFLAGS += -DFEATURE_MOBILEAP_INDICATION
+endif
+
+if USE_ROAMING_BACKHAUL_STATUS_INDICATION
+ AM_CFLAGS += -DFEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+endif
+
+AM_CPPFLAGS = -std=c++11
+
+libloc_net_iface_la_SOURCES = \
+ LocNetIfaceBase.cpp \
+ LocNetIfaceAgps.cpp \
+ le/LocNetIface.cpp
+
+if USE_GLIB
+libloc_net_iface_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_net_iface_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_net_iface_la_LDFLAGS += -Wl,--export-dynamic
+libloc_net_iface_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_net_iface_la_CFLAGS = $(AM_CFLAGS)
+libloc_net_iface_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libloc_net_iface_la_LDFLAGS += -Wl,--export-dynamic
+libloc_net_iface_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_net_iface_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices
+libloc_net_iface_la_LIBADD += $(GPSUTILS_LIBS) $(LOCHAL_LIBS) $(DATAITEMS_LIBS)
+libloc_net_iface_la_LIBADD += -lqcmap_client -ldsi_netctrl
+
+library_include_HEADERS = \
+ LocNetIfaceBase.h \
+ LocNetIfaceAgps.h \
+ le/LocNetIface.h
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_net_iface.la
+
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-net-iface.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/location/loc_net_iface/configure.ac b/location/loc_net_iface/configure.ac
new file mode 100644
index 0000000..bebf7fe
--- /dev/null
+++ b/location/loc_net_iface/configure.ac
@@ -0,0 +1,129 @@
+# configure.ac -- Autoconf script for gps loc-net-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 lbs-core package version 1.0.0
+AC_INIT([loc-net-iface],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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])
+
+PKG_CHECK_MODULES([LOCCORE], [loc-core])
+AC_SUBST([LOCCORE_CFLAGS])
+AC_SUBST([LOCCORE_LIBS])
+
+PKG_CHECK_MODULES([LOCHAL], [loc-hal])
+AC_SUBST([LOCHAL_CFLAGS])
+AC_SUBST([LOCHAL_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([QMI], [qmi])
+AC_SUBST([QMI_CFLAGS])
+AC_SUBST([QMI_LIBS])
+
+PKG_CHECK_MODULES([DSUTILS], [dsutils])
+AC_SUBST([DSUTILS_CFLAGS])
+AC_SUBST([DSUTILS_LIBS])
+
+PKG_CHECK_MODULES([DATAITEMS], [data-items])
+AC_SUBST([DATAITEMS_CFLAGS])
+AC_SUBST([DATAITEMS_LIBS])
+
+# check if it has support for mobileap register indication.
+AC_ARG_ENABLE(mobileap-indications,
+ [AS_HELP_STRING([--enable-mobileap-indications=MOBILEAP_INDICATION_ENABLED],
+ [If it has support for mobileap register indication.])],
+ [MOBILEAP_INDICATION_ENABLED=$enableval],
+ [MOBILEAP_INDICATION_ENABLED=no]
+)
+
+AM_CONDITIONAL(USE_MOBILEAP_INDICATION, test "x$MOBILEAP_INDICATION_ENABLED" == "xyes")
+
+# Check if it has support for roaming and backhaul status indication.
+AC_ARG_ENABLE(roaming-backhaul-status-indications,
+ [AS_HELP_STRING([--enable-roaming-backhaul-status-indications=ROAM_BACKHAUL_STATUS_INDICATION_ENABLED],
+ [If it has support for mobileap register indication.])],
+ [ROAM_BACKHAUL_STATUS_INDICATION_ENABLED=$enableval],
+ [ROAM_BACKHAUL_STATUS_INDICATION_ENABLED=no]
+)
+
+AM_CONDITIONAL(USE_ROAMING_BACKHAUL_STATUS_INDICATION, test "x$ROAM_BACKHAUL_STATUS_INDICATION_ENABLED" == "xyes")
+
+
+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_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 \
+ loc-net-iface.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/loc_net_iface/le/LocNetIface.cpp b/location/loc_net_iface/le/LocNetIface.cpp
new file mode 100644
index 0000000..3cde862
--- /dev/null
+++ b/location/loc_net_iface/le/LocNetIface.cpp
@@ -0,0 +1,1159 @@
+/* Copyright (c) 2017, 2020 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.
+ */
+#define LOG_TAG "LocSvc_LocNetIfaceLE"
+
+#include "LocNetIface.h"
+#include <QCMAP_Client.h>
+#include "qualcomm_mobile_access_point_msgr_v01.h"
+#include <loc_pla.h>
+#include "DataItemConcreteTypes.h"
+#include <loc_cfg.h>
+#include <log_util.h>
+#include <unistd.h>
+
+using namespace izat_manager;
+
+/* LocNetIface singleton instance
+ * Used for QCMAP registration */
+LocNetIface* LocNetIface::sLocNetIfaceInstance = NULL;
+
+void LocNetIface::subscribe(
+ const std::list<DataItemId>& itemListToSubscribe) {
+
+ ENTRY_LOG();
+
+ /* Add items to subscribed list */
+ bool anyUpdatesToSubscriptionList =
+ updateSubscribedItemList(itemListToSubscribe, true);
+
+ /* If either of network info items is in subscription list,
+ * subscribe with QCMAP */
+ if (anyUpdatesToSubscriptionList) {
+ if (isItemSubscribed(NETWORKINFO_DATA_ITEM_ID)) {
+ subscribeWithQcmap();
+ notifyCurrentNetworkInfo(true);
+ }
+ if (isItemSubscribed(WIFIHARDWARESTATE_DATA_ITEM_ID)) {
+ subscribeWithQcmap();
+ notifyCurrentWifiHardwareState(true);
+ }
+ }
+
+ EXIT_LOG_WITH_ERROR("%d", 0);
+}
+
+void LocNetIface::unsubscribe(
+ const std::list<DataItemId>& itemListToUnsubscribe) {
+
+ ENTRY_LOG();
+
+ /* Remove items from subscribed list */
+ bool anyUpdatesToSubscriptionList =
+ updateSubscribedItemList(itemListToUnsubscribe, false);
+
+ /* If neither of below two items left in subscription, we can unsubscribe
+ * from QCMAP */
+ if (anyUpdatesToSubscriptionList &&
+ !isItemSubscribed(NETWORKINFO_DATA_ITEM_ID) &&
+ !isItemSubscribed(WIFIHARDWARESTATE_DATA_ITEM_ID)) {
+
+ unsubscribeWithQcmap();
+ }
+}
+
+void LocNetIface::unsubscribeAll() {
+
+ ENTRY_LOG();
+
+ /* Check about network items */
+ if (isItemSubscribed(NETWORKINFO_DATA_ITEM_ID) ||
+ isItemSubscribed(WIFIHARDWARESTATE_DATA_ITEM_ID)) {
+
+ unsubscribeWithQcmap();
+ }
+
+ /* Clear subscription list */
+ mSubscribedItemList.clear();
+}
+
+void LocNetIface::requestData(
+ const std::list<DataItemId>& itemListToRequestData) {
+
+ ENTRY_LOG();
+
+ /* NO-OP for LE platform
+ * We don't support any data item to fetch data for */
+}
+
+void LocNetIface::subscribeWithQcmap() {
+
+ ENTRY_LOG();
+
+ qmi_error_type_v01 qcmapErr = QMI_ERR_NONE_V01;
+
+ /* We handle qcmap subscription from an exclusive instance */
+ if (LocNetIface::sLocNetIfaceInstance != NULL) {
+
+ LOC_LOGI("QCMAP registration already done !");
+ return;
+ }
+
+ /* First time registration */
+ if (LocNetIface::sLocNetIfaceInstance == NULL) {
+ LocNetIface::sLocNetIfaceInstance = this;
+ }
+
+ /* Are we already subscribed */
+ if (mQcmapClientPtr != NULL) {
+ LOC_LOGW("Already subscribed !");
+ return;
+ }
+
+ /* Create a QCMAP Client instance */
+ mQcmapClientPtr = new QCMAP_Client(qcmapClientCallback);
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("Failed to allocate QCMAP instance !");
+ return;
+ }
+ LOC_LOGD("Created QCMAP_Client instance %p", mQcmapClientPtr);
+
+#ifdef FEATURE_MOBILEAP_INDICATION
+ // We need to Enable/Disable mobile AP only for backhaul connection only if the feature
+ // FEATURE_MOBILEAP_INDICATION is available, since RegisterForIndications will give us
+ // network notification and we don't need to keep mobileap enabled for the same.
+ /* Need to RegisterForIndications to get station mode status indications */
+ uint64_t reg_mask = WWAN_ROAMING_STATUS_IND|BACKHAUL_STATUS_IND|WWAN_STATUS_IND| \
+ MOBILE_AP_STATUS_IND|STATION_MODE_STATUS_IND|CRADLE_MODE_STATUS_IND| \
+ ETHERNET_MODE_STATUS_IND|BT_TETHERING_STATUS_IND|BT_TETHERING_WAN_IND| \
+ WLAN_STATUS_IND|PACKET_STATS_STATUS_IND;
+ bool ret = false;
+ //Register with QCMAP for any BACKHAUL/network availability
+ ret = mQcmapClientPtr->RegisterForIndications(&qcmapErr, reg_mask);
+ LOC_LOGI("RegisterForIndications - qmi_error %d status %d\n", qcmapErr, ret);
+ if (QMI_ERR_NONE_V01 != qcmapErr)
+ {
+ LOC_LOGE("Backhaul registration failed error value: %d",qcmapErr);
+ }
+#else
+ /* Need to enable MobileAP to get station mode status indications */
+ bool ret = mQcmapClientPtr->EnableMobileAP(&qcmapErr);
+ if (ret == false || qcmapErr != 0) {
+ LOC_LOGE("Failed to enable mobileap, qcmapErr %d", qcmapErr);
+ }
+ /* Invoke WLAN status registration
+ * WWAN is by default registered */
+ ret = mQcmapClientPtr->RegisterForWLANStatusIND(&qcmapErr, true);
+ if (ret == false || qcmapErr != 0) {
+ LOC_LOGE("RegisterForWLANStatusIND failed, qcmapErr %d", qcmapErr);
+ }
+#endif
+}
+
+void LocNetIface::unsubscribeWithQcmap() {
+
+ ENTRY_LOG();
+
+ // Simply deleting the qcmap client instance is enough
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance to unsubscribe from");
+ return;
+ }
+
+ delete mQcmapClientPtr;
+ mQcmapClientPtr = NULL;
+}
+
+void LocNetIface::qcmapClientCallback(
+ qmi_client_type user_handle, /**< QMI user handle. */
+ unsigned int msg_id, /**< Indicator message ID. */
+ void *ind_buf, /**< Raw indication data. */
+ unsigned int ind_buf_len, /**< Raw data length. */
+ void *ind_cb_data /**< User callback handle. */ ) {
+
+ ENTRY_LOG();
+ lock_guard<recursive_mutex> guard(
+ LocNetIface::sLocNetIfaceInstance->getMutex());
+
+ qmi_client_error_type qmi_error;
+
+ // Check the message type
+ // msg_id = QMI_QCMAP_MSGR_WLAN_STATUS_IND_V01
+ // ind_buf = qcmap_msgr_wlan_status_ind_msg_v01
+ switch (msg_id) {
+
+ case QMI_QCMAP_MSGR_WLAN_STATUS_IND_V01: {
+ LOC_LOGD("Received QMI_QCMAP_MSGR_WLAN_STATUS_IND_V01");
+
+ qcmap_msgr_wlan_status_ind_msg_v01 wlanStatusIndData;
+
+ /* Parse the indication */
+ qmi_error = qmi_client_message_decode(user_handle, QMI_IDL_INDICATION,
+ msg_id, ind_buf, ind_buf_len, &wlanStatusIndData,
+ sizeof(qcmap_msgr_wlan_status_ind_msg_v01));
+
+ if (qmi_error != QMI_NO_ERR) {
+ LOC_LOGE("qmi_client_message_decode error %d", qmi_error);
+ return;
+ }
+
+ LocNetIface::sLocNetIfaceInstance->handleQcmapCallback(wlanStatusIndData);
+ break;
+ }
+
+ case QMI_QCMAP_MSGR_BRING_UP_WWAN_IND_V01: {
+ LOC_LOGD("Received QMI_QCMAP_MSGR_BRING_UP_WWAN_IND_V01");
+
+ qcmap_msgr_bring_up_wwan_ind_msg_v01 bringUpWwanIndData;
+
+ /* Parse the indication */
+ qmi_error = qmi_client_message_decode(user_handle, QMI_IDL_INDICATION,
+ msg_id, ind_buf, ind_buf_len, &bringUpWwanIndData,
+ sizeof(qcmap_msgr_bring_up_wwan_ind_msg_v01));
+
+ if (qmi_error != QMI_NO_ERR) {
+ LOC_LOGE("qmi_client_message_decode error %d", qmi_error);
+ return;
+ }
+
+ LocNetIface::sLocNetIfaceInstance->handleQcmapCallback(bringUpWwanIndData);
+ break;
+ }
+
+ case QMI_QCMAP_MSGR_TEAR_DOWN_WWAN_IND_V01: {
+ LOC_LOGD("Received QMI_QCMAP_MSGR_TEAR_DOWN_WWAN_IND_V01");
+
+ qcmap_msgr_tear_down_wwan_ind_msg_v01 teardownWwanIndData;
+
+ /* Parse the indication */
+ qmi_error = qmi_client_message_decode(user_handle, QMI_IDL_INDICATION,
+ msg_id, ind_buf, ind_buf_len, &teardownWwanIndData,
+ sizeof(qcmap_msgr_tear_down_wwan_ind_msg_v01));
+
+ if (qmi_error != QMI_NO_ERR) {
+ LOC_LOGE("qmi_client_message_decode error %d", qmi_error);
+ return;
+ }
+
+ LocNetIface::sLocNetIfaceInstance->handleQcmapCallback(teardownWwanIndData);
+ break;
+ }
+
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+ case QMI_QCMAP_MSGR_BACKHAUL_STATUS_IND_V01:
+ {
+ qcmap_msgr_backhaul_status_ind_msg_v01 backhaulStatusData;
+
+ qmi_error = qmi_client_message_decode(user_handle,
+ QMI_IDL_INDICATION,
+ msg_id,
+ ind_buf,
+ ind_buf_len,
+ &backhaulStatusData,
+ sizeof(qcmap_msgr_backhaul_status_ind_msg_v01));
+ if (qmi_error != QMI_NO_ERR) {
+ LOC_LOGE("qmi_client_message_decode error %d", qmi_error);
+ return;
+ }
+
+ LocNetIface::sLocNetIfaceInstance->handleQcmapCallback(backhaulStatusData);
+ break;
+ }
+
+ case QMI_QCMAP_MSGR_WWAN_ROAMING_STATUS_IND_V01:
+ {
+ qcmap_msgr_wwan_roaming_status_ind_msg_v01 roamingStatusData;
+
+ qmi_error = qmi_client_message_decode(user_handle,
+ QMI_IDL_INDICATION,
+ msg_id,
+ ind_buf,
+ ind_buf_len,
+ &roamingStatusData,
+ sizeof(qcmap_msgr_wwan_roaming_status_ind_msg_v01));
+ if (qmi_error != QMI_NO_ERR) {
+ LOC_LOGE("qmi_client_message_decode error %d", qmi_error);
+ return;
+ }
+
+ LocNetIface::sLocNetIfaceInstance->handleQcmapCallback(roamingStatusData);
+ break;
+ }
+#endif
+
+ default:
+ LOC_LOGE("Ignoring QCMAP indication: %d", msg_id);
+ }
+}
+
+void LocNetIface::handleQcmapCallback(
+ qcmap_msgr_wlan_status_ind_msg_v01 &wlanStatusIndData) {
+
+ ENTRY_LOG();
+
+ LOC_LOGD("WLAN Status (enabled=1, disabled=2): %d",
+ wlanStatusIndData.wlan_status);
+
+ LOC_LOGD("WLAN Mode (AP=1, ... STA=6): %d",
+ wlanStatusIndData.wlan_mode);
+
+ /* Notify observers */
+ if (wlanStatusIndData.wlan_status == QCMAP_MSGR_WLAN_ENABLED_V01) {
+ mLocNetWlanState =LOC_NET_CONN_STATE_ENABLED;
+ notifyObserverForWlanStatus(true);
+ } else if (wlanStatusIndData.wlan_status == QCMAP_MSGR_WLAN_DISABLED_V01) {
+ mLocNetWlanState = LOC_NET_CONN_STATE_DISABLED;
+ notifyObserverForWlanStatus(false);
+ } else {
+ LOC_LOGE("Invalid wlan status %d", wlanStatusIndData.wlan_status);
+ }
+}
+
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+void LocNetIface::handleQcmapCallback(
+ qcmap_msgr_backhaul_status_ind_msg_v01 &backhaulStatusIndData){
+ ENTRY_LOG();
+
+ if (true == backhaulStatusIndData.backhaul_type_valid)
+ {
+ boolean isIpv4Avail = ((backhaulStatusIndData.backhaul_v4_status_valid
+ && backhaulStatusIndData.backhaul_v4_status));
+ boolean isIpv6Avail = ((backhaulStatusIndData.backhaul_v6_status_valid
+ && backhaulStatusIndData.backhaul_v6_status));
+ setCurrentBackHaulStatus(backhaulStatusIndData.backhaul_type,
+ isIpv4Avail, isIpv6Avail);
+ notifyCurrentNetworkInfo(false);
+ }
+ else {
+ LOC_LOGE("Backhaul type is not valid : %d", backhaulStatusIndData.backhaul_type_valid);
+ mLocNetBackHaulState = LOC_NET_CONN_STATE_INVALID;
+ mLocNetBackHaulType = LOC_NET_CONN_TYPE_INVALID;
+ }
+}
+#endif
+
+void LocNetIface::handleQcmapCallback (
+ qcmap_msgr_bring_up_wwan_ind_msg_v01 &bringUpWwanIndData) {
+
+ ENTRY_LOG();
+
+ LOC_LOGD("WWAN Bring up status (Connected_v4,v6=3,9, connecting fail_v4,v6=2,8): %d",
+ bringUpWwanIndData.conn_status);
+
+ /* Notify observers */
+ if (bringUpWwanIndData.conn_status == QCMAP_MSGR_WWAN_STATUS_CONNECTED_V01 ||
+ bringUpWwanIndData.conn_status == QCMAP_MSGR_WWAN_STATUS_IPV6_CONNECTED_V01) {
+ //We update state and type in backhaul status CB only
+ if (mIsConnectBackhaulPending &&
+ mWwanCallStatusCb != NULL){
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS");
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ }
+ mIsConnectBackhaulPending = false;
+
+ } else if (bringUpWwanIndData.conn_status == QCMAP_MSGR_WWAN_STATUS_CONNECTING_FAIL_V01 ||
+ bringUpWwanIndData.conn_status == QCMAP_MSGR_WWAN_STATUS_IPV6_CONNECTING_FAIL_V01) {
+
+ if (mIsConnectBackhaulPending &&
+ mWwanCallStatusCb != NULL){
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_OPEN_FAILED");
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_OPEN_FAILED, NULL,
+ LOC_NET_CONN_IP_TYPE_INVALID);
+ }
+ mIsConnectBackhaulPending = false;
+
+ } else {
+ LOC_LOGW("Unsupported wwan status %d",
+ bringUpWwanIndData.conn_status);
+ }
+}
+
+void LocNetIface::handleQcmapCallback(
+ qcmap_msgr_tear_down_wwan_ind_msg_v01 &teardownWwanIndData) {
+
+ ENTRY_LOG();
+
+ LOC_LOGD("WWAN teardown status (Disconnected_v4,v6=6,12) (Disconnecting fail_v4,v6=5,11): %d",
+ teardownWwanIndData.conn_status);
+
+ /* Notify observers */
+ if (teardownWwanIndData.conn_status == QCMAP_MSGR_WWAN_STATUS_DISCONNECTED_V01 ||
+ teardownWwanIndData.conn_status == QCMAP_MSGR_WWAN_STATUS_IPV6_DISCONNECTED_V01) {
+ //We update state and type in backhaul status CB only
+ if (mIsDisconnectBackhaulPending &&
+ mWwanCallStatusCb != NULL) {
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS");
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ }
+ mIsDisconnectBackhaulPending = false;
+
+ } else if (teardownWwanIndData.conn_status == QCMAP_MSGR_WWAN_STATUS_DISCONNECTING_FAIL_V01 ||
+ teardownWwanIndData.conn_status ==
+ QCMAP_MSGR_WWAN_STATUS_IPV6_DISCONNECTING_FAIL_V01) {
+
+ if (mIsDisconnectBackhaulPending &&
+ mWwanCallStatusCb != NULL){
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_CLOSE_FAILED");
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_CLOSE_FAILED, NULL,
+ LOC_NET_CONN_IP_TYPE_INVALID);
+ }
+ mIsDisconnectBackhaulPending = false;
+
+ } else {
+ LOC_LOGW("Unsupported wwan status %d",
+ teardownWwanIndData.conn_status);
+ }
+}
+
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+void LocNetIface::handleQcmapCallback(
+ qcmap_msgr_wwan_roaming_status_ind_msg_v01 &roamingStatusIndData) {
+
+ ENTRY_LOG();
+
+ mIsRoaming = (roamingStatusIndData.wwan_roaming_status != 0);
+ LOC_LOGD("Roaming status(OFF:0x00, ON:0x01-0x0C): %x, Roaming: %d",
+ roamingStatusIndData.wwan_roaming_status, mIsRoaming);
+}
+#endif
+
+void LocNetIface::notifyCurrentNetworkInfo(bool queryQcmap, LocNetConnType connType) {
+
+ ENTRY_LOG();
+
+ /* Validate QCMAP Client instance */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance !");
+ return;
+ }
+
+ /* Check saved state if queryQcmap disabled */
+ if (!queryQcmap) {
+ if (LOC_NET_CONN_TYPE_INVALID != mLocNetBackHaulType) {
+ notifyObserverForNetworkInfo(
+ (LOC_NET_CONN_STATE_CONNECTED == mLocNetBackHaulState),
+ mLocNetBackHaulType);
+ }
+ else {
+ LOC_LOGE("Invalid connection type:%d , State:%d",
+ mLocNetBackHaulType, mLocNetBackHaulState);
+ }
+ return;
+ }
+
+ /* Fetch connectivity status from qcmap and notify observers */
+ /* Check if any network interface backhaul is connected */
+ isAnyBackHaulConnected();
+ if (LOC_NET_CONN_TYPE_WWAN_INTERNET == mLocNetBackHaulType) {
+ /* Check the roaming status if backhaul type is WWAN */
+ mIsRoaming = isWwanRoaming();
+ }
+ if (LOC_NET_CONN_TYPE_INVALID != mLocNetBackHaulType) {
+ notifyObserverForNetworkInfo(
+ (LOC_NET_CONN_STATE_CONNECTED == mLocNetBackHaulState),
+ mLocNetBackHaulType);
+ }
+}
+
+void LocNetIface::notifyCurrentWifiHardwareState(bool queryQcmap) {
+
+ ENTRY_LOG();
+
+ /* Validate QCMAP Client instance */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance !");
+ return;
+ }
+
+ /* Check saved state if queryQcmap disabled */
+ if (!queryQcmap) {
+ notifyObserverForWlanStatus((LOC_NET_CONN_STATE_ENABLED == mLocNetWlanState));
+ return;
+ }
+
+ /* Access QCMAP instance only from the static instance */
+ if (this != LocNetIface::sLocNetIfaceInstance &&
+ LocNetIface::sLocNetIfaceInstance != NULL) {
+ LocNetIface::sLocNetIfaceInstance->notifyCurrentWifiHardwareState(queryQcmap);
+ }
+
+ /* Fetch WLAN status */
+ qcmap_msgr_wlan_mode_enum_v01 wlan_mode =
+ QCMAP_MSGR_WLAN_MODE_ENUM_MIN_ENUM_VAL_V01;
+ qmi_error_type_v01 qmi_err_num = QMI_ERROR_TYPE_MIN_ENUM_VAL_V01;
+
+ if (!mQcmapClientPtr->GetWLANStatus(&wlan_mode, &qmi_err_num)) {
+ LOC_LOGE("Failed to fetch wlan status, err %d", qmi_err_num);
+ return;
+ }
+
+ if (wlan_mode == QCMAP_MSGR_WLAN_MODE_ENUM_MIN_ENUM_VAL_V01) {
+ mLocNetWlanState = LOC_NET_CONN_STATE_DISABLED;
+ notifyObserverForWlanStatus(false);
+ } else if (wlan_mode == QCMAP_MSGR_WLAN_MODE_STA_ONLY_V01 ||
+ wlan_mode == QCMAP_MSGR_WLAN_MODE_AP_STA_V01 ||
+ wlan_mode == QCMAP_MSGR_WLAN_MODE_AP_AP_STA_V01 ||
+ wlan_mode == QCMAP_MSGR_WLAN_MODE_AP_STA_BRIDGE_V01 ||
+ wlan_mode == QCMAP_MSGR_WLAN_MODE_AP_AP_STA_BRIDGE_V01 ||
+ wlan_mode == QCMAP_MSGR_WLAN_MODE_STA_ONLY_BRIDGE_V01) {
+ mLocNetWlanState =LOC_NET_CONN_STATE_ENABLED;
+ notifyObserverForWlanStatus(true);
+ }
+}
+
+void LocNetIface::notifyObserverForWlanStatus(bool isWlanEnabled) {
+
+ ENTRY_LOG();
+
+ /* Validate subscription object */
+ if (LocNetIfaceBase::sNotifyCb == NULL){
+ LOC_LOGE("Notify callback NULL !");
+ return;
+ }
+
+ /* Create a wifi hardware status item */
+ WifiHardwareStateDataItem wifiStateDataItem;
+ IDataItemCore *dataItem = NULL;
+
+ wifiStateDataItem.mEnabled = isWlanEnabled;
+ dataItem = &wifiStateDataItem;
+
+ // Create a list and push data item, since that's what observer expects
+ std::list<IDataItemCore *> dataItemList;
+ dataItemList.push_back(dataItem);
+
+ /* Notify back to client */
+ LocNetIfaceBase::sNotifyCb(
+ LocNetIfaceBase::sNotifyCbUserDataPtr, dataItemList);
+}
+
+void LocNetIface::notifyObserverForNetworkInfo(
+ boolean isConnected, LocNetConnType connType){
+
+ ENTRY_LOG();
+
+ // Check if observer is registered
+ if (LocNetIfaceBase::sNotifyCb == NULL) {
+ LOC_LOGE("Notify callback NULL !");
+ return;
+ }
+
+ // Create a network data item
+ NetworkInfoDataItem networkInfoDataItem;
+ IDataItemCore *dataItem = NULL;
+
+ networkInfoDataItem.mType = (int32)connType;
+ networkInfoDataItem.mAvailable = isConnected;
+ networkInfoDataItem.mConnected = isConnected;
+ networkInfoDataItem.mRoaming = mIsRoaming;
+
+ dataItem = &networkInfoDataItem;
+
+ // Create a list and push data item, since that's what observer expects
+ std::list<IDataItemCore *> dataItemList;
+ dataItemList.push_back(dataItem);
+
+ /* Notify back to client */
+ LocNetIfaceBase::sNotifyCb(
+ LocNetIfaceBase::sNotifyCbUserDataPtr, dataItemList);
+}
+
+bool LocNetIface::setupWwanCall() {
+
+ ENTRY_LOG();
+
+ /* Validate call type requested */
+ if (mLocNetConnType != LOC_NET_CONN_TYPE_WWAN_SUPL) {
+ LOC_LOGE("Unsupported call type configured: %d", mLocNetConnType);
+ return false;
+ }
+
+ /* Check for ongoing start/stop attempts */
+ if (mIsDsiStartCallPending) {
+ LOC_LOGW("Already start pending, returning as no-op");
+ return true;
+ }
+ if (mIsDsiStopCallPending) {
+ LOC_LOGE("Stop attempt pending, can't start now !");
+ /* When stop completes and DS callback is received, we will
+ * notify the client. So no need to notify now. */
+ return false;
+ }
+ if (mIsDsiCallUp) {
+ LOC_LOGW("Already ongoing data call");
+ if (mWwanCallStatusCb != NULL) {
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ }
+ return true;
+ }
+
+ /* Initialize DSI library */
+ int ret = -1;
+ if (!mIsDsiInitDone) {
+
+ if ((ret = dsi_init(DSI_MODE_GENERAL)) == DSI_SUCCESS) {
+ LOC_LOGI("dsi_init success !");
+ } else if (ret == DSI_EINITED) {
+ LOC_LOGI("dsi_init already done !");
+ } else {
+ LOC_LOGE("dsi_init failed, err %d", ret);
+ }
+ mIsDsiInitDone = true;
+
+ /* Sleep 100 ms for dsi_init() to complete */
+ LOC_LOGV("Sleeping for 100 ms");
+ usleep(100 * 1000);
+ }
+
+ /* Get DSI service handle */
+ if (mDsiHandle == NULL) {
+ mDsiHandle = dsi_get_data_srvc_hndl(
+ LocNetIface::dsiNetEventCallback, this);
+ if (mDsiHandle == NULL) {
+ LOC_LOGE("NULL DSI Handle");
+ return false;
+ }
+ }
+ LOC_LOGD("DSI Handle for call %p", mDsiHandle);
+
+ /* Set call parameters */
+ dsi_call_param_value_t callParams;
+
+ /* No Radio tech preference */
+ callParams.buf_val = NULL;
+ callParams.num_val = DSI_RADIO_TECH_UNKNOWN;
+ LOC_LOGD("DSI_CALL_INFO_TECH_PREF = DSI_RADIO_TECH_UNKNOWN");
+ dsi_set_data_call_param(mDsiHandle, DSI_CALL_INFO_TECH_PREF, &callParams);
+
+ /* APN from gps.conf
+ As this is read using loc cfg routine, the buffer size
+ max is LOC_MAX_PARAM_STRING. */
+ char* apnName = getApnNameFromConfig();
+ int apnNameLen = strnlen(apnName, LOC_MAX_PARAM_STRING);
+ if (apnName != NULL && apnNameLen > 0) {
+ callParams.buf_val = apnName;
+ callParams.num_val = apnNameLen;
+ LOC_LOGD("DSI_CALL_INFO_APN_NAME = %s", apnName);
+ dsi_set_data_call_param(mDsiHandle, DSI_CALL_INFO_APN_NAME, &callParams);
+ } else{
+ LOC_LOGE("Failed to fetch APN for data call setup");
+ return false;
+ }
+
+ /* IP type from gps.conf */
+ LocNetConnIpType ipType = getIpTypeFromConfig();
+ callParams.buf_val = NULL;
+ if (ipType == LOC_NET_CONN_IP_TYPE_V4) {
+ callParams.num_val = DSI_IP_VERSION_4;
+ } else if (ipType == LOC_NET_CONN_IP_TYPE_V6) {
+ callParams.num_val = DSI_IP_VERSION_6;
+ } else if (ipType == LOC_NET_CONN_IP_TYPE_V4V6) {
+ callParams.num_val = DSI_IP_VERSION_4_6;
+ } else {
+ LOC_LOGE("No IP Type in gps.conf, using default v4");
+ callParams.num_val = DSI_IP_VERSION_4;
+ }
+ dsi_set_data_call_param(
+ mDsiHandle, DSI_CALL_INFO_IP_VERSION, &callParams);
+
+ /* Send the call setup request */
+ ret = dsi_start_data_call(mDsiHandle);
+ if (ret != DSI_SUCCESS) {
+
+ LOC_LOGE("DSI_START_DATA_CALL FAILED, err %d", ret);
+ return false;
+ }
+
+ mIsDsiStartCallPending = true;
+ LOC_LOGI("Data call START request sent successfully to DSI");
+ return true;
+}
+
+bool LocNetIface::stopWwanCall() {
+
+ ENTRY_LOG();
+
+ /* Check for ongoing start/stop attempts */
+ if (mIsDsiStopCallPending) {
+ LOC_LOGW("Already stop pending, no-op");
+ return true;
+ }
+ if (mIsDsiStartCallPending) {
+ LOC_LOGE("Start attempt pending, can't stop now !");
+ /* When start completes and DS callback is received, we will
+ * notify the client. So no need to notify now. */
+ return false;
+ }
+ if (!mIsDsiCallUp) {
+ LOC_LOGE("No ongoing data call to stop");
+ if (mWwanCallStatusCb != NULL) {
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ }
+ return true;
+ }
+
+ /* Stop the call */
+ LOC_LOGD("Stopping data call with handle %p", mDsiHandle);
+
+ int ret = dsi_stop_data_call(mDsiHandle);
+ if (ret != DSI_SUCCESS) {
+
+ LOC_LOGE("dsi_stop_data_call() returned err %d", ret);
+ return false;
+ }
+
+ mIsDsiStopCallPending = true;
+ LOC_LOGI("Data call STOP request sent to DS");
+ return true;
+}
+
+/* Static callback method */
+void LocNetIface::dsiNetEventCallback(
+ dsi_hndl_t dsiHandle, void* userDataPtr, dsi_net_evt_t event,
+ dsi_evt_payload_t* eventPayloadPtr){
+
+ ENTRY_LOG();
+
+ /* Analyze event payload */
+ LocNetIface* locNetIface = static_cast<LocNetIface*>(userDataPtr);
+ if (locNetIface == NULL){
+ LOC_LOGE("Null user data !");
+ return;
+ }
+
+ if (event == DSI_EVT_NET_IS_CONN){
+ LOC_LOGI("DSI_EVT_NET_IS_CONN");
+ locNetIface->handleDSCallback(dsiHandle, true);
+ } else if (event == DSI_EVT_NET_NO_NET){
+ LOC_LOGI("DSI_EVT_NET_NO_NET");
+ locNetIface->handleDSCallback(dsiHandle, false);
+ } else {
+ LOC_LOGW("Unsupported event %d", event);
+ }
+}
+
+void LocNetIface::handleDSCallback(
+ dsi_hndl_t dsiHandle, bool isNetConnected){
+
+ ENTRY_LOG();
+ LOC_LOGV("dsiHandle %p, isCallUp %d, stopPending %d, startPending %d",
+ dsiHandle, mIsDsiCallUp, mIsDsiStopCallPending,
+ mIsDsiStartCallPending);
+
+ /* Validate handle */
+ if (mDsiHandle != dsiHandle){
+ LOC_LOGE("DS Handle mismatch: %p vs %p", mDsiHandle, dsiHandle);
+ return;
+ }
+
+ /* Process event */
+ if (isNetConnected){
+
+ /* Invoke client callback if registered*/
+ if (mIsDsiStartCallPending &&
+ mWwanCallStatusCb != NULL){
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS");
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ }
+
+ /* Start call complete */
+ mIsDsiCallUp = true;
+ mIsDsiStartCallPending = false;
+
+ } else {
+
+ /* Invoke client callback if registered */
+ if (mIsDsiStopCallPending &&
+ mWwanCallStatusCb != NULL) {
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS");
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ } else if (mIsDsiStartCallPending &&
+ mWwanCallStatusCb != NULL){
+ LOC_LOGV("LOC_NET_WWAN_CALL_EVT_OPEN_FAILED");
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_OPEN_FAILED, NULL,
+ LOC_NET_CONN_IP_TYPE_INVALID);
+ }
+
+ /* Stop call complete */
+ mIsDsiCallUp = false;
+ mIsDsiStopCallPending = false;
+ }
+}
+
+bool LocNetIface::isNonMeteredBackHaulTypeConnected() {
+ ENTRY_LOG();
+
+ /* Access QCMAP instance only from the static instance */
+ if (this != LocNetIface::sLocNetIfaceInstance &&
+ LocNetIface::sLocNetIfaceInstance != NULL) {
+ return LocNetIface::sLocNetIfaceInstance->isNonMeteredBackHaulTypeConnected();
+ }
+
+ /* Validate QCMAP Client instance */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance !");
+ return false;
+ }
+
+ /* Update backhaul status */
+ isAnyBackHaulConnected();
+ /* if Current backhaul - Is not WWAN && Is not an Invalid type*/
+ return ((LOC_NET_CONN_TYPE_WWAN_INTERNET != mLocNetBackHaulType) &&
+ (LOC_NET_CONN_TYPE_INVALID != mLocNetBackHaulType));
+}
+
+bool LocNetIface::isWwanRoaming() {
+ ENTRY_LOG();
+
+ /* Access QCMAP instance only from the static instance */
+ if (this != LocNetIface::sLocNetIfaceInstance &&
+ LocNetIface::sLocNetIfaceInstance != NULL) {
+ return LocNetIface::sLocNetIfaceInstance->isWwanRoaming();
+ }
+
+ /* Validate QCMAP Client instance */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance !");
+ return false;
+ }
+
+ /* fetch roaming status */
+ uint8_t roamStatus = 0;
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+ qmi_error_type_v01 qmi_err_num = QMI_ERROR_TYPE_MIN_ENUM_VAL_V01;
+ if (!mQcmapClientPtr->GetWWANRoamStatus(&roamStatus, &qmi_err_num)) {
+ LOC_LOGE("Failed to fetch roaming status, err %d", qmi_err_num);
+ return false;
+ }
+#endif
+ // update internal roaming variable
+ LOC_LOGD("Roaming status(OFF:0x00, ON:0x01-0x0C): %x", roamStatus);
+ return (roamStatus != 0);
+}
+
+bool LocNetIface::isAnyBackHaulConnected() {
+
+ ENTRY_LOG();
+
+ /* Access QCMAP instance only from the static instance */
+ if (this != LocNetIface::sLocNetIfaceInstance &&
+ LocNetIface::sLocNetIfaceInstance != NULL) {
+ return LocNetIface::sLocNetIfaceInstance->isAnyBackHaulConnected();
+ }
+
+ /* Validate QCMAP Client instance */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance !");
+ return false;
+ }
+
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+ /* Fetch backhaul status */
+ qcmap_backhaul_status_info_type backhaulStatus =
+ {false, false, QCMAP_MSGR_BACKHAUL_TYPE_ENUM_MIN_ENUM_VAL_V01};
+ qmi_error_type_v01 qmi_err_num = QMI_ERROR_TYPE_MIN_ENUM_VAL_V01;
+
+ if (!mQcmapClientPtr->GetBackhaulStatus(&backhaulStatus, &qmi_err_num)) {
+ LOC_LOGE("Failed to fetch backhaul status, err %d", qmi_err_num);
+ return false;
+ }
+ setCurrentBackHaulStatus(backhaulStatus.backhaul_type,
+ backhaulStatus.backhaul_v4_available,
+ backhaulStatus.backhaul_v6_available);
+#endif
+ return (LOC_NET_CONN_STATE_CONNECTED == mLocNetBackHaulState);
+}
+
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+void LocNetIface::setCurrentBackHaulStatus(
+ qcmap_msgr_backhaul_type_enum_v01 backhaulType,
+ boolean backhaulIPv4Available,
+ boolean backhaulIPv6Available) {
+ LOC_LOGI("Type: 1-WWAN, 2-USB Cradle, 3-WLAN , 4-Ethernet, 5-BT");
+ LOC_LOGI("BackhaulStatus Type: %d, IPv4 avail:%d, IPv6 avail:%d",
+ backhaulType, backhaulIPv4Available, backhaulIPv6Available);
+ switch (backhaulType)
+ {
+ case QCMAP_MSGR_WWAN_BACKHAUL_V01:
+ mLocNetBackHaulType = LOC_NET_CONN_TYPE_WWAN_INTERNET;
+ break;
+ case QCMAP_MSGR_USB_CRADLE_BACKHAUL_V01:
+ mLocNetBackHaulType = LOC_NET_CONN_TYPE_USB_CRADLE;
+ break;
+ case QCMAP_MSGR_WLAN_BACKHAUL_V01:
+ mLocNetBackHaulType = LOC_NET_CONN_TYPE_WLAN;
+ break;
+ case QCMAP_MSGR_ETHERNET_BACKHAUL_V01:
+ mLocNetBackHaulType = LOC_NET_CONN_TYPE_ETHERNET;
+ break;
+ case QCMAP_MSGR_BT_BACKHAUL_V01:
+ mLocNetBackHaulType = LOC_NET_CONN_TYPE_BLUETOOTH;
+ break;
+ default:
+ LOC_LOGE("Invalid backhaul type : %d", backhaulType);
+ mLocNetBackHaulType = LOC_NET_CONN_TYPE_INVALID;
+ break;
+ }
+ if (backhaulType != QCMAP_MSGR_WWAN_BACKHAUL_V01) {
+ // set this to false for backhaul type other than wwan
+ mIsRoaming = false;
+ }
+ if ((false == backhaulIPv4Available) && (false == backhaulIPv6Available)) {
+ mLocNetBackHaulState = LOC_NET_CONN_STATE_DISCONNECTED;
+ }
+ else {
+ mLocNetBackHaulState = LOC_NET_CONN_STATE_CONNECTED;
+ }
+}
+#endif
+
+/* isWwanConnected is used mainly from external clients (eg:XtraClient) */
+bool LocNetIface::isWwanConnected() {
+
+ ENTRY_LOG();
+
+ /* Access QCMAP instance only from the static instance */
+ if (this != LocNetIface::sLocNetIfaceInstance &&
+ LocNetIface::sLocNetIfaceInstance != NULL) {
+ return LocNetIface::sLocNetIfaceInstance->isWwanConnected();
+ }
+
+ /* Validate QCMAP Client instance */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance !");
+ return false;
+ }
+
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+ /* Fetch backhaul status */
+ qcmap_backhaul_status_info_type backhaulStatus =
+ {false, false, QCMAP_MSGR_BACKHAUL_TYPE_ENUM_MIN_ENUM_VAL_V01};
+ qmi_error_type_v01 qmi_err_num = QMI_ERROR_TYPE_MIN_ENUM_VAL_V01;
+
+ if (!mQcmapClientPtr->GetBackhaulStatus(&backhaulStatus, &qmi_err_num)) {
+ LOC_LOGE("Failed to fetch backhaul status, err %d", qmi_err_num);
+ return false;
+ }
+
+ if ((QCMAP_MSGR_WWAN_BACKHAUL_V01 == backhaulStatus.backhaul_type) &&
+ (backhaulStatus.backhaul_v4_available || backhaulStatus.backhaul_v6_available)) {
+ // If WWAN is current backhaul type and either IPv4 or IPv6 connection available ?
+ LOC_LOGV("WWAN is connected.");
+ return true;
+ } else {
+ LOC_LOGV("WWAN is disconnected.");
+ return false;
+ }
+#endif
+
+ return false;
+}
+
+bool LocNetIface::connectBackhaul() {
+
+ ENTRY_LOG();
+ lock_guard<recursive_mutex> guard(mMutex);
+
+ /* Access QCMAP instance only from the static instance */
+ if (this != LocNetIface::sLocNetIfaceInstance &&
+ LocNetIface::sLocNetIfaceInstance != NULL) {
+ LOC_LOGV("Invoke from static LocNetIface instance..");
+ if (mWwanCallStatusCb != NULL) {
+ LocNetIface::sLocNetIfaceInstance->
+ registerWwanCallStatusCallback(
+ mWwanCallStatusCb, mWwanCbUserDataPtr);
+ }
+ return LocNetIface::sLocNetIfaceInstance->connectBackhaul();
+ }
+
+ /* QCMAP client instance must have been created.
+ * Happens when some client subscribes. */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance");
+ return false;
+ }
+
+ /* Check if backhaul is already connected */
+ qmi_error_type_v01 qmi_err_num = QMI_ERR_NONE_V01;
+ qcmap_msgr_wwan_status_enum_v01 v4_status, v6_status;
+ if (mQcmapClientPtr->GetWWANStatus(
+ &v4_status, &v6_status, &qmi_err_num) == false) {
+ LOC_LOGE("Failed to get wwan status, err 0x%x", qmi_err_num);
+ return false;
+ }
+ if (v4_status == QCMAP_MSGR_WWAN_STATUS_CONNECTING_V01 ||
+ v6_status == QCMAP_MSGR_WWAN_STATUS_IPV6_CONNECTING_V01) {
+ LOC_LOGI("Ongoing connection attempt, ignoring connect.");
+ return true;
+ }
+ if (v4_status == QCMAP_MSGR_WWAN_STATUS_CONNECTED_V01 ||
+ v6_status == QCMAP_MSGR_WWAN_STATUS_IPV6_CONNECTED_V01) {
+ LOC_LOGV("Backhaul already connected, ignoring connect.");
+ if (mWwanCallStatusCb != NULL) {
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_OPEN_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ }
+ /* Track each connection attempt,
+ * by increasing connect request recvd counter before returning
+ * success. */
+ mConnectReqRecvCount++;
+ return true;
+ }
+
+ /* Check if we've already sent the request */
+ if (mIsConnectBackhaulPending || mIsConnectReqSent) {
+ LOC_LOGI("Ignoring connect, connect pending %d, wwan state %d "
+ "req sent %d", mIsConnectBackhaulPending, mLocNetBackHaulState,
+ mIsConnectReqSent);
+ mConnectReqRecvCount++;
+ return true;
+ }
+
+#ifdef FEATURE_MOBILEAP_INDICATION
+ qmi_err_num = QMI_ERR_NONE_V01;
+ /* Need to enable MobileAP to invoke backhaul functions */
+ bool ret = mQcmapClientPtr->EnableMobileAP(&qmi_err_num);
+ if (false == ret || 0 != qmi_err_num) {
+ LOC_LOGE("Failed to enable mobileap, qcmapErr %d", qmi_err_num);
+ return false;
+ }
+#endif
+
+ /* Send connect request to QCMAP */
+ qmi_err_num = QMI_ERR_NONE_V01;
+ qcmap_msgr_wwan_call_type_v01 wwan_call_type = getWwanCallType();
+ LOC_LOGV("Sending ConnectBackhaul request..");
+ if (mQcmapClientPtr->ConnectBackHaul(
+ wwan_call_type, &qmi_err_num) == false) {
+ LOC_LOGE("Connect backhaul failed, err 0x%x", qmi_err_num);
+#ifdef FEATURE_MOBILEAP_INDICATION
+ qmi_err_num = QMI_ERR_NONE_V01;
+ //Disabling mobile AP here if connect backhaul fails
+ bool ret = mQcmapClientPtr->DisableMobileAP(&qmi_err_num);
+ if (false == ret || 0 != qmi_err_num ) {
+ LOC_LOGE("Failed to disable mobileap, qcmapErr %d", qmi_err_num);
+ }
+#endif
+ return false;
+ }
+
+ /* Set the flag to track */
+ mIsConnectReqSent = true;
+ mIsConnectBackhaulPending = true;
+ mConnectReqRecvCount++;
+ return true;
+}
+
+
+qcmap_msgr_wwan_call_type_v01 LocNetIface::getWwanCallType() {
+ return (getIpTypeFromConfig() == LOC_NET_CONN_IP_TYPE_V6) ?
+ QCMAP_MSGR_WWAN_CALL_TYPE_V6_V01 :
+ QCMAP_MSGR_WWAN_CALL_TYPE_V4_V01;
+}
+
+
+bool LocNetIface::disconnectBackhaul() {
+
+ ENTRY_LOG();
+ lock_guard<recursive_mutex> guard(mMutex);
+
+ /* Access QCMAP instance only from the static instance */
+ if (this != LocNetIface::sLocNetIfaceInstance &&
+ LocNetIface::sLocNetIfaceInstance != NULL) {
+ LOC_LOGV("Invoke from static LocNetIface instance..");
+ return LocNetIface::sLocNetIfaceInstance->disconnectBackhaul();
+ }
+
+ /* QCMAP client instance must have been created.
+ * Happens when some client subscribes. */
+ if (mQcmapClientPtr == NULL) {
+ LOC_LOGE("No QCMAP instance");
+ return false;
+ }
+
+ /* Track connect requests recvd to multiplexing */
+ if (mConnectReqRecvCount <= 0) {
+ LOC_LOGE("Invalid connect req recv count %d", mConnectReqRecvCount);
+ return false;
+ }
+ mConnectReqRecvCount--;
+
+ /* Check if we've sent the request.
+ * If we didn't send the connect request, no need to disconnect.
+ * If we still have surplus connect request count, don't disconnect */
+ if (!mIsConnectReqSent || mConnectReqRecvCount > 0) {
+ LOC_LOGI("Conn req sent %d, conn req rcvd cnt %d, "
+ "ignoring disconnect", mIsConnectReqSent,
+ mConnectReqRecvCount);
+ if (mWwanCallStatusCb != NULL) {
+ mWwanCallStatusCb(
+ mWwanCbUserDataPtr, LOC_NET_WWAN_CALL_EVT_CLOSE_SUCCESS,
+ getApnNameFromConfig(), getIpTypeFromConfig());
+ }
+ return true;
+ }
+
+ /* Send disconnect request to QCMAP */
+ qmi_error_type_v01 qmi_err_num = QMI_ERR_NONE_V01;
+ qcmap_msgr_wwan_call_type_v01 wwan_call_type = getWwanCallType();
+ LOC_LOGV("Sending DisconnectBackhaul..");
+ if (mQcmapClientPtr->DisconnectBackHaul(
+ wwan_call_type, &qmi_err_num) == false) {
+ LOC_LOGE("Disconnect backhaul failed, err 0x%x", qmi_err_num);
+#ifdef FEATURE_MOBILEAP_INDICATION
+ // Even if DisconnectBackHaul fails, do not return, we need to
+ // DisableMobileAP in any case.
+ }
+ qmi_err_num = QMI_ERR_NONE_V01;
+ bool ret = mQcmapClientPtr->DisableMobileAP(&qmi_err_num);
+ if ( false == ret || 0 != qmi_err_num) {
+ LOC_LOGE("Failed to disable mobileap, qcmapErr %d", qmi_err_num);
+#endif
+ return false;
+ }
+
+ /* Set the flag to track */
+ mIsConnectReqSent = false;
+ mIsDisconnectBackhaulPending = true;
+ return true;
+}
diff --git a/location/loc_net_iface/le/LocNetIface.h b/location/loc_net_iface/le/LocNetIface.h
new file mode 100644
index 0000000..1688271
--- /dev/null
+++ b/location/loc_net_iface/le/LocNetIface.h
@@ -0,0 +1,161 @@
+/* Copyright (c) 2017, 2020 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_NET_IFACE_H
+#define LOC_NET_IFACE_H
+
+#include <LocNetIfaceBase.h>
+#include <dsi_netctrl.h>
+#include <QCMAP_Client.h>
+#include <mutex>
+
+using namespace std;
+
+/*--------------------------------------------------------------------
+ * LE platform specific implementation for LocNetIface
+ *-------------------------------------------------------------------*/
+class LocNetIface : public LocNetIfaceBase {
+
+public:
+ /* Constructor */
+ LocNetIface(LocNetConnType connType) :
+ LocNetIfaceBase(connType), mQcmapClientPtr(NULL),
+ mConnectReqRecvCount(0), mIsConnectReqSent(false),
+ mIsConnectBackhaulPending(false), mIsDisconnectBackhaulPending(false),
+ mLocNetBackHaulState(LOC_NET_CONN_STATE_INVALID),
+ mLocNetBackHaulType(LOC_NET_CONN_TYPE_INVALID),
+ mLocNetWlanState(LOC_NET_CONN_STATE_INVALID),
+ mIsRoaming(false),
+ mIsDsiInitDone(false), mDsiHandle(NULL), mIsDsiCallUp(false),
+ mIsDsiStartCallPending(false), mIsDsiStopCallPending(false),
+ mMutex() {}
+ LocNetIface() : LocNetIface(LOC_NET_CONN_TYPE_WWAN_INTERNET) {}
+
+ /* Override base class pure virtual methods */
+ bool setupWwanCall();
+ bool stopWwanCall();
+ void subscribe(const std::list<DataItemId>& itemListToSubscribe);
+ void unsubscribe(const std::list<DataItemId>& itemListToUnsubscribe);
+ void unsubscribeAll();
+ void requestData(const std::list<DataItemId>& itemListToRequestData);
+
+ /* Setup WWAN backhaul via QCMAP
+ * This sets up IP routes as well for any AP socket */
+ bool connectBackhaul();
+ /* Disconnects the WWANbackhaul, only if it was setup by us */
+ bool disconnectBackhaul();
+
+ /* APIs to fetch current WWAN status */
+ bool isWwanConnected();
+ /* APIs to fetch current Backhaul Network Interface status */
+ bool isAnyBackHaulConnected();
+ /* API to check if any non-metered backhaul type (eg: wifi, ethernet etc) status*/
+ bool isNonMeteredBackHaulTypeConnected();
+ /* API to check wwan roaming status */
+ bool isWwanRoaming();
+ qcmap_msgr_wwan_call_type_v01 getWwanCallType();
+
+ recursive_mutex& getMutex(){ return mMutex; }
+
+private:
+ /* QCMAP client handle
+ * This will be set only for static sQcmapInstance. */
+ QCMAP_Client* mQcmapClientPtr;
+
+ /* Flag to track whether we've setup QCMAP backhaul */
+ int mConnectReqRecvCount;
+ bool mIsConnectReqSent;
+ bool mIsConnectBackhaulPending;
+ bool mIsDisconnectBackhaulPending;
+
+ /* Maintain an exclusive instance for QCMAP interaction.
+ * QCMAP does NOT support passing in/out a void user data pointer,
+ * Hence we need to track the instance used internally. */
+ static LocNetIface* sLocNetIfaceInstance;
+
+ /* Current connection status */
+ LocNetConnState mLocNetBackHaulState;
+ /* Current Backhaul type include wwan, wifi, BT, USB cradle, Ethernet etc*/
+ LocNetConnType mLocNetBackHaulType;
+ /* Check wifi hardware state */
+ LocNetConnState mLocNetWlanState;
+ /* Roaming status */
+ bool mIsRoaming;
+
+ /* Private APIs to interact with QCMAP module */
+ void subscribeWithQcmap();
+ void unsubscribeWithQcmap();
+ void handleQcmapCallback(
+ qcmap_msgr_wlan_status_ind_msg_v01 &wlanStatusIndData);
+ void handleQcmapCallback(
+ qcmap_msgr_bring_up_wwan_ind_msg_v01 &bringUpWwanIndData);
+ void handleQcmapCallback(
+ qcmap_msgr_tear_down_wwan_ind_msg_v01 &teardownWwanIndData);
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+ void handleQcmapCallback(
+ qcmap_msgr_backhaul_status_ind_msg_v01 &backhaulStatusIndData);
+ void handleQcmapCallback(
+ qcmap_msgr_wwan_roaming_status_ind_msg_v01 &roamingStatusIndData);
+#endif
+ void notifyObserverForWlanStatus(bool isWlanEnabled);
+ void notifyObserverForNetworkInfo(boolean isConnected, LocNetConnType connType);
+ void notifyCurrentNetworkInfo(bool queryQcmap,
+ LocNetConnType connType = LOC_NET_CONN_TYPE_INVALID);
+ void notifyCurrentWifiHardwareState(bool queryQcmap);
+#ifdef FEATURE_ROAMING_BACKHAUL_STATUS_INDICATION
+ void setCurrentBackHaulStatus(qcmap_msgr_backhaul_type_enum_v01 backhaulType,
+ boolean backhaulIPv4Available, boolean backhaulIPv6Available);
+#endif
+
+ /* Callback registered with QCMAP */
+ static void qcmapClientCallback
+ (
+ qmi_client_type user_handle, /* QMI user handle. */
+ unsigned int msg_id, /* Indicator message ID. */
+ void *ind_buf, /* Raw indication data. */
+ unsigned int ind_buf_len, /* Raw data length. */
+ void *ind_cb_data /* User callback handle. */
+ );
+
+ /* Data call setup specific members */
+ bool mIsDsiInitDone;
+ dsi_hndl_t mDsiHandle;
+ bool mIsDsiCallUp;
+ bool mIsDsiStartCallPending;
+ bool mIsDsiStopCallPending;
+
+ /* Callback registered with DSI */
+ static void dsiNetEventCallback(
+ dsi_hndl_t dsiHandle, void* userDataPtr, dsi_net_evt_t event,
+ dsi_evt_payload_t* eventPayloadPtr);
+ void handleDSCallback(dsi_hndl_t dsiHandle, bool isNetConnected);
+
+ /* Mutex for synchronization */
+ recursive_mutex mMutex;
+};
+
+#endif /* #ifndef LOC_NET_IFACE_H */
diff --git a/location/loc_net_iface/loc-net-iface.pc.in b/location/loc_net_iface/loc-net-iface.pc.in
new file mode 100644
index 0000000..c076453
--- /dev/null
+++ b/location/loc_net_iface/loc-net-iface.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-net-iface
+Description: GPS Loc Net Iface
+Version: @VERSION
+Libs: -L${libdir} -lloc_net_iface
+Cflags: -I${includedir} -I${includedir}/loc-net-iface -I${includedir}/loc-net-iface/le
diff --git a/location/loc_sll_if/Android.mk b/location/loc_sll_if/Android.mk
new file mode 100644
index 0000000..e2c5a56
--- /dev/null
+++ b/location/loc_sll_if/Android.mk
@@ -0,0 +1,5 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/location/loc_sll_if/if/Android.mk b/location/loc_sll_if/if/Android.mk
new file mode 100644
index 0000000..83ccb86
--- /dev/null
+++ b/location/loc_sll_if/if/Android.mk
@@ -0,0 +1,13 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_OWNER:=qti
+LOCAL_MODULE:= loc_sll_if_headers
+LOCAL_VENDOR_MODULE := true
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
+
+endif #BUILD_TINY_ANDROID
diff --git a/location/loc_sll_if/if/loc_sll_interface.h b/location/loc_sll_if/if/loc_sll_interface.h
new file mode 100644
index 0000000..382a305
--- /dev/null
+++ b/location/loc_sll_if/if/loc_sll_interface.h
@@ -0,0 +1,1849 @@
+/* Copyright (c) 2011-2019, 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.
+ */
+
+/** @file loc-sll-interface.h
+*/
+
+#ifndef LOC_SLL_INTERFACE_H
+#define LOC_SLL_INTERFACE_H
+
+
+/*=============================================================================
+ *============================================================================*/
+#include <stdbool.h>
+#include <stdint.h>
+#include "gps_extended_c.h"
+#include "LocationDataTypes.h"
+#include "loc_gps.h"
+#include "loc_pla.h"
+#include "log_util.h"
+
+
+#define SLL_LOC_SUPPORTED_FEATURE_LENGTH_V02 (100)
+
+typedef struct {
+ LocPositionMode mode;
+ LocGpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ bool share_position;
+ char credentials[14];
+ char provider[8];
+ GnssPowerMode powerMode;
+ uint32_t timeBetweenMeasurements;
+} sllPosMode;
+
+
+/* SLL Supported Features */
+typedef struct {
+ /**< Must be set to # of elements in feature */
+ uint32_t feature_len;
+/**< This field describes which features are supported in the running
+ QMI_LOC service. The array of unit8 is the bitmask where each bit
+ represents a feature enum. Bit 0 represents feature enum ID 0,
+ bit 1 represents feature enum ID 1, etc.
+ For example, if QMI_LOC supports feature enum 0,1,2,8,
+ feature_len is 2, and
+ feature array is [7,1]. \n
+ - Type: Array of uint8
+ - Maximum array length: 100
+ - enum is "loc_supported_feature_enum" which declared in gps_extended_c.h file.
+*/
+ uint8_t feature[SLL_LOC_SUPPORTED_FEATURE_LENGTH_V02];
+} sllFeatureList;
+
+
+/** SLL module’s Event Interface.
+ These Event shall be implement by Synergy Location API module.
+ SLL module shall be store and call these Event APIs.
+ */
+typedef struct {
+ /**
+ Engine Up Event. SLL shall indicate this event when SLL engine is ready to accept
+ command such as start session, delete assistance.
+ SLL context will be used to process this event and will call Adapter APIs in the
+ same context. SLL need to support multiple execution contexts. The execution context
+ will identify using ‘void *context’ variable.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllHandleEngineUpEvent)(void *context);
+
+ /**
+ The SLL event to indicate as Engine Down. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API will called.
+ SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllHandleEngineDownEvent)(void *context);
+
+ /**
+ The SLL event to indicate as PVT report. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API will called.
+ SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #UlpLocation \n
+ #GpsLocationExtended \n
+ #LocPosTechMask \n
+ #GnssDataNotification
+
+ @param location[Input] Ulp Location Report.
+
+ @param locationExtended[Input] Extended location report.
+
+ @param status Session Status.
+
+ @param loc_technology_mask Location Technology Mask.
+
+ @param pDataNotify GNSS Data Notification.
+
+ @param msInWeek Week in milliseconds.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportPosition)(UlpLocation& location,
+ GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask,
+ GnssDataNotification* pDataNotify,
+ int msInWeek, void *context);
+
+ /**
+ The SLL event to indicate as GNSS SV Notification. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssSvNotification \n
+
+ @param GnssSvNotification[Input] GNSS SV Data.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportSv)(GnssSvNotification& svNotify, void *context);
+
+ /**
+ The SLL event to report as GNSS SV Measurement. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssSvMeasurementSet \n
+
+ @param GnssSvMeasurementSet[Input] GNSS SV Measurement Data.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportSvMeasurement)(GnssMeasurements &svMeasurementSet, void *context);
+
+ /**
+ The SLL event to report as GNSS SV Polynomial. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssSvPolynomial \n
+
+ @param svPolynomial[Input] GNSS SV Polynomial Data.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportSvPolynomial)(GnssSvPolynomial &svPolynomial, void *context);
+
+ /**
+ The SLL event to report as GNSS SV Ephemeris. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssSvEphemerisReport \n
+
+ @param svEphemeris[Input] GNSS SV Ephemeris Report.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportSvEphemeris)(GnssSvEphemerisReport &svEphemeris, void *context);
+
+ /**
+ The SLL event to report as GNSS Status Value. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocGpsStatusValue \n
+
+ @param LocGpsStatusValue[Input] GPS Status Value.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportStatus)(LocGpsStatusValue status, void *context);
+
+ /**
+ The SLL event to report NMEA Sentences. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @param nmea[Input] NMEA Sentence.
+
+ @param length[Input] Length of NMEA Sentence.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportNmea)(const char* nmea, int length, void *context);
+
+ /**
+ The SLL event to report GNSS Data Notification. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssDataNotification
+
+ @param dataNotify[Input] GNSS Data Notification.
+
+ @param msInWeek[Input] Week in milliseconds.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportData)(GnssDataNotification& dataNotify, int msInWeek, void *context);
+
+ /**
+ The SLL event to report XTRA Server details. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @param url1[Input] XTRA Server URL -1.
+
+ @param url2[Input] XTRA Server URL -2.
+
+ @param url3[Input] XTRA Server URL -3.
+
+ @param maxlength[Input] Max length of URLs.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportXtraServer)(const char* url1, const char* url2,
+ const char* url3, const int maxlength, void *context);
+
+ /**
+ The SLL event to report Location System Info. This interface API should
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocationSystemInfo
+
+ @param locationSystemInfo[Input] location System Info.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportLocationSystemInfo)(const LocationSystemInfo& locationSystemInfo,
+ void *context);
+
+ /**
+ The SLL event to request XTRA Data. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllRequestXtraData)(void *context);
+
+ /**
+ The SLL event to request Time info. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllRequestTime)(void *context);
+
+ /**
+ The SLL event to request LOcation info. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllRequestLocation)(void *context);
+
+ /**
+ The SLL event to request for ATL. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocAGpsType \n
+ #LocApnTypeMask
+
+ @param connHandle[Input] ATL Connection handle.
+
+ @param agps_type[Input] AGPS Type.
+
+ @param apn_type_mask[Input] APN Type Mask.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllRequestATL)(int connHandle, LocAGpsType agps_type, LocApnTypeMask apn_type_mask,
+ void *context);
+
+ /**
+ The SLL event to request for release ATL. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocAGpsType \n
+ #LocApnTypeMask
+
+ @param connHandle[Input] ATL Connection handle.
+
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReleaseATL)(int connHandle, void *context);
+
+ /**
+ The SLL event to indicate NI Notification. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssNiNotification
+
+ @param notify[Input] GNSS Ni Notification.
+
+ @param data[Input] Ni Data Pointer.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllRequestNiNotify)(GnssNiNotification ¬ify, const void* data, void *context);
+
+ /**
+ The SLL event to report GNSS Measurement Data. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssMeasurementsNotification
+
+ @param measurements[Input] GNSS measurements Data.
+
+ @param msInWeek[Input] Week in milliseconds.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+
+ @Note
+ This API do not have intra-constellation information.
+ */
+ void (*sllReportGnssMeasurementData)(GnssMeasurements& measurements,
+ int msInWeek, void *context);
+ /**
+ The SLL event to report WWAN ZPP Fix. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocGpsLocation
+
+ @param zppLoc[Input] ZPP PVT report.
+
+ @param msInWeek[Input] Week in milliseconds.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportWwanZppFix)(LocGpsLocation &zppLoc, void *context);
+
+ /**
+ The SLL event to report ZPP Best Available Fix. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocGpsLocation \n
+ #GpsLocationExtended \n
+ #LocPosTechMask
+
+ @param zppLoc[Input] ZPP PVT report.
+
+ @param location_extended[Input] Extended Location PVT report.
+
+ @param tech_mask[Input] Tech Mask.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportZppBestAvailableFix) (LocGpsLocation &zppLoc,
+ GpsLocationExtended &location_extended, LocPosTechMask tech_mask, void *context);
+
+ /**
+ The SLL event to report GNSS SV ID Configure. This event is the response of
+ sllGetBlacklistSv request. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssSvIdConfig
+
+ @param config[Input] GNSS SV ID configuration.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportGnssSvIdConfig)(const GnssSvIdConfig& config, void *context);
+
+ /**
+ The SLL event to report GNSS SV Type Configure. This event is response of
+ sllGetConstellationControl request. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssSvTypeConfig
+
+ @param config[Input] GNSS SV Type configuration.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportGnssSvTypeConfig)(const GnssSvTypeConfig& config, void *context);
+
+ /**
+ The SLL event to Request for ODCPI. This interface API should be call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #OdcpiRequestInfo
+
+ @param request[Input] Request for ODCPI.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllRequestOdcpi)(OdcpiRequestInfo& request, void *context);
+
+ /**
+ The SLL event to Report GNSS Engine Energy Consumed. This interface API
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using
+ ‘void *context’ variable.
+
+ @param energyConsumedSinceFirstBoot[Input] Energy Consumed
+ Since from first Boot.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportGnssEngEnergyConsumedEvent)(uint64_t energyConsumedSinceFirstBoot,
+ void *context);
+
+ /**
+ The SLL event to Indicate Deleted Aiding Data. This interface API call by SLL.
+ The Event processing is done in SLL context and same context Adapter API will
+ called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssAidingData
+
+ @param aidingData[Input] Deleted Aiding Data.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportDeleteAidingDataEvent)(GnssAidingData& aidingData, void *context);
+
+ /**
+ The SLL event to GNSS Klobuchar Iono Model. This interface API call by SLL.
+ The Event processing is done in SLL context and same context Adapter API
+ will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssKlobucharIonoModel
+
+ @param ionoModel[Input] GNSS Klobuchar Iono Model.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportKlobucharIonoModel)(GnssKlobucharIonoModel& ionoModel, void *context);
+
+ /**
+ The SLL event to Report GNSS Additional System Info. This interface API
+ call by SLL. The Event processing is done in SLL context and same context
+ Adapter API will called. SLL need to support multiple execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssAdditionalSystemInfo
+
+ @param additionalSystemInfo[Input] Additional System Info.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+ */
+ void (*sllReportGnssAdditionalSystemInfo)(GnssAdditionalSystemInfo& additionalSystemInfo,
+ void *context);
+} SllInterfaceEvent;
+
+/** SLL module’s Interface commands.
+ These commands should implement by SLL module.
+ Synergy Location API module should store and call these command APIs.
+ */
+typedef struct {
+ /**
+ The SLL Open interface function request to open/active device.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LOC_API_ADAPTER_EVENT_MASK_T \n
+ #loc_api_adapter_err
+
+ @param requestedMask [Input]
+ This input variable indicates the requested
+ configuration from the GNSS hardware.
+
+ @param isMaster [Input] 'isMaster' indicates as the master session.
+
+ @param supportedMask[out] The GNSS HW provides its supported configuration.
+
+ @param sllFeatures[out] The GNSS HW provides its supported feature list.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllOpen)(uint64_t requestedMask, bool isMaster,
+ uint64_t *supportedMask, sllFeatureList * sllFeatures,
+ void *context);
+
+ /**
+ The SLL Close interface function request to close/de-active device.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllClose)(void *context);
+
+ /**
+ The SLL Start fix interface function request to start a session of SLL.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param sllPosMode[Input] Provide Session parameters to a start session.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllStartFix)(sllPosMode& fixCriteria, void *context);
+ /**
+ The SLL Stop fix interface function request to stop a ongoing session of SLL.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllStopFix)(void *context);
+
+ /**
+ The SLL Delete Aiding Data interface function request delete assistance data of SLL.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param GnssAidingData[Input] Provide Session parameters to a start session.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllDeleteAidingData)(const GnssAidingData& data, void *context);
+
+ /**
+ The interface function to inject Position to SLL. This interface API should be call by
+ Synergy LOC API. This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssLocationInfoNotification
+ #loc_api_adapter_err
+
+ @param locationInfo[Input] Position to inject.
+
+ @param onDemandCpi[Input] Flag to indicate on demand.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllInjectPosition)(const GnssLocationInfoNotification &locationInfo,
+ bool onDemandCpi, void *context);
+
+ /**
+ The interface function to set time of SLL. This interface API should be call by
+ Synergy LOC API. This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocGpsUtcTime
+ #loc_api_adapter_err
+
+ @param time[Input] Time to inject.
+
+ @param timeReference[Input] Indicate time reference.
+
+ @param uncertainty[Input] Time uncertainty.
+
+ @param onDemandCpi[Input] Flag to indicate on demand.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetTime)(LocGpsUtcTime time, int64_t timeReference,
+ int uncertainty, void *context);
+
+ /**
+ The interface function to inject XTRA Data to SLL. This interface API should be call by
+ Synergy LOC API. This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param data[Input] XTRA data.
+
+ @param length[Input] Indicate length of XTRA data.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetXtraData)(char* data, int length, void *context);
+
+ /**
+ The interface function to request for XTRA Server to SLL. This interface API should be call by
+ Synergy LOC API. This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllRequestXtraServer)(void *context);
+
+
+ /**
+ The interface function to indicate status of open ATL connection.
+ This interface API should be call by Synergy LOC API. This API will be called multiple
+ times in different execution contexts. The execution context will identify using
+ ‘void *context’ variable.
+
+ @datatypes
+ #AGpsBearerType
+ #LocAGpsType
+ #LocApnTypeMask
+ #loc_api_adapter_err
+
+ @param handle[Input] handle of ATL connection status.
+
+ @param is_succ[Input] Indicate status of ATL Connection.
+
+ @param apn[Input] Provide APN details.
+
+ @param apnLen[Input] Length of APN data.
+
+ @param bear[Input] Indicate bearer type.
+
+ @param agpsType[Input] Indicate AGPS type.
+
+ @param mask[Input] Indicate APN type.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllAtlOpenStatus)(int handle, int is_succ, char* apn,
+ uint32_t apnLen, AGpsBearerType bear, LocAGpsType agpsType, LocApnTypeMask mask,
+ void *context);
+
+ /**
+ The interface function to indicate status of close ATL connection.
+ This interface API should be call by Synergy LOC API. This API will be called multiple
+ times in different execution contexts. The execution context will identify using
+ ‘void *context’ variable.
+
+ @datatypes
+ #AGpsBearerType
+ #LocAGpsType
+ #LocApnTypeMask
+ #loc_api_adapter_err
+
+ @param handle[Input] handle of ATL connection status.
+
+ @param is_succ[Input] Indicate status of ATL Connection.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllAtlCloseStatus)(int handle, int is_succ, void *context);
+
+ /**
+ The SLL Set Position Mode interface function to update session parameters of
+ ongoing session or upcoming session. This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param sllPosMode[Input] Provide Session parameters to a start session.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetPositionMode)(sllPosMode& posMode, void *context);
+
+ /**
+ The SLL interface function to Set Sync Server URL. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocServerType
+ #loc_api_adapter_err
+
+ @param url[Input] Indicate URL.
+
+ @param len[Input] Indicate URL length.
+
+ @param type[Input] Indicate Location Server Type.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetServerSync)(const char* url, int len, LocServerType type,
+ void *context);
+
+ /**
+ The SLL interface function to inform NI Response. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssNiResponse
+ #loc_api_adapter_err
+
+ @param userResponse[Input] Ni User Response.
+
+ @param passThroughData[Input] Pass Through Data.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllInformNiResponse)(GnssNiResponse userResponse,
+ const void* passThroughData, void *context);
+
+ /**
+ The SLL interface function to configure SUPL version. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssConfigSuplVersion
+ #loc_api_adapter_err
+
+ @param version[Input] Indicate SUPL version.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetSUPLVersionSync)(GnssConfigSuplVersion version, void *context);
+
+ /**
+ The SLL interface function to configure NMEA Type. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssConfigSuplVersion
+ #loc_api_adapter_err
+
+ @param typesMask[Input] Configure of Type Mask.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetNMEATypesSync)(uint32_t typesMask, void *context);
+
+ /**
+ The SLL interface function to configure LPP sync. This interface API should be call by
+ Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssConfigLppProfile
+ #loc_api_adapter_err
+
+ @param profile[Input] Configure of LPP Profile.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetLPPConfigSync)(GnssConfigLppProfile profile, void *context);
+
+ /**
+ The SLL interface function to configure Sensor Properties. This interface API should
+ call by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param gyroBiasVarianceRandomWalk_valid[Input] Flag to indicate Gyro Bias.
+
+ @param gyroBiasVarianceRandomWalk[Input] Gyro Bias.
+
+ @param accelBiasVarianceRandomWalk_valid[Input] Flag to indicate ACCEL Bias.
+
+ @param accelBiasVarianceRandomWalk[Input] ACCEL Bias.
+
+ @param angleBiasVarianceRandomWalk_valid[Input] Flag to indicateAngle Bias.
+
+ @param angleBiasVarianceRandomWalk[Input] Angle Bias.
+
+ @param rateBiasVarianceRandomWalk_valid[Input] Flag to indicate Angle Bias.
+
+ @param rateBiasVarianceRandomWalk[Input] Rate Bias.
+
+ @param velocityBiasVarianceRandomWalk_valid[Input] Flag to indicate Velocity Bias.
+
+ @param velocityBiasVarianceRandomWalk[Input] Velocity Bias.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetSensorPropertiesSync)
+ (bool gyroBiasVarianceRandomWalk_valid,
+ float gyroBiasVarianceRandomWalk,
+ bool accelBiasVarianceRandomWalk_valid,
+ float accelBiasVarianceRandomWalk,
+ bool angleBiasVarianceRandomWalk_valid,
+ float angleBiasVarianceRandomWalk,
+ bool rateBiasVarianceRandomWalk_valid,
+ float rateBiasVarianceRandomWalk,
+ bool velocityBiasVarianceRandomWalk_valid,
+ float velocityBiasVarianceRandomWalk, void *context);
+ /**
+ The SLL interface function to configure Set Sensor Preference Control.
+ This interface API should be call by Synergy LOC API. This API will be called
+ multiple times in different execution contexts. The execution context will
+ identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param accelSamplesPerBatch[Input] ACCEL Samples per batch.
+
+ @param accelBatchesPerSec[Input] ACCEL Batches per seconds.
+
+ @param gyroSamplesPerBatch[Input] Gyro Samples per batch.
+
+ @param gyroBatchesPerSec[Input] Gyro Batches per seconds.
+
+ @param accelSamplesPerBatchHigh[Input] ACCEL Sample per batch High.
+
+ @param accelBatchesPerSecHigh[Input] ACCEL batches per Seconds High.
+
+ @param gyroSamplesPerBatchHigh[Input] Gyro Samples per Batch High.
+
+ @param gyroBatchesPerSecHigh[Input] Gyro Batch Per Sec High.
+
+ @param algorithmConfig[Input] Algorithm Configure.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetSensorPerfControlConfigSync)(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig, void *context);
+ /**
+ The SLL interface function to configure AGLONASS Protocol Sync. This interface
+ API should be call by Synergy LOC API. This API will be called multiple times in
+ different execution contexts. The execution context will identify using
+ ‘void *context’ variable.
+
+ @datatypes
+ #GnssConfigAGlonassPositionProtocolMask
+ #loc_api_adapter_err
+
+ @param aGlonassProtocol[Input] Configure AGLONASS Protocol sync.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetAGLONASSProtocolSync)
+ (GnssConfigAGlonassPositionProtocolMask aGlonassProtocol, void *context);
+
+ /**
+ The SLL interface function to Set LPP protocol Control Plan Sync Mask. This interface API
+ should be call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssConfigLppeControlPlaneMask
+ #loc_api_adapter_err
+
+ @param lppeCP[Input] Configure of LPP protocol of Control Plan Mask.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetLPPeProtocolCpSync)(GnssConfigLppeControlPlaneMask lppeCP,
+ void *context);
+
+ /**
+ The SLL interface function to Set LPP protocol User Plan Sync Mask. This interface API should
+ call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssConfigLppeUserPlaneMask
+ #loc_api_adapter_err
+
+ @param profile[Input] Configure of LPP User Plan Mask Profile.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetLPPeProtocolUpSync)(GnssConfigLppeUserPlaneMask lppeUP,
+ void *context);
+
+ /**
+ The SLL interface function to get GNSS SUPL Version. This interface API should be call by
+ Synergy LOC API. This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+ This is blocking call.
+
+ @datatypes
+ #GnssConfigSuplVersion
+ #loc_api_adapter_err
+
+ @param suplVersion[Input] SUPL version.
+
+ @param suplConfig[Output] SUPL Version configuration.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllConvertSuplVersion)(const uint32_t suplVersion,
+ GnssConfigSuplVersion *suplConfig, void *context);
+
+ /**
+ The SLL interface function to get GNSS LPP profile. This interface API should
+ call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+ This is blocking call.
+
+ @datatypes
+ #GnssConfigLppProfile
+ #loc_api_adapter_err
+
+ @param lppProfile[Input] LPP Profile.
+
+ @param gnssLppProfile[Output] GNSS LPP Profile configuration.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllConvertLppProfile)(const uint32_t lppProfile,
+ GnssConfigLppProfile *gnssLppProfile, void *context);
+
+ /**
+ The SLL interface function to get GNSS LPP Control Plan Mask. This interface API should
+ call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+ This is blocking call.
+
+ @datatypes
+ #GnssConfigLppeControlPlaneMask
+ #loc_api_adapter_err
+
+ @param lppeControlPlaneMask[Input] LPP Control Plan Mask.
+
+ @param lppControlPlanMask[Output] GNSS LPP Control Plan Mask configuration.
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllConvertLppeCp)(const uint32_t lppeControlPlaneMask,
+ GnssConfigLppeControlPlaneMask *gnssLppControlPlanMask, void *context);
+
+ /**
+ The SLL interface function to get GNSS LPP User Plan Mask. This interface API should
+ call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+ This is blocking call.
+
+ @datatypes
+ #GnssConfigLppeUserPlaneMask
+ #loc_api_adapter_err
+
+ @param lppeUserPlaneMask[Input] LPP User Plan Mask.
+
+ @param lppControlPlanMask[Output] GNSS LPP User Plan Mask configuration.
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllConvertLppeUp)(const uint32_t lppeUserPlaneMask,
+ GnssConfigLppeUserPlaneMask *gnssLppUpMask, void *context);
+
+ /**
+ The SLL interface function to request for WWAN ZPP Fix. This interface API should
+ call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllGetWwanZppFix)(void *context);
+
+ /**
+ The SLL interface function to request for Best Available ZPP Fix. This interface
+ API should be call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllGetBestAvailableZppFix)(void *context);
+
+ /**
+ The SLL interface to request GPS Lock incase of SUPL when GNSS disabled. This interface
+ API should be call by Synergy LOC API. This API will be called multiple times in different
+ execution contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssConfigGpsLock
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetGpsLockSync)(GnssConfigGpsLock lock, void *context);
+
+ /**
+ The SLL interface to request For Aiding Data. This interface API should be call by
+ Synergy LOC API. This API will be called multiple times in different execution
+ contexts.The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #GnssAidingDataSvMask
+ #loc_api_adapter_err
+
+ @GnssConfigGpsLock[Input] GNSS Aiding Data SV Mask.
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllRequestForAidingData)(GnssAidingDataSvMask svDataMask,
+ void *context);
+
+ /**
+ The SLL interface to Get GPS Lock incase of SUPL. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using 'void *context' variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param subType[Input] Subscription that is associated with the engine lock state
+ being requested
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllGetGpsLock)(uint8_t subType, void *context);
+
+
+ /**
+ The SLL interface to Set XTRA Veresion Check. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using 'void *context' variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param check[Input] Check XTRA File Version.
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetXtraVersionCheckSync)(uint32_t check, void *context);
+
+
+ /**
+ The SLL interface function to Install AGPS Certificate. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #LocDerEncodedCertificate
+ #loc_api_adapter_err
+
+ @param pData[Input] Encoded AGPS Certificate.
+
+ @param length[Input] Length of AGPS Certificate.
+
+ @param slotBitMask[Input] Slot Bit mask.
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllInstallAGpsCert)(const LocDerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask, void *context);
+
+ /**
+ The SLL interface function to set constraint for time uncertainty and energy Budget.
+ This interface API should be call by Synergy LOC API. This API will be called multiple
+ times in different execution contexts. The execution context will identify using
+ 'void *context' variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param enabled[Input] Enabled or Disabled Constrained.
+
+ @param tuncConstraint[Input] If constraint is enabled, the engine maintains its
+ time uncertainty below the specified constraint in
+ tuncConstraint. The units are in ms.
+
+ @param energyBudget[Input] If constraint is enabled, and if energyBudget is
+ specified, the engine uses this as the maximum energy
+ to be used while keeping the engine in constrained tunc
+ mode. Units: 0.1 milliwatt second.
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetConstrainedTuncMode)(bool enabled, float tuncConstraint,
+ uint32_t energyBudget, void *context);
+
+ /**
+ The SLL interface function to enable position assisted clock estimation mode.
+ This interface API should be call by Synergy LOC API. This API will be called multiple
+ times in different execution contexts. The execution context will identify using
+ 'void *context' variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param enabled[Input] Enabled or Disabled position assisted clock estimation mode.
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetPositionAssistedClockEstimatorMode)(bool enabled,
+ void *context);
+
+ /**
+ The SLL interface function to get GNSS Energy Consumed. This interface API should be call
+ by Synergy LOC API. This API will be called multiple times in different execution
+ contexts. The execution context will identify using 'void *context' variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllGetGnssEnergyConsumed)(void *context);
+
+ /**
+ This API used to indicate Blacklisted SV to the GNSS hardware.
+ GNSS hardware can avoid these blacklisted SV in position report calculation.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param GnssSvIdConfig[Input] GNSS SV ID Configuration.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetBlacklistSv)(const GnssSvIdConfig& config, void *context);
+
+ /**
+ This API used to request to get Blacklisted SV from GNSS hardware.
+ GNSS hardware indicate blacklisted SV using sllReportGnssSvIdConfig event.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllGetBlacklistSv)(void *context);
+
+ /**
+ This API used to request to set supported constellation to GNSS hardware.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllSetConstellationControl)(const GnssSvTypeConfig& config,
+ void *context);
+
+ /**
+ This API used to request to get supported constellation from GNSS hardware.
+ GNSS hardware indicate supported constellation using sllReportGnssSvTypeConfig event.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllGetConstellationControl)(void *context);
+
+ /**
+ This API used to request to reset supported constellation from GNSS hardware.
+ This interface API should be call by Synergy LOC API.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #loc_api_adapter_err
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err[Output]
+ The return status LOC_API_ADAPTER_ERR_SUCCESS indicate command
+ is successfully received and other status indicate as failure.
+
+ @dependencies
+ None.
+ */
+ enum loc_api_adapter_err (*sllResetConstellationControl)(void *context);
+
+} SllInterfaceReq;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /**
+ The Synergy location layer(SLL) interface function provide commands and events callbacks to
+ interact with SLL module.
+ This interface API should be call by Synergy LOC API module and it should implement by SLL.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #SllInterfaceReq \n
+ #SllInterfaceEvent
+
+ @param eventCallback[Input] These are event callbacks of SLL module. These events should
+ implement by Synergy Location API.
+ SLL module should store and call these event APIs.
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store and
+ use any future interaction with Synergy location API.
+
+ @return
+ SllInterfaceReq[Output] These are Interface commands of SLL module. These commands
+ should implement by SLL module.
+ Synergy Location API module should store and call these
+ command APIs.
+
+ @dependencies
+ None.
+ */
+ const SllInterfaceReq* get_sll_if_api(const SllInterfaceEvent* eventCallback, void *context);
+
+ /**
+ The Synergy location layer(SLL) interface function pointer provide commands and events
+ callbacks to interact with SLL module. This interface API should be call by Synergy LOC
+ API module, and it should implement by SLL.
+ This API will be called multiple times in different execution contexts.
+ The execution context will identify using ‘void *context’ variable.
+
+ @datatypes
+ #SllInterfaceReq \n
+ #SllInterfaceEvent
+
+ @param eventCallback[Input] These are event callbacks of SLL module. These events
+ should implement by Synergy Location API.
+ SLL module should store and call these event APIs.
+ @param context[Input] Context Pointer of Synergy Location API. SLL should store
+ and use any future interaction with Synergy location API.
+
+ @return
+ SllInterfaceReq[Output] These are Interface commands of SLL module. These commands
+ should implement by SLL module.
+ Synergy Location API module should store and call these
+ command APIs.
+
+ @dependencies
+ None.
+ */
+ typedef const SllInterfaceReq* (*get_sll_if_api_t)
+ (const SllInterfaceEvent* eventCallback, void *context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_SLL_INTERFACE_H */
diff --git a/location/location_hal_daemon/LocHalDaemonClientHandler.cpp b/location/location_hal_daemon/LocHalDaemonClientHandler.cpp
new file mode 100644
index 0000000..b1d9763
--- /dev/null
+++ b/location/location_hal_daemon/LocHalDaemonClientHandler.cpp
@@ -0,0 +1,1016 @@
+/* Copyright (c) 2018-2020, 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 <cinttypes>
+#include <gps_extended_c.h>
+#include <LocationApiMsg.h>
+#include <LocHalDaemonClientHandler.h>
+#include <LocationApiService.h>
+
+shared_ptr<LocIpcSender> LocHalDaemonClientHandler::createSender(const string socket) {
+ SockNode sockNode(SockNode::create(socket));
+ return sockNode.createSender(true);
+}
+
+/******************************************************************************
+LocHalDaemonClientHandler - updateSubscriptionMask
+******************************************************************************/
+void LocHalDaemonClientHandler::updateSubscription(uint32_t mask) {
+
+ // update my subscription mask
+ mSubscriptionMask = mask;
+
+ // set callback functions for Location API
+ mCallbacks.size = sizeof(mCallbacks);
+
+ // mandatory callback
+ mCallbacks.capabilitiesCb = [this](LocationCapabilitiesMask mask) {
+ onCapabilitiesCallback(mask);
+ };
+ mCallbacks.responseCb = [this](LocationError err, uint32_t id) {
+ onResponseCb(err, id);
+ };
+ mCallbacks.collectiveResponseCb =
+ [this](size_t count, LocationError* errs, uint32_t* ids) {
+ onCollectiveResponseCallback(count, errs, ids);
+ };
+
+ if (mSubscriptionMask & E_LOC_CB_DISTANCE_BASED_TRACKING_BIT) {
+ mCallbacks.trackingCb = [this](Location location) {
+ onTrackingCb(location);
+ };
+ }
+
+ // batching
+ if (mSubscriptionMask & E_LOC_CB_BATCHING_BIT) {
+ mCallbacks.batchingCb = [this](size_t count, Location* location,
+ BatchingOptions batchingOptions) {
+ onBatchingCb(count, location, batchingOptions);
+ };
+ } else {
+ mCallbacks.batchingCb = nullptr;
+ }
+ // batchingStatus
+ if (mSubscriptionMask & E_LOC_CB_BATCHING_STATUS_BIT) {
+ mCallbacks.batchingStatusCb = [this](BatchingStatusInfo batchingStatus,
+ std::list<uint32_t>& listOfCompletedTrips) {
+ onBatchingStatusCb(batchingStatus, listOfCompletedTrips);
+ };
+ } else {
+ mCallbacks.batchingStatusCb = nullptr;
+ }
+ //Geofence Breach
+ if (mSubscriptionMask & E_LOC_CB_GEOFENCE_BREACH_BIT) {
+ mCallbacks.geofenceBreachCb = [this](GeofenceBreachNotification geofenceBreachNotif) {
+ onGeofenceBreachCb(geofenceBreachNotif);
+ };
+ } else {
+ mCallbacks.geofenceBreachCb = nullptr;
+ }
+
+ // location info
+ if (mSubscriptionMask & (E_LOC_CB_GNSS_LOCATION_INFO_BIT | E_LOC_CB_SIMPLE_LOCATION_INFO_BIT)) {
+ mCallbacks.gnssLocationInfoCb = [this](GnssLocationInfoNotification notification) {
+ onGnssLocationInfoCb(notification);
+ };
+ } else {
+ mCallbacks.gnssLocationInfoCb = nullptr;
+ }
+
+ // engine locations info
+ if (mSubscriptionMask & E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT) {
+ mCallbacks.engineLocationsInfoCb =
+ [this](uint32_t count, GnssLocationInfoNotification* notificationArr) {
+ onEngLocationsInfoCb(count, notificationArr);
+ };
+ } else {
+ mCallbacks.engineLocationsInfoCb = nullptr;
+ }
+
+ // sv info
+ if (mSubscriptionMask & E_LOC_CB_GNSS_SV_BIT) {
+ mCallbacks.gnssSvCb = [this](GnssSvNotification notification) {
+ onGnssSvCb(notification);
+ };
+ } else {
+ mCallbacks.gnssSvCb = nullptr;
+ }
+
+ // nmea
+ if (mSubscriptionMask & E_LOC_CB_GNSS_NMEA_BIT) {
+ mCallbacks.gnssNmeaCb = [this](GnssNmeaNotification notification) {
+ onGnssNmeaCb(notification);
+ };
+ } else {
+ mCallbacks.gnssNmeaCb = nullptr;
+ }
+
+ // data
+ if (mSubscriptionMask & E_LOC_CB_GNSS_DATA_BIT) {
+ mCallbacks.gnssDataCb = [this](GnssDataNotification notification) {
+ onGnssDataCb(notification);
+ };
+ } else {
+ mCallbacks.gnssDataCb = nullptr;
+ }
+
+ // measurements
+ if (mSubscriptionMask & E_LOC_CB_GNSS_MEAS_BIT) {
+ mCallbacks.gnssMeasurementsCb = [this](GnssMeasurementsNotification notification) {
+ onGnssMeasurementsCb(notification);
+ };
+ } else {
+ mCallbacks.gnssMeasurementsCb = nullptr;
+ }
+
+ // system info
+ if (mSubscriptionMask & E_LOC_CB_SYSTEM_INFO_BIT) {
+ mCallbacks.locationSystemInfoCb = [this](LocationSystemInfo notification) {
+ onLocationSystemInfoCb(notification);
+ };
+ } else {
+ mCallbacks.locationSystemInfoCb = nullptr;
+ }
+
+ // following callbacks are not supported
+ mCallbacks.gnssNiCb = nullptr;
+ mCallbacks.geofenceStatusCb = nullptr;
+
+ // call location API if already created
+ if (mLocationApi) {
+ LOC_LOGd("--> updateCallbacks mask=0x%x", mask);
+ mLocationApi->updateCallbacks(mCallbacks);
+ }
+}
+
+uint32_t LocHalDaemonClientHandler::startTracking() {
+ LOC_LOGd("distance %d, internal %d, req mask %x",
+ mOptions.minDistance, mOptions.minInterval,
+ mOptions.locReqEngTypeMask);
+ if (mSessionId == 0 && mLocationApi) {
+ mSessionId = mLocationApi->startTracking(mOptions);
+ }
+ return mSessionId;
+}
+
+// Round input TBF to 100ms, 200ms, 500ms, and integer senconds
+// input tbf < 200 msec, round to 100 msec, else
+// input tbf < 500 msec, round to 200 msec, else
+// input tbf < 1000 msec, round to 500 msec, else
+// round up input tbf to the closet integer seconds
+uint32_t LocHalDaemonClientHandler::startTracking(LocationOptions & locOptions) {
+ LOC_LOGd("distance %d, internal %d, req mask %x",
+ locOptions.minDistance, locOptions.minInterval,
+ locOptions.locReqEngTypeMask);
+ if (mSessionId == 0 && mLocationApi) {
+ // update option
+ mOptions = locOptions;
+ // set interval to engine supported interval
+ mOptions.minInterval = getSupportedTbf(mOptions.minInterval);
+ mSessionId = mLocationApi->startTracking(mOptions);
+ }
+
+ return mSessionId;
+}
+
+void LocHalDaemonClientHandler::unsubscribeLocationSessionCb() {
+
+ uint32_t subscriptionMask = mSubscriptionMask;
+
+ subscriptionMask &= ~LOCATION_SESSON_ALL_INFO_MASK;
+ updateSubscription(subscriptionMask);
+}
+
+void LocHalDaemonClientHandler::stopTracking() {
+ if (mSessionId != 0 && mLocationApi) {
+ mLocationApi->stopTracking(mSessionId);
+ mSessionId = 0;
+ }
+}
+
+void LocHalDaemonClientHandler::updateTrackingOptions(LocationOptions & locOptions) {
+ if (mSessionId != 0 && mLocationApi) {
+ LOC_LOGe("distance %d, internal %d, req mask %x",
+ locOptions.minDistance, locOptions.minInterval,
+ locOptions.locReqEngTypeMask);
+
+ TrackingOptions trackingOption;
+ trackingOption.setLocationOptions(locOptions);
+ // set tbf to device supported tbf
+ trackingOption.minInterval = getSupportedTbf(trackingOption.minInterval);
+ mLocationApi->updateTrackingOptions(mSessionId, trackingOption);
+
+ // save other info: eng req type that will be used in filtering
+ mOptions = locOptions;
+ }
+}
+
+uint32_t LocHalDaemonClientHandler::startBatching(uint32_t minInterval, uint32_t minDistance,
+ BatchingMode batchMode) {
+ if (mBatchingId == 0 && mLocationApi) {
+ // update option
+ LocationOptions locOption = {};
+ locOption.size = sizeof(locOption);
+ locOption.minInterval = minInterval;
+ locOption.minDistance = minDistance;
+ locOption.mode = GNSS_SUPL_MODE_STANDALONE;
+ mBatchOptions.size = sizeof(mBatchOptions);
+ mBatchOptions.batchingMode = batchMode;
+ mBatchOptions.setLocationOptions(locOption);
+
+ mBatchingId = mLocationApi->startBatching(mBatchOptions);
+ }
+ return mBatchingId;
+
+}
+
+void LocHalDaemonClientHandler::stopBatching() {
+ if (mBatchingId != 0 && mLocationApi) {
+ mLocationApi->stopBatching(mBatchingId);
+ mBatchingId = 0;
+ }
+}
+
+void LocHalDaemonClientHandler::updateBatchingOptions(uint32_t minInterval, uint32_t minDistance,
+ BatchingMode batchMode) {
+ if (mBatchingId != 0 && mLocationApi) {
+ // update option
+ LocationOptions locOption = {};
+ locOption.size = sizeof(locOption);
+ locOption.minInterval = minInterval;
+ locOption.minDistance = minDistance;
+ locOption.mode = GNSS_SUPL_MODE_STANDALONE;
+ mBatchOptions.size = sizeof(mBatchOptions);
+ mBatchOptions.batchingMode = batchMode;
+ mBatchOptions.setLocationOptions(locOption);
+
+ mLocationApi->updateBatchingOptions(mBatchingId, mBatchOptions);
+ }
+}
+void LocHalDaemonClientHandler::setGeofenceIds(size_t count, uint32_t* clientIds,
+ uint32_t* sessionIds) {
+ for (int i=0; i<count; ++i) {
+ mGfIdsMap[clientIds[i]] = sessionIds[i];
+ }
+}
+
+void LocHalDaemonClientHandler::eraseGeofenceIds(size_t count, uint32_t* clientIds) {
+ for (int i=0; i<count; ++i) {
+ mGfIdsMap.erase(clientIds[i]);
+ }
+}
+uint32_t* LocHalDaemonClientHandler::getSessionIds(size_t count, uint32_t* clientIds) {
+ uint32_t* sessionIds = nullptr;
+ if (count > 0) {
+ sessionIds = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ if (nullptr == sessionIds) {
+ return nullptr;
+ }
+ memset(sessionIds, 0, sizeof(uint32_t) * count);
+ for (int i=0; i<count; ++i) {
+ sessionIds[i] = mGfIdsMap[clientIds[i]];
+ }
+ }
+ return sessionIds;
+}
+
+uint32_t* LocHalDaemonClientHandler::getClientIds(size_t count, uint32_t* sessionIds) {
+ uint32_t* clientIds = nullptr;
+ if (count > 0) {
+ clientIds = (uint32_t*)malloc(sizeof(uint32_t) * count);
+ if (nullptr == clientIds) {
+ return nullptr;
+ }
+ memset(clientIds, 0, sizeof(uint32_t) * count);
+ for (int i=0; i<count; ++i) {
+ for(auto itor = mGfIdsMap.begin(); itor != mGfIdsMap.end(); itor++) {
+ if (itor->second == sessionIds[i]) {
+ clientIds[i] = itor->first;
+ }
+ }
+ }
+ }
+ return clientIds;
+}
+
+uint32_t* LocHalDaemonClientHandler::addGeofences(size_t count, GeofenceOption* options,
+ GeofenceInfo* info) {
+ if (count > 0 && mLocationApi) {
+ mGeofenceIds = mLocationApi->addGeofences(count, options, info);
+ if (mGeofenceIds) {
+ LOC_LOGi("start new geofence sessions: %p", mGeofenceIds);
+ }
+ }
+ return mGeofenceIds;
+}
+
+void LocHalDaemonClientHandler::removeGeofences(size_t count, uint32_t* ids) {
+ if (count > 0 && mLocationApi) {
+ mLocationApi->removeGeofences(count, ids);
+ }
+}
+
+void LocHalDaemonClientHandler::modifyGeofences(size_t count, uint32_t* ids,
+ GeofenceOption* options) {
+ if (count >0 && mLocationApi) {
+ mLocationApi->modifyGeofences(count, ids, options);
+ }
+}
+void LocHalDaemonClientHandler::pauseGeofences(size_t count, uint32_t* ids) {
+ if (count > 0 && mLocationApi) {
+ mLocationApi->pauseGeofences(count, ids);
+ }
+}
+void LocHalDaemonClientHandler::resumeGeofences(size_t count, uint32_t* ids) {
+ if (count > 0 && mLocationApi) {
+ mLocationApi->resumeGeofences(count, ids);
+ }
+}
+
+void LocHalDaemonClientHandler::pingTest() {
+
+ if (nullptr != mIpcSender) {
+ LocAPIPingTestIndMsg msg(SERVICE_NAME);
+ int rc = sendMessage(msg);
+
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::cleanup() {
+ // please do not attempt to hold the lock, as the caller of this function
+ // already holds the lock
+
+ // set the ptr to null to prevent further sending out message to the
+ // remote client that is no longer reachable
+ mIpcSender = nullptr;
+
+ // check whether this is client from external AP,
+ // mName for client on external ap is fully-qualified path name ending with
+ // "serviceid.instanceid"
+ if (strncmp(mName.c_str(), EAP_LOC_CLIENT_DIR,
+ sizeof(EAP_LOC_CLIENT_DIR)-1) == 0 ) {
+ LOC_LOGv("removed file %s", mName.c_str());
+ if (0 != remove(mName.c_str())) {
+ LOC_LOGe("<-- failed to remove file %s", mName.c_str());
+ }
+ }
+
+ if (mLocationApi) {
+ mLocationApi->destroy([this]() {onLocationApiDestroyCompleteCb();});
+ mLocationApi = nullptr;
+ } else {
+ // For location integration api client handler, it does not
+ // instantiate LocationApi interface and can be freed right away
+ LOC_LOGe("delete LocHalDaemonClientHandler");
+ delete this;
+ }
+}
+
+/******************************************************************************
+LocHalDaemonClientHandler - Location API response callback functions
+******************************************************************************/
+void LocHalDaemonClientHandler::onResponseCb(LocationError err, uint32_t id) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+
+ if (nullptr != mIpcSender) {
+ LOC_LOGd("--< onResponseCb err=%u id=%u", err, id);
+
+ ELocMsgID pendingMsgId = E_LOCAPI_UNDEFINED_MSG_ID;
+ if (!mPendingMessages.empty()) {
+ pendingMsgId = mPendingMessages.front();
+ mPendingMessages.pop();
+ }
+
+ int rc = 0;
+ // send corresponding indication message if pending
+ switch (pendingMsgId) {
+ case E_LOCAPI_START_TRACKING_MSG_ID: {
+ LOC_LOGd("<-- start resp err=%u id=%u pending=%u", err, id, pendingMsgId);
+ LocAPIGenericRespMsg msg(SERVICE_NAME, E_LOCAPI_START_TRACKING_MSG_ID, err);
+ rc = sendMessage(msg);
+ break;
+ }
+ case E_LOCAPI_STOP_TRACKING_MSG_ID: {
+ LOC_LOGd("<-- stop resp err=%u id=%u pending=%u", err, id, pendingMsgId);
+ LocAPIGenericRespMsg msg(SERVICE_NAME, E_LOCAPI_STOP_TRACKING_MSG_ID, err);
+ rc = sendMessage(msg);
+ break;
+ }
+ case E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID: {
+ LOC_LOGd("<-- update resp err=%u id=%u pending=%u", err, id, pendingMsgId);
+ LocAPIGenericRespMsg msg(SERVICE_NAME, E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID, err);
+ rc = sendMessage(msg);
+ break;
+ }
+ case E_LOCAPI_START_BATCHING_MSG_ID : {
+ LOC_LOGd("<-- start batching resp err=%u id=%u pending=%u", err, id, pendingMsgId);
+ LocAPIGenericRespMsg msg(SERVICE_NAME, E_LOCAPI_START_BATCHING_MSG_ID , err);
+ rc = sendMessage(msg);
+ break;
+ }
+ case E_LOCAPI_STOP_BATCHING_MSG_ID: {
+ LOC_LOGd("<-- stop batching resp err=%u id=%u pending=%u", err, id, pendingMsgId);
+ LocAPIGenericRespMsg msg(SERVICE_NAME, E_LOCAPI_STOP_BATCHING_MSG_ID, err);
+ rc = sendMessage(msg);
+ break;
+ }
+ case E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID: {
+ LOC_LOGd("<-- update batching options resp err=%u id=%u pending=%u", err, id,
+ pendingMsgId);
+ LocAPIGenericRespMsg msg(SERVICE_NAME, E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID, err);
+ rc = sendMessage(msg);
+ break;
+ }
+ default: {
+ LOC_LOGe("no pending message for %s", mName.c_str());
+ return;
+ }
+ }
+
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onCollectiveResponseCallback(
+ size_t count, LocationError *errs, uint32_t *ids) {
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onCollectiveResponseCallback");
+
+ if (nullptr == mIpcSender) {
+ return;
+ }
+
+ ELocMsgID pendingMsgId = E_LOCAPI_UNDEFINED_MSG_ID;
+ if (!mGfPendingMessages.empty()) {
+ pendingMsgId = mGfPendingMessages.front();
+ mGfPendingMessages.pop();
+ }
+ if (0 == count) {
+ return;
+ }
+ // serialize LocationError and ids into ipc message payload
+ size_t msglen = sizeof(LocAPICollectiveRespMsg) + sizeof(GeofenceResponse) * (count - 1);
+ uint8_t *msg = new(std::nothrow) uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ memset(msg, 0, msglen);
+ LocAPICollectiveRespMsg *pmsg = reinterpret_cast<LocAPICollectiveRespMsg*>(msg);
+ strlcpy(pmsg->mSocketName, SERVICE_NAME, MAX_SOCKET_PATHNAME_LENGTH);
+ pmsg->collectiveRes.size = msglen;
+ pmsg->collectiveRes.count = count;
+
+ int rc = 0;
+ uint32_t* clientIds = getClientIds(count, ids);
+ if (nullptr == clientIds) {
+ delete[] msg;
+ return;
+ }
+ GeofenceResponse gfResponse = {};
+ for (int i=0; i<count; ++i) {
+ gfResponse.clientId = clientIds[i];
+ gfResponse.error = errs[i];
+ *(pmsg->collectiveRes.resp+i) = gfResponse;
+ if (errs[i] != LOCATION_ERROR_SUCCESS) {
+ eraseGeofenceIds(1, &clientIds[i]);
+ }
+ }
+
+ // send corresponding indication message if pending
+ switch (pendingMsgId) {
+ case E_LOCAPI_ADD_GEOFENCES_MSG_ID: {
+ LOC_LOGd("<-- addGeofence resp pending=%u", pendingMsgId);
+ pmsg->msgId = E_LOCAPI_ADD_GEOFENCES_MSG_ID;
+ rc = sendMessage(msg, msglen);
+ break;
+ }
+ case E_LOCAPI_REMOVE_GEOFENCES_MSG_ID: {
+ LOC_LOGd("<-- removeGeofence resp pending=%u", pendingMsgId);
+ pmsg->msgId = E_LOCAPI_REMOVE_GEOFENCES_MSG_ID;
+ eraseGeofenceIds(count, clientIds);
+ rc = sendMessage(msg, msglen);
+ break;
+ }
+ case E_LOCAPI_MODIFY_GEOFENCES_MSG_ID: {
+ LOC_LOGd("<-- modifyGeofence resp pending=%u", pendingMsgId);
+ pmsg->msgId = E_LOCAPI_MODIFY_GEOFENCES_MSG_ID;
+ rc = sendMessage(msg, msglen);
+ break;
+ }
+ case E_LOCAPI_PAUSE_GEOFENCES_MSG_ID: {
+ LOC_LOGd("<-- pauseGeofence resp pending=%u", pendingMsgId);
+ pmsg->msgId = E_LOCAPI_PAUSE_GEOFENCES_MSG_ID;
+ rc = sendMessage(msg, msglen);
+ break;
+ }
+ case E_LOCAPI_RESUME_GEOFENCES_MSG_ID: {
+ LOC_LOGd("<-- resumeGeofence resp pending=%u", pendingMsgId);
+ pmsg->msgId = E_LOCAPI_RESUME_GEOFENCES_MSG_ID;
+ rc = sendMessage(msg, msglen);
+ break;
+ }
+ default: {
+ LOC_LOGe("no pending geofence message for %s", mName.c_str());
+ free(clientIds);
+ return;
+ }
+ }
+
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ delete[] msg;
+ free(clientIds);
+}
+
+
+/******************************************************************************
+LocHalDaemonClientHandler - Location Control API response callback functions
+******************************************************************************/
+void LocHalDaemonClientHandler::onControlResponseCb(LocationError err, ELocMsgID msgId) {
+ // no need to hold the lock, as lock is already held at the caller
+ if (nullptr != mIpcSender) {
+ LOC_LOGd("--< onControlResponseCb err=%u msgId=%u", err, msgId);
+ LocAPIGenericRespMsg msg(SERVICE_NAME, msgId, err);
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onGnssConfigCb(ELocMsgID configMsgId,
+ const GnssConfig & gnssConfig) {
+ uint8_t* msg = nullptr;
+ size_t msgLen = 0;
+
+ switch (configMsgId) {
+ case E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID:
+ if (gnssConfig.flags & GNSS_CONFIG_FLAGS_ROBUST_LOCATION_BIT) {
+ msg = (uint8_t*) new LocConfigGetRobustLocationConfigRespMsg(
+ SERVICE_NAME, gnssConfig.robustLocationConfig);
+ msgLen = sizeof(LocConfigGetRobustLocationConfigRespMsg);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if ((nullptr != mIpcSender) && (nullptr != msg)) {
+ int rc = sendMessage(msg, msgLen);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+
+ // cleanup
+ if (nullptr != msg) {
+ delete msg;
+ msg = nullptr;
+ }
+}
+
+/******************************************************************************
+LocHalDaemonClientHandler - Location API callback functions
+******************************************************************************/
+void LocHalDaemonClientHandler::onCapabilitiesCallback(LocationCapabilitiesMask mask) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onCapabilitiesCallback=0x%x", mask);
+
+ if (nullptr != mIpcSender) {
+ // broadcast
+ LocAPICapabilitiesIndMsg msg(SERVICE_NAME, mask);
+ if (mask != mCapabilityMask) {
+ LOC_LOGd("mask old=0x%x new=0x%x", mCapabilityMask, mask);
+ mCapabilityMask = mask;
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onTrackingCb(Location location) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onTrackingCb");
+
+ if ((nullptr != mIpcSender) &&
+ (mSubscriptionMask & E_LOC_CB_DISTANCE_BASED_TRACKING_BIT)) {
+ // broadcast
+ LocAPILocationIndMsg msg(SERVICE_NAME, location);
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onBatchingCb(size_t count, Location* location,
+ BatchingOptions batchOptions) {
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onBatchingCb");
+
+ if ((nullptr != mIpcSender) && (mSubscriptionMask & E_LOC_CB_BATCHING_BIT)) {
+ if (0 == count) {
+ return;
+ }
+
+ // serialize locations in batch into ipc message payload
+ size_t msglen = sizeof(LocAPIBatchingIndMsg) + sizeof(Location) * (count - 1);
+ uint8_t *msg = new(std::nothrow) uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ memset(msg, 0, msglen);
+ LocAPIBatchingIndMsg *pmsg = reinterpret_cast<LocAPIBatchingIndMsg*>(msg);
+ strlcpy(pmsg->mSocketName, SERVICE_NAME, MAX_SOCKET_PATHNAME_LENGTH);
+ pmsg->msgId = E_LOCAPI_BATCHING_MSG_ID;
+ pmsg->batchNotification.size = msglen;
+ pmsg->batchNotification.count = count;
+ pmsg->batchNotification.status = BATCHING_STATUS_POSITION_AVAILABE;
+ memcpy(&(pmsg->batchNotification.location[0]), location, count * sizeof(Location));
+
+ int rc = sendMessage(msg, msglen);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+
+ delete[] msg;
+ }
+}
+
+void LocHalDaemonClientHandler::onBatchingStatusCb(BatchingStatusInfo batchingStatus,
+ std::list<uint32_t>& listOfCompletedTrips) {
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onBatchingStatusCb");
+ if ((nullptr != mIpcSender) && (mSubscriptionMask & E_LOC_CB_BATCHING_STATUS_BIT) &&
+ (BATCHING_MODE_TRIP == mBatchingMode) &&
+ (BATCHING_STATUS_TRIP_COMPLETED == batchingStatus.batchingStatus)) {
+ // For trip batching, notify client to stop session when BATCHING_STATUS_TRIP_COMPLETED
+ LocAPIBatchNotification batchNotif = {};
+ batchNotif.status = BATCHING_STATUS_TRIP_COMPLETED;
+ LocAPIBatchingIndMsg msg(SERVICE_NAME, batchNotif);
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onGeofenceBreachCb(GeofenceBreachNotification gfBreachNotif) {
+ LOC_LOGd("--< onGeofenceBreachCallback");
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+
+ if ((nullptr != mIpcSender) &&
+ (mSubscriptionMask & E_LOCAPI_GEOFENCE_BREACH_MSG_ID)) {
+
+ uint32_t* clientIds = getClientIds(gfBreachNotif.count, gfBreachNotif.ids);
+ if (nullptr == clientIds) {
+ LOC_LOGe("Failed to alloc %zu bytes",
+ sizeof(uint32_t) * gfBreachNotif.count);
+ return;
+ }
+ // serialize GeofenceBreachNotification into ipc message payload
+ size_t msglen = sizeof(LocAPIGeofenceBreachIndMsg) +
+ sizeof(uint32_t) * (gfBreachNotif.count - 1);
+ uint8_t *msg = new(std::nothrow) uint8_t[msglen];
+ if (nullptr == msg) {
+ free(clientIds);
+ return;
+ }
+ memset(msg, 0, msglen);
+ LocAPIGeofenceBreachIndMsg *pmsg = reinterpret_cast<LocAPIGeofenceBreachIndMsg*>(msg);
+ strlcpy(pmsg->mSocketName, SERVICE_NAME, MAX_SOCKET_PATHNAME_LENGTH);
+ pmsg->msgId = E_LOCAPI_GEOFENCE_BREACH_MSG_ID;
+ pmsg->gfBreachNotification.size = msglen;
+ pmsg->gfBreachNotification.count = gfBreachNotif.count;
+ pmsg->gfBreachNotification.timestamp = gfBreachNotif.timestamp;
+ pmsg->gfBreachNotification.location = gfBreachNotif.location;
+ pmsg->gfBreachNotification.type = gfBreachNotif.type;
+ memcpy(&(pmsg->gfBreachNotification.id[0]), clientIds, sizeof(uint32_t)*gfBreachNotif.count);
+
+ int rc = sendMessage(msg, msglen);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+
+ delete[] msg;
+ free(clientIds);
+ }
+}
+
+void LocHalDaemonClientHandler::onGnssLocationInfoCb(GnssLocationInfoNotification notification) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onGnssLocationInfoCb");
+
+ if ((nullptr != mIpcSender) && (mSubscriptionMask &
+ (E_LOC_CB_GNSS_LOCATION_INFO_BIT | E_LOC_CB_SIMPLE_LOCATION_INFO_BIT))) {
+ int rc = 0;
+ if (mSubscriptionMask & E_LOC_CB_GNSS_LOCATION_INFO_BIT) {
+ LocAPILocationInfoIndMsg msg(SERVICE_NAME, notification);
+ rc = sendMessage(msg);
+ } else {
+ LocAPILocationIndMsg msg(SERVICE_NAME, notification.location);
+ rc = sendMessage(msg);
+ }
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onEngLocationsInfoCb(
+ uint32_t count,
+ GnssLocationInfoNotification* engLocationsInfoNotification
+) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onEngLocationInfoCb count: %d, locReqEngTypeMask 0x%x",
+ count, mOptions.locReqEngTypeMask);
+
+ if ((nullptr != mIpcSender) &&
+ (mSubscriptionMask & E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT)) {
+
+ int reportCount = 0;
+ GnssLocationInfoNotification engineLocationInfoNotification[LOC_OUTPUT_ENGINE_COUNT];
+ for (int i = 0; i < count; i++) {
+ GnssLocationInfoNotification* locPtr = engLocationsInfoNotification+i;
+
+ LOC_LOGv("--< onEngLocationInfoCb i %d, type %d", i, locPtr->locOutputEngType);
+ if (((locPtr->locOutputEngType == LOC_OUTPUT_ENGINE_FUSED) &&
+ (mOptions.locReqEngTypeMask & LOC_REQ_ENGINE_FUSED_BIT)) ||
+ ((locPtr->locOutputEngType == LOC_OUTPUT_ENGINE_SPE) &&
+ (mOptions.locReqEngTypeMask & LOC_REQ_ENGINE_SPE_BIT)) ||
+ ((locPtr->locOutputEngType == LOC_OUTPUT_ENGINE_PPE) &&
+ (mOptions.locReqEngTypeMask & LOC_REQ_ENGINE_PPE_BIT ))) {
+ engineLocationInfoNotification[reportCount++] = *locPtr;
+ }
+ }
+
+ if (reportCount > 0 ) {
+ LocAPIEngineLocationsInfoIndMsg msg(SERVICE_NAME, reportCount,
+ engineLocationInfoNotification);
+ int rc = sendMessage((const uint8_t*)&msg, msg.getMsgSize());
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onGnssNiCb");
+}
+
+void LocHalDaemonClientHandler::onGnssSvCb(GnssSvNotification notification) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onGnssSvCb");
+
+ if ((nullptr != mIpcSender) &&
+ (mSubscriptionMask & E_LOC_CB_GNSS_SV_BIT)) {
+ // broadcast
+ LocAPISatelliteVehicleIndMsg msg(SERVICE_NAME, notification);
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onGnssNmeaCb(GnssNmeaNotification notification) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ if ((nullptr != mIpcSender) && (mSubscriptionMask & E_LOC_CB_GNSS_NMEA_BIT)) {
+ LOC_LOGd("--< onGnssNmeaCb[%s] t=%" PRIu64" l=%zu nmea=%s",
+ mName.c_str(),
+ notification.timestamp,
+ notification.length,
+ notification.nmea);
+
+ // serialize nmea string into ipc message payload
+ size_t msglen = sizeof(LocAPINmeaIndMsg) + notification.length;
+ uint8_t *msg = new(std::nothrow) uint8_t[msglen];
+ if (nullptr == msg) {
+ return;
+ }
+ memset(msg, 0, msglen);
+ LocAPINmeaIndMsg *pmsg = reinterpret_cast<LocAPINmeaIndMsg*>(msg);
+ strlcpy(pmsg->mSocketName, SERVICE_NAME, MAX_SOCKET_PATHNAME_LENGTH);
+ pmsg->msgId = E_LOCAPI_NMEA_MSG_ID;
+ pmsg->gnssNmeaNotification.size = msglen;
+ pmsg->gnssNmeaNotification.timestamp = notification.timestamp;
+ pmsg->gnssNmeaNotification.length = notification.length;
+ memcpy(&(pmsg->gnssNmeaNotification.nmea[0]), notification.nmea, notification.length);
+
+ int rc = sendMessage(msg, msglen);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+
+ delete[] msg;
+ }
+}
+
+void LocHalDaemonClientHandler::onGnssDataCb(GnssDataNotification notification) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onGnssDataCb");
+
+ if ((nullptr != mIpcSender) &&
+ (mSubscriptionMask & E_LOC_CB_GNSS_DATA_BIT)) {
+ for (int sig = 0; sig < GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES; sig++) {
+ if (GNSS_LOC_DATA_JAMMER_IND_BIT ==
+ (notification.gnssDataMask[sig] & GNSS_LOC_DATA_JAMMER_IND_BIT)) {
+ LOC_LOGv("jammerInd[%d]=%f", sig, notification.jammerInd[sig]);
+ }
+ if (GNSS_LOC_DATA_AGC_BIT ==
+ (notification.gnssDataMask[sig] & GNSS_LOC_DATA_AGC_BIT)) {
+ LOC_LOGv("agc[%d]=%f", sig, notification.agc[sig]);
+ }
+ }
+
+ LocAPIDataIndMsg msg(SERVICE_NAME, notification);
+ LOC_LOGv("Sending data message");
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onGnssMeasurementsCb(GnssMeasurementsNotification notification) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onGnssMeasurementsCb");
+
+ if ((nullptr != mIpcSender) && (mSubscriptionMask & E_LOC_CB_GNSS_MEAS_BIT)) {
+ LocAPIMeasIndMsg msg(SERVICE_NAME, notification);
+ LOC_LOGv("Sending meas message");
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onLocationSystemInfoCb(LocationSystemInfo notification) {
+
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+ LOC_LOGd("--< onLocationSystemInfoCb");
+
+ if ((nullptr != mIpcSender) &&
+ (mSubscriptionMask & E_LOC_CB_SYSTEM_INFO_BIT)) {
+
+ LocAPILocationSystemInfoIndMsg msg(SERVICE_NAME, notification);
+ LOC_LOGv("Sending location system info message");
+ int rc = sendMessage(msg);
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+void LocHalDaemonClientHandler::onLocationApiDestroyCompleteCb() {
+ std::lock_guard<std::mutex> lock(LocationApiService::mMutex);
+
+ LOC_LOGe("delete LocHalDaemonClientHandler");
+ delete this;
+ // PLEASE NOTE: no more code after this, including print for class variable
+}
+
+/******************************************************************************
+LocHalDaemonClientHandler - Engine info related functionality
+******************************************************************************/
+// called to deliver GNSS energy consumed info to the requesting client
+// as this is single shot request, the corresponding mask will be cleared
+// as well
+void LocHalDaemonClientHandler::onGnssEnergyConsumedInfoAvailable(
+ LocAPIGnssEnergyConsumedIndMsg &msg) {
+
+ if ((nullptr != mIpcSender) &&
+ (mEngineInfoRequestMask & E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT)) {
+
+ int rc = sendMessage(msg);
+ mEngineInfoRequestMask &= ~E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT;
+
+ // purge this client if failed
+ if (!rc) {
+ LOC_LOGe("failed rc=%d purging client=%s", rc, mName.c_str());
+ mService->deleteClientbyName(mName);
+ }
+ }
+}
+
+// return true if the client has pending request to retrieve
+// GNSS energy consumed
+bool LocHalDaemonClientHandler::hasPendingEngineInfoRequest(uint32_t mask) {
+ if (mEngineInfoRequestMask & E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+// set up the bit to indicating the engine info request
+// is pending.
+void LocHalDaemonClientHandler::addEngineInfoRequst(uint32_t mask) {
+ mEngineInfoRequestMask |= E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT;
+}
+
+// Round input TBF to 100ms, 200ms, 500ms, and integer senconds that engine supports
+// input tbf < 200 msec, round to 100 msec, else
+// input tbf < 500 msec, round to 200 msec, else
+// input tbf < 1000 msec, round to 500 msec, else
+// round up input tbf to the closet integer seconds
+uint32_t LocHalDaemonClientHandler::getSupportedTbf(uint32_t tbfMsec) {
+ uint32_t supportedTbfMsec = 0;
+
+ if (tbfMsec < 200) {
+ supportedTbfMsec = 100;
+ } else if (tbfMsec < 500) {
+ supportedTbfMsec = 200;
+ } else if (tbfMsec < 1000) {
+ supportedTbfMsec = 500;
+ } else {
+ if (tbfMsec > (UINT32_MAX - 999)) {
+ supportedTbfMsec = UINT32_MAX / 1000 * 1000;
+ } else {
+ // round up to the next integer second
+ supportedTbfMsec = (tbfMsec+999) / 1000 * 1000;
+ }
+ }
+
+ return supportedTbfMsec;
+}
diff --git a/location/location_hal_daemon/LocHalDaemonClientHandler.h b/location/location_hal_daemon/LocHalDaemonClientHandler.h
new file mode 100644
index 0000000..55fb312
--- /dev/null
+++ b/location/location_hal_daemon/LocHalDaemonClientHandler.h
@@ -0,0 +1,189 @@
+/* Copyright (c) 2018-2020, 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 LOCHAL_CLIENT_HANDLER_H
+#define LOCHAL_CLIENT_HANDLER_H
+
+#include <queue>
+#include <mutex>
+#include <log_util.h>
+#include <loc_pla.h>
+
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
+
+#include <LocationAPI.h>
+#include <LocIpc.h>
+
+using namespace loc_util;
+
+// forward declaration
+class LocationApiService;
+
+/******************************************************************************
+LocHalDaemonClientHandler
+******************************************************************************/
+class LocHalDaemonClientHandler
+{
+public:
+ inline LocHalDaemonClientHandler(LocationApiService* service, const std::string& clientname,
+ ClientType clientType) :
+ mService(service),
+ mName(clientname),
+ mClientType(clientType),
+ mCapabilityMask(0),
+ mTracking(false),
+ mBatching(false),
+ mSessionId(0),
+ mBatchingId(0),
+ mBatchingMode(BATCHING_MODE_NO_AUTO_REPORT),
+ mLocationApi(nullptr),
+ mCallbacks{},
+ mPendingMessages(),
+ mGfPendingMessages(),
+ mSubscriptionMask(0),
+ mEngineInfoRequestMask(0),
+ mGeofenceIds(nullptr),
+ mIpcSender(createSender(clientname.c_str())) {
+
+
+ if (mClientType == LOCATION_CLIENT_API) {
+ updateSubscription(E_LOC_CB_GNSS_LOCATION_INFO_BIT);
+ mLocationApi = LocationAPI::createInstance(mCallbacks);
+ }
+ }
+
+ static shared_ptr<LocIpcSender> createSender(const string socket);
+ void cleanup();
+
+ // public APIs
+ void updateSubscription(uint32_t mask);
+ // when client stops the location session, then all callbacks
+ // related to location session need to be unsubscribed
+ void unsubscribeLocationSessionCb();
+ uint32_t startTracking();
+ uint32_t startTracking(LocationOptions & locOptions);
+ void stopTracking();
+ void updateTrackingOptions(LocationOptions & locOptions);
+ void onGnssEnergyConsumedInfoAvailable(LocAPIGnssEnergyConsumedIndMsg &msg);
+ void onControlResponseCb(LocationError err, ELocMsgID msgId);
+ void onGnssConfigCb(ELocMsgID configMsgId, const GnssConfig & gnssConfig);
+ bool hasPendingEngineInfoRequest(uint32_t mask);
+ void addEngineInfoRequst(uint32_t mask);
+
+ uint32_t startBatching(uint32_t minInterval, uint32_t minDistance, BatchingMode batchMode);
+ void stopBatching();
+ void updateBatchingOptions(uint32_t minInterval, uint32_t minDistance, BatchingMode batchMode);
+
+ uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*);
+ void removeGeofences(size_t count, uint32_t* ids);
+ void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options);
+ void pauseGeofences(size_t count, uint32_t* ids);
+ void resumeGeofences(size_t count, uint32_t* ids);
+
+ //other API
+ void setGeofenceIds(size_t count, uint32_t* clientIds, uint32_t* sessionIds);
+ void eraseGeofenceIds(size_t count, uint32_t* clientIds);
+ uint32_t* getSessionIds(size_t count, uint32_t* clientIds);
+ uint32_t* getClientIds(size_t count, uint32_t* sessionIds);
+ void pingTest();
+
+ bool mTracking;
+ bool mBatching;
+ BatchingMode mBatchingMode;
+ std::queue<ELocMsgID> mPendingMessages;
+ std::queue<ELocMsgID> mGfPendingMessages;
+
+private:
+ inline ~LocHalDaemonClientHandler() {}
+
+ // Location API callback functions
+ void onCapabilitiesCallback(LocationCapabilitiesMask capabilitiesMask);
+ void onResponseCb(LocationError err, uint32_t id);
+ void onCollectiveResponseCallback(size_t count, LocationError *errs, uint32_t *ids);
+
+ void onTrackingCb(Location location);
+ void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions);
+ void onBatchingStatusCb(BatchingStatusInfo batchingStatus,
+ std::list<uint32_t>& listOfCompletedTrips);
+ void onGnssLocationInfoCb(GnssLocationInfoNotification gnssLocationInfoNotification);
+ void onGeofenceBreachCb(GeofenceBreachNotification geofenceBreachNotification);
+ void onEngLocationsInfoCb(uint32_t count,
+ GnssLocationInfoNotification* engLocationsInfoNotification);
+ void onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotification);
+ void onGnssSvCb(GnssSvNotification gnssSvNotification);
+ void onGnssNmeaCb(GnssNmeaNotification);
+ void onGnssDataCb(GnssDataNotification gnssDataNotification);
+ void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification);
+ void onLocationSystemInfoCb(LocationSystemInfo);
+ void onLocationApiDestroyCompleteCb();
+
+ // send ipc message to this client for general use
+ template <typename MESSAGE>
+ bool sendMessage(const MESSAGE& msg) {
+ return sendMessage(reinterpret_cast<const uint8_t*>(&msg), sizeof(msg));
+ }
+
+ // send ipc message to this client for serialized payload
+ bool sendMessage(const uint8_t* pmsg, size_t msglen) {
+ return LocIpc::send(*mIpcSender, pmsg, msglen);
+ }
+
+ uint32_t getSupportedTbf (uint32_t tbfMsec);
+
+ // pointer to parent service
+ LocationApiService* mService;
+
+ // name of this client
+ const std::string mName;
+ ClientType mClientType;
+
+ // LocationAPI interface
+ LocationCapabilitiesMask mCapabilityMask;
+ uint32_t mSessionId;
+ uint32_t mBatchingId;
+ LocationAPI* mLocationApi;
+ LocationCallbacks mCallbacks;
+ TrackingOptions mOptions;
+ BatchingOptions mBatchOptions;
+
+ // bitmask to hold this client's subscription
+ uint32_t mSubscriptionMask;
+ // bitmask to hold this client's request to engine info related subscription
+ uint32_t mEngineInfoRequestMask;
+
+ uint32_t* mGeofenceIds;
+ shared_ptr<LocIpcSender> mIpcSender;
+ std::unordered_map<uint32_t, uint32_t> mGfIdsMap; //geofence ID map, clientId-->session
+};
+
+#endif //LOCHAL_CLIENT_HANDLER_H
+
diff --git a/location/location_hal_daemon/LocationApiMsg.h b/location/location_hal_daemon/LocationApiMsg.h
new file mode 100644
index 0000000..3deed05
--- /dev/null
+++ b/location/location_hal_daemon/LocationApiMsg.h
@@ -0,0 +1,824 @@
+/* Copyright (c) 2018-2020, 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 LOCATIONAPIMSG_H
+#define LOCATIONAPIMSG_H
+
+#include <string>
+#include <memory>
+#include <algorithm>
+#include <loc_pla.h> // for strlcpy
+#include <gps_extended_c.h>
+#include <log_util.h>
+#include <LocIpc.h>
+#include <LocationDataTypes.h>
+
+/******************************************************************************
+Constants
+******************************************************************************/
+#define LOCATION_REMOTE_API_MSG_VERSION (1)
+
+// Maximum fully qualified path(including the file name)
+// for the location remote API service and client socket name
+#define MAX_SOCKET_PATHNAME_LENGTH (128)
+
+#define LOCATION_CLIENT_SESSION_ID_INVALID (0)
+
+#define LOCATION_CLIENT_API_QSOCKET_HALDAEMON_SERVICE_ID (5001)
+#define LOCATION_CLIENT_API_QSOCKET_HALDAEMON_INSTANCE_ID (1)
+#define LOCATION_CLIENT_API_QSOCKET_CLIENT_SERVICE_ID (5002)
+
+#define s_CLIENTAPI_LOCAL SOCKET_LOC_CLIENT_DIR LOC_CLIENT_NAME_PREFIX
+#define s_INTAPI_LOCAL SOCKET_LOC_CLIENT_DIR LOC_INTAPI_NAME_PREFIX
+#define sEAP EAP_LOC_CLIENT_DIR LOC_CLIENT_NAME_PREFIX
+
+using namespace std;
+using namespace loc_util;
+
+class SockNode {
+ const int32_t mId1;
+ const int32_t mId2;
+ const string mNodePathnamePrefix;
+
+public:
+ enum Type { LOCAL, EAP, OTHER };
+ SockNode(int32_t id1, int32_t mId2, const string&& prefix) :
+ mId1(id1), mId2(mId2), mNodePathnamePrefix(prefix) {
+ }
+ SockNode(SockNode&& node) :
+ SockNode(node.mId1, node.mId2, move(node.mNodePathnamePrefix)) {
+ }
+ static SockNode create(const string fullPathName) {
+ return create(fullPathName.c_str(), fullPathName.size());
+ }
+ static SockNode create(const char* fullPathName, int32_t length = -1) {
+ uint32_t count = 0;
+ int32_t indx = 0, id1 = -1, id2 = -1;
+
+ if (nullptr == fullPathName) {
+ fullPathName = "";
+ }
+ indx = (length < 0) ? (strlen(fullPathName) - 1) : length;
+
+ while (count < 2 && indx >= 0) {
+ if ('.' == fullPathName[indx]) {
+ count++;
+ }
+ indx--;
+ }
+ if (count == 2) {
+ indx++;
+ sscanf(fullPathName+indx+1, "%d.%d", &id1, &id2);
+ } else {
+ indx = 0;
+ }
+
+ return SockNode(id1, id2, string(fullPathName, indx));
+ }
+ inline int getId1() const { return mId1; }
+ inline int getId2() const { return mId2; }
+ inline const string& getNodePathnamePrefix() const { return mNodePathnamePrefix; }
+ inline string getNodePathname() const {
+ return string(mNodePathnamePrefix).append(1, '.').append(to_string(mId1))
+ .append(1, '.').append(to_string(mId2));
+ }
+ inline Type getNodeType() const {
+ Type type = OTHER;
+ if (mNodePathnamePrefix.compare(0, sizeof(SOCKET_LOC_CLIENT_DIR)-1,
+ SOCKET_LOC_CLIENT_DIR) == 0) {
+ type = LOCAL;
+ } else if (mNodePathnamePrefix.compare(0, sizeof(sEAP)-1, sEAP) == 0) {
+ type = EAP;
+ }
+ return type;
+ }
+ inline shared_ptr<LocIpcSender> createSender(bool createFsNode = false) {
+ const string socket = getNodePathname();
+ const char* sock = socket.c_str();
+ switch (getNodeType()) {
+ case SockNode::LOCAL:
+ return LocIpc::getLocIpcLocalSender(sock);
+ case SockNode::EAP:
+ if (createFsNode) {
+ if (nullptr == fopen(sock, "w")) {
+ LOC_LOGe("<-- failed to open file %s", sock);
+ }
+ }
+ return LocIpc::getLocIpcQrtrSender(getId1(), getId2());
+ default:
+ return nullptr;
+ }
+ }
+};
+
+enum ClientType {
+ LOCATION_CLIENT_API = 1,
+ LOCATION_INTEGRATION_API = 2,
+};
+
+class SockNodeLocal : public SockNode {
+public:
+ SockNodeLocal(ClientType type, int32_t pid, int32_t tid) :
+ SockNode(pid, tid, (LOCATION_CLIENT_API == type) ? s_CLIENTAPI_LOCAL : s_INTAPI_LOCAL) {}
+};
+
+class SockNodeEap : public SockNode {
+public:
+ SockNodeEap(int32_t service, int32_t instance) :
+ SockNode(service, instance, sEAP) {}
+};
+
+/******************************************************************************
+List of message IDs supported by Location Remote API
+******************************************************************************/
+enum ELocMsgID {
+ E_LOCAPI_UNDEFINED_MSG_ID = 0,
+
+ // registration
+ E_LOCAPI_CLIENT_REGISTER_MSG_ID = 1,
+ E_LOCAPI_CLIENT_DEREGISTER_MSG_ID = 2,
+ E_LOCAPI_CAPABILILTIES_MSG_ID = 3,
+ E_LOCAPI_HAL_READY_MSG_ID = 4,
+
+ // tracking session
+ E_LOCAPI_START_TRACKING_MSG_ID = 5,
+ E_LOCAPI_STOP_TRACKING_MSG_ID = 6,
+ E_LOCAPI_UPDATE_CALLBACKS_MSG_ID = 7,
+ E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID = 8,
+
+ // control
+ E_LOCAPI_CONTROL_UPDATE_CONFIG_MSG_ID = 9,
+ E_LOCAPI_CONTROL_DELETE_AIDING_DATA_MSG_ID = 10,
+ E_LOCAPI_CONTROL_UPDATE_NETWORK_AVAILABILITY_MSG_ID = 11,
+
+ // Position reports
+ E_LOCAPI_LOCATION_MSG_ID = 12,
+ E_LOCAPI_LOCATION_INFO_MSG_ID = 13,
+ E_LOCAPI_SATELLITE_VEHICLE_MSG_ID = 14,
+ E_LOCAPI_NMEA_MSG_ID = 15,
+ E_LOCAPI_DATA_MSG_ID = 16,
+
+ // Get API to retrieve info from GNSS engine
+ E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID = 17,
+
+ E_LOCAPI_LOCATION_SYSTEM_INFO_MSG_ID = 18,
+
+ // engine position report
+ E_LOCAPI_ENGINE_LOCATIONS_INFO_MSG_ID = 19,
+
+ // batching session
+ E_LOCAPI_START_BATCHING_MSG_ID = 20,
+ E_LOCAPI_STOP_BATCHING_MSG_ID = 21,
+ E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID = 22,
+
+ //batching reports
+ E_LOCAPI_BATCHING_MSG_ID = 23,
+
+ // geofence session
+ E_LOCAPI_ADD_GEOFENCES_MSG_ID = 24,
+ E_LOCAPI_REMOVE_GEOFENCES_MSG_ID = 25,
+ E_LOCAPI_MODIFY_GEOFENCES_MSG_ID = 26,
+ E_LOCAPI_PAUSE_GEOFENCES_MSG_ID = 27,
+ E_LOCAPI_RESUME_GEOFENCES_MSG_ID = 28,
+
+ //geofence breach
+ E_LOCAPI_GEOFENCE_BREACH_MSG_ID = 29,
+
+ // Measurement reports
+ E_LOCAPI_MEAS_MSG_ID = 30,
+
+ // ping
+ E_LOCAPI_PINGTEST_MSG_ID = 99,
+
+ // integration API config request
+ E_INTAPI_CONFIG_CONSTRAINTED_TUNC_MSG_ID = 200,
+ E_INTAPI_CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR_MSG_ID = 201,
+ E_INTAPI_CONFIG_SV_CONSTELLATION_MSG_ID = 202,
+ E_INTAPI_CONFIG_AIDING_DATA_DELETION_MSG_ID = 203,
+ E_INTAPI_CONFIG_LEVER_ARM_MSG_ID = 204,
+ E_INTAPI_CONFIG_ROBUST_LOCATION_MSG_ID = 205,
+
+ // integration API config retrieval request/response
+ E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID = 300,
+ E_INTAPI_GET_ROBUST_LOCATION_CONFIG_RESP_MSG_ID = 301,
+};
+
+typedef uint32_t LocationCallbacksMask;
+enum ELocationCallbacksOption {
+ E_LOC_CB_DISTANCE_BASED_TRACKING_BIT= (1<<0), /**< Register for DBT location report */
+ E_LOC_CB_GNSS_LOCATION_INFO_BIT = (1<<1), /**< Register for GNSS Location */
+ E_LOC_CB_GNSS_SV_BIT = (1<<2), /**< Register for GNSS SV */
+ E_LOC_CB_GNSS_NMEA_BIT = (1<<3), /**< Register for GNSS NMEA */
+ E_LOC_CB_GNSS_DATA_BIT = (1<<4), /**< Register for GNSS DATA */
+ E_LOC_CB_SYSTEM_INFO_BIT = (1<<5), /**< Register for Location system info */
+ E_LOC_CB_BATCHING_BIT = (1<<6), /**< Register for Batching */
+ E_LOC_CB_BATCHING_STATUS_BIT = (1<<7), /**< Register for Batching Status*/
+ E_LOC_CB_GEOFENCE_BREACH_BIT = (1<<8), /**< Register for Geofence Breach */
+ E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT = (1<<9), /**< Register for multiple engine reports */
+ E_LOC_CB_SIMPLE_LOCATION_INFO_BIT = (1<<10), /**< Register for simple location */
+ E_LOC_CB_GNSS_MEAS_BIT = (1<<11), /**< Register for GNSS Measurements */
+};
+
+// Mask related to all info that are tied with a position session and need to be unsubscribed
+// when session is stopped
+#define LOCATION_SESSON_ALL_INFO_MASK (E_LOC_CB_DISTANCE_BASED_TRACKING_BIT|\
+ E_LOC_CB_GNSS_LOCATION_INFO_BIT|\
+ E_LOC_CB_GNSS_SV_BIT|E_LOC_CB_GNSS_NMEA_BIT|\
+ E_LOC_CB_GNSS_DATA_BIT|E_LOC_CB_GNSS_MEAS_BIT|\
+ E_LOC_CB_ENGINE_LOCATIONS_INFO_BIT|\
+ E_LOC_CB_SIMPLE_LOCATION_INFO_BIT)
+
+typedef uint32_t EngineInfoCallbacksMask;
+enum EEngineInfoCallbacksMask {
+ // gnss energy consumed, once the info is delivered,
+ // this bit will be cleared
+ E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT = (1<<0) /**< GNSS energy consumed */
+};
+
+/******************************************************************************
+Common data structure
+******************************************************************************/
+struct LocAPINmeaSerializedPayload {
+ // do not use size_t as data type for size_t is architecture dependent
+ uint32_t size;
+ uint64_t timestamp;
+ // do not use size_t as data type for size_t is architecture dependent
+ uint32_t length;
+ char nmea[1];
+};
+
+struct LocAPIBatchNotification {
+ // do not use size_t as data type for size_t is architecture dependent
+ uint32_t size;
+ uint32_t count;
+ BatchingStatus status;
+ Location location[1];
+};
+
+struct LocAPIGeofenceBreachNotification {
+ // do not use size_t as data type for size_t is architecture dependent
+ uint32_t size;
+ uint32_t count;
+ uint64_t timestamp;
+ GeofenceBreachTypeMask type; //type of breach
+ Location location; //location associated with breach
+ uint32_t id[1];
+};
+
+struct GeofencePayload {
+ uint32_t gfClientId;
+ GeofenceOption gfOption;
+ GeofenceInfo gfInfo;
+};
+
+struct GeofencesAddedReqPayload {
+ uint32_t count;
+ GeofencePayload gfPayload[1];
+};
+
+struct GeofencesReqClientIdPayload {
+ uint32_t count;
+ uint32_t gfIds[1];
+};
+
+struct GeofenceResponse {
+ uint32_t clientId;
+ LocationError error;
+};
+
+struct CollectiveResPayload {
+ // do not use size_t as data type for size_t is architecture dependent
+ uint32_t size;
+ uint32_t count;
+ GeofenceResponse resp[1];
+};
+/******************************************************************************
+IPC message header structure
+******************************************************************************/
+struct LocAPIMsgHeader
+{
+ char mSocketName[MAX_SOCKET_PATHNAME_LENGTH]; /**< Processor string */
+ ELocMsgID msgId; /**< LocationMsgID */
+ uint32_t msgVersion; /**< Location remote API message version */
+
+ inline LocAPIMsgHeader(const char* name, ELocMsgID msgId):
+ msgId(msgId),
+ msgVersion(LOCATION_REMOTE_API_MSG_VERSION) {
+ memset(mSocketName, 0, MAX_SOCKET_PATHNAME_LENGTH);
+ strlcpy(mSocketName, name, MAX_SOCKET_PATHNAME_LENGTH);
+ }
+};
+
+/******************************************************************************
+IPC message structure - client registration
+******************************************************************************/
+// defintion for message with msg id of E_LOCAPI_CLIENT_REGISTER_MSG_ID
+struct LocAPIClientRegisterReqMsg: LocAPIMsgHeader
+{
+ ClientType mClientType;
+
+ inline LocAPIClientRegisterReqMsg(const char* name, ClientType clientType) :
+ LocAPIMsgHeader(name, E_LOCAPI_CLIENT_REGISTER_MSG_ID),
+ mClientType(clientType) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_CLIENT_DEREGISTER_MSG_ID
+struct LocAPIClientDeregisterReqMsg: LocAPIMsgHeader
+{
+ inline LocAPIClientDeregisterReqMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_CLIENT_DEREGISTER_MSG_ID) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_CAPABILILTIES_MSG_ID
+struct LocAPICapabilitiesIndMsg: LocAPIMsgHeader
+{
+ LocationCapabilitiesMask capabilitiesMask;
+
+ inline LocAPICapabilitiesIndMsg(const char* name,
+ LocationCapabilitiesMask capabilitiesMask) :
+ LocAPIMsgHeader(name, E_LOCAPI_CAPABILILTIES_MSG_ID),
+ capabilitiesMask(capabilitiesMask) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_HAL_READY_MSG_ID
+struct LocAPIHalReadyIndMsg: LocAPIMsgHeader
+{
+ inline LocAPIHalReadyIndMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_HAL_READY_MSG_ID) { }
+};
+
+/******************************************************************************
+IPC message structure - generic response
+******************************************************************************/
+struct LocAPIGenericRespMsg: LocAPIMsgHeader
+{
+ LocationError err;
+
+ inline LocAPIGenericRespMsg(const char* name, ELocMsgID msgId, LocationError err) :
+ LocAPIMsgHeader(name, msgId),
+ err(err) { }
+};
+struct LocAPICollectiveRespMsg: LocAPIMsgHeader
+{
+ CollectiveResPayload collectiveRes;
+
+ inline LocAPICollectiveRespMsg(const char* name, ELocMsgID msgId,
+ CollectiveResPayload& response) :
+ LocAPIMsgHeader(name, msgId),
+ collectiveRes(response) { }
+};
+
+
+/******************************************************************************
+IPC message structure - tracking
+******************************************************************************/
+// defintion for message with msg id of E_LOCAPI_START_TRACKING_MSG_ID
+struct LocAPIStartTrackingReqMsg: LocAPIMsgHeader
+{
+ LocationOptions locOptions;
+
+ inline LocAPIStartTrackingReqMsg(const char* name,
+ const LocationOptions & locSessionOptions):
+ LocAPIMsgHeader(name, E_LOCAPI_START_TRACKING_MSG_ID),
+ locOptions(locSessionOptions) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_STOP_TRACKING_MSG_ID
+struct LocAPIStopTrackingReqMsg: LocAPIMsgHeader
+{
+ inline LocAPIStopTrackingReqMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_STOP_TRACKING_MSG_ID) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_UPDATE_CALLBACKS_MSG_ID
+struct LocAPIUpdateCallbacksReqMsg: LocAPIMsgHeader
+{
+ LocationCallbacksMask locationCallbacks;
+
+ inline LocAPIUpdateCallbacksReqMsg(const char* name,
+ LocationCallbacksMask callBacksMask):
+ LocAPIMsgHeader(name, E_LOCAPI_UPDATE_CALLBACKS_MSG_ID),
+ locationCallbacks(callBacksMask) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID
+struct LocAPIUpdateTrackingOptionsReqMsg: LocAPIMsgHeader
+{
+ LocationOptions locOptions;
+
+ inline LocAPIUpdateTrackingOptionsReqMsg(const char* name,
+ const LocationOptions & locSessionOptions):
+ LocAPIMsgHeader(name, E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID),
+ locOptions(locSessionOptions) { }
+};
+
+/******************************************************************************
+IPC message structure - batching
+******************************************************************************/
+// defintion for message with msg id of E_LOCAPI_START_BATCHING_MSG_ID
+struct LocAPIStartBatchingReqMsg: LocAPIMsgHeader
+{
+ uint32_t intervalInMs;
+ uint32_t distanceInMeters;
+ BatchingMode batchingMode;
+
+ inline LocAPIStartBatchingReqMsg(const char* name,
+ uint32_t minInterval,
+ uint32_t minDistance,
+ BatchingMode batchMode):
+ LocAPIMsgHeader(name, E_LOCAPI_START_BATCHING_MSG_ID),
+ intervalInMs(minInterval),
+ distanceInMeters(minDistance),
+ batchingMode(batchMode) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_STOP_BATCHING_MSG_ID
+struct LocAPIStopBatchingReqMsg: LocAPIMsgHeader
+{
+ inline LocAPIStopBatchingReqMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_STOP_BATCHING_MSG_ID) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID
+struct LocAPIUpdateBatchingOptionsReqMsg: LocAPIMsgHeader
+{
+ uint32_t intervalInMs;
+ uint32_t distanceInMeters;
+ BatchingMode batchingMode;
+
+ inline LocAPIUpdateBatchingOptionsReqMsg(const char* name,
+ uint32_t sessionInterval,
+ uint32_t sessionDistance,
+ BatchingMode batchMode):
+ LocAPIMsgHeader(name, E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID),
+ intervalInMs(sessionInterval),
+ distanceInMeters(sessionDistance),
+ batchingMode(batchMode) { }
+};
+
+/******************************************************************************
+IPC message structure - geofence
+******************************************************************************/
+// defintion for message with msg id of E_LOCAPI_ADD_GEOFENCES_MSG_ID
+struct LocAPIAddGeofencesReqMsg: LocAPIMsgHeader
+{
+ GeofencesAddedReqPayload geofences;
+ inline LocAPIAddGeofencesReqMsg(const char* name, GeofencesAddedReqPayload& geofencesAdded):
+ LocAPIMsgHeader(name, E_LOCAPI_ADD_GEOFENCES_MSG_ID),
+ geofences(geofencesAdded) { }
+};
+// defintion for message with msg id of E_LOCAPI_REMOVE_GEOFENCES_MSG_ID
+struct LocAPIRemoveGeofencesReqMsg: LocAPIMsgHeader
+{
+ GeofencesReqClientIdPayload gfClientIds;
+ inline LocAPIRemoveGeofencesReqMsg(const char* name, GeofencesReqClientIdPayload& ids):
+ LocAPIMsgHeader(name, E_LOCAPI_REMOVE_GEOFENCES_MSG_ID), gfClientIds(ids) { }
+};
+// defintion for message with msg id of E_LOCAPI_MODIFY_GEOFENCES_MSG_ID
+struct LocAPIModifyGeofencesReqMsg: LocAPIMsgHeader
+{
+ GeofencesAddedReqPayload geofences;
+
+ inline LocAPIModifyGeofencesReqMsg(const char* name,
+ GeofencesAddedReqPayload& geofencesModified):
+ LocAPIMsgHeader(name, E_LOCAPI_MODIFY_GEOFENCES_MSG_ID),
+ geofences(geofencesModified) { }
+};
+// defintion for message with msg id of E_LOCAPI_PAUSE_GEOFENCES_MSG_ID
+struct LocAPIPauseGeofencesReqMsg: LocAPIMsgHeader
+{
+ GeofencesReqClientIdPayload gfClientIds;
+ inline LocAPIPauseGeofencesReqMsg(const char* name,
+ GeofencesReqClientIdPayload& ids):
+ LocAPIMsgHeader(name, E_LOCAPI_PAUSE_GEOFENCES_MSG_ID),
+ gfClientIds(ids) { }
+};
+// defintion for message with msg id of E_LOCAPI_RESUME_GEOFENCES_MSG_ID
+struct LocAPIResumeGeofencesReqMsg: LocAPIMsgHeader
+{
+ GeofencesReqClientIdPayload gfClientIds;
+ inline LocAPIResumeGeofencesReqMsg(const char* name,
+ GeofencesReqClientIdPayload& ids):
+ LocAPIMsgHeader(name, E_LOCAPI_RESUME_GEOFENCES_MSG_ID),
+ gfClientIds(ids) { }
+};
+
+/******************************************************************************
+IPC message structure - control
+******************************************************************************/
+// defintion for message with msg id of E_LOCAPI_CONTROL_UPDATE_CONFIG_MSG_ID
+struct LocAPIUpdateConfigReqMsg: LocAPIMsgHeader
+{
+ GnssConfig gnssConfig;
+
+ inline LocAPIUpdateConfigReqMsg(const char* name, GnssConfig& config) :
+ LocAPIMsgHeader(name, E_LOCAPI_CONTROL_UPDATE_CONFIG_MSG_ID),
+ gnssConfig(config) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_CONTROL_DELETE_AIDING_DATA_MSG_ID
+struct LocAPIDeleteAidingDataReqMsg: LocAPIMsgHeader
+{
+ GnssAidingData gnssAidingData;
+
+ inline LocAPIDeleteAidingDataReqMsg(const char* name, GnssAidingData& data) :
+ LocAPIMsgHeader(name, E_LOCAPI_CONTROL_DELETE_AIDING_DATA_MSG_ID),
+ gnssAidingData(data) { }
+};
+
+struct LocAPIUpdateNetworkAvailabilityReqMsg: LocAPIMsgHeader
+{
+ bool mAvailability;
+
+ inline LocAPIUpdateNetworkAvailabilityReqMsg(const char* name, bool availability) :
+ LocAPIMsgHeader(name, E_LOCAPI_CONTROL_UPDATE_NETWORK_AVAILABILITY_MSG_ID),
+ mAvailability(availability) { }
+};
+
+struct LocAPIGetGnssEnergyConsumedReqMsg: LocAPIMsgHeader
+{
+ inline LocAPIGetGnssEnergyConsumedReqMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID) { }
+};
+
+/******************************************************************************
+IPC message structure - indications
+******************************************************************************/
+// defintion for message with msg id of E_LOCAPI_LOCATION_MSG_ID
+struct LocAPILocationIndMsg: LocAPIMsgHeader
+{
+ Location locationNotification;
+
+ inline LocAPILocationIndMsg(const char* name,
+ Location& location) :
+ LocAPIMsgHeader(name, E_LOCAPI_LOCATION_MSG_ID),
+ locationNotification(location) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_BATCHING_MSG_ID
+struct LocAPIBatchingIndMsg: LocAPIMsgHeader
+{
+ LocAPIBatchNotification batchNotification;
+
+ inline LocAPIBatchingIndMsg(const char* name, LocAPIBatchNotification& batchNotif) :
+ LocAPIMsgHeader(name, E_LOCAPI_BATCHING_MSG_ID),
+ batchNotification(batchNotif) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_GEOFENCE_BREACH_MSG_ID
+struct LocAPIGeofenceBreachIndMsg: LocAPIMsgHeader
+{
+ LocAPIGeofenceBreachNotification gfBreachNotification;
+
+ inline LocAPIGeofenceBreachIndMsg(const char* name,
+ LocAPIGeofenceBreachNotification& gfBreachNotif) :
+ LocAPIMsgHeader(name, E_LOCAPI_GEOFENCE_BREACH_MSG_ID),
+ gfBreachNotification(gfBreachNotif) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_LOCATION_INFO_MSG_ID
+struct LocAPILocationInfoIndMsg: LocAPIMsgHeader
+{
+ GnssLocationInfoNotification gnssLocationInfoNotification;
+
+ inline LocAPILocationInfoIndMsg(const char* name,
+ GnssLocationInfoNotification& locationInfo) :
+ LocAPIMsgHeader(name, E_LOCAPI_LOCATION_INFO_MSG_ID),
+ gnssLocationInfoNotification(locationInfo) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_ENGINE_LOCATIONS_INFO_MSG_ID
+struct LocAPIEngineLocationsInfoIndMsg: LocAPIMsgHeader
+{
+ uint32_t count;
+ GnssLocationInfoNotification engineLocationsInfo[LOC_OUTPUT_ENGINE_COUNT];
+
+ inline LocAPIEngineLocationsInfoIndMsg(
+ const char* name,
+ int cnt,
+ GnssLocationInfoNotification* locationInfo) :
+ LocAPIMsgHeader(name, E_LOCAPI_ENGINE_LOCATIONS_INFO_MSG_ID),
+ count(cnt) {
+
+ if (count > LOC_OUTPUT_ENGINE_COUNT) {
+ count = LOC_OUTPUT_ENGINE_COUNT;
+ }
+ if (count > 0) {
+ memcpy(engineLocationsInfo, locationInfo,
+ sizeof(GnssLocationInfoNotification) * count);
+ }
+ }
+
+ inline uint32_t getMsgSize() const {
+ return (sizeof(LocAPIEngineLocationsInfoIndMsg) -
+ (LOC_OUTPUT_ENGINE_COUNT - count) * sizeof(GnssLocationInfoNotification));
+ }
+};
+
+// defintion for message with msg id of E_LOCAPI_SATELLITE_VEHICLE_MSG_ID
+struct LocAPISatelliteVehicleIndMsg: LocAPIMsgHeader
+{
+ GnssSvNotification gnssSvNotification;
+
+ inline LocAPISatelliteVehicleIndMsg(const char* name,
+ GnssSvNotification& svNotification) :
+ LocAPIMsgHeader(name, E_LOCAPI_SATELLITE_VEHICLE_MSG_ID),
+ gnssSvNotification(svNotification) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_NMEA_MSG_ID
+struct LocAPINmeaIndMsg: LocAPIMsgHeader
+{
+ LocAPINmeaSerializedPayload gnssNmeaNotification;
+
+ inline LocAPINmeaIndMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_NMEA_MSG_ID) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_DATA_MSG_ID
+struct LocAPIDataIndMsg : LocAPIMsgHeader
+{
+ GnssDataNotification gnssDataNotification;
+
+ inline LocAPIDataIndMsg(const char* name,
+ GnssDataNotification& dataNotification) :
+ LocAPIMsgHeader(name, E_LOCAPI_DATA_MSG_ID),
+ gnssDataNotification(dataNotification) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_MEAS_MSG_ID
+struct LocAPIMeasIndMsg : LocAPIMsgHeader
+{
+ GnssMeasurementsNotification gnssMeasurementsNotification;
+
+ inline LocAPIMeasIndMsg(const char* name,
+ GnssMeasurementsNotification& measurementsNotification) :
+ LocAPIMsgHeader(name, E_LOCAPI_MEAS_MSG_ID),
+ gnssMeasurementsNotification(measurementsNotification) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_GET_TOTAL_ENGERY_CONSUMED_BY_GPS_ENGINE_MSG_ID
+struct LocAPIGnssEnergyConsumedIndMsg: LocAPIMsgHeader
+{
+ uint64_t totalGnssEnergyConsumedSinceFirstBoot;
+
+ inline LocAPIGnssEnergyConsumedIndMsg(const char* name, uint64_t energyConsumed) :
+ LocAPIMsgHeader(name, E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID),
+ totalGnssEnergyConsumedSinceFirstBoot(energyConsumed) { }
+};
+
+// defintion for message with msg id of E_LOCAPI_LOCATION_SYSTEM_INFO_MSG_ID
+struct LocAPILocationSystemInfoIndMsg: LocAPIMsgHeader
+{
+ LocationSystemInfo locationSystemInfo;
+
+ inline LocAPILocationSystemInfoIndMsg(const char* name, const LocationSystemInfo & systemInfo) :
+ LocAPIMsgHeader(name, E_LOCAPI_LOCATION_SYSTEM_INFO_MSG_ID),
+ locationSystemInfo(systemInfo) { }
+};
+
+/******************************************************************************
+IPC message structure - Location Integration API Configure Request
+******************************************************************************/
+struct LocConfigConstrainedTuncReqMsg: LocAPIMsgHeader
+{
+ bool mEnable;
+ float mTuncConstraint;
+ uint32_t mEnergyBudget;
+
+ inline LocConfigConstrainedTuncReqMsg(const char* name,
+ bool enable,
+ float tuncConstraint,
+ uint32_t energyBudget) :
+ LocAPIMsgHeader(name, E_INTAPI_CONFIG_CONSTRAINTED_TUNC_MSG_ID),
+ mEnable(enable),
+ mTuncConstraint(tuncConstraint),
+ mEnergyBudget(energyBudget) { }
+};
+
+struct LocConfigPositionAssistedClockEstimatorReqMsg: LocAPIMsgHeader
+{
+ bool mEnable;
+ inline LocConfigPositionAssistedClockEstimatorReqMsg(const char* name,
+ bool enable) :
+ LocAPIMsgHeader(name,
+ E_INTAPI_CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR_MSG_ID),
+ mEnable(enable) { }
+};
+
+struct LocConfigSvConstellationReqMsg: LocAPIMsgHeader
+{
+ bool mResetToDefault;
+ GnssSvTypeConfig mSvTypeConfig;
+ GnssSvIdConfig mSvIdConfig;
+
+ inline LocConfigSvConstellationReqMsg(const char* name,
+ bool resetToDefault,
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) :
+ LocAPIMsgHeader(name, E_INTAPI_CONFIG_SV_CONSTELLATION_MSG_ID),
+ mResetToDefault(resetToDefault),
+ mSvTypeConfig(svTypeConfig),
+ mSvIdConfig(svIdConfig){ }
+};
+
+// defintion for message with msg id of E_LOCAPI_CONTROL_DELETE_AIDING_DATA_MSG_ID
+struct LocConfigAidingDataDeletionReqMsg: LocAPIMsgHeader
+{
+ GnssAidingData mAidingData;
+
+ inline LocConfigAidingDataDeletionReqMsg(const char* name, GnssAidingData& aidingData) :
+ LocAPIMsgHeader(name, E_INTAPI_CONFIG_AIDING_DATA_DELETION_MSG_ID),
+ mAidingData(aidingData) { }
+};
+
+struct LocConfigLeverArmReqMsg: LocAPIMsgHeader
+{
+ LeverArmConfigInfo mLeverArmConfigInfo;
+
+ inline LocConfigLeverArmReqMsg(const char* name,
+ const LeverArmConfigInfo & configInfo) :
+ LocAPIMsgHeader(name, E_INTAPI_CONFIG_LEVER_ARM_MSG_ID),
+ mLeverArmConfigInfo(configInfo) { }
+};
+
+struct LocConfigRobustLocationReqMsg: LocAPIMsgHeader
+{
+ bool mEnable;
+ bool mEnableForE911;
+
+ inline LocConfigRobustLocationReqMsg(const char* name,
+ bool enable,
+ bool enableForE911) :
+ LocAPIMsgHeader(name, E_INTAPI_CONFIG_ROBUST_LOCATION_MSG_ID),
+ mEnable(enable),
+ mEnableForE911(enableForE911) { }
+};
+
+/******************************************************************************
+IPC message structure - Location Integration API Get request/response message
+******************************************************************************/
+struct LocConfigGetRobustLocationConfigReqMsg: LocAPIMsgHeader
+{
+ inline LocConfigGetRobustLocationConfigReqMsg(const char* name) :
+ LocAPIMsgHeader(name, E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID) { }
+};
+
+struct LocConfigGetRobustLocationConfigRespMsg: LocAPIMsgHeader
+{
+ GnssConfigRobustLocation mRobustLoationConfig;
+
+ inline LocConfigGetRobustLocationConfigRespMsg(
+ const char* name,
+ GnssConfigRobustLocation robustLoationConfig) :
+ LocAPIMsgHeader(name, E_INTAPI_GET_ROBUST_LOCATION_CONFIG_RESP_MSG_ID),
+ mRobustLoationConfig(robustLoationConfig) { }
+};
+
+/******************************************************************************
+IPC message structure - ping
+******************************************************************************/
+#define LOCATION_REMOTE_API_PINGTEST_SIZE (1024)
+
+struct LocAPIPingTestReqMsg: LocAPIMsgHeader
+{
+ uint8_t data[LOCATION_REMOTE_API_PINGTEST_SIZE];
+
+ inline LocAPIPingTestReqMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_PINGTEST_MSG_ID) { }
+};
+
+struct LocAPIPingTestIndMsg: LocAPIMsgHeader
+{
+ uint8_t data[LOCATION_REMOTE_API_PINGTEST_SIZE];
+
+ inline LocAPIPingTestIndMsg(const char* name) :
+ LocAPIMsgHeader(name, E_LOCAPI_PINGTEST_MSG_ID) { }
+};
+
+#endif /* LOCATIONAPIMSG_H */
diff --git a/location/location_hal_daemon/LocationApiService.cpp b/location/location_hal_daemon/LocationApiService.cpp
new file mode 100644
index 0000000..2153eed
--- /dev/null
+++ b/location/location_hal_daemon/LocationApiService.cpp
@@ -0,0 +1,1199 @@
+/* Copyright (c) 2018-2020 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 <stdint.h>
+#include <sys/stat.h>
+#include <dlfcn.h>
+#include <memory>
+#include <SystemStatus.h>
+#include <LocationApiMsg.h>
+#include <gps_extended_c.h>
+
+#ifdef POWERMANAGER_ENABLED
+#include <PowerEvtHandler.h>
+#endif
+#include <LocHalDaemonClientHandler.h>
+#include <LocationApiService.h>
+#include <location_interface.h>
+#include <loc_misc_utils.h>
+
+using namespace std;
+
+#define MAX_GEOFENCE_COUNT (200)
+
+typedef void* (getLocationInterface)();
+typedef void (createOSFramework)();
+typedef void (destroyOSFramework)();
+
+/******************************************************************************
+LocationApiService - static members
+******************************************************************************/
+LocationApiService* LocationApiService::mInstance = nullptr;
+std::mutex LocationApiService::mMutex;
+
+/******************************************************************************
+LocHaldIpcListener
+******************************************************************************/
+class LocHaldIpcListener : public ILocIpcListener {
+ LocationApiService& mService;
+ const char* mLocalSocketName;
+ const string mClientSockPath;
+ const string mClientSockPathnamePrefix;
+public:
+ inline LocHaldIpcListener(LocationApiService& service, const char* clientSockPath,
+ const char* clientSockNamePrefix, const char* localSockName = nullptr) :
+ mService(service), mLocalSocketName(localSockName),
+ mClientSockPath(clientSockPath),
+ mClientSockPathnamePrefix(string(mClientSockPath).append(clientSockNamePrefix)) {
+ }
+ // override from LocIpc
+ inline void onReceive(const char* data, uint32_t length,
+ const LocIpcRecver* recver) override {
+ mService.processClientMsg(data, length);
+ }
+ inline void onListenerReady() override {
+ if (nullptr != mLocalSocketName) {
+ if (0 != chown(mLocalSocketName, UID_GPS, GID_LOCCLIENT)) {
+ LOC_LOGe("chown to group locclient failed %s", strerror(errno));
+ }
+ }
+
+ // traverse client sockets directory - then broadcast READY message
+ LOC_LOGd(">-- onListenerReady Finding client sockets...");
+
+ DIR *dirp = opendir(mClientSockPath.c_str());
+ if (!dirp) {
+ LOC_LOGw("%s not created", mClientSockPath.c_str());
+ return;
+ }
+
+ struct dirent *dp = nullptr;
+ struct stat sbuf = {0};
+ while (nullptr != (dp = readdir(dirp))) {
+ std::string fname = mClientSockPath;
+ fname += dp->d_name;
+ if (-1 == lstat(fname.c_str(), &sbuf)) {
+ continue;
+ }
+ if ('.' == (dp->d_name[0])) {
+ continue;
+ }
+
+ if (0 == fname.compare(0, mClientSockPathnamePrefix.size(),
+ mClientSockPathnamePrefix)) {
+ shared_ptr<LocIpcSender> sender = LocHalDaemonClientHandler::createSender(fname);
+ LocAPIHalReadyIndMsg msg(SERVICE_NAME);
+ LOC_LOGd("<-- Sending ready to socket: %s, msg size %d",
+ fname.c_str(), sizeof(msg));
+ LocIpc::send(*sender, reinterpret_cast<const uint8_t*>(&msg),
+ sizeof(msg));
+ }
+ }
+ closedir(dirp);
+ }
+};
+
+/******************************************************************************
+LocationApiService - constructors
+******************************************************************************/
+LocationApiService::LocationApiService(const configParamToRead & configParamRead) :
+
+ mLocationControlId(0),
+ mAutoStartGnss(configParamRead.autoStartGnss),
+ mPowerState(POWER_STATE_UNKNOWN)
+#ifdef POWERMANAGER_ENABLED
+ ,mPowerEventObserver(nullptr)
+#endif
+ {
+
+ LOC_LOGd("AutoStartGnss=%u", mAutoStartGnss);
+ LOC_LOGd("GnssSessionTbfMs=%u", configParamRead.gnssSessionTbfMs);
+ LOC_LOGd("DeleteAllBeforeAutoStart=%u", configParamRead.deleteAllBeforeAutoStart);
+ LOC_LOGd("DeleteAllOnEnginesMask=%u", configParamRead.posEngineMask);
+
+ // create Location control API
+ mControlCallabcks.size = sizeof(mControlCallabcks);
+ mControlCallabcks.responseCb = [this](LocationError err, uint32_t id) {
+ onControlResponseCallback(err, id);
+ };
+ mControlCallabcks.collectiveResponseCb =
+ [this](size_t count, LocationError *errs, uint32_t *ids) {
+ onControlCollectiveResponseCallback(count, errs, ids);
+ };
+ mControlCallabcks.gnssConfigCb =
+ [this](uint32_t sessionId, const GnssConfig& config) {
+ onGnssConfigCallback(sessionId, config);
+ };
+
+#ifdef POWERMANAGER_ENABLED
+ // register power event handler
+ mPowerEventObserver = PowerEvtHandler::getPwrEvtHandler(this);
+ if (nullptr == mPowerEventObserver) {
+ LOC_LOGe("Failed to regiseter Powerevent handler");
+ return;
+ }
+#endif
+
+ // Create OSFramework and IzatManager instance
+ createOSFrameworkInstance();
+
+ // create a default client if enabled by config
+ if (mAutoStartGnss) {
+ checkEnableGnss();
+ if ((configParamRead.deleteAllBeforeAutoStart) &&
+ (configParamRead.posEngineMask != 0)) {
+ GnssAidingData aidingData = {};
+ aidingData.deleteAll = true;
+ aidingData.posEngineMask = configParamRead.posEngineMask;
+
+ gnssDeleteAidingData(aidingData);
+ }
+
+ LOC_LOGd("--> Starting a default client...");
+ LocHalDaemonClientHandler* pClient =
+ new LocHalDaemonClientHandler(this, "default", LOCATION_CLIENT_API);
+ mClients.emplace("default", pClient);
+
+ pClient->updateSubscription(
+ E_LOC_CB_GNSS_LOCATION_INFO_BIT | E_LOC_CB_GNSS_SV_BIT);
+
+ LocationOptions locationOption;
+ locationOption.size = sizeof(locationOption);
+ locationOption.minInterval = configParamRead.gnssSessionTbfMs;
+ locationOption.minDistance = 0;
+
+ pClient->startTracking(locationOption);
+ pClient->mTracking = true;
+ pClient->mPendingMessages.push(E_LOCAPI_START_TRACKING_MSG_ID);
+ }
+
+ // start receiver - never return
+ LOC_LOGd("Ready, start Ipc Receivers");
+ auto recver = LocIpc::getLocIpcLocalRecver(
+ make_shared<LocHaldIpcListener>(*this, SOCKET_LOC_CLIENT_DIR, LOC_CLIENT_NAME_PREFIX,
+ SOCKET_TO_LOCATION_HAL_DAEMON),
+ SOCKET_TO_LOCATION_HAL_DAEMON);
+ // blocking: set to false
+ mIpc.startNonBlockingListening(recver);
+
+ mBlockingRecver = LocIpc::getLocIpcQrtrRecver(
+ make_shared<LocHaldIpcListener>(*this, EAP_LOC_CLIENT_DIR, LOC_CLIENT_NAME_PREFIX),
+ LOCATION_CLIENT_API_QSOCKET_HALDAEMON_SERVICE_ID,
+ LOCATION_CLIENT_API_QSOCKET_HALDAEMON_INSTANCE_ID);
+ mIpc.startBlockingListening(*mBlockingRecver);
+}
+
+LocationApiService::~LocationApiService() {
+ mIpc.stopNonBlockingListening();
+ mIpc.stopBlockingListening(*mBlockingRecver);
+
+ // free resource associated with the client
+ for (auto each : mClients) {
+ LOC_LOGd(">-- deleted client [%s]", each.first.c_str());
+ each.second->cleanup();
+ }
+
+ // Destroy OSFramework instance
+ destroyOSFrameworkInstance();
+
+ // delete location contorol API handle
+ mLocationControlApi->disable(mLocationControlId);
+ mLocationControlApi->destroy();
+}
+
+/******************************************************************************
+LocationApiService - implementation - registration
+******************************************************************************/
+void LocationApiService::processClientMsg(const char* data, uint32_t length) {
+
+ // parse received message
+ LocAPIMsgHeader* pMsg = (LocAPIMsgHeader*)data;
+ LOC_LOGi(">-- onReceive len=%u remote=%s msgId=%u",
+ length, pMsg->mSocketName, pMsg->msgId);
+
+ switch (pMsg->msgId) {
+ case E_LOCAPI_CLIENT_REGISTER_MSG_ID: {
+ // new client
+ if (sizeof(LocAPIClientRegisterReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ newClient(reinterpret_cast<LocAPIClientRegisterReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_CLIENT_DEREGISTER_MSG_ID: {
+ // delete client
+ if (sizeof(LocAPIClientDeregisterReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ deleteClient(reinterpret_cast<LocAPIClientDeregisterReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_LOCAPI_START_TRACKING_MSG_ID: {
+ // start
+ if (sizeof(LocAPIStartTrackingReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ startTracking(reinterpret_cast<LocAPIStartTrackingReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_STOP_TRACKING_MSG_ID: {
+ // stop
+ if (sizeof(LocAPIStopTrackingReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ stopTracking(reinterpret_cast<LocAPIStopTrackingReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_UPDATE_CALLBACKS_MSG_ID: {
+ // update subscription
+ if (sizeof(LocAPIUpdateCallbacksReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ updateSubscription(reinterpret_cast<LocAPIUpdateCallbacksReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID: {
+ if (sizeof(LocAPIUpdateTrackingOptionsReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ updateTrackingOptions(reinterpret_cast
+ <LocAPIUpdateTrackingOptionsReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_LOCAPI_START_BATCHING_MSG_ID: {
+ // start
+ if (sizeof(LocAPIStartBatchingReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ startBatching(reinterpret_cast<LocAPIStartBatchingReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_STOP_BATCHING_MSG_ID: {
+ // stop
+ if (sizeof(LocAPIStopBatchingReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ stopBatching(reinterpret_cast<LocAPIStopBatchingReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID: {
+ if (sizeof(LocAPIUpdateBatchingOptionsReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ updateBatchingOptions(reinterpret_cast
+ <LocAPIUpdateBatchingOptionsReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_ADD_GEOFENCES_MSG_ID: {
+ if (sizeof(LocAPIAddGeofencesReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ addGeofences(reinterpret_cast<LocAPIAddGeofencesReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_REMOVE_GEOFENCES_MSG_ID: {
+ if (sizeof(LocAPIRemoveGeofencesReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ removeGeofences(reinterpret_cast<LocAPIRemoveGeofencesReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_MODIFY_GEOFENCES_MSG_ID: {
+ if (sizeof(LocAPIModifyGeofencesReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ modifyGeofences(reinterpret_cast<LocAPIModifyGeofencesReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_PAUSE_GEOFENCES_MSG_ID: {
+ if (sizeof(LocAPIPauseGeofencesReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ pauseGeofences(reinterpret_cast<LocAPIPauseGeofencesReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_RESUME_GEOFENCES_MSG_ID: {
+ if (sizeof(LocAPIResumeGeofencesReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ resumeGeofences(reinterpret_cast<LocAPIResumeGeofencesReqMsg*>(pMsg));
+ break;
+ }
+ case E_LOCAPI_CONTROL_UPDATE_CONFIG_MSG_ID: {
+ if (sizeof(LocAPIUpdateConfigReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ gnssUpdateConfig(reinterpret_cast<
+ LocAPIUpdateConfigReqMsg*>(pMsg)->gnssConfig);
+ break;
+ }
+ case E_LOCAPI_CONTROL_DELETE_AIDING_DATA_MSG_ID: {
+ if (sizeof(LocAPIDeleteAidingDataReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ gnssDeleteAidingData(reinterpret_cast
+ <LocAPIDeleteAidingDataReqMsg*>(pMsg)->gnssAidingData);
+ break;
+ }
+ case E_LOCAPI_CONTROL_UPDATE_NETWORK_AVAILABILITY_MSG_ID: {
+ if (sizeof(LocAPIUpdateNetworkAvailabilityReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ updateNetworkAvailability(reinterpret_cast
+ <LocAPIUpdateNetworkAvailabilityReqMsg*>(pMsg)->mAvailability);
+ break;
+ }
+ case E_LOCAPI_GET_GNSS_ENGERY_CONSUMED_MSG_ID: {
+ if (sizeof(LocAPIGetGnssEnergyConsumedReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ getGnssEnergyConsumed(reinterpret_cast
+ <LocAPIGetGnssEnergyConsumedReqMsg*>(pMsg)->mSocketName);
+ break;
+ }
+ case E_LOCAPI_PINGTEST_MSG_ID: {
+ if (sizeof(LocAPIPingTestReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ pingTest(reinterpret_cast<LocAPIPingTestReqMsg*>(pMsg));
+ break;
+ }
+
+ // location configuration API
+ case E_INTAPI_CONFIG_CONSTRAINTED_TUNC_MSG_ID: {
+ if (sizeof(LocConfigConstrainedTuncReqMsg) != length) {
+ LOC_LOGe("invalid LocConfigConstrainedTuncReqMsg");
+ break;
+ }
+ configConstrainedTunc(reinterpret_cast<LocConfigConstrainedTuncReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_INTAPI_CONFIG_POSITION_ASSISTED_CLOCK_ESTIMATOR_MSG_ID: {
+ if (sizeof(LocConfigPositionAssistedClockEstimatorReqMsg) != length) {
+ LOC_LOGe("invalid LocConfigPositionAssistedClockEstimatorReqMsg");
+ break;
+ }
+ configPositionAssistedClockEstimator(reinterpret_cast
+ <LocConfigPositionAssistedClockEstimatorReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_INTAPI_CONFIG_SV_CONSTELLATION_MSG_ID: {
+ if (sizeof(LocConfigSvConstellationReqMsg) != length) {
+ LOC_LOGe("invalid LocConfigSvConstellationReqMsg");
+ break;
+ }
+ configConstellations(reinterpret_cast
+ <LocConfigSvConstellationReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_INTAPI_CONFIG_AIDING_DATA_DELETION_MSG_ID: {
+ if (sizeof(LocConfigAidingDataDeletionReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ configAidingDataDeletion(reinterpret_cast<LocConfigAidingDataDeletionReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_INTAPI_CONFIG_LEVER_ARM_MSG_ID: {
+ if (sizeof(LocConfigLeverArmReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ configLeverArm(reinterpret_cast<LocConfigLeverArmReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_INTAPI_CONFIG_ROBUST_LOCATION_MSG_ID: {
+ if (sizeof(LocConfigRobustLocationReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ configRobustLocation(reinterpret_cast<LocConfigRobustLocationReqMsg*>(pMsg));
+ break;
+ }
+
+ case E_INTAPI_GET_ROBUST_LOCATION_CONFIG_REQ_MSG_ID: {
+ if (sizeof(LocConfigGetRobustLocationConfigReqMsg) != length) {
+ LOC_LOGe("invalid message");
+ break;
+ }
+ getGnssConfig(pMsg, GNSS_CONFIG_FLAGS_ROBUST_LOCATION_BIT);
+ break;
+ }
+ default: {
+ LOC_LOGe("Unknown message");
+ break;
+ }
+ }
+}
+
+/******************************************************************************
+LocationApiService - implementation - registration
+******************************************************************************/
+void LocationApiService::newClient(LocAPIClientRegisterReqMsg *pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ std::string clientname(pMsg->mSocketName);
+
+ checkEnableGnss();
+
+ // if this name is already used return error
+ if (mClients.find(clientname) != mClients.end()) {
+ LOC_LOGe("invalid client=%s already existing", clientname.c_str());
+ return;
+ }
+
+ // store it in client property database
+ LocHalDaemonClientHandler *pClient =
+ new LocHalDaemonClientHandler(this, clientname, pMsg->mClientType);
+ if (!pClient) {
+ LOC_LOGe("failed to register client=%s", clientname.c_str());
+ return;
+ }
+
+ mClients.emplace(clientname, pClient);
+ LOC_LOGi(">-- registered new client=%s", clientname.c_str());
+}
+
+void LocationApiService::deleteClient(LocAPIClientDeregisterReqMsg *pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ std::string clientname(pMsg->mSocketName);
+ deleteClientbyName(clientname);
+}
+
+void LocationApiService::deleteClientbyName(const std::string clientname) {
+ // We shall not hold the lock, as lock already held by the caller
+ //
+ // remove the client from the config request map
+ for (auto it = mConfigReqs.begin(); it != mConfigReqs.end();) {
+ if (strncmp(it->second.clientName.c_str(), clientname.c_str(),
+ strlen (clientname.c_str())) == 0) {
+ it = mConfigReqs.erase(it);
+ } else {
+ ++it;
+ }
+ }
+
+ // delete this client from property db
+ LocHalDaemonClientHandler* pClient = getClient(clientname);
+
+ if (!pClient) {
+ LOC_LOGe(">-- deleteClient invlalid client=%s", clientname.c_str());
+ return;
+ }
+ mClients.erase(clientname);
+ pClient->cleanup();
+
+ LOC_LOGi(">-- deleteClient client=%s", clientname.c_str());
+}
+/******************************************************************************
+LocationApiService - implementation - tracking
+******************************************************************************/
+void LocationApiService::startTracking(LocAPIStartTrackingReqMsg *pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (!pClient) {
+ LOC_LOGe(">-- start invlalid client=%s", pMsg->mSocketName);
+ return;
+ }
+
+ if (!pClient->startTracking(pMsg->locOptions)) {
+ LOC_LOGe("Failed to start session");
+ return;
+ }
+ // success
+ pClient->mTracking = true;
+ pClient->mPendingMessages.push(E_LOCAPI_START_TRACKING_MSG_ID);
+
+ LOC_LOGi(">-- start started session");
+ return;
+}
+
+void LocationApiService::stopTracking(LocAPIStopTrackingReqMsg *pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (!pClient) {
+ LOC_LOGe(">-- stop invlalid client=%s", pMsg->mSocketName);
+ return;
+ }
+
+ pClient->mTracking = false;
+ pClient->unsubscribeLocationSessionCb();
+ pClient->stopTracking();
+ pClient->mPendingMessages.push(E_LOCAPI_STOP_TRACKING_MSG_ID);
+ LOC_LOGi(">-- stopping session");
+}
+
+// no need to hold the lock as lock has been held on calling functions
+void LocationApiService::suspendAllTrackingSessions() {
+ for (auto client : mClients) {
+ // stop session if running
+ if (client.second && client.second->mTracking) {
+ client.second->stopTracking();
+ client.second->mPendingMessages.push(E_LOCAPI_STOP_TRACKING_MSG_ID);
+ LOC_LOGi("--> suspended");
+ }
+ }
+}
+
+// no need to hold the lock as lock has been held on calling functions
+void LocationApiService::resumeAllTrackingSessions() {
+ for (auto client : mClients) {
+ // start session if not running
+ if (client.second && client.second->mTracking) {
+
+ // resume session with preserved options
+ if (!client.second->startTracking()) {
+ LOC_LOGe("Failed to start session");
+ return;
+ }
+ // success
+ client.second->mPendingMessages.push(E_LOCAPI_START_TRACKING_MSG_ID);
+ LOC_LOGi("--> resumed");
+ }
+ }
+}
+
+void LocationApiService::updateSubscription(LocAPIUpdateCallbacksReqMsg *pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (!pClient) {
+ LOC_LOGe(">-- updateSubscription invlalid client=%s", pMsg->mSocketName);
+ return;
+ }
+
+ pClient->updateSubscription(pMsg->locationCallbacks);
+
+ LOC_LOGi(">-- update subscription client=%s mask=0x%x",
+ pMsg->mSocketName, pMsg->locationCallbacks);
+}
+
+void LocationApiService::updateTrackingOptions(LocAPIUpdateTrackingOptionsReqMsg *pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (pClient) {
+ pClient->updateTrackingOptions(pMsg->locOptions);
+ pClient->mPendingMessages.push(E_LOCAPI_UPDATE_TRACKING_OPTIONS_MSG_ID);
+ }
+
+ LOC_LOGi(">-- update tracking options");
+}
+
+void LocationApiService::updateNetworkAvailability(bool availability) {
+
+ LOC_LOGi(">-- updateNetworkAvailability=%u", availability);
+ GnssInterface* gnssInterface = getGnssInterface();
+ if (gnssInterface) {
+ // Map the network connectivity to MOBILE for now.
+ // In next phase, when we support third party connectivity manager,
+ // we plan to deplicate this API.
+ gnssInterface->updateConnectionStatus(
+ availability, loc_core::TYPE_MOBILE,
+ false, NETWORK_HANDLE_UNKNOWN);
+ }
+}
+
+void LocationApiService::getGnssEnergyConsumed(const char* clientSocketName) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ LOC_LOGi(">-- getGnssEnergyConsumed by=%s", clientSocketName);
+
+ GnssInterface* gnssInterface = getGnssInterface();
+ if (!gnssInterface) {
+ LOC_LOGe(">-- getGnssEnergyConsumed null GnssInterface");
+ return;
+ }
+
+ bool requestAlreadyPending = false;
+ for (auto each : mClients) {
+ if ((each.second != nullptr) &&
+ (each.second->hasPendingEngineInfoRequest(E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT))) {
+ requestAlreadyPending = true;
+ break;
+ }
+ }
+
+ std::string clientname(clientSocketName);
+ LocHalDaemonClientHandler* pClient = getClient(clientname);
+ if (pClient) {
+ pClient->addEngineInfoRequst(E_ENGINE_INFO_CB_GNSS_ENERGY_CONSUMED_BIT);
+
+ // this is first client coming to request GNSS energy consumed
+ if (requestAlreadyPending == false) {
+ LOC_LOGd("--< issue request to GNSS HAL");
+
+ // callback function for engine hub to report back sv event
+ GnssEnergyConsumedCallback reportEnergyCb =
+ [this](uint64_t total) {
+ onGnssEnergyConsumedCb(total);
+ };
+
+ gnssInterface->getGnssEnergyConsumed(reportEnergyCb);
+ }
+ }
+}
+
+/******************************************************************************
+LocationApiService - implementation - batching
+******************************************************************************/
+void LocationApiService::startBatching(LocAPIStartBatchingReqMsg *pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (!pClient) {
+ LOC_LOGe(">-- start invalid client=%s", pMsg->mSocketName);
+ return;
+ }
+
+ if (!pClient->startBatching(pMsg->intervalInMs, pMsg->distanceInMeters,
+ pMsg->batchingMode)) {
+ LOC_LOGe("Failed to start session");
+ return;
+ }
+ // success
+ pClient->mBatching = true;
+ pClient->mBatchingMode = pMsg->batchingMode;
+ pClient->mPendingMessages.push(E_LOCAPI_START_BATCHING_MSG_ID);
+
+ LOC_LOGi(">-- start batching session");
+ return;
+}
+
+void LocationApiService::stopBatching(LocAPIStopBatchingReqMsg *pMsg) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (!pClient) {
+ LOC_LOGe(">-- stop invalid client=%s", pMsg->mSocketName);
+ return;
+ }
+
+ pClient->mBatching = false;
+ pClient->mBatchingMode = BATCHING_MODE_NO_AUTO_REPORT;
+ pClient->updateSubscription(0);
+ pClient->stopBatching();
+ pClient->mPendingMessages.push(E_LOCAPI_STOP_BATCHING_MSG_ID);
+ LOC_LOGi(">-- stopping batching session");
+}
+
+void LocationApiService::updateBatchingOptions(LocAPIUpdateBatchingOptionsReqMsg *pMsg) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (pClient) {
+ pClient->updateBatchingOptions(pMsg->intervalInMs, pMsg->distanceInMeters,
+ pMsg->batchingMode);
+ pClient->mPendingMessages.push(E_LOCAPI_UPDATE_BATCHING_OPTIONS_MSG_ID);
+ }
+
+ LOC_LOGi(">-- update batching options");
+}
+
+/******************************************************************************
+LocationApiService - implementation - geofence
+******************************************************************************/
+void LocationApiService::addGeofences(LocAPIAddGeofencesReqMsg* pMsg) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (!pClient) {
+ LOC_LOGe(">-- start invlalid client=%s", pMsg->mSocketName);
+ return;
+ }
+ if (pMsg->geofences.count > MAX_GEOFENCE_COUNT) {
+ LOC_LOGe(">-- geofence count greater than MAX =%d", pMsg->geofences.count);
+ return;
+ }
+ GeofenceOption* gfOptions =
+ (GeofenceOption*)malloc(pMsg->geofences.count * sizeof(GeofenceOption));
+ GeofenceInfo* gfInfos = (GeofenceInfo*)malloc(pMsg->geofences.count * sizeof(GeofenceInfo));
+ uint32_t* clientIds = (uint32_t*)malloc(pMsg->geofences.count * sizeof(uint32_t));
+ if ((nullptr == gfOptions) || (nullptr == gfInfos) || (nullptr == clientIds)) {
+ LOC_LOGe("Failed to malloc memory!");
+ if (clientIds != nullptr) {
+ free(clientIds);
+ }
+ if (gfInfos != nullptr) {
+ free(gfInfos);
+ }
+ if (gfOptions != nullptr) {
+ free(gfOptions);
+ }
+ return;
+ }
+
+ for(int i=0; i < pMsg->geofences.count; ++i) {
+ gfOptions[i] = (*(pMsg->geofences.gfPayload + i)).gfOption;
+ gfInfos[i] = (*(pMsg->geofences.gfPayload + i)).gfInfo;
+ clientIds[i] = (*(pMsg->geofences.gfPayload + i)).gfClientId;
+ }
+
+ uint32_t* sessions = pClient->addGeofences(pMsg->geofences.count, gfOptions, gfInfos);
+ if (!sessions) {
+ LOC_LOGe("Failed to add geofences");
+ free(clientIds);
+ free(gfInfos);
+ free(gfOptions);
+ return;
+ }
+ pClient->setGeofenceIds(pMsg->geofences.count, clientIds, sessions);
+ // success
+ pClient->mGfPendingMessages.push(E_LOCAPI_ADD_GEOFENCES_MSG_ID);
+
+ LOC_LOGi(">-- add geofences");
+ free(clientIds);
+ free(gfInfos);
+ free(gfOptions);
+}
+
+void LocationApiService::removeGeofences(LocAPIRemoveGeofencesReqMsg* pMsg) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (nullptr == pClient) {
+ LOC_LOGe("removeGeofences - Null client!");
+ return;
+ }
+ uint32_t* sessions = pClient->getSessionIds(pMsg->gfClientIds.count, pMsg->gfClientIds.gfIds);
+ if (pClient && sessions) {
+ pClient->removeGeofences(pMsg->gfClientIds.count, sessions);
+ pClient->mGfPendingMessages.push(E_LOCAPI_REMOVE_GEOFENCES_MSG_ID);
+ }
+
+ LOC_LOGi(">-- remove geofences");
+ free(sessions);
+}
+void LocationApiService::modifyGeofences(LocAPIModifyGeofencesReqMsg* pMsg) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (nullptr == pClient) {
+ LOC_LOGe("modifyGeofences - Null client!");
+ return;
+ }
+ if (pMsg->geofences.count > MAX_GEOFENCE_COUNT) {
+ LOC_LOGe("modifyGeofences - geofence count greater than MAX =%d", pMsg->geofences.count);
+ return;
+ }
+ GeofenceOption* gfOptions = (GeofenceOption*)
+ malloc(sizeof(GeofenceOption) * pMsg->geofences.count);
+ uint32_t* clientIds = (uint32_t*)malloc(sizeof(uint32_t) * pMsg->geofences.count);
+ if (nullptr == gfOptions || nullptr == clientIds) {
+ LOC_LOGe("Failed to malloc memory!");
+ if (clientIds != nullptr) {
+ free(clientIds);
+ }
+ if (gfOptions != nullptr) {
+ free(gfOptions);
+ }
+ return;
+ }
+ for (int i=0; i<pMsg->geofences.count; ++i) {
+ gfOptions[i] = (*(pMsg->geofences.gfPayload + i)).gfOption;
+ clientIds[i] = (*(pMsg->geofences.gfPayload + i)).gfClientId;
+ }
+ uint32_t* sessions = pClient->getSessionIds(pMsg->geofences.count, clientIds);
+
+ if (pClient && sessions) {
+ pClient->modifyGeofences(pMsg->geofences.count, sessions, gfOptions);
+ pClient->mGfPendingMessages.push(E_LOCAPI_MODIFY_GEOFENCES_MSG_ID);
+ }
+
+ LOC_LOGi(">-- modify geofences");
+ free(sessions);
+ free(clientIds);
+ free(gfOptions);
+}
+void LocationApiService::pauseGeofences(LocAPIPauseGeofencesReqMsg* pMsg) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (nullptr == pClient) {
+ LOC_LOGe("pauseGeofences - Null client!");
+ return;
+ }
+ uint32_t* sessions = pClient->getSessionIds(pMsg->gfClientIds.count, pMsg->gfClientIds.gfIds);
+ if (pClient && sessions) {
+ pClient->pauseGeofences(pMsg->gfClientIds.count, sessions);
+ pClient->mGfPendingMessages.push(E_LOCAPI_PAUSE_GEOFENCES_MSG_ID);
+ }
+
+ LOC_LOGi(">-- pause geofences");
+ free(sessions);
+}
+void LocationApiService::resumeGeofences(LocAPIResumeGeofencesReqMsg* pMsg) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (nullptr == pClient) {
+ LOC_LOGe("resumeGeofences - Null client!");
+ return;
+ }
+ uint32_t* sessions = pClient->getSessionIds(pMsg->gfClientIds.count, pMsg->gfClientIds.gfIds);
+ if (pClient && sessions) {
+ pClient->resumeGeofences(pMsg->gfClientIds.count, sessions);
+ pClient->mGfPendingMessages.push(E_LOCAPI_RESUME_GEOFENCES_MSG_ID);
+ }
+
+ LOC_LOGi(">-- resume geofences");
+ free(sessions);
+}
+
+void LocationApiService::pingTest(LocAPIPingTestReqMsg* pMsg) {
+
+ // test only - ignore this request when config is not enabled
+ std::lock_guard<std::mutex> lock(mMutex);
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (!pClient) {
+ LOC_LOGe(">-- pingTest invlalid client=%s", pMsg->mSocketName);
+ return;
+ }
+ pClient->pingTest();
+ LOC_LOGd(">-- pingTest");
+}
+
+void LocationApiService::configConstrainedTunc(
+ const LocConfigConstrainedTuncReqMsg* pMsg){
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!pMsg || !mLocationControlApi) {
+ return;
+ }
+
+ uint32_t sessionId = mLocationControlApi->configConstrainedTimeUncertainty(
+ pMsg->mEnable, pMsg->mTuncConstraint, pMsg->mEnergyBudget);
+ LOC_LOGi(">-- enable: %d, tunc constraint %f, energy budget %d, session ID = %d",
+ pMsg->mEnable, pMsg->mTuncConstraint, pMsg->mEnergyBudget,
+ sessionId);
+ addConfigRequestToMap(sessionId, pMsg);
+}
+
+void LocationApiService::configPositionAssistedClockEstimator(
+ const LocConfigPositionAssistedClockEstimatorReqMsg* pMsg)
+{
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!pMsg || !mLocationControlApi) {
+ return;
+ }
+
+ uint32_t sessionId = mLocationControlApi->
+ configPositionAssistedClockEstimator(pMsg->mEnable);
+ LOC_LOGi(">-- enable: %d, session ID = %d", pMsg->mEnable, sessionId);
+
+ addConfigRequestToMap(sessionId, pMsg);
+}
+
+void LocationApiService::configConstellations(
+ const LocConfigSvConstellationReqMsg* pMsg){
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!pMsg) {
+ return;
+ }
+
+ uint32_t sessionId = 0;
+ if (pMsg->mResetToDefault) {
+ sessionId = mLocationControlApi->resetConstellationConfig();
+ } else {
+ sessionId = mLocationControlApi->configConstellations(
+ pMsg->mSvTypeConfig, pMsg->mSvIdConfig);
+ }
+
+ LOC_LOGi(">-- reset: %d, enable constellations: 0x%" PRIx64 ", "
+ "blacklisted consteallations: 0x%" PRIx64 ", ",
+ pMsg->mResetToDefault,
+ pMsg->mSvTypeConfig.enabledSvTypesMask,
+ pMsg->mSvTypeConfig.blacklistedSvTypesMask);
+ addConfigRequestToMap(sessionId, pMsg);
+}
+
+void LocationApiService::configAidingDataDeletion(
+ LocConfigAidingDataDeletionReqMsg* pMsg) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!pMsg) {
+ return;
+ }
+
+ LOC_LOGi(">-- client %s, deleteAll %d",
+ pMsg->mSocketName, pMsg->mAidingData.deleteAll);
+
+ // suspend all sessions before calling delete
+ suspendAllTrackingSessions();
+
+ uint32_t sessionId = mLocationControlApi->gnssDeleteAidingData(pMsg->mAidingData);
+ addConfigRequestToMap(sessionId, pMsg);
+
+#ifdef POWERMANAGER_ENABLED
+ // We do not need to resume the session if device is suspend/shutdown state
+ // as sessions will resumed when power state changes to resume
+ if ((POWER_STATE_SUSPEND == mPowerState) ||
+ (POWER_STATE_SHUTDOWN == mPowerState)) {
+ return;
+ }
+#endif
+
+ // resume all sessions after calling aiding data deletion
+ resumeAllTrackingSessions();
+}
+
+void LocationApiService::configLeverArm(const LocConfigLeverArmReqMsg* pMsg){
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!pMsg) {
+ return;
+ }
+ uint32_t sessionId = mLocationControlApi->configLeverArm(pMsg->mLeverArmConfigInfo);
+ addConfigRequestToMap(sessionId, pMsg);
+}
+
+void LocationApiService::configRobustLocation(
+ const LocConfigRobustLocationReqMsg* pMsg){
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!pMsg) {
+ return;
+ }
+ LOC_LOGi(">-- client %s, enable %d, enableForE911 %d",
+ pMsg->mSocketName, pMsg->mEnable, pMsg->mEnableForE911);
+
+ uint32_t sessionId = mLocationControlApi->configRobustLocation(
+ pMsg->mEnable, pMsg->mEnableForE911);
+ addConfigRequestToMap(sessionId, pMsg);
+}
+
+void LocationApiService::getGnssConfig(const LocAPIMsgHeader* pReqMsg,
+ GnssConfigFlagsBits configFlag) {
+
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!pReqMsg) {
+ return;
+ }
+
+ uint32_t sessionId = 0;
+ uint32_t* sessionIds = mLocationControlApi->gnssGetConfig(
+ configFlag);
+ if (sessionIds) {
+ LOC_LOGd(">-- session id %d", *sessionIds);
+ sessionId = *sessionIds;
+ }
+ // if sessionId is 0, e.g.: error callback will be delivered
+ // by addConfigRequestToMap
+ addConfigRequestToMap(sessionId, pReqMsg);
+}
+
+void LocationApiService::addConfigRequestToMap(
+ uint32_t sessionId, const LocAPIMsgHeader* pMsg){
+ // for config request that is invoked from location integration API
+ // if session id is valid, we need to add it to the map so when response
+ // comes back, we can deliver the response to the integration api client
+ if (sessionId != 0) {
+ ConfigReqClientData configClientData;
+ configClientData.configMsgId = pMsg->msgId;
+ configClientData.clientName = pMsg->mSocketName;
+ mConfigReqs.emplace(sessionId, configClientData);
+ } else {
+ // if session id is 0, we need to deliver failed response back to the
+ // client
+ LocHalDaemonClientHandler* pClient = getClient(pMsg->mSocketName);
+ if (pClient) {
+ pClient->onControlResponseCb(LOCATION_ERROR_GENERAL_FAILURE, pMsg->msgId);
+ }
+ }
+}
+
+/******************************************************************************
+LocationApiService - Location Control API callback functions
+******************************************************************************/
+void LocationApiService::onControlResponseCallback(LocationError err, uint32_t sessionId) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LOC_LOGd("--< onControlResponseCallback err=%u id=%u", err, sessionId);
+
+ auto configReqData = mConfigReqs.find(sessionId);
+ if (configReqData != std::end(mConfigReqs)) {
+ LocHalDaemonClientHandler* pClient = getClient(configReqData->second.clientName);
+ if (pClient) {
+ pClient->onControlResponseCb(err, configReqData->second.configMsgId);
+ }
+ mConfigReqs.erase(configReqData);
+ LOC_LOGd("--< map size %d", mConfigReqs.size());
+ } else {
+ LOC_LOGe("--< client not found for session id %d", sessionId);
+ }
+}
+
+void LocationApiService::onControlCollectiveResponseCallback(
+ size_t count, LocationError *errs, uint32_t *ids) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LOC_LOGd("--< onControlCollectiveResponseCallback");
+}
+
+void LocationApiService::onGnssConfigCallback(uint32_t sessionId,
+ const GnssConfig& config) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LOC_LOGd("--< onGnssConfigCallback, req cnt %d", mConfigReqs.size());
+
+ auto configReqData = mConfigReqs.find(sessionId);
+ if (configReqData != std::end(mConfigReqs)) {
+ LocHalDaemonClientHandler* pClient = getClient(configReqData->second.clientName);
+ if (pClient) {
+ // invoke the respCb to deliver success status
+ pClient->onControlResponseCb(LOCATION_ERROR_SUCCESS, configReqData->second.configMsgId);
+ // invoke the configCb to deliver the config
+ pClient->onGnssConfigCb(configReqData->second.configMsgId, config);
+ }
+ mConfigReqs.erase(configReqData);
+ LOC_LOGd("--< map size %d", mConfigReqs.size());
+ } else {
+ LOC_LOGe("--< client not found for session id %d", sessionId);
+ }
+}
+
+/******************************************************************************
+LocationApiService - power event handlers
+******************************************************************************/
+#ifdef POWERMANAGER_ENABLED
+void LocationApiService::onPowerEvent(PowerStateType powerState) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LOC_LOGd("--< onPowerEvent %d", powerState);
+
+ mPowerState = powerState;
+ if ((POWER_STATE_SUSPEND == powerState) ||
+ (POWER_STATE_SHUTDOWN == powerState)) {
+ suspendAllTrackingSessions();
+ } else if (POWER_STATE_RESUME == powerState) {
+ resumeAllTrackingSessions();
+ }
+
+ GnssInterface* gnssInterface = getGnssInterface();
+ if (!gnssInterface) {
+ LOC_LOGe(">-- getGnssEnergyConsumed null GnssInterface");
+ return;
+ }
+ gnssInterface->updateSystemPowerState(powerState);
+}
+#endif
+
+/******************************************************************************
+LocationApiService - on query callback from location engines
+******************************************************************************/
+void LocationApiService::onGnssEnergyConsumedCb(uint64_t totalGnssEnergyConsumedSinceFirstBoot) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ LOC_LOGd("--< onGnssEnergyConsumedCb");
+
+ LocAPIGnssEnergyConsumedIndMsg msg(SERVICE_NAME, totalGnssEnergyConsumedSinceFirstBoot);
+ for (auto each : mClients) {
+ // deliver the engergy info to registered client
+ each.second->onGnssEnergyConsumedInfoAvailable(msg);
+ }
+}
+
+/******************************************************************************
+LocationApiService - other utilities
+******************************************************************************/
+GnssInterface* LocationApiService::getGnssInterface() {
+
+ static bool getGnssInterfaceFailed = false;
+ static GnssInterface* gnssInterface = nullptr;
+
+ if (nullptr == gnssInterface && !getGnssInterfaceFailed) {
+ void * tempPtr = nullptr;
+ getLocationInterface* getter = (getLocationInterface*)
+ dlGetSymFromLib(tempPtr, "libgnss.so", "getGnssInterface");
+
+ if (nullptr == getter) {
+ getGnssInterfaceFailed = true;
+ } else {
+ gnssInterface = (GnssInterface*)(*getter)();
+ }
+ }
+ return gnssInterface;
+}
+
+void LocationApiService::checkEnableGnss() {
+ if (nullptr == mLocationControlApi) {
+ mLocationControlApi = LocationControlAPI::createInstance(mControlCallabcks);
+ if (nullptr == mLocationControlApi) {
+ LOC_LOGe("Failed to create LocationControlAPI");
+ return;
+ }
+
+ // enable
+ mLocationControlId = mLocationControlApi->enable(LOCATION_TECHNOLOGY_TYPE_GNSS);
+ LOC_LOGd("-->enable=%u", mLocationControlId);
+ // this is a unique id assigned to this daemon - will be used when disable
+ }
+}
+
+// Create OSFramework instance
+void LocationApiService::createOSFrameworkInstance() {
+ void* libHandle = nullptr;
+ createOSFramework* getter = (createOSFramework*)dlGetSymFromLib(libHandle,
+ "liblocationservice_glue.so", "createOSFramework");
+ if (getter != nullptr) {
+ (*getter)();
+ } else {
+ LOC_LOGe("dlGetSymFromLib failed for liblocationservice_glue.so");
+ }
+}
+
+// Destroy OSFramework instance
+void LocationApiService::destroyOSFrameworkInstance() {
+ void* libHandle = nullptr;
+ destroyOSFramework* getter = (destroyOSFramework*)dlGetSymFromLib(libHandle,
+ "liblocationservice_glue.so", "destroyOSFramework");
+ if (getter != nullptr) {
+ (*getter)();
+ } else {
+ LOC_LOGe("dlGetSymFromLib failed for liblocationservice_glue.so");
+ }
+}
diff --git a/location/location_hal_daemon/LocationApiService.h b/location/location_hal_daemon/LocationApiService.h
new file mode 100644
index 0000000..0b9aef6
--- /dev/null
+++ b/location/location_hal_daemon/LocationApiService.h
@@ -0,0 +1,230 @@
+/* Copyright (c) 2018-2020 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 LOCATIONAPISERVICE_H
+#define LOCATIONAPISERVICE_H
+
+#include <string>
+#include <mutex>
+
+#include <MsgTask.h>
+#include <loc_cfg.h>
+#include <LocIpc.h>
+#ifdef POWERMANAGER_ENABLED
+#include <PowerEvtHandler.h>
+#endif
+#include <location_interface.h>
+#include <LocationAPI.h>
+#include <LocationApiMsg.h>
+
+#include <LocHalDaemonClientHandler.h>
+
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
+
+#undef LOG_TAG
+#define LOG_TAG "LocSvc_HalDaemon"
+
+#define SERVICE_NAME "locapiservice"
+
+typedef struct {
+ uint32_t autoStartGnss;
+ uint32_t gnssSessionTbfMs;
+ uint32_t deleteAllBeforeAutoStart;
+ uint32_t posEngineMask;
+} configParamToRead;
+
+
+/******************************************************************************
+LocationApiService
+******************************************************************************/
+
+typedef struct {
+ // this stores the client name and the command type that client requests
+ // the info will be used to send back command response
+ std::string clientName;
+ ELocMsgID configMsgId;
+} ConfigReqClientData;
+
+class LocationApiService
+{
+public:
+
+ // singleton instance
+ LocationApiService(const LocationApiService&) = delete;
+ LocationApiService& operator = (const LocationApiService&) = delete;
+
+ static LocationApiService* getInstance(
+ const configParamToRead & configParamRead) {
+ if (nullptr == mInstance) {
+ mInstance = new LocationApiService(configParamRead);
+ }
+ return mInstance;
+ }
+
+ static void destroy() {
+ if (nullptr != mInstance) {
+ delete mInstance;
+ mInstance = nullptr;
+ }
+ }
+
+ // APIs can be invoked by IPC
+ void processClientMsg(const char* data, uint32_t length);
+
+ // from IPC receiver
+ void onListenerReady(bool externalApIpc);
+
+#ifdef POWERMANAGER_ENABLED
+ void onPowerEvent(PowerStateType powerState);
+#endif
+
+ // other APIs
+ void deleteClientbyName(const std::string name);
+
+ static std::mutex mMutex;
+
+private:
+ // APIs can be invoked to process client's IPC messgage
+ void newClient(LocAPIClientRegisterReqMsg*);
+ void deleteClient(LocAPIClientDeregisterReqMsg*);
+
+ void startTracking(LocAPIStartTrackingReqMsg*);
+ void stopTracking(LocAPIStopTrackingReqMsg*);
+
+ void suspendAllTrackingSessions();
+ void resumeAllTrackingSessions();
+
+ void updateSubscription(LocAPIUpdateCallbacksReqMsg*);
+ void updateTrackingOptions(LocAPIUpdateTrackingOptionsReqMsg*);
+ void updateNetworkAvailability(bool availability);
+ void getGnssEnergyConsumed(const char* clientSocketName);
+
+ void startBatching(LocAPIStartBatchingReqMsg*);
+ void stopBatching(LocAPIStopBatchingReqMsg*);
+ void updateBatchingOptions(LocAPIUpdateBatchingOptionsReqMsg*);
+
+ void addGeofences(LocAPIAddGeofencesReqMsg*);
+ void removeGeofences(LocAPIRemoveGeofencesReqMsg*);
+ void modifyGeofences(LocAPIModifyGeofencesReqMsg*);
+ void pauseGeofences(LocAPIPauseGeofencesReqMsg*);
+ void resumeGeofences(LocAPIResumeGeofencesReqMsg*);
+
+ void pingTest(LocAPIPingTestReqMsg*);
+
+ inline void gnssUpdateConfig(GnssConfig config) {
+ mLocationControlApi->gnssUpdateConfig(config);
+ }
+
+ inline void gnssDeleteAidingData(GnssAidingData& data) {
+ mLocationControlApi->gnssDeleteAidingData(data);
+ }
+
+ // Location control API callback
+ void onControlResponseCallback(LocationError err, uint32_t id);
+ void onControlCollectiveResponseCallback(size_t count, LocationError *errs, uint32_t *ids);
+ void onGnssConfigCallback(uint32_t sessionId, const GnssConfig& config);
+ void onGnssEnergyConsumedCb(uint64_t totalEnergyConsumedSinceFirstBoot);
+
+ // Location configuration API requests
+ void configConstrainedTunc(
+ const LocConfigConstrainedTuncReqMsg* pMsg);
+ void configPositionAssistedClockEstimator(
+ const LocConfigPositionAssistedClockEstimatorReqMsg* pMsg);
+ void configConstellations(
+ const LocConfigSvConstellationReqMsg* pMsg);
+ void configAidingDataDeletion(
+ LocConfigAidingDataDeletionReqMsg* pMsg);
+ void configLeverArm(const LocConfigLeverArmReqMsg* pMsg);
+ void configRobustLocation(const LocConfigRobustLocationReqMsg* pMsg);
+
+ // Location configuration API get/read requests
+ void getGnssConfig(const LocAPIMsgHeader* pReqMsg,
+ GnssConfigFlagsBits configFlag);
+
+ // Location configuration API util routines
+ void addConfigRequestToMap(uint32_t sessionId,
+ const LocAPIMsgHeader* pMsg);
+
+ LocationApiService(const configParamToRead & configParamRead);
+ virtual ~LocationApiService();
+
+ // private utilities
+ inline LocHalDaemonClientHandler* getClient(const std::string& clientname) {
+ // find client from property db
+ auto client = mClients.find(clientname);
+ if (client == std::end(mClients)) {
+ LOC_LOGe("Failed to find client %s", clientname.c_str());
+ return nullptr;
+ }
+ return client->second;
+ }
+
+ inline LocHalDaemonClientHandler* getClient(const char* socketName) {
+ std::string clientname(socketName);
+ return getClient(clientname);
+ }
+
+ void checkEnableGnss();
+
+ GnssInterface* getGnssInterface();
+ // OSFramework instance
+ void createOSFrameworkInstance();
+ void destroyOSFrameworkInstance();
+
+#ifdef POWERMANAGER_ENABLED
+ // power event observer
+ PowerEvtHandler* mPowerEventObserver;
+#endif
+
+ // singleton instance
+ static LocationApiService *mInstance;
+
+ // IPC interface
+ LocIpc mIpc;
+ unique_ptr<LocIpcRecver> mBlockingRecver;
+
+ // Client propery database
+ std::unordered_map<std::string, LocHalDaemonClientHandler*> mClients;
+ std::unordered_map<uint32_t, ConfigReqClientData> mConfigReqs;
+
+ // Location Control API interface
+ uint32_t mLocationControlId;
+ LocationControlCallbacks mControlCallabcks;
+ LocationControlAPI *mLocationControlApi;
+
+ // Configration
+ const uint32_t mAutoStartGnss;
+ PowerStateType mPowerState;
+};
+
+#endif //LOCATIONAPISERVICE_H
+
diff --git a/location/location_hal_daemon/Makefile.am b/location/location_hal_daemon/Makefile.am
new file mode 100644
index 0000000..7513c3f
--- /dev/null
+++ b/location/location_hal_daemon/Makefile.am
@@ -0,0 +1,65 @@
+AM_CFLAGS = \
+ -DDEBUG \
+ -I./ \
+ $(LOCCORE_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ -std=c++11
+
+if USE_SYSTEMD
+AM_CFLAGS += -DINIT_SYSTEM_SYSTEMD
+else
+AM_CFLAGS += -DINIT_SYSTEM_SYSV
+endif
+
+if USE_FEATURE_AUTOMOTIVE
+AM_CFLAGS += -DFEATURE_AUTOMOTIVE
+endif
+
+requiredlibs = \
+ $(LOCATIONAPI_LIBS) \
+ $(GPSUTILS_LIBS)
+
+h_sources = \
+ LocationApiMsg.h \
+ LocHalDaemonClientHandler.h \
+ LocationApiService.h
+
+c_sources = \
+ LocHalDaemonClientHandler.cpp \
+ LocationApiService.cpp \
+ main.cpp
+
+if POWERMANAGER_ENABLED
+AM_CFLAGS += $(PM_CFLAGS) -DPOWERMANAGER_ENABLED
+c_sources += PowerEvtHandler.cpp
+requiredlibs += $(PM_LIBS)
+endif
+
+location_hal_daemon_SOURCES = \
+ $(c_sources) $(h_sources)
+
+######################
+# Build location_hal_daemon
+######################
+
+if USE_GLIB
+location_hal_daemon_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+location_hal_daemon_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared
+location_hal_daemon_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+location_hal_daemon_CFLAGS = $(AM_CFLAGS)
+location_hal_daemon_LDFLAGS = -Wl,-z,defs -lpthread -shared
+location_hal_daemon_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+location_hal_daemon_LDADD = $(requiredlibs) -lcutils -ldl
+
+bin_PROGRAMS = location_hal_daemon
+
+library_include_HEADERS = $(h_sources)
+library_includedir = $(pkgincludedir)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-hal-daemon.pc
+EXTRA_DIST = $(pkgconfig_DATA)
+
diff --git a/location/location_hal_daemon/PowerEvtHandler.cpp b/location/location_hal_daemon/PowerEvtHandler.cpp
new file mode 100644
index 0000000..deb811e
--- /dev/null
+++ b/location/location_hal_daemon/PowerEvtHandler.cpp
@@ -0,0 +1,83 @@
+/* Copyright (c) 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 <unistd.h>
+#include <PowerEvtHandler.h>
+#include <LocationApiService.h>
+#include <log_util.h>
+
+#define ACK_TIMEOUT_US 300000 // 300 msec
+
+LocationApiService* PowerEvtHandler::mLocationApiService = nullptr;
+
+PowerEvtHandler* PowerEvtHandler::getPwrEvtHandler(LocationApiService* locServiceApiObj) {
+ mLocationApiService = locServiceApiObj;
+ static PowerEvtHandler instance;
+ return &instance;
+}
+
+PowerEvtHandler::PowerEvtHandler() {
+ pwr_state_notification_register(PowerEvtHandler::pwrStateCb);
+}
+
+PowerEvtHandler::~PowerEvtHandler() {
+}
+
+int PowerEvtHandler::pwrStateCb(power_state_t pwr_state) {
+ client_ack_t client_ack;
+ client_ack.ack = ERR;
+ PowerStateType powerState = POWER_STATE_UNKNOWN;
+
+ switch (pwr_state.sys_state) {
+ case SYS_SUSPEND:
+ client_ack.ack = SUSPEND_ACK;
+ powerState = POWER_STATE_SUSPEND;
+ break;
+ case SYS_RESUME:
+ client_ack.ack = RESUME_ACK;
+ powerState = POWER_STATE_RESUME;
+ break;
+ case SYS_SHUTDOWN:
+ client_ack.ack = SHUTDOWN_ACK;
+ powerState = POWER_STATE_SHUTDOWN;
+ break;
+ }
+
+ if (powerState != POWER_STATE_UNKNOWN) {
+ if (mLocationApiService) {
+ mLocationApiService->onPowerEvent(powerState);
+ }
+ }
+
+ //Allow some time to stop the session and write calibration data NVM.
+ usleep(ACK_TIMEOUT_US);
+ send_acknowledgement(client_ack);
+
+ return 0;
+}
+
diff --git a/location/location_hal_daemon/PowerEvtHandler.h b/location/location_hal_daemon/PowerEvtHandler.h
new file mode 100644
index 0000000..75bd3db
--- /dev/null
+++ b/location/location_hal_daemon/PowerEvtHandler.h
@@ -0,0 +1,49 @@
+/* Copyright (c) 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 _POWER_EVENT_HANDLER_H_
+#define _POWER_EVENT_HANDLER_H_
+
+#include <power_state.h>
+
+class LocationApiService;
+
+class PowerEvtHandler
+{
+public:
+ static PowerEvtHandler* getPwrEvtHandler(LocationApiService*);
+ ~PowerEvtHandler();
+ static int pwrStateCb(power_state_t pwr_state);
+
+private:
+ PowerEvtHandler();
+ static LocationApiService* mLocationApiService;
+};
+
+#endif //_POWER_EVENT_HANDLER_H_
+
diff --git a/location/location_hal_daemon/configure.ac b/location/location_hal_daemon/configure.ac
new file mode 100644
index 0000000..5f4382b
--- /dev/null
+++ b/location/location_hal_daemon/configure.ac
@@ -0,0 +1,113 @@
+# configure.ac -- Autoconf script for gps location-hal-daemon
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the location-hal-daemon package version 1.0.0
+AC_INIT([location-hal-daemon],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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([LOCCORE], [loc-core])
+AC_SUBST([LOCCORE_CFLAGS])
+AC_SUBST([LOCCORE_LIBS])
+
+PKG_CHECK_MODULES([LOCATIONAPI], [location-api])
+AC_SUBST([LOCATIONAPI_CFLAGS])
+AC_SUBST([LOCATIONAPI_LIBS])
+
+PKG_CHECK_MODULES([LOCHAL], [loc-hal])
+AC_SUBST([LOCHAL_CFLAGS])
+AC_SUBST([LOCHAL_LIBS])
+
+PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
+AC_SUBST([GPSUTILS_CFLAGS])
+AC_SUBST([GPSUTILS_LIBS])
+
+AC_ARG_ENABLE(target,
+ [AS_HELP_STRING([--enable-target=TARGET], [Specify the target product to build])],
+ [TARGET=$enableval],
+ [TARGET=none]
+)
+
+AM_CONDITIONAL(POWERMANAGER_ENABLED, [test "x$TARGET" = "xmdm9607"])
+AM_COND_IF(POWERMANAGER_ENABLED, [
+ PKG_CHECK_MODULES([PM], [powermanager])
+ AC_SUBST([PM_CFLAGS])
+ AC_SUBST([PM_LIBS])
+])
+
+AC_ARG_WITH([systemd],
+ AC_HELP_STRING([--with-systemd],
+ [systemd enable, building LE systems which has systemd]))
+
+AM_CONDITIONAL(USE_SYSTEMD, test "x${with_systemd}" = "xyes")
+
+AC_ARG_WITH([auto_feature],
+ AC_HELP_STRING([--with-auto_feature=@<:@dir@:>@],
+ [Using Automotive feature]),
+ [],
+ with_auto_feature=no)
+
+if test "x$with_auto_feature" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -DFEATURE_AUTOMOTIVE"
+fi
+
+AM_CONDITIONAL(USE_FEATURE_AUTOMOTIVE, test "x${with_auto_feature}" = "xyes")
+
+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_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_CONFIG_FILES([ \
+ Makefile \
+ location-hal-daemon.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/location_hal_daemon/location-hal-daemon.pc.in b/location/location_hal_daemon/location-hal-daemon.pc.in
new file mode 100644
index 0000000..46ca939
--- /dev/null
+++ b/location/location_hal_daemon/location-hal-daemon.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-hal-daemon
+Description: location hal daemon service
+Version: @VERSION@
+Libs: -L${libdir} -llocation-hal-daemon
+Cflags: -I${includedir} -I${includedir}/location-hal-daemon
diff --git a/location/location_hal_daemon/location_hal_initializer b/location/location_hal_daemon/location_hal_initializer
new file mode 100644
index 0000000..9d5b005
--- /dev/null
+++ b/location/location_hal_daemon/location_hal_initializer
@@ -0,0 +1,76 @@
+
+#!/bin/sh
+#
+# 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.
+#
+
+# Location Hal Daemon - init.d script for /usr/bin/location_hal_daemon
+
+set -e
+wait_for_dir_mount() {
+ while ! [ -d /dev ]
+ do
+ echo "waiting for /dev to mount"
+ done
+}
+
+create_set_folder() {
+ if [ ! -d "${1}" ]
+ then
+ mkdir -p "${1}"
+ chown -R "${2}" "${1}"
+ chmod "${3}" "${1}"
+ fi
+}
+
+# for location hal daemon
+case "$1" in
+ start)
+ echo -n "Starting location_hal_initializer" > /dev/kmsg
+ wait_for_dir_mount
+ create_set_folder "/dev/socket/location" "gps:gps" 755
+ create_set_folder "/dev/socket/loc_client" "gps:locclient" 775
+ create_set_folder "/data/vendor/location/extap_locclient" "gps:gps" 755
+ create_set_folder "/dev/socket/location/ehub" "gps:gps" 755
+ echo "Done creating folders for location hal daemon"
+ ;;
+ stop)
+ echo -n "Stopping location_hal_initializer" > /dev/kmsg
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo -n "Usage location_hal_initializer { start | stop | restart }" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/location/location_hal_daemon/main.cpp b/location/location_hal_daemon/main.cpp
new file mode 100644
index 0000000..9856c11
--- /dev/null
+++ b/location/location_hal_daemon/main.cpp
@@ -0,0 +1,183 @@
+/* Copyright (c) 2018-2020 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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <grp.h>
+#include <unistd.h>
+#include <sys/prctl.h>
+#include <sys/capability.h>
+#include <loc_pla.h>
+#include <loc_cfg.h>
+#include <gps_extended_c.h>
+#include <loc_misc_utils.h>
+#include "LocationApiService.h"
+
+#define HAL_DAEMON_VERSION "1.1.0"
+
+typedef void (StartDgnssApiServiceApi)();
+
+// this function will block until the directory specified in
+// dirName has been created
+static inline void waitForDir(const char* dirName) {
+ // wait for parent direcoty to be created...
+ struct stat buf_stat;
+ while (1) {
+ LOC_LOGd("waiting for %s...", dirName);
+ int rc = stat(dirName, &buf_stat);
+ if (!rc) {
+ break;
+ }
+ usleep(100000); //100ms
+ }
+ LOC_LOGd("done");
+}
+
+int main(int argc, char *argv[])
+{
+ configParamToRead configParamRead = {};
+
+ const loc_param_s_type configTable[] =
+ {
+ {"AUTO_START_GNSS", &configParamRead.autoStartGnss, NULL, 'n'},
+ {"GNSS_SESSION_TBF_MS", &configParamRead.gnssSessionTbfMs, NULL, 'n'},
+ {"DELETE_ALL_BEFORE_AUTO_START", &configParamRead.deleteAllBeforeAutoStart, NULL, 'n'},
+ {"DELETE_ALL_ON_ENGINE_MASK", &configParamRead.posEngineMask, NULL, 'n'}
+ };
+
+#if FEATURE_AUTOMOTIVE
+ // enable auto start by default with 100 ms TBF
+ configParamRead.autoStartGnss = 1;
+ configParamRead.gnssSessionTbfMs = 100;
+#endif
+
+ // read configuration file
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, configTable);
+
+ LOC_LOGi("location hal daemon - ver %s", HAL_DAEMON_VERSION);
+
+ waitForDir(SOCKET_DIR_LOCATION);
+ waitForDir(SOCKET_LOC_CLIENT_DIR);
+ waitForDir(EAP_LOC_CLIENT_DIR);
+ waitForDir(SOCKET_DIR_EHUB);
+
+ LOC_LOGd("starting loc_hal_daemon");
+
+#ifdef INIT_SYSTEM_SYSV
+ // set supplementary groups for sysvinit
+ // For systemd, common supplementary groups are set via service files
+ #ifdef POWERMANAGER_ENABLED
+ char groupNames[LOC_MAX_PARAM_NAME] = "gps diag powermgr locclient inet";
+ #else
+ char groupNames[LOC_MAX_PARAM_NAME] = "gps diag locclient inet";
+ #endif
+
+ gid_t groupIds[LOC_PROCESS_MAX_NUM_GROUPS] = {};
+ char *splitGrpString[LOC_PROCESS_MAX_NUM_GROUPS];
+ int numGrps = loc_util_split_string(groupNames, splitGrpString,
+ LOC_PROCESS_MAX_NUM_GROUPS, ' ');
+
+ int numGrpIds=0;
+ for (int i=0; i<numGrps; i++) {
+ struct group* grp = getgrnam(splitGrpString[i]);
+ if (grp) {
+ groupIds[numGrpIds] = grp->gr_gid;
+ LOC_LOGd("Group %s = %d", splitGrpString[i], groupIds[numGrpIds]);
+ numGrpIds++;
+ }
+ }
+ if (0 != numGrpIds) {
+ if (-1 == setgroups(numGrpIds, groupIds)) {
+ LOC_LOGe("Error: setgroups failed %s", strerror(errno));
+ }
+ }
+#endif
+
+ // check if this process started by root
+ if (0 == getuid()) {
+#ifdef INIT_SYSTEM_SYSTEMD
+ // started as root.
+ LOC_LOGE("Error !!! location_hal_daemon started as root");
+ exit(1);
+#else
+ // Set capabilities
+ struct __user_cap_header_struct cap_hdr = {};
+ cap_hdr.version = _LINUX_CAPABILITY_VERSION;
+ cap_hdr.pid = getpid();
+ if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
+ LOC_LOGe("Error: prctl failed. %s", strerror(errno));
+ }
+
+ // Set the group id first and then set the effective userid, to gps.
+ if (-1 == setgid(GID_GPS)) {
+ LOC_LOGe("Error: setgid failed. %s", strerror(errno));
+ }
+ // Set user id
+ if (-1 == setuid(UID_GPS)) {
+ LOC_LOGe("Error: setuid failed. %s", strerror(errno));
+ }
+
+ // Set access to netmgr (QCMAP)
+ struct __user_cap_data_struct cap_data = {};
+ cap_data.permitted = (1 << CAP_NET_BIND_SERVICE) | (1 << CAP_NET_ADMIN);
+ cap_data.effective = cap_data.permitted;
+ LOC_LOGv("cap_data.permitted: %d", (int)cap_data.permitted);
+ if (capset(&cap_hdr, &cap_data)) {
+ LOC_LOGe("Error: capset failed. %s", strerror(errno));
+ }
+#endif
+ }
+
+ // move to root dir
+ chdir("/");
+
+ // start listening for dgnss client events
+ StartDgnssApiServiceApi* pStartDgnssApiService = nullptr;
+ void* libhandle = nullptr;
+ const char* libName = "libcdfw.so";
+
+ pStartDgnssApiService =
+ (StartDgnssApiServiceApi*)dlGetSymFromLib(libhandle, libName,
+ "startDgnssApiService");
+ if (nullptr != pStartDgnssApiService){
+ pStartDgnssApiService();
+ }
+
+ // start listening for client events - will not return
+ if (!LocationApiService::getInstance(configParamRead)) {
+ LOC_LOGd("Failed to start LocationApiService.");
+ }
+
+ // should not reach here...
+ LOC_LOGd("done");
+ exit(0);
+}
+
diff --git a/location/nlp_api/Android.mk b/location/nlp_api/Android.mk
new file mode 100644
index 0000000..53b9bfd
--- /dev/null
+++ b/location/nlp_api/Android.mk
@@ -0,0 +1,10 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libnlp_api_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
+
+include $(BUILD_HEADER_LIBRARY)
+
+include $(CLEAR_VARS)
diff --git a/location/nlp_api/inc/DBCommon.h b/location/nlp_api/inc/DBCommon.h
new file mode 100644
index 0000000..8a3f1a3
--- /dev/null
+++ b/location/nlp_api/inc/DBCommon.h
@@ -0,0 +1,117 @@
+/* Copyright (c) 2020 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 WIFI_DB_COMMON_H
+#define WIFI_DB_COMMON_H
+
+#include <stdint.h>
+
+typedef enum {
+ STD_CONT = 0,
+ STD_FINAL = 1,
+ SCAN_FINAL = 2,
+} ApBsListStatus;
+
+typedef enum {
+ GSM = 0,
+ WCDMA = 1,
+ CDMA = 2,
+ LTE = 3,
+} CellType;
+
+typedef struct {
+ CellType cellType;
+ uint16_t regionId1;
+ uint16_t regionId2;
+ uint16_t regionId3;
+ uint16_t regionId4;
+ uint32_t timestamp;
+} CellInfo;
+
+typedef enum LocationPositionSource : uint8_t {
+ GPS = (1<<0),
+ HYBRID = (1<<1),
+} LocationPositionSource;
+
+typedef enum NlpLocationFlagsBits : uint16_t {
+ LAT_LONG_BIT = (1<<0), // location has valid latitude and longitude
+ ALTITUDE_BIT = (1<<1), // location has valid altitude
+ SPEED_BIT = (1<<2), // location has valid speed
+ BEARING_BIT = (1<<3), // location has valid bearing
+ ACCURACY_BIT = (1<<4), // location has valid accuracy
+ VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy
+ SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy
+ BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy
+} NlpLocationFlagsBits;
+
+typedef struct {
+ LocationPositionSource positionSource;
+ NlpLocationFlagsBits locationFlagsMask;
+ uint64_t timestamp;
+ double latitude;
+ double longitude;
+ double altitude;
+ float speed;
+ float bearing;
+ float accuracy;
+ float verticalAccuracy;
+ float speedAccuracy;
+ float bearingAccuracy;
+} NlpLocation;
+
+typedef enum {
+ OPT_OUT = 0,
+ OPT_IN = 1,
+} OptInStatus;
+
+typedef enum {
+ TYPE_MOBILE = 0,
+ TYPE_WIFI,
+ TYPE_ETHERNET,
+ TYPE_BLUETOOTH,
+ TYPE_MMS,
+ TYPE_SUPL,
+ TYPE_DUN,
+ TYPE_HIPRI,
+ TYPE_WIMAX,
+ TYPE_PROXY,
+ TYPE_UNKNOWN,
+} NetworkType;
+
+typedef struct {
+ NetworkType networkType;
+ uint64_t networkHandle;
+} NlpNetwork;
+
+typedef struct {
+ void (*onLocationOptInUpdate)(OptInStatus optInStatus);
+ void (*onNetworkStatusUpdate)(bool isConected, const NlpNetwork* networksAvailable,
+ uint8_t networksAvailableCount);
+} SystemStatusListener;
+
+#endif /* WIFI_DB_COMMON_H */
diff --git a/location/nlp_api/inc/NLPApi.h b/location/nlp_api/inc/NLPApi.h
new file mode 100644
index 0000000..3559ee9
--- /dev/null
+++ b/location/nlp_api/inc/NLPApi.h
@@ -0,0 +1,139 @@
+/* Copyright (c) 2020 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 NLP_API_H
+#define NLP_API_H
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <WiFiDBReceiver.h>
+#include <WiFiDBProvider.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ /** @brief
+ Allows the registration of a SystemStatusListener to get updates on changes
+ in system status.
+
+ @param
+ listener: instance of SystemStatusListener,
+ implementing the required callback functions.
+ Should not be freed until disconnect function is called.
+
+ @return bool True if the connection is succesfull.
+ */
+ bool (*connectToSystemStatus)(const SystemStatusListener* listener);
+
+ /** @brief
+ Provides an instance of WiFiDBReceiver object with
+ the specified listener.
+
+ @param
+ listener: instance of WiFiDBReceiverResponseListener,
+ implementing the required callback functions.
+ Should not be freed until disconnect function is called.
+
+ @return WiFiDBReceiver
+ */
+ const WiFiDBReceiver* (*connectToWiFiDBReceiver)(
+ const WiFiDBReceiverResponseListener* listener);
+
+ /** @brief
+ Provides an instance of WiFiDBProvider object with
+ the specified priority listener.
+
+ @param
+ listener: instance of WiFiDBProviderResponseListener,
+ implementing the required callback functions.
+ Should not be freed until disconnect function is called.
+
+ @return WiFiDBProvider
+ */
+ const WiFiDBProvider* (*connectToWiFiDBProvider)(
+ const WiFiDBProviderResponseListener* listener);
+
+ /** @brief
+ Disconnect the SystemStatusListener. Indicates that client process is not
+ available for any reason.
+
+ @param
+ listener: instance of WiFiDBReceiverResponseListener, previously provided
+ in the connectToWiFiDBReceiver call.
+ */
+ void (*disconnectFromSystemStatus)(const SystemStatusListener* listener);
+
+ /** @brief
+ Disconnect the WiFiDBReceiver associated with the provided listener.
+
+ @param
+ listener: instance of WiFiDBReceiverResponseListener, previously provided
+ in the connectToWiFiDBReceiver call.
+ */
+ void (*disconnectFromWiFiDBReceiver)(
+ const WiFiDBReceiverResponseListener* listener);
+
+ /** @brief
+ Disconnect the WiFiDBProvider associated with the provided listener.
+
+ @param
+ listener: instance of WiFiDBProviderResponseListener, previously provided
+ in the connectToWiFiDBProvider call.
+ */
+ void (*disconnectFromWiFiDBProvider)(
+ const WiFiDBProviderResponseListener* listener);
+} NLPApi;
+
+/** @brief
+ Provides a C pointer to an instance of NLPApi struct after dynamic linking to lobnlp_api.so.
+*/
+inline const NLPApi* linkGetNLPApi() {
+ typedef void* (getNLPApi)();
+
+ getNLPApi* getter = NULL;
+ const char *error = NULL;
+ dlerror();
+ void *handle = dlopen("libnlp_api.so", RTLD_NOW);
+ if (NULL != handle || (error = dlerror()) == NULL) {
+ getter = (getNLPApi*)dlsym(handle, "getNLPApi");
+ if ((error = dlerror()) != NULL) {
+ getter = NULL;
+ }
+ }
+
+ return (NLPApi*)(*getter)();
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NLP_API_H */
diff --git a/location/nlp_api/inc/WiFiDBProvider.h b/location/nlp_api/inc/WiFiDBProvider.h
new file mode 100644
index 0000000..a84c085
--- /dev/null
+++ b/location/nlp_api/inc/WiFiDBProvider.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2020 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 WIFI_DB_PROV_H
+#define WIFI_DB_PROV_H
+
+#include <DBCommon.h>
+
+/******************************************************************************
+WiFiDBReceiver
+******************************************************************************/
+
+typedef struct {
+ void (*requestAPObsLocData)();
+} WiFiDBProvider;
+
+/******************************************************************************
+ResponseListener
+******************************************************************************/
+typedef struct {
+ uint8_t macAddress[6];
+ float rssi;
+ uint64_t deltaTime;
+ char ssid[8];
+ uint16_t channelNumber;
+} ApScan;
+
+typedef struct {
+ NlpLocation location;
+ CellInfo cellInfo;
+ uint64_t scanTimestamp;
+ ApScan* ap_scan_list;
+ uint16_t ap_scan_list_count;
+} APObsLocData;
+
+/** @brief
+ All the memory pointers returned in these callbacks will be freed after call returns.
+ Implementation of these callbacks shall copy the needed data before returning.
+*/
+typedef struct {
+ void (*onApObsLocDataAvailable)(const APObsLocData* ap_obs_list, uint16_t ap_obs_list_count,
+ ApBsListStatus ap_status);
+ void (*onServiceRequest)();
+} WiFiDBProviderResponseListener;
+
+#endif /* WIFI_DB_PROV_H */
diff --git a/location/nlp_api/inc/WiFiDBReceiver.h b/location/nlp_api/inc/WiFiDBReceiver.h
new file mode 100644
index 0000000..65eb702
--- /dev/null
+++ b/location/nlp_api/inc/WiFiDBReceiver.h
@@ -0,0 +1,114 @@
+/* Copyright (c) 2020 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 WIFI_DB_REC_H
+#define WIFI_DB_REC_H
+
+#include <DBCommon.h>
+
+/******************************************************************************
+WiFiDBReceiver
+******************************************************************************/
+
+typedef enum ReliabilityTypes : uint8_t {
+ VERY_LOW = 0,
+ LOW = 1,
+ MEDIUM = 2,
+ HIGH = 3,
+ VERY_HIGH = 4,
+} ReliabilityTypes;
+
+typedef struct {
+ uint8_t macAddress[6];
+ double latitude;
+ double longitude;
+ float max_antenna_range;
+ float horizontal_error;
+ ReliabilityTypes reliability;
+} APLocationData;
+
+typedef enum APSpecialInfoType : uint8_t {
+ NO_INFO_AVAILABLE = 0,
+ MOVING_AP = 1,
+} APSpecialInfoType;
+
+typedef struct {
+ uint8_t macAddress[6];
+ APSpecialInfoType specialInfoType;
+} APSpecialInfo;
+
+/** @brief
+ All the memory pointers received will be never freed internally.
+ Caller shall manage the memory before and after calling these functions.
+*/
+typedef struct {
+ void (*requestAPList)(int expire_in_days);
+ void (*requestScanList)();
+ void (*pushWiFiDB)(const APLocationData* location_data, uint16_t location_data_count,
+ const APSpecialInfo* special_info, uint16_t special_info_count, int days_valid);
+ void (*pushLookupResult)(const APLocationData* location_data, uint16_t location_data_count,
+ const APSpecialInfo* special_info, uint16_t special_info_count);
+} WiFiDBReceiver;
+
+/******************************************************************************
+ResponseListener
+******************************************************************************/
+
+typedef enum FdalStatus : uint8_t {
+ NOT_IN_FDAL = 0,
+ IN_FDAL = 1,
+ BLACKLISTED = 2,
+ NA = 3,
+} FdalStatus;
+
+typedef struct {
+ char ssid[8];
+ CellInfo cellInfo;
+} NlpAPInfoExtra;
+
+typedef struct {
+ uint8_t macAddress[6];
+ uint64_t timestamp;
+ FdalStatus fdalStatus;
+ NlpAPInfoExtra extra;
+} NlpAPInfo;
+
+/** @brief
+ All the memory pointers returned in these callbacks will be freed after call returns.
+ Implementation of these callbacks shall copy the needed data before returning.
+*/
+typedef struct {
+ void (*onAPListAvailable)(const NlpAPInfo* ap_list, uint16_t ap_list_count,
+ ApBsListStatus ap_status, NlpLocation location);
+ void (*onLookupRequest)(const NlpAPInfo* ap_list, uint16_t ap_list_count, NlpLocation location,
+ bool is_emergency);
+ void (*onStatusUpdate)(bool is_success, const char* error);
+ void (*onServiceRequest)(bool is_emergency);
+} WiFiDBReceiverResponseListener;
+
+#endif /* WIFI_DB_REC_H */
diff --git a/location/qapi/Makefile.am b/location/qapi/Makefile.am
new file mode 100644
index 0000000..0301bc8
--- /dev/null
+++ b/location/qapi/Makefile.am
@@ -0,0 +1,49 @@
+AM_CFLAGS = \
+ -DDEBUG \
+ -I src/ \
+ -I inc/ \
+ $(GPSUTILS_CFLAGS) \
+ $(LOCCLIENTAPI_CFLAGS) \
+ -std=c++11
+
+ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -std=c++11
+
+requiredlibs = \
+ $(GPSUTILS_LIBS) \
+ $(LOCCLIENTAPI_LIBS)
+
+h_sources = \
+ inc/qapi_location.h
+
+c_sources = \
+ src/qapi_location.cpp
+
+liblocation_qapi_la_SOURCES = \
+ $(c_sources) $(h_sources)
+
+######################
+# Build location_qapi
+######################
+
+if USE_GLIB
+liblocation_qapi_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+liblocation_qapi_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+liblocation_qapi_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+liblocation_qapi_la_CFLAGS = $(AM_CFLAGS)
+liblocation_qapi_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+liblocation_qapi_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+liblocation_qapi_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install libraries
+library_include_HEADERS = $(h_sources)
+lib_LTLIBRARIES = liblocation_qapi.la
+
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = location-qapi.pc
+sysconf_DATA = $(WORKSPACE)/gps/etc/qapi.conf
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/location/qapi/configure.ac b/location/qapi/configure.ac
new file mode 100644
index 0000000..a8fa656
--- /dev/null
+++ b/location/qapi/configure.ac
@@ -0,0 +1,64 @@
+# configure.ac -- Autoconf script for gps location-qapi
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the location_qapi package version 1.0.0
+AC_INIT([location-qapi],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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])
+
+PKG_CHECK_MODULES([LOCCLIENTAPI], [location-client-api])
+AC_SUBST([LOCCLIENTAPI_CFLAGS])
+AC_SUBST([LOCCLIENTAPI_LIBS])
+
+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-qapi.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/qapi/inc/qapi_location.h b/location/qapi/inc/qapi_location.h
new file mode 100644
index 0000000..c2a3975
--- /dev/null
+++ b/location/qapi/inc/qapi_location.h
@@ -0,0 +1,880 @@
+/* Copyright (c) 2019-2020 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 QAPI_LOCATION_H_
+#define QAPI_LOCATION_H_
+
+#include <stdint.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /** @addtogroup qapi_location
+ @{ */
+
+ /**
+ * GNSS location error codes.
+ */
+ typedef enum {
+ QAPI_LOCATION_ERROR_SUCCESS = 0, /**< Success. */
+ QAPI_LOCATION_ERROR_GENERAL_FAILURE, /**< General failure. */
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING, /**< Callback is missing. */
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER, /**< Invalid parameter. */
+ QAPI_LOCATION_ERROR_ID_EXISTS, /**< ID already exists. */
+ QAPI_LOCATION_ERROR_ID_UNKNOWN, /**< ID is unknown. */
+ QAPI_LOCATION_ERROR_ALREADY_STARTED, /**< Already started. */
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED, /**< Not initialized. */
+ QAPI_LOCATION_ERROR_GEOFENCES_AT_MAX, /**< Maximum number of geofences reached. */
+ QAPI_LOCATION_ERROR_NOT_SUPPORTED, /**< Not supported. */
+ QAPI_LOCATION_ERROR_TIMEOUT, /**< Timeout when asking single shot. */
+ QAPI_LOCATION_ERROR_LOAD_FAILURE, /**< GNSS engine could not get loaded. */
+ QAPI_LOCATION_ERROR_LOCATION_DISABLED, /**< Location module license is disabled. */
+ QAPI_LOCATION_ERROR_BEST_AVAIL_POS_INVALID, /**< Best available position is invalid. */
+ } qapi_Location_Error_t;
+
+ typedef uint16_t qapi_Location_Flags_Mask_t;
+ /**
+ * Flags to indicate which values are valid in a location.
+ */
+ typedef enum {
+ QAPI_LOCATION_HAS_LAT_LONG_BIT = (1 << 0), /**< Location has a valid latitude and longitude. */
+ QAPI_LOCATION_HAS_ALTITUDE_BIT = (1 << 1), /**< Location has a valid altitude. */
+ QAPI_LOCATION_HAS_SPEED_BIT = (1 << 2), /**< Location has a valid speed. */
+ QAPI_LOCATION_HAS_BEARING_BIT = (1 << 3), /**< Location has a valid bearing. */
+ QAPI_LOCATION_HAS_ACCURACY_BIT = (1 << 4), /**< Location has valid accuracy. */
+ QAPI_LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1 << 5), /**< Location has valid vertical accuracy. */
+ QAPI_LOCATION_HAS_SPEED_ACCURACY_BIT = (1 << 6), /**< Location has valid speed accuracy. */
+ QAPI_LOCATION_HAS_BEARING_ACCURACY_BIT = (1 << 7), /**< Location has valid bearing accuracy. */
+ QAPI_LOCATION_HAS_ALTITUDE_MSL_BIT = (1 << 8), /**< Location has valid altitude wrt mean sea level. */
+ QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT = (1 << 9), /**< Location is the currently best available position. */
+ } qapi_Location_Flags_t;
+
+ /**
+ * Flags to indicate Geofence breach status.
+ */
+ typedef enum {
+ QAPI_GEOFENCE_BREACH_ENTER = 0, /**< Entering Geofence breach. */
+ QAPI_GEOFENCE_BREACH_EXIT, /**< Exiting Geofence breach. */
+ QAPI_GEOFENCE_BREACH_DWELL_IN, /**< Dwelling in a breached Geofence. */
+ QAPI_GEOFENCE_BREACH_DWELL_OUT, /**< Dwelling outside of a breached Geofence. */
+ QAPI_GEOFENCE_BREACH_UNKNOWN, /**< Breach is unknown. */
+ } qapi_Geofence_Breach_t;
+
+ typedef uint16_t qapi_Geofence_Breach_Mask_t;
+ /** Flags to indicate Geofence breach mask bit. */
+ typedef enum {
+ QAPI_GEOFENCE_BREACH_ENTER_BIT = (1 << 0), /**< Breach enter bit. */
+ QAPI_GEOFENCE_BREACH_EXIT_BIT = (1 << 1), /**< Breach exit bit. */
+ QAPI_GEOFENCE_BREACH_DWELL_IN_BIT = (1 << 2), /**< Breach dwell in bit. */
+ QAPI_GEOFENCE_BREACH_DWELL_OUT_BIT = (1 << 3), /**< Breach dwell out bit. */
+ } qapi_Geofence_Breach_Mask_Bits_t;
+
+ typedef uint32_t qapi_Location_Capabilities_Mask_t;
+ /** Flags to indicate the capabilities bit. */
+ typedef enum {
+ /**< Capabilities time-based tracking bit. */
+ QAPI_LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1 << 0),
+ /**< Capabilities time-based batching bit. */
+ QAPI_LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT = (1 << 1),
+ /**< Capabilities distance-based tracking bit. */
+ QAPI_LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT = (1 << 2),
+ /**< Capabilities distance-based batching bit. */
+ QAPI_LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT = (1 << 3),
+ /**< Capabilities Geofence bit. */
+ QAPI_LOCATION_CAPABILITIES_GEOFENCE_BIT = (1 << 4),
+ /**< Capabilities Geofence bit. */
+ QAPI_LOCATION_CAPABILITIES_GNSS_DATA_BIT = (1 << 5),
+ } qapi_Location_Capabilities_Mask_Bits_t;
+
+ /** Flags to indicate the constellation type. */
+ typedef enum {
+ QAPI_GNSS_SV_TYPE_UNKNOWN = 0, /**< Unknown. */
+ QAPI_GNSS_SV_TYPE_GPS, /**< GPS. */
+ QAPI_GNSS_SV_TYPE_SBAS, /**< SBAS. */
+ QAPI_GNSS_SV_TYPE_GLONASS, /**< GLONASS. */
+ QAPI_GNSS_SV_TYPE_QZSS, /**< QZSS. */
+ QAPI_GNSS_SV_TYPE_BEIDOU, /**< BEIDOU. */
+ QAPI_GNSS_SV_TYPE_GALILEO, /**< GALILEO. */
+ QAPI_MAX_NUMBER_OF_CONSTELLATIONS /**< Maximum number of constellations. */
+ } qapi_Gnss_Sv_t;
+
+ typedef enum {
+ QAPI_LOCATION_POWER_HIGH = 0, /**< Use all technologies available to calculate location. */
+ QAPI_LOCATION_POWER_LOW, /**< Use all low power technologies to calculate location. */
+ QAPI_LOCATION_POWER_MED, /**< Use only low and medium power technologies to calculate location */
+ } qapi_Location_Power_Level_t;
+
+ /** Structure for location information. */
+ typedef struct {
+ size_t size; /**< Size. Set to the size of qapi_Location_t. */
+ qapi_Location_Flags_Mask_t flags; /**< Bitwise OR of qapi_Location_Flags_t. */
+ uint64_t timestamp; /**< UTC timestamp for a location fix; milliseconds
+ since Jan. 1, 1970. */
+ double latitude; /**< Latitude in degrees. */
+ double longitude; /**< Longitude in degrees. */
+ double altitude; /**< Altitude in meters above the WGS 84 reference
+ ellipsoid. */
+ double altitudeMeanSeaLevel; /**< Altitude in meters with respect to mean
+ sea level. */
+ float speed; /**< Speed in meters per second. */
+ float bearing; /**< Bearing in degrees; range: 0 to 360. */
+ float accuracy; /**< Accuracy in meters. */
+ float verticalAccuracy; /**< Vertical accuracy in meters. */
+ float speedAccuracy; /**< Speed accuracy in meters/second. */
+ float bearingAccuracy; /**< Bearing accuracy in degrees (0 to 359.999). */
+ } qapi_Location_t;
+
+ /** Structure for GNSS data information. */
+ typedef struct {
+ size_t size; /**< Size. Set to the size of #qapi_Gnss_Data_t. */
+ uint32_t jammerInd[QAPI_MAX_NUMBER_OF_CONSTELLATIONS]; /**< Jammer indication. */
+ } qapi_Gnss_Data_t;
+
+ /** Structure for location options. */
+ typedef struct {
+ size_t size; /**< Size. Set to the size of #qapi_Location_Options_t. */
+ uint32_t minInterval; /**< There are three different interpretations of this field,
+ depending if minDistance is 0 or not:
+ 1. Time-based tracking (minDistance = 0). minInterval is the minimum
+ time interval in milliseconds that must elapse between final position
+ reports.
+ 2. Distance-based tracking (minDistance > 0). minInterval is the
+ maximum time period in milliseconds after the minimum distance
+ criteria has been met within which a location update must be provided.
+ If set to 0, an ideal value will be assumed by the engine.
+ 3. Batching. minInterval is the minimum time interval in milliseconds
+ that must elapse between position reports. */
+ uint32_t minDistance; /**< Minimum distance in meters that must be traversed between
+ position reports. Setting this interval to 0 will be a pure
+ time-based tracking/batching. */
+ } qapi_Location_Options_t;
+
+ /** Structure for Geofence options. */
+ typedef struct {
+ /**< Size. Set to the size of #qapi_Geofence_Option_t. */
+ size_t size;
+ /**< Bitwise OR of #qapi_Geofence_Breach_Mask_Bits_t bits. */
+ qapi_Geofence_Breach_Mask_t breachTypeMask;
+ /**< Specifies in milliseconds the user-defined rate of detection for a Geofence
+ breach. This may impact the time lag between the actual breach event and
+ when it is reported. The gap between the actual breach and the time it
+ is reported depends on the user setting. The power implication is
+ inversely proportional to the responsiveness value set by the user.
+ The higher the responsiveness value, the lower the power implications,
+ and vice-versa. */
+ uint32_t responsiveness;
+ /**< Dwell time is the time in milliseconds a user spends in the Geofence before
+ a dwell event is sent. */
+ uint32_t dwellTime;
+ } qapi_Geofence_Option_t;
+
+ /** Structure for Geofence information. */
+ typedef struct {
+ size_t size; /**< Size. Set to the size of #qapi_Geofence_Info_t. */
+ double latitude; /**< Latitude of the center of the Geofence in degrees. */
+ double longitude; /**< Longitude of the center of the Geofence in degrees. */
+ double radius; /**< Radius of the Geofence in meters. */
+ } qapi_Geofence_Info_t;
+
+ /** Structure for Geofence breach notification. */
+ typedef struct {
+ size_t size; /**< Size. Set to the size of
+ #qapi_Geofence_Breach_Notification_t. */
+ size_t count; /**< Number of IDs in the array. */
+ uint32_t* ids; /**< Array of IDs that have been breached. */
+ qapi_Location_t location; /**< Location associated with a breach. */
+ qapi_Geofence_Breach_t type; /**< Type of breach. */
+ uint64_t timestamp; /**< Timestamp of the breach. */
+ } qapi_Geofence_Breach_Notification_t;
+
+ /* GNSS Location Callbacks */
+
+ /**
+ * @brief Provides the capabilities of the system.
+ It is called once after qapi_Loc_Init() is called.
+
+ @param[in] capabilitiesMask Bitwise OR of #qapi_Location_Capabilities_Mask_Bits_t.
+
+ @return None.
+ */
+ typedef void(*qapi_Capabilities_Callback)(
+ qapi_Location_Capabilities_Mask_t capabilitiesMask
+ );
+
+ /**
+ * @brief Response callback, which is used by all tracking, batching
+ and Single Shot APIs.
+ It is called for every tracking, batching and single shot API.
+
+ @param[in] err #qapi_Location_Error_t associated with the request.
+ If this is not QAPI_LOCATION_ERROR_SUCCESS then id is not valid.
+ @param[in] id ID to be associated with the request.
+
+ @return None.
+ */
+ typedef void(*qapi_Response_Callback)(
+ qapi_Location_Error_t err,
+ uint32_t id
+ );
+
+ /**
+ * @brief Collective response callback is used by Geofence APIs.
+ It is called for every Geofence API call.
+
+ @param[in] count Number of locations in arrays.
+ @param[in] err Array of #qapi_Location_Error_t associated with the request.
+ @param[in] ids Array of IDs to be associated with the request.
+
+ @return None.
+ */
+ typedef void(*qapi_Collective_Response_Callback)(
+ size_t count,
+ qapi_Location_Error_t* err,
+ uint32_t* ids
+ );
+
+ /**
+ * @brief Tracking callback used for the qapi_Loc_Start_Tracking() API.
+ This is an optional function and can be NULL.
+ It is called when delivering a location in a tracking session.
+
+ @param[in] location Structure containing information related to the
+ tracked location.
+
+ @return None.
+ */
+ typedef void(*qapi_Tracking_Callback)(
+ qapi_Location_t location
+ );
+
+ /**
+ * @brief Batching callback used for the qapi_Loc_Start_Batching() API.
+ This is an optional function and can be NULL.
+ It is called when delivering a location in a batching session.
+
+ @param[in] count Number of locations in an array.
+ @param[in] location Array of location structures containing information
+ related to the batched locations.
+
+ @return None.
+ */
+ typedef void(*qapi_Batching_Callback)(
+ size_t count,
+ qapi_Location_t* location
+ );
+
+ /**
+ * @brief Geofence breach callback used for the qapi_Loc_Add_Geofences() API.
+ This is an optional function and can be NULL.
+ It is called when any number of geofences have a state change.
+
+ @param[in] geofenceBreachNotification Breach notification information.
+
+ @return None.
+ */
+ typedef void(*qapi_Geofence_Breach_Callback)(
+ qapi_Geofence_Breach_Notification_t geofenceBreachNotification
+ );
+
+ /**
+ * @brief Single shot callback used for the qapi_Loc_Get_Single_Shot() API.
+ This is an optional function and can be NULL.
+ It is called when delivering a location in a single shot session
+ broadcasted to all clients, no matter if a session has started by client.
+
+ @param[in] location Structure containing information related to the
+ tracked location.
+ @param[in] err #qapi_Location_Error_t associated with the request.
+ This could be QAPI_LOCATION_ERROR_SUCCESS (location
+ is valid) or QAPI_LOCATION_ERROR_TIMEOUT (a timeout
+ occurred, location is not valid).
+
+ @return None.
+ */
+ typedef void(*qapi_Single_Shot_Callback)(
+ qapi_Location_t location,
+ qapi_Location_Error_t err
+ );
+
+ /**
+ * @brief GNSS data callback used for the qapi_Loc_Start_Get_Gnss_Data() API.
+ This is an optional function and can be NULL.
+ It is called when delivering a GNSS Data structure. The GNSS data
+ structure contains useful information (e.g., jammer indication).
+ This callback will be called every second.
+
+ @param[in] gnssData Structure containing information related to the
+ requested GNSS Data.
+
+ @return None.
+ */
+ typedef void(*qapi_Gnss_Data_Callback)(
+ qapi_Gnss_Data_t gnssData
+ );
+
+ /** Location callbacks requirements. */
+ typedef struct {
+ size_t size;
+ /**< Size. Set to the size of qapi_Location_Callbacks_t. */
+ qapi_Capabilities_Callback capabilitiesCb;
+ /**< Capabilities callback is mandatory. */
+ qapi_Response_Callback responseCb;
+ /**< Response callback is mandatory. */
+ qapi_Collective_Response_Callback collectiveResponseCb;
+ /**< Collective response callback is mandatory. */
+ qapi_Tracking_Callback trackingCb;
+ /**< Tracking callback is optional. */
+ qapi_Batching_Callback batchingCb;
+ /**< Batching callback is optional. */
+ qapi_Geofence_Breach_Callback geofenceBreachCb;
+ /**< Geofence breach callback is optional. */
+ qapi_Single_Shot_Callback singleShotCb;
+ /**< Single shot callback is optional. */
+ qapi_Gnss_Data_Callback gnssDataCb;
+ /**< GNSS data callback is optional. @newpagetable */
+ } qapi_Location_Callbacks_t;
+
+ /** Location client identifier. */
+ typedef uint32_t qapi_loc_client_id;
+
+ /**
+ * @brief Initializes a location session and registers the callbacks.
+
+ @param[out] pClientId Pointer to client ID type, where the unique identifier
+ for this location client is returned.
+ @param[in] pCallbacks Pointer to the structure with the callback
+ functions to be registered.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING -- One of the mandatory
+ callback functions is missing. \n
+ QAPI_LOCATION_ERROR_GENERAL_FAILURE -- There is an internal error. \n
+ QAPI_LOCATION_ERROR_ALREADY_STARTED -- A location session has
+ already been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Init(
+ qapi_loc_client_id* pClientId,
+ const qapi_Location_Callbacks_t* pCallbacks);
+
+ /**
+ * @brief De-initializes a location session.
+
+ @param[in] clientId Client identifier for the location client to be
+ deinitialized.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Deinit(
+ qapi_loc_client_id clientId);
+
+ /**
+ * @brief Sets the user buffer to be used for sending back callback data.
+
+ @param[in] clientId Client ID for which user buffer is to be set
+ @param[in] pUserBuffer User memory buffer to hold information passed
+ in callbacks. Note that since buffer is shared by all
+ the callbacks this has to be consumed at the user side
+ before it can be used by another callback to avoid any
+ potential race condition.
+ @param[in] bufferSize Size of user memory buffer to hold information passed
+ in callbacks. This size should be large enough to
+ accomodate the largest data size passed in a callback.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_GENERAL_FAILURE -- There is an internal error. \n
+ */
+ qapi_Location_Error_t qapi_Loc_Set_User_Buffer(
+ qapi_loc_client_id clientId,
+ uint8_t* pUserBuffer,
+ size_t bufferSize);
+
+ /**
+ * @brief Starts a tracking session, which returns a
+ session ID that will be used by the other tracking APIs and in
+ the response callback to match the command with a response. Locations are
+ reported on the tracking callback passed in qapi_Loc_Init() periodically
+ according to the location options.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successfully started.
+ QAPI_LOCATION_ERROR_ALREADY_STARTED if a qapi_Loc_Start_Tracking session is already in progress.
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING if no trackingCb was passed in qapi_Loc_Init().
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] pOptions Pointer to a structure containing the options:
+ - minInterval -- There are two different interpretations of this field,
+ depending if minDistance is 0 or not:
+ 1. Time-based tracking (minDistance = 0). minInterval is the minimum
+ time interval in milliseconds that must elapse between final position reports.
+ 2. Distance-based tracking (minDistance > 0). minInterval is the
+ maximum time period in milliseconds after the minimum distance
+ criteria has been met within which a location update must be provided.
+ If set to 0, an ideal value will be assumed by the engine.
+ - minDistance -- Minimum distance in meters that must be traversed between position
+ reports. Setting this interval to 0 will be a pure time-based tracking.
+ @param[out] pSessionId Pointer to the session ID to be returned.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Start_Tracking(
+ qapi_loc_client_id clientId,
+ const qapi_Location_Options_t* pOptions,
+ uint32_t* pSessionId);
+
+ /**
+ * @brief Stops a tracking session associated with the id
+ parameter
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if successful.
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a tracking session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] sessionId ID of the session to be stopped.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Stop_Tracking(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId);
+
+ /**
+ * @brief Changes the location options of a
+ tracking session associated with the id parameter.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if successful.
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a tracking session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] sessionId ID of the session to be changed.
+ @param[in] pOptions Pointer to a structure containing the options:
+ - minInterval -- There are two different interpretations of this field,
+ depending if minDistance is 0 or not:
+ 1. Time-based tracking (minDistance = 0). minInterval is the minimum
+ time interval in milliseconds that must elapse between final position reports.
+ 2. Distance-based tracking (minDistance > 0). minInterval is the
+ maximum time period in milliseconds after the minimum distance
+ criteria has been met within which a location update must be provided.
+ If set to 0, an ideal value will be assumed by the engine.
+ - minDistance -- Minimum distance in meters that must be traversed between position
+ reports. Setting this interval to 0 will be a pure time-based tracking.@tablebulletend
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Update_Tracking_Options(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId,
+ const qapi_Location_Options_t* pOptions);
+
+ /**
+ * @brief Starts a batching session, which returns a
+ session ID that will be used by the other batching APIs and in
+ the response callback to match the command with a response.
+
+ Locations are
+ reported on the batching callback passed in qapi_Loc_Init() periodically
+ according to the location options. A batching session starts tracking on
+ the low power processor and delivers them in batches by the
+ batching callback when the batch is full or when qapi_Loc_Get_Batched_Locations()
+ is called. This allows for the processor that calls this API to sleep
+ when the low power processor can batch locations in the background and
+ wake up the processor calling the API only when the batch is full,
+ thus saving power.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successfully started.
+ QAPI_LOCATION_ERROR_ALREADY_STARTED if a qapi_Loc_Start_Batching session is already in progress.
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING if no batchingCb was passed in qapi_Loc_Init().
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
+ QAPI_LOCATION_ERROR_NOT_SUPPORTED if batching is not supported.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] pOptions Pointer to a structure containing the options:
+ - minInterval -- minInterval is the minimum time interval in milliseconds that
+ must elapse between position reports.
+ - minDistance -- Minimum distance in meters that must be traversed between
+ position reports.@tablebulletend
+ @param[out] pSessionId Pointer to the session ID to be returned.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Start_Batching(
+ qapi_loc_client_id clientId,
+ const qapi_Location_Options_t* pOptions,
+ uint32_t* pSessionId);
+
+ /**
+ * @brief Stops a batching session associated with the id
+ parameter.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if successful.
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a batching session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] sessionId ID of the session to be stopped.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Stop_Batching(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId);
+
+ /**
+ * @brief Changes the location options of a
+ batching session associated with the id parameter.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if successful.
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if pOptions parameter is invalid.
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a batching session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] sessionId ID of the session to be changed.
+ @param[in] pOptions Pointer to a structure containing the options:
+ - minInterval -- minInterval is the minimum time interval in milliseconds that
+ must elapse between position reports.
+ - minDistance -- Minimum distance in meters that must be traversed between
+ position reports.@tablebulletend
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Update_Batching_Options(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId,
+ const qapi_Location_Options_t* pOptions);
+
+ /**
+ * @brief Gets a number of locations that are
+ currently stored or batched on the low power processor, delivered by
+ the batching callback passed to qapi_Loc_Init(). Locations are then
+ deleted from the batch stored on the low power processor.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if successful, will be followed by batchingCallback call.
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING if no batchingCb was passed in qapi_Loc_Init().
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a batching session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] sessionId ID of the session for which the number of locations is requested.
+ @param[in] count Number of requested locations. The client can set this to
+ MAXINT to get all the batched locations. If set to 0 no location
+ will be present in the callback function.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Get_Batched_Locations(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId,
+ size_t count);
+
+ /**
+ * @brief Adds a specified number of Geofences and returns an
+ array of Geofence IDs that will be used by the other Geofence APIs,
+ as well as in the collective response callback to match the command with
+ a response. The Geofence breach callback delivers the status of each
+ Geofence according to the Geofence options for each.
+ collectiveResponseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successful
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING if no geofenceBreachCb
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ QAPI_LOCATION_ERROR_NOT_SUPPORTED if geofence is not supported
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] count Number of Geofences to be added.
+ @param[in] pOptions Array of structures containing the options:
+ - breachTypeMask -- Bitwise OR of GeofenceBreachTypeMask bits
+ - responsiveness in milliseconds
+ - dwellTime in seconds @vertspace{-14}
+ @param[in] pInfo Array of structures containing the data:
+ - Latitude of the center of the Geofence in degrees
+ - Longitude of the center of the Geofence in degrees
+ - Radius of the Geofence in meters @vertspace{-14}
+ @param[out] pIdArray Array of IDs of Geofences to be returned.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Add_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const qapi_Geofence_Option_t* pOptions,
+ const qapi_Geofence_Info_t* pInfo,
+ uint32_t** pIdArray);
+
+ /**
+ * @brief Removes a specified number of Geofences.
+ collectiveResponseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successful
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] count Number of Geofences to be removed.
+ @param[in] pIDs Array of IDs of the Geofences to be removed.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Remove_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs);
+
+ /**
+ * @brief Modifies a specified number of Geofences.
+ collectiveResponseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successful
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] count Number of Geofences to be modified.
+ @param[in] pIDs Array of IDs of the Geofences to be modified.
+ @param[in] options Array of structures containing the options:
+ - breachTypeMask -- Bitwise OR of GeofenceBreachTypeMask bits
+ - responsiveness in milliseconds
+ - dwellTime in seconds @tablebulletend
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Modify_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs,
+ const qapi_Geofence_Option_t* options);
+
+ /**
+ * @brief Pauses a specified number of Geofences, which is
+ similar to qapi_Loc_Remove_Geofences() except that they can be resumed
+ at any time.
+ collectiveResponseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successful
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] count Number of Geofences to be paused.
+ @param[in] pIDs Array of IDs of the Geofences to be paused.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Pause_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs);
+
+ /**
+ * @brief Resumes a specified number of Geofences that are
+ paused.
+ collectiveResponseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successful
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a geofence session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] count Number of Geofences to be resumed.
+ @param[in] pIDs Array of IDs of the Geofences to be resumed.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Resume_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs);
+
+ /**
+ * @brief Attempts a single location fix. It returns a session ID that
+ will be used by qapi_Loc_Cancel_Single_Shot API and in
+ the response callback to match the command with a response.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if session was successfully started.
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING if no singleShotCb passed in qapi_Loc_Init().
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if anyparameter is invalid.
+ If responseCb reports LOCATION_ERROR_SUCESS, then the following is what
+ can happen to end the single shot session:
+ 1) A location will be reported on the singleShotCb.
+ 2) QAPI_LOCATION_ERROR_TIMEOUT will be reported on the singleShotCb.
+ 3) The single shot session is canceled using the qapi_Loc_Cancel_Single_Shot API
+ In either of these cases, the session is considered complete and the session id will
+ no longer be valid.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] powerLevel Indicates what available technologies to use to compute the location.
+ @param[out] pSessionId Pointer to the session ID to be returned.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Get_Single_Shot(
+ qapi_loc_client_id clientId,
+ qapi_Location_Power_Level_t powerLevel,
+ uint32_t* pSessionId);
+
+ /**
+ * @brief Cancels a single shot session.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_SUCCESS if successful.
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a single shot session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] sessionId ID of the single shot session to be cancelled.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Cancel_Single_Shot(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId);
+
+ /**
+ * @brief Starts a Get GNSS data session, which returns a
+ session ID that will be used by the qapi_Loc_Stop_Get_Gnss_Data() API and in
+ the response callback to match the command with a response. GNSS data is
+ reported on the GNSS data callback passed in qapi_Loc_Init() periodically
+ (every second until qapi_Loc_Stop_Get_Gnss_Data() is called).
+
+ responseCb returns: \n
+ QAPI_LOCATION_ERROR_SUCCESS if session was successfully started. \n
+ QAPI_LOCATION_ERROR_ALREADY_STARTED if a qapi_Loc_Start_Get_Gnss_Data() session is already
+ in progress. \n
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING if no gnssDataCb was passed in qapi_Loc_Init().
+
+ @param[in] clientId Client identifier for the location client.
+ @param[out] pSessionId Pointer to the session ID to be returned.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Start_Get_Gnss_Data(
+ qapi_loc_client_id clientId,
+ uint32_t* pSessionId);
+
+ /**
+ * @brief Stops a Get GNSS data session associated with the ID
+ parameter.
+
+ responseCb returns: \n
+ QAPI_LOCATION_ERROR_SUCCESS if successful. \n
+ QAPI_LOCATION_ERROR_ID_UNKNOWN if clientId is not associated with a Get GNSS data session.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[in] sessionId ID of the session to be stopped.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No location session has
+ been initialized.
+ */
+ qapi_Location_Error_t qapi_Loc_Stop_Get_Gnss_Data(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId);
+
+ /**
+ * @versiontable{2.0,2.45,
+ * Location 1.2.0 & Introduced. @tblendline
+ * }
+ *
+ * Fetches the best available position with the GNSS Engine.
+ It returns a session ID that will be sent in response callback
+ to match the command with a response.
+ responseCb returns:
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING if no singleShotCb passed in qapi_Loc_Init().
+ QAPI_LOCATION_ERROR_INVALID_PARAMETER if any parameter is invalid.
+ QAPI_LOCATION_ERROR_SUCCESS if request was successfully placed to GNSS Engine.
+ If responseCb reports LOCATION_ERROR_SUCESS, then the following is what
+ can happen:
+ 1) A location will be reported on the singleShotCb.
+ The location object would have QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT
+ set in the flags field to indicate that this position is the best
+ available position and not a response to the singleshot request.
+ This location can have a large accuracy value, which must be
+ checked by the client if it suffices it's purpose.
+
+ @param[in] clientId Client identifier for the location client.
+ @param[out] pSessionId Pointer to the session ID to be returned.
+
+ @return
+ QAPI_LOCATION_ERROR_SUCCESS -- The operation was successful. \n
+ QAPI_LOCATION_ERROR_ID_UNKNOWN -- Invalid client id provided. \n
+ QAPI_LOCATION_ERROR_NOT_INITIALIZED -- No user space buffer is set. \n
+ QAPI_LOCATION_ERROR_CALLBACK_MISSING -- Singleshot callback is not set. \n
+ QAPI_LOCATION_ERROR_GENERAL_FAILURE -- Internal failure while processing
+ the request.
+ */
+ qapi_Location_Error_t qapi_Loc_Get_Best_Available_Position(
+ qapi_loc_client_id clientId,
+ uint32_t* pSessionId);
+
+ /** @} */ /* end_addtogroup qapi_location */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* QAPI_LOCATION_H_ */
diff --git a/location/qapi/location-qapi.pc.in b/location/qapi/location-qapi.pc.in
new file mode 100644
index 0000000..48b11f7
--- /dev/null
+++ b/location/qapi/location-qapi.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: location-qapi
+Description: location qapi library
+Version: @VERSION@
+Libs: -L${libdir} -llocation_qapi
+Cflags: -I${includedir} -I${includedir}/location-qapi
\ No newline at end of file
diff --git a/location/qapi/src/qapi_location.cpp b/location/qapi/src/qapi_location.cpp
new file mode 100644
index 0000000..d544d99
--- /dev/null
+++ b/location/qapi/src/qapi_location.cpp
@@ -0,0 +1,727 @@
+/* Copyright (c) 2019-2020 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.
+ */
+
+#define LOG_TAG "LocSvc_LocationQapi"
+
+#include <loc_pla.h>
+#include "log_util.h"
+#include "loc_cfg.h"
+#include "LocationClientApi.h"
+#include "qapi_location.h"
+#include <pthread.h>
+#include <vector>
+#include <string.h>
+#include <LocTimer.h>
+
+using namespace std;
+using namespace location_client;
+using Runnable = std::function<void()>;
+
+class QapiTimer : public LocTimer {
+public:
+ QapiTimer() : LocTimer(), mStarted(false) {}
+ inline ~QapiTimer() { stop(); }
+ inline void set(const time_t waitTimeMs, const Runnable& runable) {
+ mWaitTimeInMs = waitTimeMs;
+ mRunnable = runable;
+ }
+ inline void start() {
+ mStarted = true;
+ LocTimer::start(mWaitTimeInMs, false);
+ }
+ inline void start(const time_t waitTimeSec) {
+ mWaitTimeInMs = waitTimeSec * 1000;
+ start();
+ }
+ inline void stop() {
+ if (mStarted) {
+ LocTimer::stop();
+ mStarted = false;
+ }
+ }
+ inline void restart() { stop(); start(); }
+ inline void restart(const time_t waitTimeSec) { stop(); start(waitTimeSec); }
+ inline bool isStarted() { return mStarted; }
+
+private:
+ // Override
+ inline virtual void timeOutCallback() override {
+ mStarted = false;
+ mRunnable();
+ }
+
+private:
+ time_t mWaitTimeInMs;
+ Runnable mRunnable;
+ bool mStarted;
+
+};
+
+static pthread_mutex_t qMutex;
+static bool qMutexInitDone = false;
+static LocationClientApi* pLocClientApi = nullptr;
+static LocationClientApi* pLocPassiveClientApi = nullptr;
+static QapiTimer mTimer;
+qapi_Location_Callbacks_t qLocationCallbacks;
+static qapi_Location_t qCacheLocation;
+static QapiTimer mPassiveTimer;
+
+static qapi_Location_Error_t get_qapi_error(LocationResponse err)
+{
+ switch (err)
+ {
+ case LOCATION_RESPONSE_SUCCESS: return QAPI_LOCATION_ERROR_SUCCESS;
+ case LOCATION_RESPONSE_UNKOWN_FAILURE: return QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ case LOCATION_RESPONSE_NOT_SUPPORTED: return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ default: return QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ }
+}
+
+static int32_t copy_to_user_space_buffer(
+ uint8_t* user_space_buffer,
+ uint32_t user_space_buffer_size,
+ uint8_t* data_ptr,
+ uint32_t data_size,
+ uint32_t offset) {
+
+ if (offset >= user_space_buffer_size) {
+ LOC_LOGe("Invalid offset %d, buffer size %d",
+ offset, user_space_buffer_size);
+ return -1;
+ }
+
+ memcpy((user_space_buffer + offset), data_ptr, data_size);
+
+ return 0;
+}
+
+static void print_qLocation_array(qapi_Location_t* qLocationArray, uint32_t length) {
+
+ for (uint32_t i = 0; i < length; i++) {
+ LOC_LOGv("LAT: %d.%d LON: %d.%d ALT: %d.%d ALT_MSL: %d.%d",
+ (int)qLocationArray[i].latitude,
+ (abs((int)(qLocationArray[i].latitude * 100000))) % 100000,
+ (int)qLocationArray[i].longitude,
+ (abs((int)(qLocationArray[i].longitude * 100000))) % 100000,
+ (int)qLocationArray[i].altitude,
+ (abs((int)(qLocationArray[i].altitude * 100))) % 100,
+ (int)qLocationArray[i].altitudeMeanSeaLevel,
+ (abs((int)(qLocationArray[i].altitudeMeanSeaLevel * 100))) % 100);
+
+ LOC_LOGv("SPEED: %d.%d BEAR: %d.%d TIME: 0x%x%x FLAGS: %u",
+ (int)qLocationArray[i].speed,
+ (abs((int)(qLocationArray[i].speed * 100))) % 100,
+ (int)qLocationArray[i].bearing,
+ (abs((int)(qLocationArray[i].bearing * 100))) % 100,
+ (int)(qLocationArray[i].timestamp >> 32),
+ (int)qLocationArray[i].timestamp, qLocationArray[i].flags);
+
+ LOC_LOGv("ACC: %d.%d VERT_ACC: %d.%d SPEED_ACC: %d.%d BEAR_ACC: %d.%d",
+ (int)qLocationArray[i].accuracy,
+ (abs((int)(qLocationArray[i].accuracy * 100))) % 100,
+ (int)qLocationArray[i].verticalAccuracy,
+ (abs((int)(qLocationArray[i].verticalAccuracy * 100))) % 100,
+ (int)qLocationArray[i].speedAccuracy,
+ (abs((int)(qLocationArray[i].speedAccuracy * 100))) % 100,
+ (int)qLocationArray[i].bearingAccuracy,
+ (abs((int)(qLocationArray[i].bearingAccuracy * 100))) % 100);
+ }
+}
+
+static void print_qGnssData(qapi_Gnss_Data_t* qGnssData) {
+
+ LOC_LOGv("JAMMER_GPS: %u JAMMER_GLONASS: %u",
+ qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_GPS],
+ qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_GLONASS]);
+
+ LOC_LOGv("JAMMER_BEIDOU: %u JAMMER_GALILEO: %u",
+ qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_BEIDOU],
+ qGnssData->jammerInd[QAPI_GNSS_SV_TYPE_GALILEO]);
+}
+
+static void location_capabilities_callback(
+ LocationCapabilitiesMask capsMask)
+{
+ LOC_LOGv("location_capabilities_callback!");
+
+ qLocationCallbacks.capabilitiesCb(
+ (qapi_Location_Capabilities_Mask_t)capsMask);
+}
+
+static void location_response_callback(
+ LocationResponse err)
+{
+ qapi_Location_Error_t qErr;
+
+ qErr = get_qapi_error(err);
+ LOC_LOGv("location_response_callback!");
+
+ // hard-code id to 0 for now
+ uint32_t id = 0;
+ qLocationCallbacks.responseCb(qErr, id);
+}
+
+static void location_collective_response_callback(
+ vector<std::pair<Geofence, LocationResponse>>& responses)
+{
+ qapi_Location_Error_t* qLocationErrorArray = NULL;
+
+ // hard-coded
+ qLocationErrorArray = new qapi_Location_Error_t[5];
+ uint32_t* ids = new uint32_t[5];
+
+ for (int i = 0; i < 5; i++) {
+ qLocationErrorArray[i] = QAPI_LOCATION_ERROR_SUCCESS;
+ }
+
+ LOC_LOGd("Invoking Collective Response Cb");
+ qLocationCallbacks.collectiveResponseCb(
+ 5, qLocationErrorArray, ids);
+
+ delete[] qLocationErrorArray;
+ delete[] ids;
+}
+
+static void location_tracking_callback(
+ Location location)
+{
+ qapi_Location_t qLocation = {};
+ bool bIsSingleShot = false;
+
+ // first check if location is valid
+ if (0 == location.flags) {
+ LOC_LOGd("Ignore invalid location");
+ return;
+ }
+
+ if (mTimer.isStarted()) {
+ LOC_LOGd("Timer was started, meaning this is singleshot");
+ if (nullptr != pLocClientApi) {
+ LOC_LOGd("Stop singleshot session");
+ pLocClientApi->stopPositionSession();
+ }
+ LOC_LOGd("Stop singleshot timer");
+ mTimer.stop();
+ bIsSingleShot = true;
+ }
+ qLocation.size = sizeof(qapi_Location_t);
+ qLocation.timestamp = location.timestamp;
+ qLocation.latitude = location.latitude;
+ qLocation.longitude = location.longitude;
+ qLocation.altitude = location.altitude;
+// TODO
+// qLocation.altitudeMeanSeaLevel = location.altitudeMeanSeaLevel;
+ qLocation.flags &= ~QAPI_LOCATION_HAS_ALTITUDE_MSL_BIT;
+ qLocation.speed = location.speed;
+ qLocation.bearing = location.bearing;
+ qLocation.accuracy = location.horizontalAccuracy;
+ qLocation.flags = location.flags;
+ qLocation.verticalAccuracy = location.verticalAccuracy;
+ qLocation.speedAccuracy = location.speedAccuracy;
+ qLocation.bearingAccuracy = location.bearingAccuracy;
+
+ print_qLocation_array(&qLocation, 1);
+ if (bIsSingleShot) {
+ LOC_LOGd("Invoking Singleshot Callback");
+ if (qLocationCallbacks.singleShotCb) {
+ qLocationCallbacks.singleShotCb(qLocation, QAPI_LOCATION_ERROR_SUCCESS);
+ } else {
+ LOC_LOGe("No singleshot cb registered");
+ }
+ } else {
+ LOC_LOGd("Invoking Tracking Callback");
+ if (qLocationCallbacks.trackingCb) {
+ qLocationCallbacks.trackingCb(qLocation);
+ }
+ else {
+ LOC_LOGe("No tracking cb registered");
+ }
+ }
+}
+
+static void loc_passive_capabilities_callback(
+ LocationCapabilitiesMask capsMask)
+{
+ LOC_LOGv("loc_passive_capabilities_callback!");
+}
+
+static void loc_passive_tracking_callback(
+ Location location)
+{
+ qCacheLocation.size = sizeof(qapi_Location_t);
+ qCacheLocation.timestamp = location.timestamp;
+ qCacheLocation.latitude = location.latitude;
+ qCacheLocation.longitude = location.longitude;
+ qCacheLocation.altitude = location.altitude;
+ // TODO
+ // qCacheLocation.altitudeMeanSeaLevel = location.altitudeMeanSeaLevel;
+ qCacheLocation.flags &= ~QAPI_LOCATION_HAS_ALTITUDE_MSL_BIT;
+
+ qCacheLocation.speed = location.speed;
+ qCacheLocation.bearing = location.bearing;
+ qCacheLocation.accuracy = location.horizontalAccuracy;
+ qCacheLocation.flags = location.flags;
+ qCacheLocation.flags |= QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT;
+ qCacheLocation.verticalAccuracy = location.verticalAccuracy;
+ qCacheLocation.speedAccuracy = location.speedAccuracy;
+ qCacheLocation.bearingAccuracy = location.bearingAccuracy;
+
+ print_qLocation_array(&qCacheLocation, 1);
+}
+
+static void loc_passive_response_callback(
+ LocationResponse err)
+{
+ LOC_LOGv("loc_passive_response_callback!");
+}
+
+struct ClientCallbacks {
+ CapabilitiesCb capabilitycb;
+ ResponseCb responsecb;
+ CollectiveResponseCb collectivecb;
+ LocationCb locationcb;
+};
+
+static ClientCallbacks gLocationCallbacks = {
+ location_capabilities_callback,
+ location_response_callback,
+ location_collective_response_callback,
+ location_tracking_callback
+};
+
+#define LOC_PATH_QAPI_CONF_STR "/etc/qapi.conf"
+
+const char LOC_PATH_QAPI_CONF[] = LOC_PATH_QAPI_CONF_STR;
+static uint32_t gDebug = 0;
+static uint32_t gSingleshotTimeout = 0;
+
+static const loc_param_s_type gConfigTable[] =
+{
+ { "DEBUG_LEVEL", &gDebug, NULL, 'n' }
+};
+
+static const loc_param_s_type gQapiConfigTable[] =
+{
+ { "SINGLESHOT_TIMEOUT", &gSingleshotTimeout, NULL, 'n' }
+};
+
+/* Parameters we need in a configuration file specifically for QAPI:
+ SINGLESHOT_TIMEOUT
+ */
+
+extern "C" {
+ qapi_Location_Error_t qapi_Loc_Init(
+ qapi_loc_client_id* pClientId,
+ const qapi_Location_Callbacks_t* pCallbacks)
+ {
+ qapi_Location_Error_t retVal =
+ QAPI_LOCATION_ERROR_SUCCESS;
+
+ // read configuration file
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, gConfigTable);
+ LOC_LOGd("gDebug=%u LOC_PATH_GPS_CONF=%s", gDebug, LOC_PATH_GPS_CONF);
+
+ UTIL_READ_CONF(LOC_PATH_QAPI_CONF, gQapiConfigTable);
+ LOC_LOGd("gSingleshotTimeout=%u LOC_PATH_QAPI_CONF=%s",
+ gSingleshotTimeout, LOC_PATH_QAPI_CONF);
+
+ ClientCallbacks locationCallbacks = gLocationCallbacks;
+
+ LOC_LOGd("qapi_Loc_Init! pCallbacks %p"
+ "cap %p res %p col %p trk %p",
+ pCallbacks,
+ pCallbacks->capabilitiesCb,
+ pCallbacks->responseCb,
+ pCallbacks->collectiveResponseCb,
+ pCallbacks->trackingCb);
+
+ LOC_LOGd("qapi_Loc_Init! pCallbacks %p"
+ "bat %p gf %p ss %p gd %p",
+ pCallbacks,
+ pCallbacks->batchingCb,
+ pCallbacks->geofenceBreachCb,
+ pCallbacks->singleShotCb,
+ pCallbacks->gnssDataCb);
+
+ if (!qMutexInitDone)
+ {
+ pthread_mutex_init(&qMutex, NULL);
+ qMutexInitDone = true;
+ }
+
+ /* Input sanity */
+ if (NULL == pCallbacks->capabilitiesCb ||
+ NULL == pCallbacks->responseCb ||
+ NULL == pCallbacks->collectiveResponseCb)
+ {
+ return QAPI_LOCATION_ERROR_CALLBACK_MISSING;
+ }
+ /* Don't register callbacks not provided by client */
+ if (NULL == pCallbacks->trackingCb) {
+ locationCallbacks.locationcb = NULL;
+ }
+ pthread_mutex_lock(&qMutex);
+
+ do
+ {
+ qLocationCallbacks = *pCallbacks;
+ if (nullptr == pLocClientApi) {
+ pLocClientApi = new LocationClientApi(
+ location_capabilities_callback);
+ retVal = QAPI_LOCATION_ERROR_SUCCESS;
+ } else {
+ retVal = QAPI_LOCATION_ERROR_ALREADY_STARTED;
+ }
+ /* Start passive listener here in order to be able to satisfy
+ qapi_Loc_Get_Best_Available_Position call */
+
+ if (nullptr == pLocPassiveClientApi) {
+ pLocPassiveClientApi = new LocationClientApi(
+ loc_passive_capabilities_callback);
+ retVal = QAPI_LOCATION_ERROR_SUCCESS;
+ bool ret;
+ memset(&qCacheLocation, 0, sizeof(qCacheLocation));
+ qCacheLocation.flags |= QAPI_LOCATION_IS_BEST_AVAIL_POS_BIT;
+ ret = pLocPassiveClientApi->startPositionSession(
+ 0, // both 0 means passive listener
+ 0, // both 0 means passive listener
+ loc_passive_tracking_callback,
+ loc_passive_response_callback);
+ if (!ret) {
+ retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ } else {
+ retVal = QAPI_LOCATION_ERROR_ALREADY_STARTED;
+ }
+
+ *pClientId = 0;
+ } while (0);
+ pthread_mutex_unlock(&qMutex);
+ return retVal;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Deinit(
+ qapi_loc_client_id clientId)
+ {
+ qapi_Location_Error_t retVal =
+ QAPI_LOCATION_ERROR_ID_UNKNOWN;
+
+ LOC_LOGd("gDebug=%u LOC_PATH_GPS_CONF=%s", gDebug, LOC_PATH_GPS_CONF);
+ LOC_LOGd("qapi_Loc_Deinit client %d", clientId);
+
+ pthread_mutex_lock(&qMutex);
+ if (nullptr != pLocClientApi) {
+ delete pLocClientApi;
+ pLocClientApi = nullptr;
+ retVal = QAPI_LOCATION_ERROR_SUCCESS;
+ }
+ pthread_mutex_unlock(&qMutex);
+ return retVal;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Set_User_Buffer(
+ qapi_loc_client_id clientId,
+ uint8_t* pUserBuffer,
+ size_t bufferSize)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Start_Tracking(
+ qapi_loc_client_id clientId,
+ const qapi_Location_Options_t* pOptions,
+ uint32_t* pSessionId)
+ {
+ qapi_Location_Error_t retVal =
+ QAPI_LOCATION_ERROR_SUCCESS;
+
+ LOC_LOGd("qapi_Loc_Start_Tracking! pOptions=%p pSessionId=%p clientId=%d",
+ pOptions, pSessionId, clientId);
+
+ pthread_mutex_lock(&qMutex);
+ do {
+ if (NULL == pOptions)
+ {
+ LOC_LOGe("pOptions NULL");
+ retVal = QAPI_LOCATION_ERROR_INVALID_PARAMETER;
+ break;
+ }
+
+ LOC_LOGd("qapi_Loc_Start_Tracking! minInterval=%d minDistance=%d",
+ pOptions->minInterval,
+ pOptions->minDistance);
+
+ if (nullptr != pLocClientApi) {
+ bool ret;
+ ret = pLocClientApi->startPositionSession(
+ pOptions->minInterval,
+ pOptions->minDistance,
+ location_tracking_callback,
+ location_response_callback);
+ if (!ret) {
+ retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ } else {
+ retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ } while (0);
+ *pSessionId = 1;
+ pthread_mutex_unlock(&qMutex);
+ return retVal;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Stop_Tracking(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId)
+ {
+ qapi_Location_Error_t retVal =
+ QAPI_LOCATION_ERROR_SUCCESS;
+
+ LOC_LOGv("qapi_Loc_Stop_Tracking! clientId %d, sessionId %d",
+ clientId, sessionId);
+
+ pthread_mutex_lock(&qMutex);
+
+ if (nullptr != pLocClientApi) {
+ pLocClientApi->stopPositionSession();
+ } else {
+ retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ pthread_mutex_unlock(&qMutex);
+ return retVal;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Update_Tracking_Options(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId,
+ const qapi_Location_Options_t* pOptions)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Start_Batching(
+ qapi_loc_client_id clientId,
+ const qapi_Location_Options_t* pOptions,
+ uint32_t* pSessionId)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Stop_Batching(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Update_Batching_Options(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId,
+ const qapi_Location_Options_t* pOptions)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Get_Batched_Locations(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId,
+ size_t count)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Add_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const qapi_Geofence_Option_t* pOptions,
+ const qapi_Geofence_Info_t* pInfo,
+ uint32_t** pIdArray)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Remove_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Modify_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs,
+ const qapi_Geofence_Option_t* options)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Pause_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Resume_Geofences(
+ qapi_loc_client_id clientId,
+ size_t count,
+ const uint32_t* pIDs)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Get_Single_Shot(
+ qapi_loc_client_id clientId,
+ qapi_Location_Power_Level_t powerLevel,
+ uint32_t* pSessionId)
+ {
+ qapi_Location_Error_t retVal =
+ QAPI_LOCATION_ERROR_SUCCESS;
+ bool bFound = false;
+ qapi_Location_Options_t options;
+
+ LOC_LOGd("qapi_Loc_Get_Single_Shot! pSessionId=%p clientId=%d",
+ pSessionId, clientId);
+
+ pthread_mutex_lock(&qMutex);
+ do {
+ if (QAPI_LOCATION_POWER_HIGH != powerLevel &&
+ QAPI_LOCATION_POWER_LOW != powerLevel)
+ {
+ LOC_LOGe("powerLevel is invalid");
+ retVal = QAPI_LOCATION_ERROR_INVALID_PARAMETER;
+ break;
+ }
+
+ LOC_LOGd("qapi_Loc_Get_Single_Shot! powerLevel=%d",
+ powerLevel);
+
+ if (nullptr != pLocClientApi) {
+ bool ret;
+ ret = pLocClientApi->startPositionSession(
+ 1000,
+ 0,
+ location_tracking_callback,
+ location_response_callback);
+ if (!ret) {
+ retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ } else {
+ Runnable timerRunnable = [pLocClientApi] {
+ pLocClientApi->stopPositionSession();
+ if (qLocationCallbacks.singleShotCb) {
+ qapi_Location_t qLocation;
+ qLocationCallbacks.singleShotCb(qLocation, QAPI_LOCATION_ERROR_TIMEOUT);
+ } else {
+ LOC_LOGe("No singleshot cb registered");
+ }
+ };
+ mTimer.set(gSingleshotTimeout, timerRunnable);
+ mTimer.start();
+ }
+ } else {
+ retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ } while (0);
+ *pSessionId = 1;
+ pthread_mutex_unlock(&qMutex);
+ return retVal;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Cancel_Single_Shot(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId)
+ {
+ qapi_Location_Error_t retVal =
+ QAPI_LOCATION_ERROR_SUCCESS;
+
+ LOC_LOGv("qapi_Loc_Cancel_Single_Shot! clientId %d, sessionId %d",
+ clientId, sessionId);
+
+ pthread_mutex_lock(&qMutex);
+ if (mTimer.isStarted()) {
+ LOC_LOGd("Timer was started, singleshot session in progress");
+ if (nullptr != pLocClientApi) {
+ LOC_LOGd("Stop singleshot session");
+ pLocClientApi->stopPositionSession();
+ }
+ LOC_LOGd("Stop singleshot timer");
+ mTimer.stop();
+ } else {
+ LOC_LOGd("No singleshot session in progress!");
+ }
+ pthread_mutex_unlock(&qMutex);
+ return retVal;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Start_Get_Gnss_Data(
+ qapi_loc_client_id clientId,
+ uint32_t* pSessionId)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Stop_Get_Gnss_Data(
+ qapi_loc_client_id clientId,
+ uint32_t sessionId)
+ {
+ return QAPI_LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ qapi_Location_Error_t qapi_Loc_Get_Best_Available_Position(
+ qapi_loc_client_id clientId,
+ uint32_t* pSessionId)
+ {
+ qapi_Location_Error_t retVal = QAPI_LOCATION_ERROR_SUCCESS;
+
+ LOC_LOGv("qapi_Loc_Get_Best_Available_Position! clientId %d", clientId);
+ pthread_mutex_lock(&qMutex);
+ do {
+ if (nullptr != pLocClientApi) {
+ Runnable timerRunnable = [] {
+ if (qLocationCallbacks.singleShotCb) {
+ qLocationCallbacks.singleShotCb(qCacheLocation, QAPI_LOCATION_ERROR_SUCCESS);
+ } else {
+ LOC_LOGe("No singleshot cb registered");
+ }
+ };
+ mPassiveTimer.set(500, timerRunnable);
+ mPassiveTimer.start();
+
+ } else {
+ retVal = QAPI_LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ } while (0);
+
+ pthread_mutex_unlock(&qMutex);
+ return retVal;
+ }
+
+} /* extern "C" */
diff --git a/location/synergy_loc_api/Android.mk b/location/synergy_loc_api/Android.mk
new file mode 100644
index 0000000..3e71818
--- /dev/null
+++ b/location/synergy_loc_api/Android.mk
@@ -0,0 +1,51 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libsynergy_loc_api
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+LOCAL_MODULE_TAGS := optional
+LOCAL_VENDOR_MODULE := true
+
+ifeq ($(TARGET_DEVICE),apq8026_lw)
+LOCAL_CFLAGS += -DPDK_FEATURE_SET
+else ifeq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true)
+LOCAL_CFLAGS += -DPDK_FEATURE_SET
+endif
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libqmi_cci \
+ libqmi_common_so \
+ libloc_core \
+ libgps.utils \
+ libdl \
+ liblog
+
+LOCAL_SRC_FILES = \
+ SynergyLocApi.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+## Includes
+LOCAL_HEADER_LIBRARIES := \
+ libloc_core_headers \
+ libgps.utils_headers \
+ libloc_pla_headers \
+ loc_sll_if_headers \
+ liblocation_api_headers
+
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libsynergyloc_api_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
diff --git a/location/synergy_loc_api/SynergyLocApi.cpp b/location/synergy_loc_api/SynergyLocApi.cpp
new file mode 100644
index 0000000..536013c
--- /dev/null
+++ b/location/synergy_loc_api/SynergyLocApi.cpp
@@ -0,0 +1,2850 @@
+/* Copyright (c) 2019-2020, 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.
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "SynergyLoc_Api"
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sstream>
+#include <math.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <algorithm>
+#include <cutils/sched_policy.h>
+
+#include <synergy_loc_util_log.h>
+#include <gps_extended.h>
+#include "loc_pla.h"
+#include <loc_cfg.h>
+#include <LocContext.h>
+#include <SynergyLocApi.h>
+
+using namespace std;
+using namespace loc_core;
+
+
+#define SL_MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION (64)
+#define SL_NO_FEATURE_SUPPORTED (0)
+#define SLL_CORE_LIB_NAME "libloc_sll_impl.so"
+#define SLL_CORE_SIM_LIB_NAME "libloc_sll_sim.so"
+
+#define SLL_DEFAULT_IMPL() \
+{ \
+ LOC_LOGd("%s: default implementation invoked", __func__); \
+ return LOC_API_ADAPTER_ERR_UNSUPPORTED; \
+}
+
+typedef const SllInterfaceReq* (*get_sll_if_api_t)
+ (const SllInterfaceEvent* eventCallback, void *context);
+
+/**
+ Engine Up Event, this is receive from SLL Hardware.
+ This event indicates Engine is ready to accept command
+ such as start, delete assistance data.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllEngineUp(void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportStatus(LOC_GPS_STATUS_ENGINE_ON);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+
+/**
+ Engine Down Event, this is receive from SLL Hardware.
+ This event indicates Engine is not ready.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllEngineDown(void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportStatus(LOC_GPS_STATUS_ENGINE_OFF);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Position report Event, this is receive from SLL Hardware.
+ This event sends Position report of SSL Hardware.
+
+ @param UlpLocation[Input] Position reprot.
+ @param GpsLocationExtended[Input] Extended Position reprot.
+ @param loc_sess_status[Input] Indicates Position report status
+ as Final or intermediate
+ @param LocPosTechMask[Input] Indiacte Fix type.
+ @param GnssDataNotification[Input] Indicate Jammer and AGC info.
+ @param msInWeek[Input] Indicate time in milliseconds.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportPosition(UlpLocation& location,
+ GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask,
+ GnssDataNotification* pDataNotify,
+ int msInWeek, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportPosition(location, locationExtended,
+ status, loc_technology_mask, pDataNotify, msInWeek);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ SV Report Event, this is receive from SLL Hardware.
+ This event indicates SV Info.
+
+ @param GnssSvNotification[Input] SV Info in track.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportSv(GnssSvNotification& svNotify, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportSv(svNotify);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ SV Measurement Event, this is receive from SLL Hardware.
+ This event indicates SV Measurement.
+
+ @param GnssSvMeasurementSet[Input] SV Measurement
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportSvMeasurement(GnssMeasurements &svMeasurementSet, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportGnssMeasurements(svMeasurementSet, 0);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ SV Polynomial Event, this is receive from SLL Hardware.
+ This event indicates SV Polynomial.
+
+ @param GnssSvPolynomial[Input] SV Polynomial
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void hanldeSllReportSvPolynomial(GnssSvPolynomial &svPolynomial, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportSvPolynomial(svPolynomial);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ SV Ephemeris Event, this is receive from SLL Hardware.
+ This event indicates SV Ephemeris.
+
+ @param GnssSvEphemerisReport[Input] SV Ephemeris
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportSvEphemeris(GnssSvEphemerisReport &svEphemeris, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportSvEphemeris(svEphemeris);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Engine and Session Status Event, this is receive from SLL Hardware.
+ This event indicates Engine and Session Status.
+
+ @param LocGpsStatusValue[Input] SV Ephemeris
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void hanldeSllReportStatus(LocGpsStatusValue status, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportStatus(status);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Report NMEA String, this is receive from SLL Hardware.
+ This event indicates NMEA string which generated by Hardware.
+
+ @param nmea[Input] NMEA Strings
+ @param nmea[Input] NMEA Strings Length
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void hanldeSllReportNmea(const char* nmea, int length, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportNmea(nmea, length);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Report AGC and Jammer Info, this is received from SLL Hardware.
+ This event indicates AGC and Jammer Info which generated by Hardware.
+
+ @param GnssDataNotification[Input] GNSS Data Notification.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportData(GnssDataNotification& dataNotify, int msInWeek,
+ void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportData(dataNotify, msInWeek);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Report XTRA Server Info, this is received from SLL Hardware.
+ This event indicates XTRA Server URL info.
+
+ @param url1[Input] XTRA Server URL.
+ @param url2[Input] XTRA Server URL.
+ @param url3[Input] XTRA Server URL.
+ @param maxlength[Input] Max length of URL.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void hanldeSllReportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportXtraServer(url1, url2, url3, maxlength);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Report Location System Info, this is received from SLL Hardware.
+ This event indicates LEAP second related Info.
+
+ @param LocationSystemInfo[Input] Leap Second related info.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportLocationSystemInfo(const LocationSystemInfo& locationSystemInfo,
+ void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportLocationSystemInfo(locationSystemInfo);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Request for XTRA Server Info, this is received from SLL Hardware.
+ This event is to request to provide XTRA Server URL info.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllRequestXtraData(void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->requestXtraData();
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Request for Time Info, this is received from SLL Hardware.
+ This event is to request to provide Time info.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllRequestTime(void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->requestTime();
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Request for Location Info, this is received from SLL Hardware.
+ This event is to request to provide Location info.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllRequestLocation(void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->requestLocation();
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Request for ATL Info, this is received from SLL Hardware.
+ This event is to request to provide ATL info.
+
+ @param connHandle[Input] Connection Handle of ATL.
+ @param agps_type[Input] AGPS Type such as SUPL/Wifi/SUPL ES
+ @param apn_type_mask[Input] APN Type.
+
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllRequestATL(int connHandle, LocAGpsType agps_type,
+ LocApnTypeMask apn_type_mask, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->requestATL(connHandle, agps_type, apn_type_mask);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Request to release ATL Connection, this is received from SLL Hardware.
+ This event is to request to release ATL connection.
+
+ @param connHandle[Input] Connection Handle of ATL.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReleaseATL(int connHandle, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->releaseATL(connHandle);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Request to indicate NI-SUPL User notification, this is received from SLL Hardware.
+ This event is to indicate NI-SUPL User notification.
+
+ @param notify[Input] NI SUPL User indication.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllRequestNiNotify(GnssNiNotification ¬ify, const void* data,
+ void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ //synergyLocApiInstance->requestNiNotify(notify, data);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Request to indicate measurement report, this is received from SLL Hardware.
+ This event is to indicate measurement reprot.
+
+ @param GnssMeasurementsNotification[Input] measurement report.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportGnssMeasurementData(GnssMeasurements &measurements,
+ int msInWeek, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportGnssMeasurements(measurements, msInWeek);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Request to report WWAN ZPP Position report, this is received from SLL Hardware.
+ This event is to report ZPP Position report.
+
+ @param LocGpsLocation[Input] Position report.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportWwanZppFix(LocGpsLocation &zppLoc, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportWwanZppFix(zppLoc);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Report the Best ZPP Position, this is received from SLL Hardware.
+ This event is to report Best ZPP Position.
+
+ @param LocGpsLocation[Input] Position report.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportZppBestAvailableFix(LocGpsLocation &zppLoc,
+ GpsLocationExtended &location_extended, LocPosTechMask tech_mask, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportZppBestAvailableFix(zppLoc,
+ location_extended, tech_mask);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Report the Black listed SV configuration, this is received from SLL Hardware.
+ This event is to report Black listed SV ID.
+
+ @param GnssSvIdConfig[Input] Black listed SV configuration.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportGnssSvIdConfig(const GnssSvIdConfig& config, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportGnssSvIdConfig(config);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Report the Blacklisted Constellation, this is received from SLL Hardware.
+ This event is to report Blacklisted Constellation.
+
+ @param GnssSvIdConfig[Input] Blacklisted Constellation.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportGnssSvTypeConfig(const GnssSvTypeConfig& config, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportGnssSvTypeConfig(config);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Request the ODCPI, this is received from SLL Hardware.
+ This event is to request ODCPI.
+
+ @param OdcpiRequestInfo[Input] Request for ODCPI.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllRequestOdcpi(OdcpiRequestInfo& request, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->requestOdcpi(request);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Report the Energy Consumed, this is received from SLL Hardware.
+ This event is to report Engery Consumed by HW from Boot.
+
+ @param GnssSvIdConfig[Input] Engery Consumed Since First Boot,
+ in units of 0.1 milli watt seconds
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot,
+ void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportGnssEngEnergyConsumedEvent(energyConsumedSinceFirstBoot);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+
+}
+
+/**
+ Report the Delete Aiding Data Event, this is received from SLL Hardware.
+ This event is to report delete aiding data event.
+
+ @param GnssAidingData[Input] Indicate GNSS Aiding Data,
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportDeleteAidingDataEvent(GnssAidingData& aidingData, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportDeleteAidingDataEvent(aidingData);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Report the IONO model, this is received from SLL Hardware.
+ This event is to report IONO Model.
+
+ @param GnssKlobucharIonoModel[Input] Report IONO Model,
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportKlobucharIonoModel(GnssKlobucharIonoModel& ionoModel, void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportKlobucharIonoModel(ionoModel);
+
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/**
+ Report the Additional System Info, this is received from SLL Hardware.
+ This event is to report Additional System Info which includes system time.
+
+ @param GnssAdditionalSystemInfo[Input] Report Additional System Info
+ which includes system time.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void handleSllReportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo,
+ void *context) {
+
+ if (nullptr != context) {
+ SynergyLocApi *synergyLocApiInstance = (SynergyLocApi*)context;
+ synergyLocApiInstance->reportGnssAdditionalSystemInfo(additionalSystemInfo);
+ } else {
+ LOC_LOGw ("Context is NULL");
+ }
+}
+
+/* Init SLL Event Callbacks */
+const SllInterfaceEvent sllEventCb = {
+ handleSllEngineUp,
+ handleSllEngineDown,
+ handleSllReportPosition,
+ handleSllReportSv,
+ handleSllReportSvMeasurement,
+ hanldeSllReportSvPolynomial,
+ handleSllReportSvEphemeris,
+ hanldeSllReportStatus,
+ hanldeSllReportNmea,
+ handleSllReportData,
+ hanldeSllReportXtraServer,
+ handleSllReportLocationSystemInfo,
+ handleSllRequestXtraData,
+ handleSllRequestTime,
+ handleSllRequestLocation,
+ handleSllRequestATL,
+ handleSllReleaseATL,
+ handleSllRequestNiNotify,
+ handleSllReportGnssMeasurementData,
+ handleSllReportWwanZppFix,
+ handleSllReportZppBestAvailableFix,
+ handleSllReportGnssSvIdConfig,
+ handleSllReportGnssSvTypeConfig,
+ handleSllRequestOdcpi,
+ handleSllReportGnssEngEnergyConsumedEvent,
+ handleSllReportDeleteAidingDataEvent,
+ handleSllReportKlobucharIonoModel,
+ handleSllReportGnssAdditionalSystemInfo
+};
+
+/**
+ Default Implantation of Open Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllOpen(uint64_t requestedMask, bool isMaster,
+ uint64_t *supportedMask, sllFeatureList * sllFeatures,
+ void *context) {
+ (void*)supportedMask;
+ (void*)sllFeatures;
+ (void*)context;
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Close Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllClose(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Start Session Command;
+ to indicate the open command is not supported.
+*/
+enum loc_api_adapter_err defaultSllStartFix(sllPosMode& fixCriteria, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Stop Session Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllStopFix(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Delet Aiding Data Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllDeleteAidingData(const GnssAidingData& data, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Inject Position Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllInjectPosition(const GnssLocationInfoNotification &locationInfo,
+ bool onDemandCpi, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Set Time Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetTime(LocGpsUtcTime time, int64_t timeReference,
+ int uncertainty, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Set XTRA Data Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetXtraData(char* data, int length, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Request XTRA Server Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllRequestXtraServer(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of ATL Open Status Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllAtlOpenStatus(int handle, int is_succ, char* apn,
+ uint32_t apnLen, AGpsBearerType bear, LocAGpsType agpsType, LocApnTypeMask mask,
+ void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of ATL Close Status Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllAtlCloseStatus(int handle, int is_succ, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Set Position Mode Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetPositionMode(sllPosMode& posMode, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Set Server Sync Command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetServerSync(const char* url, int len, LocServerType type,
+ void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of inform NI reponse command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllInformNiResponse(GnssNiResponse userResponse,
+ const void* passThroughData, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of inform NI reponse commnad;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetSUPLVersionSync
+ (GnssConfigSuplVersion version, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set NMEA Types command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetNMEATypesSync(uint32_t typesMask, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set LPP Configuration command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetLPPConfigSync(GnssConfigLppProfile profile, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set Sensor Properties command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetSensorPropertiesSync
+ (bool gyroBiasVarianceRandomWalk_valid,
+ float gyroBiasVarianceRandomWalk,
+ bool accelBiasVarianceRandomWalk_valid,
+ float accelBiasVarianceRandomWalk,
+ bool angleBiasVarianceRandomWalk_valid,
+ float angleBiasVarianceRandomWalk,
+ bool rateBiasVarianceRandomWalk_valid,
+ float rateBiasVarianceRandomWalk,
+ bool velocityBiasVarianceRandomWalk_valid,
+ float velocityBiasVarianceRandomWalk, void *context) {
+ SLL_DEFAULT_IMPL();
+
+}
+
+/**
+ Default Implantation of set Sensor Preferred Control configure command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetSensorPerfControlConfigSync(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set AGLONASS Protocol Sync command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetAGLONASSProtocolSync
+ (GnssConfigAGlonassPositionProtocolMask aGlonassProtocol, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set LPPe Protocol Control Sync command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP,
+ void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set LPPe Protocol UP Sync command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP,
+ void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of convert SUPL Version command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllConvertSuplVersion(const uint32_t suplVersion,
+ GnssConfigSuplVersion *suplConfig, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of convert LPP Profile command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllConvertLppProfile(const uint32_t lppProfile,
+ GnssConfigLppProfile *gnssLppProfile, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of convert LPPe Control Plan command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllConvertLppeCp(const uint32_t lppeControlPlaneMask,
+ GnssConfigLppeControlPlaneMask *gnssLppControlPlanMask, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of convert LPPe User Plan command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllConvertLppeUp(const uint32_t lppeUserPlaneMask,
+ GnssConfigLppeUserPlaneMask *gnssLppUpMask, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of get WWAN ZPP Fix command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllGetWwanZppFix(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of best Available ZPP Fix command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllGetBestAvailableZppFix(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Set GPS Lock Sync command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetGpsLockSync(GnssConfigGpsLock lock, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Request for aiding data command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllRequestForAidingData(GnssAidingDataSvMask svDataMask,
+ void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Request for get GPS Lock command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllGetGpsLock(uint8_t subType, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of Request for get GPS Lock command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetXtraVersionCheckSync(uint32_t check, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set AGPS certificate command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllInstallAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set Constrained Tunc Mode command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetConstrainedTuncMode(bool enabled, float tuncConstraint,
+ uint32_t energyBudget, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set Position Assisted Clock Estimator Mode command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllSetPositionAssistedClockEstimatorMode(bool enabled,
+ void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of get GNSS Energy Consumed command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultSllGetGnssEnergyConsumed(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set Black List SV command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultsllSetBlacklistSv(const GnssSvIdConfig& config, void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of get Black List SV command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultsllGetBlacklistSv(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of set constellation Control command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultsllSetConstellationControl(const GnssSvTypeConfig& config,
+ void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of get constellation Control command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultsllGetConstellationControl(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/**
+ Default Implantation of reset constellation Control command;
+ to indicate the command is not supported.
+*/
+enum loc_api_adapter_err defaultsllResetConstellationControl(void *context) {
+ SLL_DEFAULT_IMPL();
+}
+
+/* Default Implantation of SLL Commands */
+const SllInterfaceReq sllDefultReq = {
+ defaultSllOpen,
+ defaultSllClose,
+ defaultSllStartFix,
+ defaultSllStopFix,
+ defaultSllDeleteAidingData,
+ defaultSllInjectPosition,
+ defaultSllSetTime,
+ defaultSllSetXtraData,
+ defaultSllRequestXtraServer,
+ defaultSllAtlOpenStatus,
+ defaultSllAtlCloseStatus,
+ defaultSllSetPositionMode,
+ defaultSllSetServerSync,
+ defaultSllInformNiResponse,
+ defaultSllSetSUPLVersionSync,
+ defaultSllSetNMEATypesSync,
+ defaultSllSetLPPConfigSync,
+ defaultSllSetSensorPropertiesSync,
+ defaultSllSetSensorPerfControlConfigSync,
+ defaultSllSetAGLONASSProtocolSync,
+ defaultSllSetLPPeProtocolCpSync,
+ defaultSllSetLPPeProtocolUpSync,
+ defaultSllConvertSuplVersion,
+ defaultSllConvertLppProfile,
+ defaultSllConvertLppeCp,
+ defaultSllConvertLppeUp,
+ defaultSllGetWwanZppFix,
+ defaultSllGetBestAvailableZppFix,
+ defaultSllSetGpsLockSync,
+ defaultSllRequestForAidingData,
+ defaultSllGetGpsLock,
+ defaultSllSetXtraVersionCheckSync,
+ defaultSllInstallAGpsCert,
+ defaultSllSetConstrainedTuncMode,
+ defaultSllSetPositionAssistedClockEstimatorMode,
+ defaultSllGetGnssEnergyConsumed,
+ defaultsllSetBlacklistSv,
+ defaultsllGetBlacklistSv,
+ defaultsllSetConstellationControl,
+ defaultsllGetConstellationControl,
+ defaultsllResetConstellationControl
+};
+
+/* Constructor for SynergyLocApi */
+SynergyLocApi::SynergyLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) :
+ LocApiBase(exMask, context),
+ mSlMask(0), mInSession(false), mPowerMode(GNSS_POWER_MODE_INVALID),
+ mEngineOn(false), mMeasurementsStarted(false),
+ mIsMasterRegistered(false), mMasterRegisterNotSupported(false),
+ mSvMeasurementSet(nullptr)
+{
+ const char * libName = nullptr;
+ void *handle = nullptr;
+ int isSllSimEnabled = 0;
+ const char *error = nullptr;
+
+ loc_param_s_type gps_conf_param_table[] =
+ {
+ {"IS_SLL_SIM_ENABLED", &isSllSimEnabled, NULL, 'n'}
+ };
+
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, gps_conf_param_table);
+
+ if (isSllSimEnabled) {
+ libName = SLL_CORE_SIM_LIB_NAME;
+ } else {
+ libName = SLL_CORE_LIB_NAME;
+ }
+
+ if ((handle = dlopen(libName, RTLD_NOW)) != nullptr) {
+ LOC_LOGv("%s is present", libName);
+ get_sll_if_api_t getter = (get_sll_if_api_t)dlsym(handle, "get_sll_if_api");
+
+ if ((error = dlerror()) != nullptr) {
+ LOC_LOGe("dlsym for %s get_sll_if_api failed, error = %s", libName, error);
+ getter = nullptr;
+ }
+
+ if (getter != nullptr) {
+ sllReqIf = (getter)(&sllEventCb, ((void *)this));
+ if (sllReqIf != nullptr) {
+ return;
+ } else {
+ LOC_LOGe("%s SLL lib provided Command Interface as NULL", libName);
+ }
+ }
+ } else {
+ char *errorDll = dlerror();
+
+ LOC_LOGe("dlopen for %s failed, handle %p error: %s", libName, handle,
+ ((nullptr != errorDll) ? errorDll : "No Error"))
+ }
+
+ sllReqIf = &sllDefultReq;
+
+}
+
+/* Destructor for SynergyLocApi */
+SynergyLocApi::~SynergyLocApi()
+{
+ close();
+}
+
+/**
+ The API to Call of Synergy Location Layer.
+
+ @param LOC_API_ADAPTER_EVENT_MASK_T[Input] Configure Event Mask.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ LocApiBase: Pointer of Constructor of Synergy Location API.
+
+ @dependencies
+ None.
+*/
+LocApiBase* getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context)
+{
+ return (LocApiBase*)SynergyLocApi::createSynergyLocApi(exMask, context);
+}
+
+
+/**
+ The API to call Constructor of Synergy Location API.
+
+ @param LOC_API_ADAPTER_EVENT_MASK_T[Input] Configure Event Mask.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ LocApiBase: Pointer of Constructor of Synergy Location API.
+
+ @dependencies
+ None.
+*/
+LocApiBase* SynergyLocApi::createSynergyLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context)
+{
+ return new SynergyLocApi(exMask, context);
+}
+
+
+/**
+ Initialize a synergy loc api client AND
+ check which loc message are supported by SLL.
+
+ @param LOC_API_ADAPTER_EVENT_MASK_T[Input] Configure Event Mask.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ loc_api_adapter_err.
+
+ @dependencies
+ None.
+*/
+enum loc_api_adapter_err
+SynergyLocApi::open(LOC_API_ADAPTER_EVENT_MASK_T mask) {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_UNKNOWN;
+ uint64_t supportedMask = 0;
+ uint64_t requestedMask = (uint64_t)mask;
+ bool gnssMeasurementSupported = false;
+ bool isMasterSession = false;
+ sllFeatureList getSllFeatures;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllOpen)) {
+ //Check for Master and Measurement
+ if (isMaster()) {
+ isMasterSession = true;
+ }
+
+ memset(&getSllFeatures, 0, sizeof(getSllFeatures));
+ rtv = sllReqIf->sllOpen(requestedMask, isMasterSession, &supportedMask,
+ &getSllFeatures, (void *)this);
+ if (((LOC_API_ADAPTER_ERR_SUCCESS == rtv) ||
+ (LOC_API_ADAPTER_ERR_UNSUPPORTED == rtv)) &&
+ (SL_NO_FEATURE_SUPPORTED != supportedMask)) {
+ LOC_LOGd ("SLL Requested Configuration 0x%" PRIx64 ","
+ " Supported Configuration 0x%" PRIx64 "",
+ mask, supportedMask);
+ if ((LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT ==
+ (supportedMask & LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT)) ||
+ (LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT ==
+ (supportedMask & LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT))) {
+ gnssMeasurementSupported = true;
+ }
+ mContext->setEngineCapabilities(supportedMask, (getSllFeatures.feature_len != 0 ?
+ getSllFeatures.feature : NULL), gnssMeasurementSupported);
+ }
+ }
+ return rtv;
+}
+
+/**
+ Register Event Mask
+
+ @param LOC_API_ADAPTER_EVENT_MASK_T[Input] Configure Event Mask.
+ @param context[Input] Context Pointer of Synergy Location API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::registerEventMask(LOC_API_ADAPTER_EVENT_MASK_T adapterMask) {
+
+ mMask = adapterMask;
+ return;
+}
+
+/**
+ Request to Close SLL Hardware
+
+ @param
+ none
+
+ @return
+ loc_api_adapter_err.
+
+ @dependencies
+ None.
+*/
+enum loc_api_adapter_err SynergyLocApi::close() {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllClose)) {
+ rtv = sllReqIf->sllClose((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGw ("Close Error 0x%x:", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNKNOWN;
+ }
+ return rtv;
+}
+
+
+/**
+ start positioning session
+
+ @param LocPosMode[Input] Session configuration.
+ @param LocApiResponse[Input] LOC API Response API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::startFix(const LocPosMode& fixCriteria, LocApiResponse *adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, fixCriteria, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ sllPosMode posMode;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllStartFix)) {
+ posMode.mode = fixCriteria.mode;
+ posMode.recurrence = fixCriteria.recurrence;
+ posMode.min_interval = fixCriteria.min_interval;
+ posMode.preferred_accuracy = fixCriteria.preferred_accuracy;
+ posMode.preferred_time = fixCriteria.preferred_time;
+ posMode.share_position = fixCriteria.share_position;
+ posMode.powerMode = fixCriteria.powerMode;
+ posMode.timeBetweenMeasurements = fixCriteria.timeBetweenMeasurements;
+
+ rtv = sllReqIf->sllStartFix(posMode, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+
+}
+
+/**
+ stop a positioning session
+
+ @param LocApiResponse[Input] LOC API Response API.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::stopFix(LocApiResponse *adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllStopFix)) {
+
+ rtv = sllReqIf->sllStopFix((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+
+/**
+ set the positioning fix criteria
+
+ @param LocPosMode[Input] Session configuration paramter.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::setPositionMode(const LocPosMode& posMode) {
+
+ sendMsg(new LocApiMsg([this, posMode] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ sllPosMode LocSlPosMode;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetPositionMode)) {
+ LocSlPosMode.mode = posMode.mode;
+ LocSlPosMode.recurrence = posMode.recurrence;
+ LocSlPosMode.min_interval = posMode.min_interval;
+ LocSlPosMode.preferred_accuracy = posMode.preferred_accuracy;
+ LocSlPosMode.preferred_time = posMode.preferred_time;
+ LocSlPosMode.share_position = posMode.share_position;
+ LocSlPosMode.powerMode = posMode.powerMode;
+ LocSlPosMode.timeBetweenMeasurements = posMode.timeBetweenMeasurements;
+
+ rtv = sllReqIf->sllSetPositionMode(LocSlPosMode, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ }));
+}
+
+/**
+ Inject time into the position engine
+
+ @param LocGpsUtcTime[Input] Location GPS UTC Time.
+ @param timeReference[Input] Reference Time.
+ @param uncertainty[Input] Time Uncertainty.
+ Units: Milliseconds.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::
+ setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty) {
+
+ sendMsg(new LocApiMsg([this, time, timeReference, uncertainty] () {
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetTime)) {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ rtv = sllReqIf->sllSetTime(time, timeReference, uncertainty, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+
+ }));
+
+}
+
+/**
+ inject position into the position engine
+
+ @param Location[Input] Position report.
+ @param onDemandCpi[Input] Indicate CPI demanded or not.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::injectPosition(const Location& location, bool onDemandCpi) {
+
+ sendMsg(new LocApiMsg([this, location, onDemandCpi] () {
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllInjectPosition)) {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ GnssLocationInfoNotification locInfo;
+ locInfo.location = location;
+ rtv = sllReqIf->sllInjectPosition(locInfo, onDemandCpi, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+
+ }));
+
+}
+
+/**
+ This API provides number of SV used in the fix
+
+ @param LocGpsUtcTime[Input] Location GPS UTC Time.
+ @param timeReference[Input] Reference Time.
+ @param uncertainty[Input] Time Uncertainty.
+ Units: Milliseconds.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+int SynergyLocApi::getNumSvUsed (uint64_t svUsedIdsMask, int totalSvCntInOneConstellation) {
+
+ if (totalSvCntInOneConstellation > SL_MAX_SV_CNT_SUPPORTED_IN_ONE_CONSTELLATION) {
+ LOC_LOGe ("error: total SV count in one constellation %d exceeded limit of 64",
+ totalSvCntInOneConstellation);
+ return 0;
+ }
+
+ int numSvUsed = 0;
+ uint64_t mask = 0x1;
+ for (int i = 0; i < totalSvCntInOneConstellation; i++) {
+ if (svUsedIdsMask & mask) {
+ numSvUsed++;
+ }
+ mask <<= 1;
+ }
+
+ return numSvUsed;
+}
+
+
+/**
+ This API provides Position report
+
+ @param GnssLocationInfoNotification[Input] recevied Position report.
+ @param onDemandCpi[Input] Indicate CPI demanded or not.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::injectPosition(const GnssLocationInfoNotification &locationInfo,
+ bool onDemandCpi) {
+
+ sendMsg(new LocApiMsg([this, locationInfo, onDemandCpi] () {
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllInjectPosition)){
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ rtv = sllReqIf->sllInjectPosition(locationInfo, onDemandCpi, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+
+ }));
+}
+
+
+
+/**
+ This API provides delete assistance data
+
+ @param GnssAidingData[Input] GNSS Aiding Data.
+ @param LocApiResponse[Input] Adapter Response.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void
+SynergyLocApi::deleteAidingData(const GnssAidingData& data, LocApiResponse *adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, data, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllDeleteAidingData)) {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ rtv = sllReqIf->sllDeleteAidingData(data, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+
+/**
+ This API provides NI user response to the engine
+
+ @param GnssNiResponse[Input] GNSS NI Response.
+ @param LocApiResponse[Input] Pass Through Data.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void
+SynergyLocApi::informNiResponse(GnssNiResponse userResponse, const void* passThroughData) {
+
+ sendMsg(new LocApiMsg([this, userResponse, passThroughData] () {
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllInformNiResponse)) {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ rtv = sllReqIf->sllInformNiResponse(userResponse, passThroughData, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+ free((void *)passThroughData);
+ }));
+
+}
+
+
+/**
+ This API provides Set UMTs SLP server URL
+
+ @param const char*[Input] Server URL Configuration.
+ @param Length[Input] Server URL Lenght
+ @param LocServerType[Input] Server Type
+
+ @return
+ LocationError.
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setServerSync(const char* url, int len, LocServerType type) {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetServerSync)) {
+ rtv = sllReqIf->sllSetServerSync (url, len, type, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ } else {
+ err = LOCATION_ERROR_CALLBACK_MISSING;
+ }
+
+ return err;
+}
+
+/**
+ This API configure Server using IP Address and Port Number
+
+ @param unsigned int ip[Input] Server IP Configuration.
+ @param int port[Input] Port number
+ @param LocServerType[Input] Server Type
+
+ @return
+ LocationError.
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setServerSync(unsigned int ip, int port, LocServerType type) {
+
+ return LOCATION_ERROR_CALLBACK_MISSING;
+}
+
+
+/**
+ This API to Inject XTRA data, this module breaks down the XTRA
+ file into "chunks" and injects them one at a time
+
+ @param char* data[Input] XTRA Data Buffer
+ @param int length[Input] XTRA Data Buffer length
+
+ @return
+ enum loc_api_adapter_err.
+
+ @dependencies
+ None.
+*/
+enum loc_api_adapter_err SynergyLocApi::setXtraData(char* data, int length) {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetXtraData)) {
+ rtv = sllReqIf->sllSetXtraData(data, length, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+
+ return rtv;
+}
+
+/**
+ This API request the Xtra Server Url
+
+ @param
+ none
+
+ @return
+ enum loc_api_adapter_err.
+
+ @dependencies
+ None.
+*/
+enum loc_api_adapter_err SynergyLocApi::requestXtraServer() {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllRequestXtraServer)) {
+ rtv= sllReqIf->sllRequestXtraServer((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+
+ return rtv;
+}
+
+/**
+ This API request to OPEN ATL Status
+
+ @param handle[Input] ATL Connection handle
+ @param is_succ[Input] ATL connection status
+ @param APN[Input] ATL APN buffer
+ @param AGpsBearerType[Input] APN Type
+ @param LocAGpsType[Input] AGPS Type
+ @param LocApnTypeMask[Input] AGPS Configuration Mask
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::atlOpenStatus(
+ int handle, int is_succ, char* apn, uint32_t apnLen, AGpsBearerType bear,
+ LocAGpsType agpsType, LocApnTypeMask apnTypeMask) {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllAtlOpenStatus)) {
+
+ rtv= sllReqIf->sllAtlOpenStatus(handle, is_succ, apn, apnLen, bear, agpsType,
+ apnTypeMask, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+
+ LOC_LOGd("Error: %d", rtv);
+
+ return;
+}
+
+
+/**
+ This API request to close ATL connection
+
+ @param handle[Input] ATL Connection handle
+ @param is_succ[Input] ATL connection status
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::atlCloseStatus(int handle, int is_succ) {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllAtlCloseStatus)) {
+
+ rtv= sllReqIf->sllAtlCloseStatus(handle, is_succ, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+
+ return;
+}
+
+
+/**
+ set the SUPL version
+
+ @param GnssConfigSuplVersion[Input] ATL Connection handle
+ @param is_succ[Input] ATL connection status
+
+ @return
+ LocationError.
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setSUPLVersionSync(GnssConfigSuplVersion version) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetSUPLVersionSync)) {
+
+ rtv = sllReqIf->sllSetSUPLVersionSync(version, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ return err;
+}
+
+/**
+ set the NMEA types mask
+
+ @param typesMask[Input] Set NMEA Mask
+
+ @return
+ enum loc_api_adapter_err
+
+ @dependencies
+ None.
+*/
+enum loc_api_adapter_err SynergyLocApi::setNMEATypesSync(uint32_t typesMask) {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetNMEATypesSync)) {
+ rtv= sllReqIf->sllSetNMEATypesSync(typesMask, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+
+ return rtv;
+}
+
+/**
+ set the configuration for LTE positioning profile (LPP).
+
+ @param GnssConfigLppProfile[Input] Configur LPP Profile.
+
+ @return
+ LocationError
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setLPPConfigSync(GnssConfigLppProfile profile) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetLPPConfigSync)) {
+
+ rtv = sllReqIf->sllSetLPPConfigSync(profile, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ return err;
+}
+
+
+/**
+ Set the Sensor Properties configuration.
+
+ @param gyroBiasVarianceRandomWalk_valid[Input] Is vaild Gyro Bias Varianace
+ @param gyroBiasVarianceRandomWalk[Input] Gyro Bias Variance.
+ @param accelBiasVarianceRandomWalk_valid[Input] Is vaild Accel Bias Varianace
+ @param accelBiasVarianceRandomWalk[Input] Accel Bias Variance.
+ @param angleBiasVarianceRandomWalk_valid[Input] Is vaild Angle Bias Varianace
+ @param angleBiasVarianceRandomWalk[Input] Angle Bias Variance.
+ @param velocityBiasVarianceRandomWalk_valid[Input] Is vaild Velocity Bias Varianace
+ @param velocityBiasVarianceRandomWalk[Input] Velocity Bias Variance.
+
+ @return
+ enum loc_api_adapter_err
+
+ @dependencies
+ None.
+*/
+enum loc_api_adapter_err SynergyLocApi::setSensorPropertiesSync(
+ bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
+ bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
+ bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
+ bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
+ bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk) {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetSensorPropertiesSync)) {
+
+ rtv= sllReqIf->sllSetSensorPropertiesSync(gyroBiasVarianceRandomWalk_valid,
+ gyroBiasVarianceRandomWalk,
+ accelBiasVarianceRandomWalk_valid,
+ accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk_valid,
+ angleBiasVarianceRandomWalk,
+ rateBiasVarianceRandomWalk_valid,
+ rateBiasVarianceRandomWalk,
+ velocityBiasVarianceRandomWalk_valid,
+ velocityBiasVarianceRandomWalk,
+ (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+ return rtv;
+
+}
+
+
+/**
+ Set the Sensor Performance Configuration.
+
+ @param controlMode[Input] Control Mode
+ @param accelSamplesPerBatch[Input] Accel Sample Per Batch.
+ @param accelBatchesPerSec[Input] Accel Batch Per Seconds.
+ @param gyroSamplesPerBatch[Input] Gyro Sample Per Batch.
+ @param gyroBatchesPerSec[Input] Gyro Batch Per Seconds.
+ @param accelSamplesPerBatchHigh[Input] Max Accel Sample Per Batches.
+ @param accelBatchesPerSecHigh[Input] Max Accel Batches Per Second.
+ @param gyroSamplesPerBatchHigh[Input] Max Gyro Sample Per Batches.
+ @param gyroBatchesPerSecHigh[Input] Max Gyro Batches Per Second.
+ @param algorithmConfig[Input] Configure Algorithm.
+
+ @return
+ enum loc_api_adapter_err
+
+ @dependencies
+ None.
+*/
+enum loc_api_adapter_err SynergyLocApi::setSensorPerfControlConfigSync(int controlMode,
+ int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh,
+ int algorithmConfig) {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetSensorPerfControlConfigSync)) {
+
+ rtv= sllReqIf->sllSetSensorPerfControlConfigSync(controlMode,
+ accelSamplesPerBatch,
+ accelBatchesPerSec,
+ gyroSamplesPerBatch,
+ gyroBatchesPerSec,
+ accelSamplesPerBatchHigh,
+ accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh,
+ gyroBatchesPerSecHigh,
+ algorithmConfig,
+ (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+ return rtv;
+
+}
+
+
+/**
+ Set the Positioning Protocol on A-GLONASS system.
+
+ @param GnssConfigAGlonassPositionProtocolMask[Input] AGLONASS Protocol configure
+
+ @return
+ LocationError
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetAGLONASSProtocolSync)) {
+
+ rtv = sllReqIf->sllSetAGLONASSProtocolSync(aGlonassProtocol, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ return err;
+}
+
+
+/**
+ Set the LPPe Protocol control plan synchronize.
+
+ @param GnssConfigLppeControlPlaneMask[Input] GNSS Configure Control Plan Mask.
+
+ @return
+ LocationError
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetLPPeProtocolCpSync)) {
+
+ rtv = sllReqIf->sllSetLPPeProtocolCpSync(lppeCP, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ return err;
+}
+
+
+/**
+ Set the LPPe Protocol User plan synchronize.
+
+ @param GnssConfigLppeUserPlaneMask[Input] GNSS Configure User Plan Mask.
+
+ @return
+ LocationError
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetLPPeProtocolUpSync)) {
+
+ rtv = sllReqIf->sllSetLPPeProtocolUpSync(lppeUP, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ return err;
+
+}
+
+
+/**
+ Request for WWAN ZPP Fix- Position reprot.
+
+ @param
+ None
+
+ @return
+ None
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::getWwanZppFix() {
+
+ sendMsg(new LocApiMsg([this] () {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllGetWwanZppFix)) {
+ rtv= sllReqIf->sllGetWwanZppFix((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+ LOC_LOGd("Status: %d", rtv);
+ }));
+
+}
+
+/**
+ Request for Best Available ZPP Fix- Position reprot.
+
+ @param
+ None
+
+ @return
+ None
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::getBestAvailableZppFix() {
+
+ sendMsg(new LocApiMsg([this] () {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllGetWwanZppFix)) {
+ rtv= sllReqIf->sllGetWwanZppFix((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+ LOC_LOGd("Status: %d", rtv);
+ }));
+
+}
+
+
+/**
+ Set GPS Lock.
+
+ @param GnssConfigGpsLock[Input] Configure GPS Lock
+
+ @return
+ LocationError
+
+ @dependencies
+ None.
+*/
+LocationError SynergyLocApi::setGpsLockSync(GnssConfigGpsLock lock) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetGpsLockSync)) {
+
+ rtv = sllReqIf->sllSetGpsLockSync(lock, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ return err;
+}
+
+
+/**
+ Configure Aiding Data
+
+ @param GnssAidingDataSvMask[Input] GNSS Aiding Data SV Mask
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::requestForAidingData(GnssAidingDataSvMask svDataMask) {
+
+ sendMsg(new LocApiMsg([this, svDataMask] () {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllRequestForAidingData)) {
+
+ rtv = sllReqIf->sllRequestForAidingData(svDataMask, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+ }));
+}
+
+
+/**
+ Check XTRA Version Check
+
+ @param uint32_t[Input] XTRA Version Check
+
+ @return
+ LocationError.
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setXtraVersionCheckSync(uint32_t check) {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetXtraVersionCheckSync)) {
+
+ rtv = sllReqIf->sllSetXtraVersionCheckSync(check, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ return err;
+}
+
+
+/**
+ Check XTRA Version Check
+
+ @param LocDerEncodedCertificate[Input] AGPS Certificate Buffer
+ @param numberOfCerts[Input] Number of AGPS Certificates
+ @param slotBitMask[Input] Bit mask of Certificates
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::installAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t numberOfCerts,
+ uint32_t slotBitMask) {
+
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllInstallAGpsCert)) {
+ rtv = sllReqIf->sllInstallAGpsCert(pData, numberOfCerts, slotBitMask, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ } else {
+ rtv = LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ }
+}
+
+
+/**
+ Set Constrained Tunc Mode
+
+ @param enabled[Input] Enabled OR Disabled
+ @param tuncConstraint[Input] Number of AGPS Certificates
+ @param energyBudget[Input] Bit mask of Certificates
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::setConstrainedTuncMode(bool enabled,
+ float tuncConstraint,
+ uint32_t energyBudget,
+ LocApiResponse* adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, enabled, tuncConstraint, energyBudget, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetConstrainedTuncMode)) {
+
+ rtv = sllReqIf->sllSetConstrainedTuncMode(enabled, tuncConstraint,
+ energyBudget, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+
+/**
+ Enable Position Assisted Clock Estimator Mode
+
+ @param enabled[Input] Enable or disable Clock estimator.
+
+ @return
+ LocationError.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::setPositionAssistedClockEstimatorMode(bool enabled,
+ LocApiResponse* adapterResponse) {
+ sendMsg(new LocApiMsg([this, enabled, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) &&
+ (nullptr != sllReqIf->sllSetPositionAssistedClockEstimatorMode)) {
+ rtv = sllReqIf->sllSetPositionAssistedClockEstimatorMode(enabled, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+
+/**
+ Get GNSS Engery Consumed
+
+ @param
+ None.
+
+ @return
+ LocationError.
+
+ @dependencies
+ None.
+*/
+LocationError SynergyLocApi::getGnssEnergyConsumed() {
+
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllGetGnssEnergyConsumed)) {
+ rtv = sllReqIf->sllGetGnssEnergyConsumed((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ return err;
+}
+
+
+/**
+ Convert SUPL Version into GNSS SUPL Version format
+
+ @param suplVersion[Input] SUPL Version
+
+ @return
+ GnssConfigSuplVersion.
+
+ @dependencies
+ None.
+*/
+GnssConfigSuplVersion
+SynergyLocApi::convertSuplVersion(const uint32_t suplVersion) {
+
+ GnssConfigSuplVersion configSuplVersion = GNSS_CONFIG_SUPL_VERSION_1_0_0;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllConvertSuplVersion)) {
+ rtv = sllReqIf->sllConvertSuplVersion(suplVersion, &configSuplVersion, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ configSuplVersion = GNSS_CONFIG_SUPL_VERSION_1_0_0;
+ }
+ }
+
+ return configSuplVersion;
+}
+
+
+/**
+ Convert LPP Profile vesrion in GNSS LPP profile format
+
+ @param lppProfile[Input] LPP Profile Version
+
+
+ @return
+ GnssConfigLppProfile.
+
+ @dependencies
+ None.
+*/
+GnssConfigLppProfile
+SynergyLocApi::convertLppProfile(const uint32_t lppProfile) {
+ GnssConfigLppProfile configLppProfile = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllConvertLppProfile)) {
+ rtv = sllReqIf->sllConvertLppProfile(lppProfile, &configLppProfile, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ configLppProfile = GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE;
+ }
+ }
+
+ return configLppProfile;
+}
+
+
+/**
+ Convert LPPe Control Plan Profile vesrion in GNSS LPP Control Plan profile format
+
+
+ @param lppeControlPlaneMask[Input] LPPe Control Plan Mask
+
+
+ @return
+ GnssConfigLppeControlPlaneMask.
+
+ @dependencies
+ None.
+*/
+GnssConfigLppeControlPlaneMask
+SynergyLocApi::convertLppeCp(const uint32_t lppeControlPlaneMask) {
+ GnssConfigLppeControlPlaneMask configLppeCp = 0;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllConvertLppeCp)) {
+ rtv = sllReqIf->sllConvertLppeCp(lppeControlPlaneMask, &configLppeCp, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ configLppeCp = 0;
+ }
+ }
+
+ return configLppeCp;
+}
+
+
+/**
+ Convert LPPe Control Plan Profile vesrion in GNSS LPP User Plan profile format
+
+ @param lppeUserPlaneMask[Input] LPPe User Plan Mask
+
+
+ @return
+ GnssConfigLppeUserPlaneMask.
+
+ @dependencies
+ None.
+*/
+GnssConfigLppeUserPlaneMask
+SynergyLocApi::convertLppeUp(const uint32_t lppeUserPlaneMask) {
+ GnssConfigLppeUserPlaneMask configLppeUp = 0;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllConvertLppeUp)) {
+ rtv = sllReqIf->sllConvertLppeUp(lppeUserPlaneMask, &configLppeUp, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ configLppeUp = 0;
+ }
+ }
+ return configLppeUp;
+}
+
+
+/**
+ Set Black listed SV.
+
+ @param GnssSvIdConfig[Input] Black listed SV ID
+
+
+ @return
+ LocationError.
+
+ @dependencies
+ None.
+*/
+LocationError
+SynergyLocApi::setBlacklistSvSync(const GnssSvIdConfig& config) {
+
+ LocationError rtv = LOCATION_ERROR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetBlacklistSv)) {
+ setBlacklistSv(config);
+ } else {
+ rtv = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ return rtv;
+}
+
+
+/**
+ Set Black listed SV.
+
+ @param GnssSvIdConfig[Input] Black listed SV ID
+
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void
+SynergyLocApi::setBlacklistSv(const GnssSvIdConfig& config) {
+ sendMsg(new LocApiMsg([this, config] () {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetBlacklistSv)) {
+ rtv = sllReqIf->sllSetBlacklistSv(config, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+ }));
+}
+
+
+/**
+ Get Black listed SV.
+
+ @param
+ None.
+
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void SynergyLocApi::getBlacklistSv() {
+ sendMsg(new LocApiMsg([this] () {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllGetBlacklistSv)) {
+ rtv = sllReqIf->sllGetBlacklistSv((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+ }));
+}
+
+
+/**
+ Configure Constellation Control.
+
+ @param GnssSvTypeConfig[Input] GNSS Constellation configuration.
+
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void
+SynergyLocApi::setConstellationControl(const GnssSvTypeConfig& config,
+ LocApiResponse *adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, config, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllSetConstellationControl)) {
+ rtv = sllReqIf->sllSetConstellationControl(config, (void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+/**
+ Request get configured Constellation from Hardware.
+
+ @param
+ None.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void
+SynergyLocApi::getConstellationControl() {
+
+ sendMsg(new LocApiMsg([this] () {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllGetConstellationControl)) {
+ rtv = sllReqIf->sllGetConstellationControl((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS != rtv) {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+ }));
+}
+
+
+/**
+ Request to reset configured Constellation from Hardware.
+
+ @param
+ None.
+
+ @return
+ None.
+
+ @dependencies
+ None.
+*/
+void
+SynergyLocApi::resetConstellationControl(LocApiResponse *adapterResponse) {
+ sendMsg(new LocApiMsg([this, adapterResponse] () {
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllResetConstellationControl)) {
+ rtv = sllReqIf->sllResetConstellationControl((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ LOC_LOGe ("Error: %d", rtv);
+ }
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+
+void
+SynergyLocApi::startTimeBasedTracking(const TrackingOptions& options,
+ LocApiResponse* adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, options, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ sllPosMode posMode;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllStartFix)) {
+
+ posMode.mode = LOC_POSITION_MODE_STANDALONE;
+ posMode.recurrence = LOC_GPS_POSITION_RECURRENCE_PERIODIC;
+ posMode.min_interval = options.minInterval;
+ posMode.preferred_accuracy = 100;
+ posMode.preferred_time = 120000;
+ posMode.share_position = true;
+ posMode.powerMode = GNSS_POWER_MODE_M2;
+ posMode.timeBetweenMeasurements = 1000;
+
+ rtv = sllReqIf->sllStartFix(posMode, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+
+}
+
+void
+SynergyLocApi::stopTimeBasedTracking(LocApiResponse* adapterResponse){
+
+ sendMsg(new LocApiMsg([this, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllStopFix)) {
+
+ rtv = sllReqIf->sllStopFix((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+SynergyLocApi::startDistanceBasedTracking(uint32_t sessionId,
+ const LocationOptions& options, LocApiResponse* adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, options, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ sllPosMode posMode;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllStartFix)) {
+
+ posMode.mode = LOC_POSITION_MODE_STANDALONE;
+ posMode.recurrence = LOC_GPS_POSITION_RECURRENCE_PERIODIC;
+ posMode.min_interval = options.minInterval;
+ posMode.preferred_accuracy = 100;
+ posMode.preferred_time = 120000;
+ posMode.share_position = true;
+ posMode.powerMode = GNSS_POWER_MODE_M2;
+ posMode.timeBetweenMeasurements = 1000;
+
+ rtv = sllReqIf->sllStartFix(posMode, ((void *)this));
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
+
+void
+SynergyLocApi::stopDistanceBasedTracking(uint32_t sessionId,
+ LocApiResponse* adapterResponse) {
+
+ sendMsg(new LocApiMsg([this, adapterResponse] () {
+ LocationError err = LOCATION_ERROR_GENERAL_FAILURE;
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if ((nullptr != sllReqIf) && (nullptr != sllReqIf->sllStopFix)) {
+
+ rtv = sllReqIf->sllStopFix((void *)this);
+ if (LOC_API_ADAPTER_ERR_SUCCESS == rtv) {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ } else {
+ err = LOCATION_ERROR_NOT_SUPPORTED;
+ }
+
+ if (adapterResponse != NULL) {
+ adapterResponse->returnToSender(err);
+ }
+ }));
+}
diff --git a/location/synergy_loc_api/SynergyLocApi.h b/location/synergy_loc_api/SynergyLocApi.h
new file mode 100644
index 0000000..6b7f641
--- /dev/null
+++ b/location/synergy_loc_api/SynergyLocApi.h
@@ -0,0 +1,198 @@
+/* Copyright (c) 2019, 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 SYNERGY_LOC_API_H
+#define SYNERGY_LOC_API_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <LocApiBase.h>
+#include <loc_sll_interface.h>
+#include <vector>
+#include <functional>
+
+
+#define LOC_CLIENT_INVALID_HANDLE_VALUE (NULL)
+
+using Resender = std::function<void()>;
+
+using namespace std;
+using namespace loc_core;
+
+
+/* This class derives from the LocApiBase class.
+ The members of this class are responsible for converting
+ the Synergy Location API data structures into Loc Adapter data structures.
+ This class also implements some of the virtual functions that
+ handle the requests from loc engine. */
+class SynergyLocApi : public LocApiBase {
+protected:
+
+
+private:
+ bool mInSession;
+ GnssPowerMode mPowerMode;
+ bool mEngineOn;
+ bool mMeasurementsStarted;
+ std::vector<Resender> mResenders;
+ bool mIsMasterRegistered;
+ bool mMasterRegisterNotSupported;
+ GnssSvMeasurementSet* mSvMeasurementSet;
+ LOC_API_ADAPTER_EVENT_MASK_T mSlMask;
+
+ const SllInterfaceReq *sllReqIf;
+
+ void registerEventMask(LOC_API_ADAPTER_EVENT_MASK_T adapterMask);
+
+
+protected:
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+
+ SynergyLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context = NULL);
+ virtual ~SynergyLocApi();
+
+public:
+ static LocApiBase* createSynergyLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context);
+
+
+ virtual void startFix(const LocPosMode& posMode,
+ LocApiResponse *adapterResponse);
+
+ virtual void stopFix(LocApiResponse *adapterResponse);
+
+ virtual void setPositionMode(const LocPosMode& mode);
+
+ virtual void
+ setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
+
+ virtual int getNumSvUsed (uint64_t svUsedIdsMask, int totalSvCntInOneConstellation);
+
+ virtual void
+ injectPosition(const Location& location, bool onDemandCpi);
+
+ virtual void
+ injectPosition(const GnssLocationInfoNotification &locationInfo, bool onDemandCpi);
+
+ virtual void
+ deleteAidingData(const GnssAidingData& data, LocApiResponse *adapterResponse);
+
+ virtual void
+ informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
+
+ virtual LocationError
+ setServerSync(const char* url, int len, LocServerType type);
+
+ virtual LocationError
+ setServerSync(unsigned int ip, int port, LocServerType type);
+
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+
+ virtual void
+ atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen, AGpsBearerType bear,
+ LocAGpsType agpsType, LocApnTypeMask mask);
+ virtual void atlCloseStatus(int handle, int is_succ);
+ virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
+
+ virtual enum loc_api_adapter_err setNMEATypesSync(uint32_t typesMask);
+
+ virtual LocationError setLPPConfigSync(GnssConfigLppProfile profile);
+
+
+ virtual enum loc_api_adapter_err
+ setSensorPropertiesSync(bool gyroBiasVarianceRandomWalk_valid,
+ float gyroBiasVarianceRandomWalk,
+ bool accelBiasVarianceRandomWalk_valid,
+ float accelBiasVarianceRandomWalk,
+ bool angleBiasVarianceRandomWalk_valid,
+ float angleBiasVarianceRandomWalk,
+ bool rateBiasVarianceRandomWalk_valid,
+ float rateBiasVarianceRandomWalk,
+ bool velocityBiasVarianceRandomWalk_valid,
+ float velocityBiasVarianceRandomWalk);
+
+ virtual enum loc_api_adapter_err
+ setSensorPerfControlConfigSync(int controlMode, int accelSamplesPerBatch,
+ int accelBatchesPerSec, int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
+ virtual LocationError
+ setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
+ virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
+ virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
+ virtual void getWwanZppFix();
+ virtual void getBestAvailableZppFix();
+ virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
+ virtual void setConstrainedTuncMode(bool enabled,
+ float tuncConstraint,
+ uint32_t energyBudget,
+ LocApiResponse* adapterResponse=nullptr);
+ virtual void setPositionAssistedClockEstimatorMode(bool enabled,
+ LocApiResponse* adapterResponse=nullptr);
+ virtual LocationError getGnssEnergyConsumed();
+ virtual void requestForAidingData(GnssAidingDataSvMask svDataMask);
+
+ virtual LocationError setXtraVersionCheckSync(uint32_t check);
+ virtual void installAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+
+ virtual void startTimeBasedTracking(const TrackingOptions& options,
+ LocApiResponse* adapterResponse);
+ virtual void stopTimeBasedTracking(LocApiResponse* adapterResponse);
+ virtual void startDistanceBasedTracking(uint32_t sessionId, const LocationOptions& options,
+ LocApiResponse* adapterResponse);
+ virtual void stopDistanceBasedTracking(uint32_t sessionId,
+ LocApiResponse* adapterResponse = nullptr);
+
+ virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
+ virtual GnssConfigLppProfile convertLppProfile(const uint32_t lppProfile);
+ virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
+ virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
+
+ /* Requests for SV/Constellation Control */
+ virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
+ virtual void setBlacklistSv(const GnssSvIdConfig& config);
+ virtual void getBlacklistSv();
+ virtual void setConstellationControl(const GnssSvTypeConfig& config,
+ LocApiResponse *adapterResponse=nullptr);
+ virtual void getConstellationControl();
+ virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
+};
+
+extern "C" LocApiBase* getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+#endif //SYNERGY_LOC_API_H
diff --git a/location/synergy_loc_api/synergy_loc_util_log.h b/location/synergy_loc_api/synergy_loc_util_log.h
new file mode 100644
index 0000000..7cabf55
--- /dev/null
+++ b/location/synergy_loc_api/synergy_loc_util_log.h
@@ -0,0 +1,84 @@
+/* Copyright (c) 2011-2012, 2014, 2019, 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 SYNERGY_LOCATION_UTIL_LOG_H
+#define SYNERGY_LOCATION_UTIL_LOG_H
+
+#include <log_util.h>
+
+#if defined(_ANDROID_)
+//#include "loc_api_v02_log.h"
+
+#else // no _ANDROID_
+
+#if defined(__LOC_API_V02_LOG_SILENT__)
+#define MSG_LOG
+#define LOC_LOGE(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGW(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGD(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGI(...) MSG_LOG(__VA_ARGS__);
+#define LOC_LOGV(...) MSG_LOG(__VA_ARGS__);
+#elif !defined(USE_GLIB)
+
+// common for QNX and Griffon
+#if !defined (_ANDROID_) && !defined(USE_GLIB)
+//error logs
+#define LOC_LOGE(...) printf(__VA_ARGS__)
+//warning logs
+#define LOC_LOGW(...) printf(__VA_ARGS__)
+// debug logs
+#define LOC_LOGD(...) printf(__VA_ARGS__)
+//info logs
+#define LOC_LOGI(...) printf(__VA_ARGS__)
+//verbose logs
+#define LOC_LOGV(...) printf(__VA_ARGS__)
+#endif //!defined (_ANDROID_) && !defined(USE_GLIB)
+#endif //__LOC_API_V02_LOG_SILENT__
+
+#define loc_get_v02_event_name(X) #X
+#define loc_get_v02_client_status_name(X) #X
+
+#define loc_get_v02_qmi_status_name(X) #X
+
+//specific to OFF TARGET
+#ifdef LOC_UTIL_TARGET_OFF_TARGET
+
+# include <stdio.h>
+# include <asm/errno.h>
+# include <sys/time.h>
+
+// get around strl*: not found in glibc
+// TBD:look for presence of eglibc other libraries
+// with strlcpy supported.
+#define strlcpy(X, Y, Z) strcpy(X, Y)
+#define strlcat(X, Y, Z) strcat(X, Y)
+
+#endif //LOC_UTIL_TARGET_OFF_TARGET
+
+#endif //_ANDROID_
+
+#endif //SYNERGY_LOCATION_UTIL_LOG_H
diff --git a/location/utils/Android.mk b/location/utils/Android.mk
new file mode 100644
index 0000000..6361f9b
--- /dev/null
+++ b/location/utils/Android.mk
@@ -0,0 +1,2 @@
+LOCAL_PATH := $(call my-dir)
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/location/utils/loc_socket/Android.mk b/location/utils/loc_socket/Android.mk
new file mode 100644
index 0000000..e413bde
--- /dev/null
+++ b/location/utils/loc_socket/Android.mk
@@ -0,0 +1,43 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_socket
+LOCAL_SANITIZE += $(GNSS_SANITIZE)
+# activate the following line for debug purposes only, comment out for production
+#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
+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 \
+ liblog \
+ libgps.utils
+
+LOCAL_SRC_FILES := \
+ LocSocket.cpp
+
+LOCAL_CFLAGS := \
+ -fno-short-enums \
+ -D_ANDROID_
+
+## Includes
+LOCAL_C_INCLUDES := \
+ $(TARGET_OUT_HEADERS)/qmi-framework/inc \
+ $(TARGET_OUT_HEADERS)/qmi/inc
+LOCAL_HEADER_LIBRARIES := \
+ libloc_core_headers \
+ libgps.utils_headers \
+ libloc_pla_headers \
+ liblocation_api_headers
+LOCAL_CFLAGS += $(GNSS_CFLAGS)
+
+ifeq ($(TARGET_KERNEL_VERSION),$(filter $(TARGET_KERNEL_VERSION),3.18 4.4 4.9))
+LOCAL_CFLAGS += -DUSE_QSOCKET
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/qsocket/inc
+LOCAL_SHARED_LIBRARIES += libqsocket
+endif
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/location/utils/loc_socket/LocSocket.cpp b/location/utils/loc_socket/LocSocket.cpp
new file mode 100644
index 0000000..daec458
--- /dev/null
+++ b/location/utils/loc_socket/LocSocket.cpp
@@ -0,0 +1,337 @@
+/* Copyright (c) 2019 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 <unistd.h>
+#include <memory>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <errno.h>
+
+#ifdef USE_QSOCKET
+#include <sys/ioctl.h>
+#include <poll.h>
+#include <qsocket.h>
+#include <qsocket_ipcr.h>
+#else
+#include <endian.h>
+#include <linux/qrtr.h>
+#endif
+
+#include <log_util.h>
+#include <LocIpc.h>
+
+namespace loc_util {
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LocSvc_Qrtr"
+
+class ServiceInfo {
+ const int32_t mServiceId;
+ const int32_t mInstanceId;
+ const string mName;
+public:
+ inline ServiceInfo(int32_t service, int32_t instance) :
+ mServiceId(service), mInstanceId(instance),
+ mName(to_string(service) + ":" + to_string(instance)) {}
+ inline const char* getName() const { return mName.data(); }
+ inline int32_t getServiceId() const { return mServiceId; }
+ inline int32_t getInstanceId() const { return mInstanceId; }
+};
+
+#ifdef USE_QSOCKET
+
+class LocIpcQsockSender : public LocIpcSender {
+protected:
+ shared_ptr<Sock> mSock;
+ const ServiceInfo mServiceInfo;
+ qsockaddr_ipcr mAddr;
+ mutable bool mLookupPending;
+ inline virtual bool isOperable() const override {
+ return mSock != nullptr && mSock->mSid != -1;
+ }
+ inline void serviceLookup() const {
+ if (mLookupPending && mSock->isValid()) {
+ ipcr_name_t ipcrName = {
+ .service = (uint32_t)mServiceInfo.getServiceId(),
+ .instance = (uint32_t)mServiceInfo.getInstanceId()
+ };
+ uint32_t numEntries = 1;
+ int rc = ipcr_find_name(mSock->mSid, &ipcrName,
+ (struct qsockaddr_ipcr*)&mAddr, NULL, &numEntries, 0);
+ LOC_LOGd("serviceLookup, rc = %d, numEntries = %d\n", rc, numEntries);
+ if (rc < 0 || 1 != numEntries) {
+ mSock->close();
+ }
+ mLookupPending = false;
+ }
+ }
+ inline virtual ssize_t send(const uint8_t data[], uint32_t length,
+ int32_t /* msgId */) const override {
+ serviceLookup();
+ return mSock->send(data, length, 0, (struct sockaddr*)&mAddr,
+ sizeof(mAddr));
+ }
+public:
+ inline LocIpcQsockSender(const shared_ptr<Sock>& sock, const qsockaddr_ipcr& destAddr) :
+ LocIpcSender(), mSock(sock),
+ mServiceInfo(0, 0), mAddr(destAddr), mLookupPending(false) {
+ }
+ inline LocIpcQsockSender(int service, int instance) :
+ LocIpcSender(),
+ mSock(make_shared<Sock>(::socket(AF_IPC_ROUTER, SOCK_DGRAM, 0))),
+ mServiceInfo(service, instance), mAddr({}), mLookupPending(true) {
+ }
+
+ unique_ptr<LocIpcRecver> getRecver(const shared_ptr<ILocIpcListener>& listener) override {
+ return make_unique<SockRecver>(listener, *this, mSock);
+ }
+};
+
+class LocIpcQsockRecver : public LocIpcQsockSender, public LocIpcRecver {
+protected:
+ inline virtual ssize_t recv() const override {
+ socklen_t size = sizeof(mAddr);
+ return mSock->recv(*this, mDataCb, 0, (struct sockaddr*)&mAddr, &size);
+ }
+public:
+ inline LocIpcQsockRecver(const shared_ptr<ILocIpcListener>& listener,
+ int service, int instance) :
+ LocIpcQsockSender(service, instance),
+ LocIpcRecver(listener, *this) {
+ qsockaddr_ipcr addr = {
+ AF_IPC_ROUTER,
+ {
+ IPCR_ADDR_NAME,
+ {
+ (uint32_t)service,
+ (uint32_t)instance
+ }
+ },
+ 0
+ };
+ if (mSock->isValid() &&
+ ::bind(mSock->mSid, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ LOC_LOGe("bind socket error. sock fd: %d,reason: %s",
+ mSock->mSid, strerror(errno));
+ mSock->close();
+ }
+ }
+ inline virtual unique_ptr<LocIpcSender> getLastSender() const override {
+ return make_unique<LocIpcQsockSender>(mSock, mAddr);
+ }
+ inline virtual const char* getName() const override {
+ return mServiceInfo.getName();
+ }
+ inline virtual void abort() const override {
+ if (isSendable()) {
+ serviceLookup();
+ mSock->sendAbort(0, (struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+ }
+};
+
+shared_ptr<LocIpcSender> createLocIpcQrtrSender(int service, int instance) {
+ return make_shared<LocIpcQsockSender>(service, instance);
+}
+unique_ptr<LocIpcRecver> createLocIpcQrtrRecver(const shared_ptr<ILocIpcListener>& listener,
+ int service, int instance) {
+ return make_unique<LocIpcQsockRecver>(listener, service, instance);
+}
+
+#else
+
+#define RETRY_FINDNEWSERVICE_MAX_COUNT 10000
+#define RETRY_FINDNEWSERVICE_SLEEP_MS 5
+#define SOCKET_TIMEOUT_SEC 2
+
+static inline __le32 cpu_to_le32(uint32_t x) { return htole32(x); }
+static inline uint32_t le32_to_cpu(__le32 x) { return le32toh(x); }
+
+class LocIpcQrtrSender : public LocIpcSender {
+protected:
+ const ServiceInfo mServiceInfo;
+ shared_ptr<Sock> mSock;
+ mutable sockaddr_qrtr mAddr;
+ mutable struct qrtr_ctrl_pkt mCtrlPkt;
+ mutable bool mLookupPending;
+ bool ctrlCmdAndResponse(enum qrtr_pkt_type cmd) const {
+ if (mSock->isValid()) {
+ int rc = 0;
+ sockaddr_qrtr addr = mAddr;
+ addr.sq_port = QRTR_PORT_CTRL;
+ mCtrlPkt.cmd = cpu_to_le32(cmd);
+ if ((rc = ::sendto(mSock->mSid, &mCtrlPkt, sizeof(mCtrlPkt), 0,
+ (const struct sockaddr *)&addr, sizeof(addr))) < 0) {
+ LOC_LOGe("failed: sendto rc=%d reason=(%s)\n", rc, strerror(errno));
+ } else if (QRTR_TYPE_NEW_LOOKUP == cmd) {
+ int len;
+ struct qrtr_ctrl_pkt pkt;
+ bool serviceFound = false;
+ while ((len = ::recv(mSock->mSid, &pkt, sizeof(pkt), 0)) > 0) {
+ if (cpu_to_le32(QRTR_TYPE_DEL_SERVER) == pkt.cmd) {
+ LOC_LOGe("server deleted");
+ break;
+ }
+
+ if ((len >= (decltype(len))sizeof(pkt)) &&
+ (cpu_to_le32(QRTR_TYPE_NEW_SERVER) == pkt.cmd) &&
+ (0 != pkt.server.service)) {
+ serviceFound = true;
+ break;
+ }
+ }
+
+ if (serviceFound == true) {
+ mAddr.sq_node = le32_to_cpu(pkt.server.node);
+ mAddr.sq_port = le32_to_cpu(pkt.server.port);
+ LOC_LOGd("pkt.cmd %d, service %d, node, %d, port %d",
+ pkt.cmd, pkt.server.service, mAddr.sq_node, mAddr.sq_port);
+ }
+ }
+ }
+ return mSock->isValid();
+ }
+
+ inline virtual bool isOperable() const override {
+ return mSock != nullptr && mSock->isValid() &&
+ (mAddr.sq_node != 0 || mAddr.sq_port != 0);
+ }
+
+ inline virtual ssize_t send(const uint8_t data[], uint32_t length,
+ int32_t /* msgId */) const override {
+ if (mLookupPending) {
+ mLookupPending = false;
+ ctrlCmdAndResponse(QRTR_TYPE_NEW_LOOKUP);
+ }
+ return mSock->send(data, length, 0, (struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+public:
+ inline LocIpcQrtrSender(const shared_ptr<Sock>& sock, const sockaddr_qrtr& destAddr) :
+ LocIpcSender(), mServiceInfo(0, 0), mSock(sock),
+ mAddr(destAddr), mCtrlPkt({}), mLookupPending(false) {
+ }
+ inline LocIpcQrtrSender(int service, int instance) : LocIpcSender(),
+ mServiceInfo(service, instance),
+ mSock(make_shared<Sock>(::socket(AF_QIPCRTR, SOCK_DGRAM, 0))),
+ mAddr({AF_QIPCRTR, 0, 0}),
+ mCtrlPkt({}),
+ mLookupPending(true) {
+ // set timeout so if failed to send, call will return after 2 seconds timeout
+ // otherwise, call may never return
+ timeval timeout;
+ timeout.tv_sec = SOCKET_TIMEOUT_SEC;
+ timeout.tv_usec = 0;
+ setsockopt(mSock->mSid, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
+
+ socklen_t sl = sizeof(mAddr);
+ int rc = 0;
+ if ((rc = getsockname(mSock->mSid, (struct sockaddr*)&mAddr, &sl)) ||
+ mAddr.sq_family != AF_QIPCRTR || sl != sizeof(mAddr)) {
+ LOC_LOGe("failed: getsockname rc=%d reason=(%s), mAddr.sq_family=%d",
+ rc, strerror(errno), mAddr.sq_family);
+ mSock->close();
+ } else {
+ mCtrlPkt.server.service = cpu_to_le32(service);
+ mCtrlPkt.server.instance = cpu_to_le32(instance);
+ mCtrlPkt.server.node = cpu_to_le32(mAddr.sq_node);
+ mCtrlPkt.server.port = cpu_to_le32(mAddr.sq_port);
+ }
+ }
+
+ // when the qrtr socket sender is informed that the socket
+ // receiver has restarted, it need to find the re-started
+ // service node/port as the old node/port is no longer valid
+ inline virtual void informRecverRestarted() override {
+
+ sockaddr_qrtr oldAddr = mAddr;
+ int retryCount = 0;
+
+ while (retryCount < RETRY_FINDNEWSERVICE_MAX_COUNT) {
+ if (true == ctrlCmdAndResponse(QRTR_TYPE_NEW_LOOKUP)) {
+ LOC_LOGd("retry count %d, old %d %d, new %d %d",
+ retryCount, oldAddr.sq_node, oldAddr.sq_port,
+ mAddr.sq_node, mAddr.sq_port);
+ if ((mAddr.sq_node != 0 || mAddr.sq_port != 0) &&
+ ((mAddr.sq_node != oldAddr.sq_node) ||
+ (mAddr.sq_port != oldAddr.sq_port))) {
+ break;
+ }
+ }
+ usleep(RETRY_FINDNEWSERVICE_SLEEP_MS*1000*10);
+ retryCount++;
+ }
+
+ LOC_LOGd("retry count %d, old %d %d, new %d %d",
+ retryCount, oldAddr.sq_node, oldAddr.sq_port,
+ mAddr.sq_node, mAddr.sq_port);
+ }
+
+ unique_ptr<LocIpcRecver> getRecver(const shared_ptr<ILocIpcListener>& listener) override {
+ return make_unique<SockRecver>(listener, *this, mSock);
+ }
+};
+
+class LocIpcQrtrRecver : public LocIpcQrtrSender, public LocIpcRecver {
+protected:
+ inline virtual ssize_t recv() const override {
+ socklen_t size = sizeof(mAddr);
+ return mSock->recv(*this, mDataCb, 0, (struct sockaddr*)&mAddr, &size);
+ }
+public:
+ inline LocIpcQrtrRecver(const shared_ptr<ILocIpcListener>& listener,
+ int service, int instance) :
+ LocIpcQrtrSender(service, instance), LocIpcRecver(listener, *this) {
+ ctrlCmdAndResponse(QRTR_TYPE_NEW_SERVER);
+ }
+ inline ~LocIpcQrtrRecver() { ctrlCmdAndResponse(QRTR_TYPE_DEL_SERVER); }
+ inline virtual unique_ptr<LocIpcSender> getLastSender() const override {
+ return make_unique<LocIpcQrtrSender>(mSock, mAddr);
+ }
+ inline virtual const char* getName() const override {
+ return mServiceInfo.getName();
+ }
+ inline virtual void abort() const override {
+ if (isSendable()) {
+ mSock->sendAbort(0, (struct sockaddr*)&mAddr, sizeof(mAddr));
+ }
+ }
+};
+
+shared_ptr<LocIpcSender> createLocIpcQrtrSender(int service, int instance) {
+ return make_shared<LocIpcQrtrSender>(service, instance);
+}
+unique_ptr<LocIpcRecver> createLocIpcQrtrRecver(const shared_ptr<ILocIpcListener>& listener,
+ int service, int instance) {
+ return make_unique<LocIpcQrtrRecver>(listener, service, instance);
+}
+
+#endif
+
+}
diff --git a/location/utils/loc_socket/Makefile.am b/location/utils/loc_socket/Makefile.am
new file mode 100644
index 0000000..15e0feb
--- /dev/null
+++ b/location/utils/loc_socket/Makefile.am
@@ -0,0 +1,50 @@
+AM_CFLAGS = \
+ -DDEBUG \
+ -I src/ \
+ -I inc/ \
+ $(QMIFW_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ -fpermissive
+
+if USE_QSOCKET
+ AM_CFLAGS += -DUSE_QSOCKET
+endif
+
+ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -std=c++14
+
+requiredlibs = \
+ $(QMIFW_LIBS) \
+ $(GPSUTILS_LIBS)
+
+c_sources = \
+ LocSocket.cpp
+
+libloc_socket_la_SOURCES = \
+ $(c_sources)
+
+######################
+# Build loc_socket
+######################
+
+if USE_GLIB
+libloc_socket_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_socket_la_LDFLAGS = -lstdc++ -g -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_socket_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_socket_la_CFLAGS = $(AM_CFLAGS)
+libloc_socket_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libloc_socket_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_socket_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install libraries
+library_include_HEADERS =
+lib_LTLIBRARIES = libloc_socket.la
+
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-socket.pc
+EXTRA_DIST = $(pkgconfig_DATA)
+
diff --git a/location/utils/loc_socket/configure.ac b/location/utils/loc_socket/configure.ac
new file mode 100644
index 0000000..dfb93ec
--- /dev/null
+++ b/location/utils/loc_socket/configure.ac
@@ -0,0 +1,77 @@
+# configure.ac -- Autoconf script for gps location-utils
+#
+# Process this file with autoconf to produce a configure script
+
+# Requires autoconf tool later than 2.61
+AC_PREREQ(2.61)
+# Initialize the loc_socket package version 1.0.0
+AC_INIT([loc-socket],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([Makefile.am])
+# 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])
+
+PKG_CHECK_MODULES([QMIFW], [qmi-framework])
+AC_SUBST([QMIFW_CFLAGS])
+AC_SUBST([QMIFW_LIBS])
+
+AC_ARG_WITH([kernel-qrtr],
+ AC_HELP_STRING([--with-kernel-qrtr],
+ [enable kernel qrtr, kernel supports qrtr]))
+AC_ARG_ENABLE([kernel-qrtr],
+ [ --enable-kernel-qrtr kernel qrtr is enabled],
+ [case "${enableval}" in
+ yes) kernelqrtr=true ;;
+ no) kernelqrtr=false ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-kernel-qrtr]) ;;
+ esac],[kernelqrtr=false])
+
+AM_CONDITIONAL(USE_QSOCKET, test "x${kernelqrtr}" = "xfalse")
+
+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 \
+ loc-socket.pc
+ ])
+
+AC_OUTPUT
diff --git a/location/utils/loc_socket/loc-socket.pc.in b/location/utils/loc_socket/loc-socket.pc.in
new file mode 100644
index 0000000..0485001
--- /dev/null
+++ b/location/utils/loc_socket/loc-socket.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-socket
+Description: location socket library
+Version: @VERSION@
+Libs: -L${libdir} -lloc_socket
+Cflags: -I${includedir} -I${includedir}/loc-socket
\ No newline at end of file